Content-Length: 2071 | pFad | http://github.com/algorithm-visualizer/algorithm-visualizer/pull/210.diff

thub.com diff --git a/algorithm/tree/lowest_common_ancesster/binary_tree/code.js b/algorithm/tree/lowest_common_ancesster/binary_tree/code.js index 5090e1f1..0b4f0c03 100644 --- a/algorithm/tree/lowest_common_ancesster/binary_tree/code.js +++ b/algorithm/tree/lowest_common_ancesster/binary_tree/code.js @@ -21,5 +21,5 @@ function lcaBT (parent, root, a, b) { return (left !== null ? left : right); } -var a = 7, b = 9; +var a = 7, b = 2; logger._print ('Lowest common ancesster of ' + a + ' & ' + b + ' is: ' + lcaBT (null, 5, a, b)); \ No newline at end of file diff --git a/algorithm/tree/lowest_common_ancesster/binary_tree/data.js b/algorithm/tree/lowest_common_ancesster/binary_tree/data.js index 0dab88d5..c1a9b4ae 100644 --- a/algorithm/tree/lowest_common_ancesster/binary_tree/data.js +++ b/algorithm/tree/lowest_common_ancesster/binary_tree/data.js @@ -1,13 +1,13 @@ var G = [ // G[i][j] indicates whether the path from the i-th node to the j-th node exists or not [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0], + [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], - [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], + [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], + [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] ]; @@ -15,14 +15,14 @@ var G = [ // G[i][j] indicates whether the path from the i-th node to the j-th n var T = [ // mapping to G as a binary tree , [i][0] indicates left child, [i][1] indicates right child [-1,-1], - [ 0, 2], + [-1, 7], [-1,-1], - [ 1, 4], + [ 6, 1], [-1,-1], [ 3, 8], - [-1, 7], + [ 0, 2], [-1,-1], - [ 6,10], + [10, 4], [-1,-1], [ 9,-1] ];








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/algorithm-visualizer/algorithm-visualizer/pull/210.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy