-
Notifications
You must be signed in to change notification settings - Fork 0
/
heap.html
150 lines (147 loc) · 7.75 KB
/
heap.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
<!DOCTYPE html>
<html>
<head>
<title>Palgo</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/material-design/bootstrap-material-design.css">
<link rel="stylesheet" type="text/css" href="css/ripples/ripples.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/vis/vis.css">
</head>
<body>
<div class="window">
<div class="bs-component">
<div class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-inverse-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="welcome.html" class="navbar-left"><img src="assets/icons/png/icon.png" style="max-height: 60px;"></a>
</div>
<div class="navbar-collapse collapse navbar-inverse-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Algorithms
<b class="caret"></b>
<div class="ripple-container"></div>
</a>
<ul class="dropdown-menu">
<li class="dropdown-header">Trees</li>
<li><a href="huffman.html">Huffman Tree</a></li>
<li><a href="prim-jarnik.html">Prim-Jarnik</a></li>
<li><a href="prim-jarnik-refinement.html">Prim-Jarnik Dijkstra's Refinement</a></li>
<li class="active"><a href="heap.html">Heap</a></li>
<li class="divider"></li>
<li class="dropdown-header">Graphs</li>
<li><a href="bfs.html">Breadth-First Search</a></li>
<li><a href="dfs.html">Depth-First Search</a></li>
<li><a href="dijkstra.html">Dijkstra's Shortest Path</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="mailto:[email protected]" class="btn btn-primary btn-fab"
data-toggle="tooltip" data-placement="left" title=""
data-original-title="Tooltip on left">
<i class="fa fa-comments-o"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div id="source-button" class="btn btn-primary btn-xs" style="display: none;">< ></div>
</div>
<header class="toolbar toolbar-header">
<div class="row" style="margin-bottom: 16px; margin-left: 5px; margin-top: 15px;">
<a id="insert-btn" class="btn btn-primary btn-raised col-md-5">Insert Node
<div class="ripple-container"></div>
</a>
<a id="delete-btn" class="btn btn-primary btn-raised col-md-5">Delete Node
<div class="ripple-container"></div>
</a>
</div>
</header>
<div class="window-content">
<div class="modal" id="insert-node-popUp">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" id="insert-close-x1" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title">Add Heap Node</h4>
</div>
<div class="modal-body" id="insert-node-operation">
<div class="form-group label-floating" id="insert-node-label-text">
<label class="control-label" for="insert-node-label" id="insert-n-label-text">Insert label for the node</label>
<input class="form-control" id="insert-node-label" type="text">
</div>
</div>
<div class="modal-footer">
<button type="button" value="save" class="btn btn-default" id="insert-node-cancelButton" data-dismiss="modal">Close</button>
<button type="button" value="cancel" class="btn btn-primary" id="insert-node-saveButton">Add Node</button>
</div>
</div>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Heap</h3>
</div>
<div class="panel-body" id="algo-panel">
<div class="container-fluid">
<div class="row">
<div class="col-md-7">
<div id="tree-simple"></div>
</div>
<div class="col-md-5">
<div class="well well-lg">
<code id="insert-function-call">Insert(item): </code><br>
<code id="insert-line-0">     insert item in new leaf node; </code><br>
<code id="insert-line-1">     while (new_value not in root && new_value > parent_value) </code><br>
<code id="insert-line-2">         swap new_value with parent_value; </code><br>
<code></code><br>
<code id="impose-function-call">Impose(item): </code><br>
<code id="impose-line-0">     while (bad_value not in leaf && bad_value < larger_child) </code><br>
<code id="impose-line-1">         swap bad_value with larger_child; </code><br>
<code></code><br>
<code id="delete-function-call">Delete(item): </code><br>
<code id="delete-line-0">     swap root value with value in last (bottom-right) leaf; </code><br>
<code id="delete-line-1">     delete last (bottom-right) leaf; </code><br>
<code id="delete-line-2">     impose heap property on bad value in root; </code><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
if (typeof module === 'object') {
window.module = module;
module = undefined;
}
</script>
<script src="js/jquery/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/ripples.min.js"></script>
<script src="js/material/material.js"></script>
<script>
$.material.init();
</script>
<script src="js/vis/vis.js"></script>
<script src="vendor/raphael.js"></script>
<script src="js/helpers/network-util.js"></script>
<script src="js/helpers/alerts.js"></script>
<script src="js/helpers/codeline-util.js"></script>
<script src="js/helpers/nodes-util.js"></script>
<script src="js/heap/heap.js"></script>
<script src="js/material/wNumb.js"></script>
</body>
</html>