-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
560 lines (492 loc) · 14.8 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
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
<!DOCTYPE html>
<html>
<head>
<title>Draw my Code</title>
<style>
html, * {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
#main {
min-height: 100vh;
background: rgb(228, 226, 226);
overflow: hidden;
}
.main__heading {
background: rgb(238, 243, 238);
box-shadow: -5px -5px 20px rgba(0, 0, 0, .3);
border-radius: 0 0 20px 0px;
font-family: ubuntu;
font-weight: bolder;
font-size: 30px;
margin: auto;
display: flex;
justify-content: center;
display: flex;
flex-wrap: wrap;
text-align: center;
padding: 20px 0px ;
}
.heading__text {
font-family: serif;
color: black;
font-weight: bolder;
font-size: 40px;
}
.section {
overflow-y: scroll;
display: flex;
margin: auto;
text-align: center;
}
.info__box:hover {
transform: translateY(-10px);
transition: 100ms linear;
}
.popup__heading {
font-family: ubuntu;
font-weight: bold;
font-size: 23px;
}
.popup__sub__heading {
text-align: left;
font-weight: bold;
text-transform: capitalize;
}
.popup__sub__heading > b {
color: gray;
font-weight: bolder;
font-size: 23px;
}
.card-body {
display: flex;
justify-content: flex-start;
box-shadow: 10px 10px 10px rgba(0, 0, 0, .2);
background: #0e110a;
flex-wrap: wrap;
}
.card {
text-align: center;
display: flex;
justify-content: center;
transform: scale(.9);
box-shadow: 5px -5px 5px rgba(0, 0, 0, .3);
transition: 100ms linear;
}
.card:hover {
transform: scale(.9) translateY(-5px);
transition: 100ms linear;
}
.card-img-top-parent {
overflow: hidden;
transition: 200ms linear;
height: 300px;
position: relative;
}
.card-img-top:hover {
transition: 200ms linear;
transform: scale(1.1);
}
.card__heading {
padding: 10px;
background: #0e110a;
font-weight: bolder;
text-transform: uppercase;
font-family: ubuntu;
color: lightskyblue;
font-size: 1.2rem;
}
.dark{
background-color: #222;
color: #e6e6e6;
}
</style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
</head>
<body>
<div id='main'>
<div class="main__heading">
<img src="./images/Draw my Code.png" alt="" style="height: 70px; margin-right: 10px; border-radius: 7px;">
<b class='heading__text title' >Draw my Code</b> <span style="color: darkgray; margin-top: 9px;">DSA made easy</span>
<button onclick="myFunction()">Switch mode</button>
</div>
<div class="section row"></div>
<div class="body__bin"></div>
</div>
<script>
// Main
let sec = document.querySelector('.section');
let heading = document.querySelector('.main__heading');
let counter = 0;
document.querySelector(".title").addEventListener("click", () => {
if(counter == 10) {
if(window.localStorage.getItem("questions")) {
window.localStorage.removeItem("questions");
}
else
window.localStorage.setItem("questions", true)
window.location.reload();
}
console.log(counter);
counter++;
})
let details = [
{
heading: 'Time Complexity',
image: `images/time_complexity.png`,
link: 'templates/time_complexity.html',
sub_topics: [
"Big Oh",
"Big Omega",
"Big Theta"
]
},
{
heading: 'Array',
image: `images/array.png`,
link: 'templates/array.html',
sub_topics: [
"create",
"insert",
"delete",
"linear search",
"prefix sum",
"kadane",
"sliding windows",
"partitioning",
"rain water trapping"
]
},
{
heading: 'Stack',
image: `images/stack.png`,
link: 'templates/stack.html',
sub_topics: [
"create",
"push",
"pop",
"peek",
"Balanced bracket",
"infix to postfix",
"infix to prefix",
"postfix evaluation",
"prefix evaluation",
"Max Area under histogram",
"Min Stack O(1)"
]
},
{
heading: 'Matrix',
image: `images/matrix.png`,
link: 'templates/matrix.html',
sub_topics: [
"Transpose",
"Sparse Matrix",
"kadane 2d",
"Sorted Matrix search"
]
},
{
heading: 'Queue',
image: 'images/queue.png',
link: 'templates/queue.html',
sub_topics: [
"create",
"enqueue",
"dequeue",
"bfs"
]
},
{
heading: 'Heap',
image: 'images/heap.png',
link: 'templates/heap.html',
sub_topics: [
"create",
"delete",
"insert",
"heapify",
"heap sort"
]
},
{
heading: 'Linked List',
image: 'images/linked_list.png',
link: 'templates/linkedlist.html',
sub_topics: [
"singly",
"doubly",
"circular",
"stack",
"queue"
]
},
{
heading: 'Recursion',
image: 'images/recursion.jpg',
link: 'templates/recursion.html',
sub_topics: [
"factorial",
"H tree",
"snowflakes",
"Tower Of Brahma"
]
},
{
heading: 'Binar Search Tree',
image: 'images/tree.png',
link: 'templates/tree.html',
sub_topics: [
"create",
"insert",
"delete",
"find",
"traversal",
// "rotations"
]
},
{
heading: 'Binary Search Algorithm',
image: 'images/search.jpeg',
link: 'templates/search.html',
sub_topics: [
"binary search",
"start point in roated array",
"find peak element",
// "minmum page allocation",
"biotonic array"
]
},
{
heading: 'Sort Algorithms',
image: 'images/sort.png',
link: 'templates/sort.html',
sub_topics: [
"bubble",
"selection",
"insertion",
"merge",
"quick",
// "radix",
"heap",
"shell",
"counting"
]
},
{
heading: 'Divide And Conquer',
image: 'images/divide_and_conquer.png',
link: 'templates/divide_and_conquer.html',
sub_topics: [
"merge sort",
"quick sort",
"counting inversion"
]
},
{
heading: 'String',
image: 'images/string.png',
link: 'templates/string.html',
sub_topics: [
"Naive",
"KMP",
"Rabin Karp",
// "Boyer Moore",
"Z Function"
]
},
{
heading: 'Graph',
image: 'images/graph.png',
link: 'templates/graph.html',
sub_topics: [
"create",
"dfs",
"bfs",
"kruskals",
// "prims",
"dfs maze",
"djstras",
"flood fill",
"color filling",
"topological sorting",
"detect cycle",
// "bellman ford",
// "floyd warshall",
// "snake and ladders",
"travelling salesman",
// "ford fulkerson",
// "tarjons",
"bridges",
// "kosarajus ",
// "Articulation points",
// "dinics"
]
},
// // Extras
{
heading: 'Disjoint Set',
image: 'images/disjoint_set.png',
link: 'templates/disjoint.html',
sub_topics: [
"find",
"union"
]
},
{
heading: 'Hashing Table',
image: 'images/hashing_table.png',
link: 'templates/hashing_table.html',
sub_topics: [
"open hashing",
"closed hashing"
]
},
// {
// heading: 'Segment Tree',
// image: 'images/segment_tree.png',
// link: 'templates/segment_tree.html',
// sub_topics: [
// "create",
// "query",
// "update"
// ]
// },
// Questions
{
heading: 'Questions',
image: 'images/question.jpeg',
link: 'templates/questions.html',
sub_topics: [
"Data Structure",
"Algorithm"
]
},
]
if(!localStorage.getItem("counter"))
pop_up();
// Utility
details.forEach((detail, index) => {
let temp = window.localStorage.getItem("questions");
if(detail.heading == "Questions" && temp == null) {
// Do Nothing
}
else
add_card(detail, index);
})
function add_card(details, index) {
let card = document.createElement('div');
['col', 'col-12', 'col-md-6', 'col-lg-4'].forEach((el) => card.classList.add(el));
card.style.borderRadius = '10px';
card.style.transform = 'scale(.9)';
let card_html = `
<div class="card" style="">
<div class="card__heading">${details.heading}</div>
<a href="${details.link}" target="_self" class="card-img-top-parent">
<img src="${details.image}" class="card-img-top" alt="${details.heading}">
</a>
<div class="card-body">
</div>
</div>
`
card.innerHTML = card_html;
sec.appendChild(card);
details.sub_topics.forEach((e) => {
let card_span = document.createElement('button');
card_span.classList.add('badge');
card_span.classList.add('badge-primary');
card_span.innerText = e.toUpperCase();
document.querySelectorAll('.card-body')[index].appendChild(card_span);
})
}
// POP UP
function pop_up() {
if(+localStorage.getItem("counter") == 1) return;
if(+localStorage.getItem("first_time") == 1){
localStorage.setItem("counter", 1);
}
else
localStorage.setItem('first_time', 1)
if(true && +localStorage.getItem('first_time') == 1) {
let cross;
let slider;
let info;
cross = document.createElement("span");
cross.innerText = "X";
cross.style.position = 'absolute';
cross.style.top = '10px';
cross.style.right = '10px';
cross.style.borderRadius = "10px";
cross.style.color = 'white';
cross.style.boxShadow = '1px 1px 10px rgba(255, 255, 255, .5)'
cross.style.padding = '15px 20px';
cross.style.cursor = 'pointer';
cross.classList.add('cross')
slider = document.createElement("div");
slider.style.width = '100vw';
slider.style.height = '100vh';
slider.style.overflow = 'scroll';
slider.style.background = 'rgba(0, 0, 0, .9)';
slider.style.position = 'fixed';
slider.style.top = '0px';
slider.style.left = '0px';
slider.style.zIndex = '20';
// debugger
// POPUP Info
let html = () => {
let a = `
<div class="popup__heading">DSALGO</div>
<img src="https://github.com/jhabarsingh/DSALGO-VISUALIZER/blob/main/logo/logo_2.png?raw=true"
style="width:200px;"
/>
<div class="popup__sub__heading">
<b>Ds Algo visualizer </b>
<br />
<code>
is made for students who want to learn Data structures and algorithms with Animations. This project includes all the important data structures that are being widely used.
</code>
<hr />
<h5> <b>Topics Covered</b> </h5>
<div>`
let b = "";
for(let i=0; i<details.length; i++)
b += `<span class="badge badge-primary" style="margin:3px;">${details[i].heading}</span>`
let c = ` </div>
</div>
<blockquote class="popup__sub__heading__details"> </blockquote>
`
return a + b + c;
}
info = document.createElement("div");
info.innerHTML = html();
info.style.maxWidth = '600px';
info.style.textAlign = 'center';
info.style.margin = '30px'
info.style.transform = 'translateY(100px)';
info.style.background = 'white';
info.style.borderRadius = '10px'
info.classList.add("info__box");
info.style.boxShadow = '20px 20px 30px rgba(0, 0, 0, .3)'
info.style.padding = '20px'
info.style.border = '1px solid black';
info.style.margin = 'auto';
slider.appendChild(cross);
slider.appendChild(info);
slider.style.textAlign = 'center';
document.querySelector('.body__bin').appendChild(slider);
localStorage.setItem('first_time', 1)
document.querySelector('.cross').addEventListener("click", () => {
document.querySelector('.body__bin').innerHTML = '';
})
}
}
function myFunction() {
var element = document.main;
element.classList.toggle("dark");
}
</script>
</body>
</html>