-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
159 lines (159 loc) · 5.78 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sorting Visualiser</title>
<link rel="stylesheet" href="style.css" />
<script src="script.js" defer></script>
<script src="mergesort.js" defer></script>
<script src="quicksort.js" defer></script>
<script src="bubblesort.js" defer></script>
<script src="selectionsort.js" defer></script>
</head>
<body>
<nav>
<div class="inner-nav">
<button id="mute">
<svg
id="mutesvg"
xmlns="http://www.w3.org/2000/svg"
width="30"
height="26"
fill="black"
class="bi bi-volume-mute-fill"
viewBox="0 0 16 16"
>
<path
d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06zm7.137 2.096a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0z"
/>
</svg>
</button>
<div class="slidecontainer">
<label for="generate" class="sliderlabel button" id="generatelabel"
>Generate Array</label
>
<input
type="range"
min="10"
max="100"
value="55"
step="1"
class="slider"
id="generate"
/>
</div>
<div class="slidecontainer">
<label for="speed" class="sliderlabel" id="speedlabel">Speed</label>
<input
type="range"
min="1"
max="199"
value="100"
step="1"
class="slider"
id="speed"
/>
</div>
</div>
<div class="inner-nav">
<button class="button" id="mergesort">Mergesort</button>
<button class="button" id="quicksort">Quicksort</button>
<button class="button" id="bubblesort">Bubblesort</button>
<button class="button" id="selectionsort">Selectionsort</button>
</div>
</nav>
<div class="background" id="div1">
<div class="desc-container">
<div class="description" id="mergedesc">
<h1 class="heading1">Merge Sort</h1>
<h2 class="heading2">Time Complexity</h2>
<p>Average - θ(n log(n))</p>
<p>Worst - O(n log(n))</p>
<h2 class="heading2">Explanation</h2>
<p>
Recursively divides an array into smaller subarrays, sorting each
subarray, then merging the sorted subarrays together.
</p>
<p>
Here is an in-depth<a
href="https://www.geeksforgeeks.org/merge-sort/"
>explanation</a
>
</p>
<ul>
<li class="compare">
<span class="text">Comparing & Swapping</span>
</li>
</ul>
</div>
<div class="description" id="quickdesc">
<h1 class="heading1">Quick Sort</h1>
<h2 class="heading2">Time Complexity</h2>
<p>Average - θ(n log(n))</p>
<p>Worst - O(n^2)</p>
<h2 class="heading2">Explanation</h2>
<p>
Recursively partitions the array, moving elements smaller than the
pivot, to the left of the pivot and elements larger to the right.
</p>
<p>
Here is an in-depth<a
href="https://www.geeksforgeeks.org/quick-sort/"
>explanation</a
>
</p>
<ul>
<li class="compare"><span class="text">Comparing</span></li>
<li class="swap"><span class="text">Swapping</span></li>
<li class="pivot"><span class="text">Pivot</span></li>
</ul>
</div>
<div class="description" id="bubbledesc">
<h1 class="heading1">Bubble Sort</h1>
<h2 class="heading2">Time Complexity</h2>
<p>Average - θ(n^2)</p>
<p>Worst - O(n^2)</p>
<h2 class="heading2">Explanation</h2>
<p>
Loops through array for each element, comparing adjacent elements,
moving the larger element to the right.
</p>
<p>
Here is an in-depth<a
href="https://www.geeksforgeeks.org/bubble-sort/"
>explanation</a
>
</p>
<ul>
<li class="compare"><span class="text">Comparing</span></li>
<li class="swap"><span class="text">Swapping</span></li>
</ul>
</div>
<div class="description" id="selectiondesc">
<h1 class="heading1">Selection Sort</h1>
<h2 class="heading2">Time Complexity</h2>
<p>Average - θ(n^2)</p>
<p>Worst - O(n^2)</p>
<h2 class="heading2">Explanation</h2>
<p>
Loops through array for each element, keeping track of the last
minimum value seen, and moving it to the start of the loop.
</p>
<p>
Here is an in-depth<a
href="https://www.geeksforgeeks.org/selection-sort/"
>explanation</a
>
</p>
<ul>
<li class="compare"><span class="text">Comparing</span></li>
<li class="swap"><span class="text">Swapping</span></li>
<li class="pivot"><span class="text">Last Minimum Value</span></li>
</ul>
</div>
</div>
</div>
</body>
</html>