GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — added mathjax example · syohnet/AlgorithmVisualizer@78bd06e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • algorithm
    • backtracking
      • knight's_tour
        • desc.json
      • n_queens
        • desc.json
    • number_theory/sieve_of_eratosthenes
      • desc.json
  • index.html
  • js
    • dom
      • show_algorithm.js
    • utils
      • index.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎algorithm/backtracking/knight's_tour/desc.json‎

Copy file name to clipboardExpand all lines: algorithm/backtracking/knight's_tour/desc.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"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.",
33
"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)$$"
66
},
77
"References": [
88
"<a href='https://en.wikipedia.org/wiki/Knight%27s_tour'>Wikipedia</a>"
Collapse file

‎algorithm/backtracking/n_queens/desc.json‎

Copy file name to clipboardExpand all lines: algorithm/backtracking/n_queens/desc.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"Searching"
66
],
77
"Complexity": {
8-
"time": "Worst O(N!)",
9-
"space": "Worst O(N)"
8+
"time": "Worst $$O(N!)$$",
9+
"space": "Worst $$O(N)$$"
1010
},
1111
"References": [
1212
"<a href='http://www.geeksforgeeks.org/backtracking-set-3-n-queen-problem/'>geeksforgeeks</a>"
Collapse file

‎algorithm/number_theory/sieve_of_eratosthenes/desc.json‎

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 numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"Sieve of Eratosthenes": "Finding all prime numbers up to a given range.",
33
"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}})$$"
66
},
77
"References": [
88
"<a href='https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes'>Wikipedia</a>"
Collapse file

‎index.html‎

Copy file name to clipboardExpand all lines: index.html
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111
<title>Algorithm Visualizer</title>
1212
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
1313
<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>
1428
</head>
1529

1630
<body>
@@ -36,7 +50,6 @@ <h3>
3650
<span class="btn-text">Generate</span>
3751
</div>
3852
</div>
39-
4053
<div class="btn" id="btn_share">
4154
<div class="wrapper">
4255
<i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared">
Collapse file

‎js/dom/show_algorithm.js‎

Copy file name to clipboardExpand all lines: js/dom/show_algorithm.js
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
'use strict';
22

33
const app = require('../app');
4-
5-
const {
6-
isScratchPaper
7-
} = require('../utils');
8-
4+
const utils = require('../utils');
95
const showDescription = require('./show_description');
106
const addFiles = require('./add_files');
117

@@ -14,7 +10,7 @@ module.exports = (category, algorithm, data, requestedFile) => {
1410
let category_name;
1511
let algorithm_name;
1612

17-
if (isScratchPaper(category)) {
13+
if (utils.isScratchPaper(category)) {
1814
$menu = $('#scratch-paper');
1915
category_name = 'Scratch Paper';
2016
algorithm_name = algorithm ? 'Shared' : 'Temporary';
@@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => {
4541

4642
showDescription(data);
4743
addFiles(category, algorithm, files, requestedFile);
44+
utils.renderMathJax();
4845
};
Collapse file

‎js/utils/index.js‎

Copy file name to clipboardExpand all lines: js/utils/index.js
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ const getFileDir = (category, algorithm, file) => {
1414
return `./algorithm/${category}/${algorithm}/${file}/`;
1515
};
1616

17+
const renderMathJax = () =>{
18+
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
19+
};
20+
1721
module.exports = {
1822
isScratchPaper,
1923
getAlgorithmDir,
20-
getFileDir
21-
};
24+
getFileDir,
25+
renderMathJax
26+
};

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.