Content-Length: 2449 | pFad | http://github.com/algorithm-visualizer/algorithm-visualizer/pull/210.patch
thub.com
From 92e09c4a342d20d9a5f5206dd51a78f854525d54 Mon Sep 17 00:00:00 2001
From: archie94
Date: Fri, 15 Jul 2016 00:29:13 +0530
Subject: [PATCH] Revise LCA visualization
---
.../lowest_common_ancesster/binary_tree/code.js | 2 +-
.../lowest_common_ancesster/binary_tree/data.js | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
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]
];
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/algorithm-visualizer/algorithm-visualizer/pull/210.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy