From 78bd06e45fc1d1af7e7d25eb9ea7ffe54cae233a Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Tue, 12 Jul 2016 06:54:17 -0700 Subject: [PATCH 1/2] added mathjax example --- algorithm/backtracking/knight's_tour/desc.json | 4 ++-- algorithm/backtracking/n_queens/desc.json | 4 ++-- .../number_theory/sieve_of_eratosthenes/desc.json | 4 ++-- index.html | 15 ++++++++++++++- js/dom/show_algorithm.js | 9 +++------ js/utils/index.js | 9 +++++++-- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/algorithm/backtracking/knight's_tour/desc.json b/algorithm/backtracking/knight's_tour/desc.json index 2b4af117..cbc7e2fa 100644 --- a/algorithm/backtracking/knight's_tour/desc.json +++ b/algorithm/backtracking/knight's_tour/desc.json @@ -1,8 +1,8 @@ { "Knight’s tour problem": "A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed, otherwise it is open.", "Complexity": { - "time": "Worst O(8N2)", - "space": "Worst O(N2)" + "time": "Worst $$O(8^{N^{2}})$$", + "space": "Worst $$O(N^2)$$" }, "References": [ "Wikipedia" diff --git a/algorithm/backtracking/n_queens/desc.json b/algorithm/backtracking/n_queens/desc.json index 77c991ee..7cbd07b0 100644 --- a/algorithm/backtracking/n_queens/desc.json +++ b/algorithm/backtracking/n_queens/desc.json @@ -5,8 +5,8 @@ "Searching" ], "Complexity": { - "time": "Worst O(N!)", - "space": "Worst O(N)" + "time": "Worst $$O(N!)$$", + "space": "Worst $$O(N)$$" }, "References": [ "geeksforgeeks" diff --git a/algorithm/number_theory/sieve_of_eratosthenes/desc.json b/algorithm/number_theory/sieve_of_eratosthenes/desc.json index a684f3d7..951ae7d6 100644 --- a/algorithm/number_theory/sieve_of_eratosthenes/desc.json +++ b/algorithm/number_theory/sieve_of_eratosthenes/desc.json @@ -1,8 +1,8 @@ { "Sieve of Eratosthenes": "Finding all prime numbers up to a given range.", "Complexity": { - "time": "O(n(log n)(log log n))", - "space": "O(n1/2)" + "time": "$$O(n\\,(log\\,n)(log\\,log\\,n))$$", + "space": "$$O(n^{\\frac{1}{2}})$$" }, "References": [ "Wikipedia" diff --git a/index.html b/index.html index 86ed1f4f..2475f173 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,20 @@ Algorithm Visualizer + + @@ -36,7 +50,6 @@

Generate -
Share diff --git a/js/dom/show_algorithm.js b/js/dom/show_algorithm.js index 61783e13..deb68c5b 100644 --- a/js/dom/show_algorithm.js +++ b/js/dom/show_algorithm.js @@ -1,11 +1,7 @@ 'use strict'; const app = require('../app'); - -const { - isScratchPaper -} = require('../utils'); - +const utils = require('../utils'); const showDescription = require('./show_description'); const addFiles = require('./add_files'); @@ -14,7 +10,7 @@ module.exports = (category, algorithm, data, requestedFile) => { let category_name; let algorithm_name; - if (isScratchPaper(category)) { + if (utils.isScratchPaper(category)) { $menu = $('#scratch-paper'); category_name = 'Scratch Paper'; algorithm_name = algorithm ? 'Shared' : 'Temporary'; @@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => { showDescription(data); addFiles(category, algorithm, files, requestedFile); + utils.renderMathJax(); }; diff --git a/js/utils/index.js b/js/utils/index.js index ac608251..ffdbf5f1 100644 --- a/js/utils/index.js +++ b/js/utils/index.js @@ -14,8 +14,13 @@ const getFileDir = (category, algorithm, file) => { return `./algorithm/${category}/${algorithm}/${file}/`; }; +const renderMathJax = () =>{ + MathJax.Hub.Queue(["Typeset",MathJax.Hub]); +}; + module.exports = { isScratchPaper, getAlgorithmDir, - getFileDir -}; \ No newline at end of file + getFileDir, + renderMathJax +}; From 0ccdcf1d996683747f366c96ed855ad2794ddee2 Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Tue, 12 Jul 2016 07:37:35 -0700 Subject: [PATCH 2/2] added powered by for mathjax --- index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.html b/index.html index 2475f173..a5bb36e9 100644 --- a/index.html +++ b/index.html @@ -122,6 +122,9 @@

+ + +

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy