GeezerVison is showing github.com — added mathjax example · syohnet/AlgorithmVisualizer@78bd06e
File treeExpand file treeCollapse file tree Open diff view settings number_theory/sieve_of_eratosthenes
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: algorithm/backtracking/knight's_tour/desc.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "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.", | 3 | 3 | "Complexity": { | 4 | | - "time": "Worst O(8<sup>N<sup>2</sup></sup>)", | 5 | | - "space": "Worst O(N<sup>2</sup>)" | | 4 | + "time": "Worst $$O(8^{N^{2}})$$", | | 5 | + "space": "Worst $$O(N^2)$$" | 6 | 6 | }, | 7 | 7 | "References": [ | 8 | 8 | "<a href='https://en.wikipedia.org/wiki/Knight%27s_tour'>Wikipedia</a>" | |
Collapse file Copy file name to clipboardExpand all lines: algorithm/backtracking/n_queens/desc.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | "Searching" | 6 | 6 | ], | 7 | 7 | "Complexity": { | 8 | | - "time": "Worst O(N!)", | 9 | | - "space": "Worst O(N)" | | 8 | + "time": "Worst $$O(N!)$$", | | 9 | + "space": "Worst $$O(N)$$" | 10 | 10 | }, | 11 | 11 | "References": [ | 12 | 12 | "<a href='http://www.geeksforgeeks.org/backtracking-set-3-n-queen-problem/'>geeksforgeeks</a>" | |
Collapse file Copy file name to clipboardExpand all lines: algorithm/number_theory/sieve_of_eratosthenes/desc.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "Sieve of Eratosthenes": "Finding all prime numbers up to a given range.", | 3 | 3 | "Complexity": { | 4 | | - "time": "O(n(log n)(log log n))", | 5 | | - "space": "O(n<sup>1/2</sup>)" | | 4 | + "time": "$$O(n\\,(log\\,n)(log\\,log\\,n))$$", | | 5 | + "space": "$$O(n^{\\frac{1}{2}})$$" | 6 | 6 | }, | 7 | 7 | "References": [ | 8 | 8 | "<a href='https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes'>Wikipedia</a>" | |
Collapse file Copy file name to clipboardExpand all lines: index.html +14-1Lines changed: 14 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 | <title>Algorithm Visualizer</title> | 12 | 12 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto"> | 13 | 13 | <link rel="stylesheet" href="public/algorithm_visualizer.min.css"> | | 14 | + <script type="text/x-mathjax-config"> | | 15 | + MathJax.Hub.Config({ | | 16 | + tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, | | 17 | + styles: { | | 18 | + ".MJXc-display": { | | 19 | + "display": "inline !important", | | 20 | + "margin": "0 !important" | | 21 | + }, | | 22 | + } | | 23 | + }); | | 24 | + </script> | | 25 | + <script type="text/javascript" async | | 26 | + src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> | | 27 | + </script> | 14 | 28 | </head> | 15 | 29 |
| 16 | 30 | <body> | | 36 | 50 | <span class="btn-text">Generate</span> | 37 | 51 | </div> | 38 | 52 | </div> | 39 | | - | 40 | 53 | <div class="btn" id="btn_share"> | 41 | 54 | <div class="wrapper"> | 42 | 55 | <i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared"> | |
Collapse file Copy file name to clipboardExpand all lines: js/dom/show_algorithm.js +3-6Lines changed: 3 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 |
| 3 | 3 | const app = require('../app'); | 4 | | - | 5 | | -const { | 6 | | - isScratchPaper | 7 | | -} = require('../utils'); | 8 | | - | | 4 | +const utils = require('../utils'); | 9 | 5 | const showDescription = require('./show_description'); | 10 | 6 | const addFiles = require('./add_files'); | 11 | 7 |
| @@ -14,7 +10,7 @@ module.exports = (category, algorithm, data, requestedFile) => { | 14 | 10 | let category_name; | 15 | 11 | let algorithm_name; | 16 | 12 |
| 17 | | - if (isScratchPaper(category)) { | | 13 | + if (utils.isScratchPaper(category)) { | 18 | 14 | $menu = $('#scratch-paper'); | 19 | 15 | category_name = 'Scratch Paper'; | 20 | 16 | algorithm_name = algorithm ? 'Shared' : 'Temporary'; | @@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => { | 45 | 41 |
| 46 | 42 | showDescription(data); | 47 | 43 | addFiles(category, algorithm, files, requestedFile); | | 44 | + utils.renderMathJax(); | 48 | 45 | }; |
Collapse file Copy file name to clipboardExpand all lines: js/utils/index.js +7-2Lines changed: 7 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,8 +14,13 @@ const getFileDir = (category, algorithm, file) => { | 14 | 14 | return `./algorithm/${category}/${algorithm}/${file}/`; | 15 | 15 | }; | 16 | 16 |
| | 17 | +const renderMathJax = () =>{ | | 18 | + MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | | 19 | +}; | | 20 | + | 17 | 21 | module.exports = { | 18 | 22 | isScratchPaper, | 19 | 23 | getAlgorithmDir, | 20 | | - getFileDir | 21 | | -}; | | 24 | + getFileDir, | | 25 | + renderMathJax | | 26 | +}; |
|