-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsorting.html
More file actions
168 lines (142 loc) · 6.05 KB
/
Copy pathsorting.html
File metadata and controls
168 lines (142 loc) · 6.05 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sorting | Algorithms Visualized</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Geologica:wght@100..900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles/header.css">
<link rel="stylesheet" href="styles/general.css">
<link rel="stylesheet" href="styles/sidebar.css">
<link rel="stylesheet" href="styles/home-page.css">
<link rel="stylesheet" href="styles/application-preview.css">
<link rel="stylesheet" href="styles/sorting.css">
</head>
<body>
<div class="header">
<div class="left-section">
<p class="home-algorithms">Algorithms Visualized</p>
</div>
<div class="middle-section">
<button class="base-button-header js-home-button">Home</button>
<button class="base-button-header js-about-button">
<div class="about-github-container">
<span class="about-button-about-text">About</span>
<img src="images/github.svg">
</div>
</button>
</div>
</div>
<div class="sidebar">
<button class="base-button-sidebar js-graph-editor-button"><img src="images/graph-editor-icon.svg"> Graph Editor</button>
<button class="base-button-sidebar js-h-h-button"><img src="images/havel-hakimi-icon.svg"> Havel-Hakimi Game</button>
<button class="base-button-sidebar js-sorting-button"><img src="images/sorting-algo-icon.svg"> Sorting</button>
</div>
<div class="main-dashboard">
<h1>Sorting Algorithms</h1>
<div class="center-canvas">
<div class="canvas">
<svg id="graph" width="875" height="410">
</svg>
<div id="status">📦❓Unsorted</div>
</div>
</div>
<div class="button-container-play-etc">
<button class="base-play-buttons js-sort-array">▶️Play</button>
<button class="base-play-buttons js-generate-array">🔢Generate Array</button>
</div>
<div class="graph-editor-about-section">
<div>
<h2 class="about-heading">⚙️Settings</h2>
</div>
<div class="options-container">
<div class="control-group">
<div class="control-group-heading">
<h3 class="about-heading">🔀Sorting Algorithm⬆️⬇️</h5>
</div>
<div class="control-group-custom">
<select id="algorithm">
<option value="bubble">🫧Bubble Sort</option>
<option value="merge" selected>🧩Merge Sort</option>
<option value="quick">⚡Quick Sort</option>
<option value="selection">🔍Selection Sort</option>
</select>
</div>
</div>
<div class="control-group">
<div class="control-group-heading">
<h3 class="about-heading">🔢Array Settings⚙️</h5>
</div>
<div class="control-group-custom">
<span id="display-current-value-num-items">Number of Items: 40</span>
<div class="slider-wrapper">
<span class="slider-label">10</span>
<input type="range" class="num-items-slider" min="10" max="300" value="40">
<span class="slider-label">300</span>
</div>
</div>
</div>
<div class="control-group">
<div class="control-group-heading">
<h3 class="about-heading">🎬Playback</h5>
</div>
<div class="control-group-custom">
<span id="display-current-value-playback-speed">Speed: 50ms</span>
<div class="slider-wrapper">
<span class="slider-label">0</span>
<input type="range" class="playback-speed-slider" min="0" max="500" value="50">
<span class="slider-label">500</span>
</div>
</div>
</div>
</div>
</div>
<div class="graph-editor-about-section">
<div>
<h2 class="about-heading">👋About</h2>
</div>
<div>
<div>
<p class="right-paragraph">
This sorting algorithm visualizer was created to help users understand how common sorting techniques operate step by step. Built using JavaScript and the D3.js library, this interactive tool visually demonstrates popular sorting algorithms including <strong>Bubble Sort, Merge Sort, Quick Sort, and Selection Sort</strong>.
</p>
<p class="right-paragraph">
Users can customize the number of elements to sort, adjust playback speed, and switch between different algorithms to compare performance and behavior.
</p>
<p class="right-paragraph">
Although there are a lack of settings, more features are coming!
</p>
</div>
</div>
</div>
<div class="graph-editor-about-section">
<div>
<h2 class="about-heading">🧠 Sorting Algorithm</h2>
</div>
<div class="code-block-container">
<p class="right-paragraph">
Here is the pseudocode for
</p>
<div class="code-block">
<h3 class="subheading-code-block">🧩 Merge Sort</h3>
<pre><code>
Function mergeSort(array):
If length of array > 1:
Split array into left and right halves
mergeSort(left)
mergeSort(right)
Merge sorted left and right into original array
</code></pre>
</div>
</div>
</div>
</div>
<script src="//d3js.org/d3.v7.min.js"></script>
<script src="scripts/general/header-sidebar-buttons.js"></script>
<script src="scripts/sorting-webpage/sorting-visual.js"></script>
<script src="scripts/sorting-webpage/sorting-algorithms.js"></script>
<script src="scripts/sorting-webpage/sorting-buttons.js"></script>
<script src="scripts/sorting-webpage/sorting-init.js"></script>
</body>
</html>