-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray-visualRepresentation.html
312 lines (241 loc) · 12.1 KB
/
array-visualRepresentation.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DSA Visualizer - Array</title>
<link rel="shortcut icon" href="images/icon1.jpeg" type="image/x-icon">
<script src="https://kit.fontawesome.com/176e14c7a2.js" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>
<body onload="loadArrayPage()">
<nav class="navbar navbar-expand-lg">
<div class="container-fluid">
<a style="color: white; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 500; position: relative; top: -1px;"
class="navbar-brand" href="#">DSA Visualizer</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<i style="color: white;" class="fa-solid fa-bars"></i>
</button>
<div class="collapse navbar-collapse justify-content-start mt-2" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item a" onclick="getIndex()">
<a class="nav-link">Data Structures</a>
<div class="underline "></div>
</li>
<li class="nav-item a" onclick="getCompiler()">
<a class="nav-link">Compiler</a>
<div class="underline"></div>
</li>
<li class="nav-item a" onclick="getTopic()">
<a class="nav-link">DSA Topics</a>
<div class="underline"></div>
</li>
</ul>
</div>
<script>
function getIndex() {
window.location.href = 'https://dsabrototype.vercel.app'
}
function getCompiler() {
window.location.href = 'https://dsabrototype.vercel.app/compiler.html'
}
function getTopic() {
window.location.href = 'https://dsabrototype.vercel.app/topics.html'
}
</script>
<div class="collapse navbar-collapse justify-content-end mt-2" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item a">
<a class="nav-link" id="basic_op_btn">Basic Operations</a>
<div class="underline"></div>
</li>
<li class="nav-item a">
<a class="nav-link" id="search_op_btn">Search Operations</a>
<div class="underline"></div>
</li>
<li class="nav-item a">
<a class="nav-link" id="special_op_btn">Special Operations</a>
<div class="underline"></div>
</li>
</ul>
</div>
</div>
</nav>
<section id="message">
<h4 style="text-align: center;">Please make the window wider for a better user experience</h4>
</section>
<section id="content">
<h1
style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; text-align: center; font-size: 22px; background-color: rgb(229, 229, 229); padding: 12px; padding-bottom: 16px; font-weight: 500;">
Array - <span style="color: chocolate;">Visual</span> Representation</h1>
<section class="">
<section style="display: flex; flex-direction: column; align-items: center; padding-top: 60px;">
<div class="array_area">
<div id="array_box" class="array_body">
<div id="0" class="index">
10
</div>
<div id="1" class="index">
10
</div>
<div id="2" class="index">
10
</div>
<div id="3" class="index">
10
</div>
</div>
</div>
<div class="array_area">
<div id="array_index" style="position: relative; top: -35px; display: flex;" class="">
<div id="box0" class="ind">
0
</div>
<div id="box1" class="ind">
1
</div>
<div id="box2" class="ind">
2
</div>
<div id="box3" class="ind">
3
</div>
</div>
</section>
</section>
<section style="display: flex; justify-content: space-between; padding-left: 20px;" id="form_section">
<!-- basic operations -->
<div id="basic_operations" style="display: none; flex-direction: column;">
<p
style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 500; font-size: 20px; padding-left: 20px;">
Basic Operations</p>
<div
style="padding: 30px; overflow-y: auto; padding: 20px; padding-top: 10px; background-color:rgba(99, 99, 99, 0); border-width: 2px; border-style: none; border-color: lightgray;">
<div class="">
<form action="" onsubmit="insertAtLast(event)">
v = <input type="number" id="insertedValue" required>
<input id="insertAtLastBtn" type="submit" value="Push">
</form>
</div>
<br>
<div class="">
<form action="" onsubmit="removeValue(event)">
v = <input type="number" id="number" required>
<input id="removeBtn" type="submit" value="Remove">
</form>
</div>
<br>
<div class="">
<form id="form" action="" onsubmit="insertValue(event)">
v = <input type="number" id="insertingValue" required>
i = <input type="number" id="position" required>
<input id="insertAtPosition" type="submit" value="Insert">
</form>
</div>
<br>
<div class="">
<form id="form" action="" onsubmit="Update(event)">
v = <input type="number" id="updatingValue" required>
i = <input type="number" id="index" required>
<input id="update" type="submit" value="Update">
</form>
</div>
</div>
</div>
<!-- special operations -->
<div id="search_operations" style="display: none; flex-direction: column;">
<p
style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 500; font-size: 20px; padding-left: 20px;">
Search Operations</p>
<div style="padding: 10px; padding-left: 20px;">
<div class="">
<form id="form" action="" onsubmit="LinearSearch(event)">
v = <input type="number" id="Linear_search_value" required>
<input style="width: 130px;" id="linerarSearch" type="submit" value="Linear Search">
</form>
</div>
<br>
<div class="">
<form id="form" action="" onsubmit="BinarySearch(event)">
v = <input type="number" id="binary_search_value" required>
<input style="width: 130px;" id="binarySearch" type="submit" value="Binary Search">
</form>
</div>
<br>
</div>
</div>
<!-- special operations -->
<div id="special_operations" style="display: none; flex-direction: column;">
<p
style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 500; font-size: 20px; padding-left: 20px;">
Special Operations</p>
<div style="padding: 10px; padding-left: 20px;">
<div>
<form action="" onsubmit="reverseArray(event)">
<input type="submit" id="reverse" value="Reverse">
</form>
</div>
</div>
</div>
<div id="note_pad_div" style="display: none; flex-direction: column; padding-right: 30px;">
<p
style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: 500; font-size: 20px; padding-left: 0px;">
Explanation</p>
<div id="note_pad"
style="width:400px; background-color: rgb(229, 229, 229); padding: 20px; padding-top: 20px;">
</div>
</div>
</section>
</section>
<script src="javascript/array.js"></script>
<script src="javascript/specialoperarionsArray.js"></script>
<script>
let basic_btn = document.getElementById('basic_op_btn')
let special_btn = document.getElementById('special_op_btn')
let search_btn = document.getElementById('search_op_btn')
let basic_div = document.getElementById('basic_operations')
let special_div = document.getElementById('special_operations')
let search_div = document.getElementById('search_operations')
let note_pad_div = document.getElementById('note_pad_div')
function resetAllForms() {
const forms = document.querySelectorAll('form');
forms.forEach(form => form.reset());
}
// basic operations btn
basic_btn.addEventListener('click', () => {
basic_div.style.display = 'flex'
special_div.style.display = 'none'
search_div.style.display = 'none'
resetAllForms()
note_pad_div.style.display = 'none'
localStorage.setItem('which', 'basic')
})
// speacial operations btn
special_btn.addEventListener('click', () => {
special_div.style.display = 'flex'
basic_div.style.display = 'none'
search_div.style.display = 'none'
resetAllForms()
note_pad_div.style.display = 'none'
document.getElementById('binary_search_value').removeAttribute('readOnly')
localStorage.setItem('which', 'special')
})
// serach operations btn
search_btn.addEventListener('click', () => {
search_div.style.display = 'flex'
special_div.style.display = 'none'
basic_div.style.display = 'none'
resetAllForms()
note_pad_div.style.display = 'none'
document.getElementById('binary_search_value').removeAttribute('readOnly')
localStorage.setItem('which', 'search')
})
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>