-
Notifications
You must be signed in to change notification settings - Fork 5
/
binarySTree.html
247 lines (231 loc) · 6 KB
/
binarySTree.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<html>
<!-- THIS FILE WAS GENERATED BY A SCRIPT: DO NOT EDIT IT! -->
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="lib/bootstrap.min.css" />
<link rel="stylesheet" href="userInterface.css" />
<script src="lib/jquery.min.js"></script>
<script src="lib/bootstrap.min.js"></script>
<script src="lib/sigma/sigma.min.js"></script>
<script src="lib/sigma/sigma.renderers.canvas.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.labels.def.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.nodes.def.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.edges.def.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.edges.arrow.js"></script>
<script src="lib/sigma/sigma.plugins.dragNodes.js"></script>
<script src="lib/sigma/sigma.canvas.labels.def.js"></script>
<script src="lib/sigma/sigma.canvas.edges.labels.def.js"></script>
<script src="lib/sigma/setting.js"></script>
<script src="lib/sigma/sigma.classes.graph.js"></script>
<script src="lib/sigma/graphArrange.js"></script>
<script src="lib/sigma/sigma.core.js"></script>
<script src="widgets.js"></script>
<script src="graph.js"></script>
<script src="binarySTree.js"></script>
<link rel="stylesheet" href="style.css" />
<!--algocynfas webpage css, independent from the user interface css -->
</head>
<body>
<h1>Binary Search Tree</h1>
<div class="container" style="margin-left: 10em">
<h5 style="margin-left: 0em">1. Create a Binary Search Tree:</h5>
<input
type="text"
class="edgeBox"
id="treeList"
placeholder="Enter a list of nums separate by comma"
/>
<button
class="btn btn-primary"
id="createBST-button"
type="button"
onclick="createBST(1)"
>
Create BST
</button>
 
<b>
sample values:
</b>
<select id="treeSample" onchange="setTreeSample()">
<option value="Select">Customize</option>
<option value="sample1">6 nodes </option>
<option value="sample2">15 nodes </option>
</select>
 
<input
type="checkbox"
name="ran"
value="randomize"
id="random"
checked="true"
/>
Randomize
<br />
<br />
<hr />
<h5 style="margin-left: 0em">2. Choose an algorithm:</h5>
<b
>Choose Speed:
<input type="radio" name="speed" value="500" id="Fast" />
<label for="Fast">Fast</label>
<input
type="radio"
name="speed"
value="1000"
id="Medium"
checked="true"
/>
<label for="Medium">Medium</label>
<input type="radio" name="speed" value="2000" id="Slow" />
<label for="Slow">Slow</label>
<br />
</b>
<br />
<input
type="text"
class="Box"
id="treeNode"
placeholder="Enter an integer"
/>
<button
class="btn btn-primary"
id="insert-button"
type="button"
onclick="createBST(2)"
>
Insert
</button>
 
<input
type="text"
class="Box"
id="deleteBox"
placeholder="Enter an Node"
/>
<button
class="btn btn-primary"
id="delete-button"
type="button"
onclick="deleteNode()"
>
Delete
</button>
 
<select id="treeWalkChoice">
<option value="pre">Preorder Traversal </option>
<option value="in"> Inorder Traversal</option>
<option value="post"> Postorder Traversal </option>
</select>
<button
class="btn btn-primary"
id="traversal-button"
type="button"
onclick="PreInPost()"
>
Traverse
</button>
<br />
<br />
<input
type="text"
class="Box"
id="searchBox"
placeholder="Enter an Node"
/>
<button
class="btn btn-primary"
id="search-button"
type="button"
onclick="searchInTree()"
>
Search
</button>
 
<b>
Get
</b>
<select id="minMaxChoice">
<option value="min">Min </option>
<option value="max"> Max </option>
</select>
<button
class="btn btn-primary"
id="minmax-button"
type="button"
onclick="findMinMax()"
>
Find
</button>
 
<b>
Get
</b>
<select id="preSucChoice">
<option value="pre">Predecessor </option>
<option value="suc"> Successor </option>
</select>
<b>
of
</b>
<input
type="text"
class="Box"
id="preSucBox"
placeholder="Enter an Node"
/>
<button
class="btn btn-primary"
id="presuc-button"
type="button"
onclick="findPreSuc()"
>
Find
</button>
<br />
<br />
<button
id="clear-button"
type="button"
class="btn btn-danger col-1"
style="max-width: 150 ;width: 130"
onclick="clearBstGraph()"
>
Clear Graph
</button>
<button
id="stop-button"
type="button"
class="btn btn-danger col-1"
onclick="stopAnime()"
>
Stop
</button>
<br />
<br />
<script>
let inputType = "num";
let dir = 0;
let weight = 0;
let Graph = null;
let animeRunning = true;
</script>
</div>
<div
id="bstGraphContainer"
class="bstGraphContainer"
style="width: 800; height: 300; margin-left: 10em; border: 1px; border-style: solid"
></div>
<footer id="bstLegend" style="margin-left: 10em">
<script>
window.display_legend(
"bstLegend",
"Items not looking at",
"Items being traced",
"#0039e6",
"#F5B041"
);
</script>
</footer>
</body>
</html>