-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkedList-visualRepresention.html
229 lines (177 loc) · 9.5 KB
/
linkedList-visualRepresention.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DSA Visualizer - Linked List</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="loadLinkedListPage()">
<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>
</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;">
Linked List - <span style="color: chocolate;">Visual</span> Representation</h1>
<section class="">
<section
style="display: flex; flex-direction: column; align-items: center; padding-top: 60px; padding-bottom: 100px;">
<div id="linked-list" class="linked-list">
<!-- <div class="oneNode">
<div class="value1">10</div>
<div class="address">101</div>
</div>
<div class="arrow">→</div>
<div class="oneNode">
<div class="value2">20</div>
<div class="address">105</div>
</div>
<div class="arrow">→</div>
<div class="oneNode">
<div class="value3">40</div>
<div class="address">null</div>
</div> -->
</div>
</section>
<section style="display: flex; justify-content: space-between; padding-left: 20px;" id="form_section">
<!-- basic operations -->
<div id="basic_operations" style="display: block; 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="appendValue" required>
<input id="insertAtLastBtn" type="submit" value="Append">
</form>
</div>
<br>
<div class="">
<form id="form" action="" onsubmit="insertAtFirst(event)">
v = <input type="number" id="prependValue" required>
<input id="insertAtPosition" type="submit" value="PrePend">
</form>
</div>
<br>
<div class="">
<form action="" onsubmit="removeValues(event)">
v = <input type="number" id="removeValue" required>
<input id="removeBtn" type="submit" value="Remove">
</form>
</div>
<br>
<div class="">
<form id="form" action="" onsubmit="Search(event)">
v = <input type="number" id="searchValue" required>
<input id="update" type="submit" value="Search">
</form>
</div>
</div>
</div>
<div id="note_pad_div" style="display: block; 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;">
<p style="font-size:16px; margin-bottom: 0px;">A linked list is a linear data structure where
elements (called nodes) are stored in a sequence, but unlike arrays, they are not stored in
contiguous memory locations. Each node contains two parts:
Data: The value or the information the node holds.
Pointer (or reference): A link to the next node in the sequence.</p>
</div>
</div>
</section>
</section>
<script src="javascript/linkedList.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>