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 — Merge pull request #210 from archie94/lca-revise · AquaMir/AlgorithmVisualizer@52dbc4c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • algorithm/tree/lowest_common_ancestor/binary_tree
    • code.js
    • data.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎algorithm/tree/lowest_common_ancestor/binary_tree/code.js‎

Copy file name to clipboardExpand all lines: algorithm/tree/lowest_common_ancestor/binary_tree/code.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ function lcaBT (parent, root, a, b) {
2121
return (left !== null ? left : right);
2222
}
2323

24-
var a = 7, b = 9;
24+
var a = 7, b = 2;
2525
logger._print ('Lowest common ancestor of ' + a + ' & ' + b + ' is: ' + lcaBT (null, 5, a, b));
Collapse file

‎algorithm/tree/lowest_common_ancestor/binary_tree/data.js‎

Copy file name to clipboardExpand all lines: algorithm/tree/lowest_common_ancestor/binary_tree/data.js
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
var G = [ // G[i][j] indicates whether the path from the i-th node to the j-th node exists or not
22
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
3-
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
3+
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
44
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
5-
[0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
5+
[0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0],
66
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
77
[0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0],
8-
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
8+
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
99
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
10-
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
10+
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1],
1111
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
1212
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
1313
];
1414

1515

1616
var T = [ // mapping to G as a binary tree , [i][0] indicates left child, [i][1] indicates right child
1717
[-1,-1],
18-
[ 0, 2],
18+
[-1, 7],
1919
[-1,-1],
20-
[ 1, 4],
20+
[ 6, 1],
2121
[-1,-1],
2222
[ 3, 8],
23-
[-1, 7],
23+
[ 0, 2],
2424
[-1,-1],
25-
[ 6,10],
25+
[10, 4],
2626
[-1,-1],
2727
[ 9,-1]
2828
];

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.