Skip to content

Commit 7cf642a

Browse files
committed
added trace to construct elements
still work pending in construct and tree code
1 parent 47010c4 commit 7cf642a

File tree

3 files changed

+452
-26
lines changed

3 files changed

+452
-26
lines changed

algorithm/tree/binary_search_tree/bst_insert/data.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
1-
var G = [ // G[i][j] indicates whether the path from the i-th node to the j-th node exists or not
2-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
3-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
4-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
5-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
6-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
7-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
8-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
9-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
10-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
11-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
12-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
13-
];
1+
var G = [];
142

153

16-
var T = [ // mapping to G as a binary tree , [i][0] indicates left child, [i][1] indicates right child
17-
[-1,-1],
18-
[-1,-1],
19-
[-1,-1],
20-
[-1,-1],
21-
[-1,-1],
22-
[-1,-1],
23-
[-1,-1],
24-
[-1,-1],
25-
[-1,-1],
26-
[-1,-1],
27-
[-1,-1]
28-
];
4+
var T = {};
295

306
var elements = [5,8,10,3,1,6,9,7,2,0,4]; // item to be searched
317
var tracer = new DirectedGraphTracer( " BST - Elements marked red indicates the current status of tree ");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy