-
Notifications
You must be signed in to change notification settings - Fork 2
/
core.html
51 lines (48 loc) · 3.62 KB
/
core.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="define.js"></script>
<script type="text/javascript" src="core.js"></script>
<script type="text/javascript" src="test.js"></script>
<style>
.input {
width: 30%;
height: 1.5em;
}
</style>
<title>数组生成二叉树</title>
</head>
<body>
<p>输入数字,逗号分隔,空节点用null表示,生成二叉树</p>
<p>普通二叉树树</p>
<input class="input" id="inputBiTree" type="text" name="输入" value="1,2,3,null,4,5,6,null,null,null,7">
<input type="button" value="添加节点" title="添加节点" onclick="insertBiTree()"/>
<input type="button" value="重新生成" title="重新生成" onclick="generateBiTree()"/>
<input type="button" value="随机生成" title="随机生成" onclick="randomBiTree()"/>
<p>输入数字,逗号分隔,生成二叉搜索树</p>
<p>二叉搜索树</p>
<input class="input" id="inputBST" type="text" name="输入" value="9,5,13,3,7,10,16,1,2,6,8,14,15,17,19">
<input type="button" value="添加节点" title="添加节点" onclick="insertBSTree()"/>
<input type="button" value="重新生成" title="重新生成" onclick="generateBSTree()"/>
<input type="button" value="移除节点" title="移除节点" onclick="removeBSTree()"/>
<input type="button" value="随机生成" title="随机生成" onclick="randomBSTree()"/>
<input type="button" value="自平衡(转换为AVL)" title="自平衡(转换为AVL)" onclick="BST2AVL()"/>
<p>AVL树</p>
<input class="input" id="inputAVL" type="text" name="输入" value="9,5,13,3,7,10,16,1,2,6,8,14,15,17,19">
<input type="button" value="添加节点" title="添加节点" onclick="insertAVL()"/>
<input type="button" value="重新生成" title="重新生成" onclick="generateAVL()"/>
<input type="button" value="移除节点" title="移除节点" onclick="removeAVL()"/>
<input type="button" value="随机生成" title="随机生成" onclick="randomAVLTree()"/>
<input type="button" value="随机移除" title="随机移除" onclick="randomAVLTreeRemove()"/>
<p>红黑树</p>
<input class="input" id="inputRBT" type="text" name="输入" value="19,278,96,158,410,430,484,21,58,70,463,244,20,360,157,427,414,183,47,494,363,355,235,499,483,251,151,356,437,194,55,460,388,186,112,383,416,123,365,472,234,30,81,233,140,169,40,200,381,316,141,445,347,442,230,37,29,267,51,450,111,309,491,243,67,136,145,7,333,45,225,52,217,379,237,425,495,38,187,478,192,134,92,413,350,44,66,156,477,489,10,303,428,314,249,329,373,254,435,288,446,227,139,80,443,224,305,452,173,95,239,348,342,130,193,103,397,464,159,257,432,189,291,93,79,202,161,266,188,170,175,480,2,469,221,148,63,150,75,401,208,105,106,466,496,39,487,48,354,68,296,242,54,184,28,332,290,84,3,334,143,31,100,135,252,481,176,284,285,328,474,318,485,73,399,400,322,128,324,441,215,392,18,206,289,255,433,281,222,431,325,180,246,313,114,144,179,359,395,265">
<input type="button" value="添加节点" title="添加节点" onclick="insertRBTree()"/>
<input type="button" value="重新生成" title="重新生成" onclick="generateRBTree()"/>
<input type="button" value="移除节点" title="移除节点" onclick="removeRBTree()"/>
<input type="button" value="随机生成" title="随机生成" onclick="randomRBTree()"/>
<input type="button" value="随机移除" title="随机移除" onclick="randomRBTreeRemove()"/>
<canvas id="canvas" style="display: block; margin: 0 auto;"></canvas>
<canvas id="canvas2" style="display: block; margin: 0 auto;"></canvas>
</body>
</html>