-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·200 lines (192 loc) · 6.45 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sort Visualizer</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: #333;
color: #f3f3f3;
font-family: 'Segoe UI', sans-serif;
}
h1 {
text-align: center;
margin-bottom: 20px;
font-size: 2em;
}
.container {
max-width: 1200px;
height: 100vh;
width: 90%;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 20px;
}
.value_container {
display: flex;
align-items: flex-start;
width: 100%;
height: 80%;
background-color: #444;
border: 1px solid #555;
overflow: auto;
padding: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transform: rotateX(180deg);
}
.value {
height: 100%;
width: 10px;
background-color: #fff;
transition: background-color 0.3s ease;
}
.button_container {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
align-items: center;
}
button, select {
font-family: 'Arial', sans-serif;
font-size: 1em;
padding: 10px 15px;
border: none;
border-radius: 5px;
background-color: #555;
color: #f3f3f3;
cursor: pointer;
margin: 5px;
transition: background-color 0.3s ease, transform 0.2s ease;
}
button:hover, select:hover {
background-color: #666;
}
select {
width: 150px;
}
span {
color: #ccc;
font-size: 0.9em;
text-align: center;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<h1>Sort Visualizer</h1>
<div class="value_container" id="value_container"></div>
<div class="button_container">
<button id="reverse_btn">Reverse Array</button>
<button id="randomize_btn">Randomize Array</button>
<button id="sort_btn">Sort</button>
<button id="initialize_btn">Init</button>
<select name="sorting algorithm" class="algo-menu">
<optgroup label="Exchange Sorts">
<option value="1" selected>Bubble Sort</option>
<option value="3">Quick Sort</option>
<option value="36">Parallel Quick Sort</option>
<option value="5">Cocktail Shaker Sort</option>
<option value="6">Odd-Even Sort</option>
<option value="7">Comb Sort</option>
<option value="14">Gnome Sort</option>
<option value="21">Circle Sort</option>
</optgroup>
<optgroup label="Selection Sorts">
<option value="4">Selection Sort</option>
<option value="11">Max Heap Sort</option>
<option value="34">Min Heap Sort</option>
<option value="17">Cycle Sort</option>
</optgroup>
<optgroup label="Insertion Sorts">
<option value="2">Insertion Sort</option>
<option value="8">Shell Sort</option>
</optgroup>
<optgroup label="Merge Sorts">
<option value="9">Merge Sort Recursive</option>
<option value="41">Merge Sort Iterative</option>
<option value="37">Merge Sort Parallel</option>
<option value="42">Merge Sort In-Place</option>
</optgroup>
<optgroup label="Distribution Sorts">
<option value="18">Counting Sort</option>
<option value="19">Radix Sort</option>
</optgroup>
<optgroup label="Concurrent Sorts">
<option value="16">Bitonic Sort Recursive</option>
<option value="22">Bitonic Sort Iterative</option>
<option value="38">Bitonic Sort Parallel</option>
<option value="20">Diamond Sort Recursive</option>
<option value="23">Diamond Sort I</option>
<option value="24">Crease Sort</option>
<option value="25">Fold Sort</option>
<option value="26">Weave Sort Recursive</option>
<option value="27">Weave Sort Iterative</option>
<option value="29">Pairwise Sorting Network Recursive</option>
<option value="30">Pairwise Sorting Network Iterative</option>
<option value="40">Pairwise Sorting Network Parallel</option>
<option value="32">Odd-Even Merge Sort Recursive</option>
<option value="33">Odd-Even Merge Sort Iterative</option>
<option value="39">Odd-Even Merge Sort Parallel</option>
</optgroup>
<optgroup label="Hybrid Sorts">
<option value="15">Tim Sort</option>
</optgroup>
<optgroup label="Impractical Sorts">
<option value="10">Stooge Sort</option>
<option value="13">Bogo Sort</option>
<option value="28">Stalin Sort</option>
<option value="31">Bozo Sort</option>
</optgroup>
<optgroup label="Other Sorts">
<option value="12">Pancake Sort</option>
<option value="35">Simple Sort (polylog)</option>
</optgroup>
</select>
<select name="amount of values" class="size-menu">
<option value="2">2</option>
<option value="4">4</option>
<option value="8">8</option>
<option value="16">16</option>
<option value="32">32</option>
<option value="64">64</option>
<option value="128" selected>128</option>
<option value="256">256</option>
<option value="512">512</option>
<option value="1024">1,024</option>
</select>
<select name="speed (in ms)" class="speed-menu">
<option value="1">1 ms</option>
<option value="5">5 ms</option>
<option value="10" selected>10 ms</option>
<option value="50">50 ms</option>
<option value="100">100 ms</option>
<option value="500">500 ms</option>
<option value="1000">1 sec</option>
</select>
<select name="values visualization" class="visualizer-menu">
<option value="1" selected>Histogram</option>
<option value="2">Dot Plot</option>
<option value="3">Histogram (Colored)</option>
<option value="4">Equalizer</option>
<option value="5">Equalizer (Colored)</option>
</select>
</div>
<span>*Improved by bitonic589</span>
</div>
<script src="scripts/helper.js"></script>
<script src="scripts/utils.js"></script>
<script src="scripts/sorting_algorithms.js"></script>
<script src="scripts/app.js"></script>
</body>
</html>