-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
1655 lines (1612 loc) · 51.2 KB
/
script.js
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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ====start Data====
var root = document.body;
var synth = window.speechSynthesis;
if (typeof synth === 'undefined') {
alert('Speech Synthesis is not supported on this browser. See https://caniuse.com/?search=Speech%20Synthesis for browser support.')
}
var voices = [];
var voice = {}
var prevVoiceLength = 0;
var voiceTestString = "Hello there.";
var deck = {}; // deck obj for edit page
var deckIndex = 0;
var g = { // g means Game
question: "",
answer: "",
answerAttempt: "",
answerSubmitted: false,
feedback: "",
qaPairs: [],
qaPair: {},
qaPairIndex: 0,
inProgress: false,
correctCount: 0,
incorrectCount: 0
}
var d = [ // d means Decks
{
name: 'What is active recall?',
cards: [
{
q: "Learning something by just reading it over and over.",
a: "passive review"
},
{
q: "When you try to think of the answer on the back of a flashcard without looking first",
a: "active recall"
},
{
q: "This is a local first app. Your decks are saved to 'blank' in your browser and not sent over the internet.",
a: "localStorage"
},
{
q: "Adjust the rate, 'blank', volume, and voice synthesizer on the Settings page",
a: "pitch"
}
],
},
{
name: 'Adding Your Own Decks',
cards: [
{
q: "Save the current decks as a file by going to Settings and clicking the 'blank blank blank' button",
a: "Download as JSON"
},
{
q: "Add 'blank' and cards in your own JSON file, or by clicking the Create 'blank' button.",
a: "decks"
},
{
q: "Upload your own JSON of decks and cards by clicking the 'blank blank' button in Settings",
a: "Choose File"
},
{
q: "Click the 'blank' button to change the cards and title of a deck.",
a: "edit"
},
{
q: "Editing changes are saved 'blank'",
a: "automatically"
}
]
},
{
name: "US Capitals",
cards: [
{q: "What is the capital of Alabama?", a: "Montgomery"},
{q: "What is the capital of Alaska?", a: "Juneau"},
{q: "What is the capital of Arizona?", a: "Phoenix"},
{q: "What is the capital of Arkansas?", a: "Little Rock"},
{q: "What is the capital of California?", a: "Sacramento"},
{q: "What is the capital of Colorado?", a: "Denver"},
{q: "What is the capital of Connecticut?", a: "Hartford"},
{q: "What is the capital of Delaware?", a: "Dover"},
{q: "What is the capital of Hawaii?", a: "Honolulu"},
{q: "What is the capital of Florida?", a: "Tallahassee"},
{q: "What is the capital of Georgia?", a: "Atlanta"},
{q: "What is the capital of Idaho?", a: "Boise"},
{q: "What is the capital of Illinois?", a: "Springfield"},
{q: "What is the capital of Indiana?", a: "Indianapolis"},
{q: "What is the capital of Iowa?", a: "Des Moines"},
{q: "What is the capital of Kansas?", a: "Topeka"},
{q: "What is the capital of Kentucky?", a: "Frankfort"},
{q: "What is the capital of Louisiana?", a: "Baton Rouge"},
{q: "What is the capital of Maine?", a: "Augusta"},
{q: "What is the capital of Maryland?", a: "Annapolis"},
{q: "What is the capital of Massachusetts?", a: "Boston"},
{q: "What is the capital of Michigan?", a: "Lansing"},
{q: "What is the capital of Minnesota?", a: "St. Paul"},
{q: "What is the capital of Mississippi?", a: "Jackson"},
{q: "What is the capital of Missouri?", a: "Jefferson City"},
{q: "What is the capital of Montana?", a: "Helena"},
{q: "What is the capital of Nebraska?", a: "Lincoln"},
{q: "What is the capital of Nevada?", a: "Carson City"},
{q: "What is the capital of New Hampshire?", a: "Concord"},
{q: "What is the capital of New Jersey?", a: "Trenton"},
{q: "What is the capital of New Mexico?", a: "Santa Fe"},
{q: "What is the capital of North Carolina?", a: "Raleigh"},
{q: "What is the capital of North Dakota?", a: "Bismarck"},
{q: "What is the capital of New York?", a: "Albany"},
{q: "What is the capital of Ohio?", a: "Columbus"},
{q: "What is the capital of Oklahoma?", a: "Oklahoma City"},
{q: "What is the capital of Oregon?", a: "Salem"},
{q: "What is the capital of Pennsylvania?", a: "Harrisburg"},
{q: "What is the capital of Rhode Island?", a: "Providence"},
{q: "What is the capital of South Carolina?", a: "Columbia"},
{q: "What is the capital of South Dakota?", a: "Pierre"},
{q: "What is the capital of Tennessee?", a: "Nashville"},
{q: "What is the capital of Texas?", a: "Austin"},
{q: "What is the capital of Utah?", a: "Salt Lake City"},
{q: "What is the capital of Vermont?", a: "Montpelier"},
{q: "What is the capital of Virginia?", a: "Richmond"},
{q: "What is the capital of Washington?", a: "Olympia"},
{q: "What is the capital of West Virginia?", a: "Charleston"},
{q: "What is the capital of Wisconsin?", a: "Madison"},
{q: "What is the capital of Wyoming?", a: "Cheyenne"}
]
},
{
"name": "Big-O Data Structure Access Time Complexities",
"cards": [
{
"q": "What is the average access time complexity for an Array?",
"a": "1"
},
{
"q": "What is the average access time complexity for a Stack?",
"a": "n"
},
{
"q": "What is the average access time complexity for a Queue?",
"a": "n"
},
{
"q": "What is the average access time complexity for a Singly-Linked List?",
"a": "n"
},
{
"q": "What is the average access time complexity for a Double-Linked List?",
"a": "n"
},
{
"q": "What is the average access time complexity for a Skip List?",
"a": "log n"
},
{
"q": "What is the average access time complexity for a Hash Table?",
"a": "n/a"
},
{
"q": "What is the average access time complexity for a Binary Search Tree?",
"a": "log n"
},
{
"q": "What is the average access time complexity for a Cartesian Tree?",
"a": "n/a"
},
{
"q": "What is the average access time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the average access time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the average access time complexity for a Splay Tree?",
"a": "n/a"
},
{
"q": "What is the average access time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the average access time complexity for a KD Tree?",
"a": "log n"
},
{
"q": "What is the worst access time complexity for an Array?",
"a": "1"
},
{
"q": "What is the worst access time complexity for a Stack?",
"a": "n"
},
{
"q": "What is the worst access time complexity for a Queue?",
"a": "n"
},
{
"q": "What is the worst access time complexity for a Singly-Linked List?",
"a": "n"
},
{
"q": "What is the worst access time complexity for a Double-Linked List?",
"a": "n"
},
{
"q": "What is the worst access time complexity for a Skip List?",
"a": "n"
},
{
"q": "What is the worst access time complexity for a Hash Table?",
"a": "n/a"
},
{
"q": "What is the worst access time complexity for a Binary Search Tree?",
"a": "n"
},
{
"q": "What is the worst access time complexity for a Cartesian Tree?",
"a": "n/a"
},
{
"q": "What is the worst access time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the worst access time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the worst access time complexity for a Splay Tree?",
"a": "n/a"
},
{
"q": "What is the worst access time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the worst access time complexity for a KD Tree?",
"a": "n"
}
]
},
{
"name": "Big-O Data Structure Search Time Complexities",
"cards": [
{
"q": "What is the average search time complexity for an Array?",
"a": "n"
},
{
"q": "What is the average search time complexity for a Stack?",
"a": "n"
},
{
"q": "What is the average search time complexity for a Queue?",
"a": "n"
},
{
"q": "What is the average search time complexity for a Singly-Linked List?",
"a": "n"
},
{
"q": "What is the average search time complexity for a Double-Linked List?",
"a": "n"
},
{
"q": "What is the average search time complexity for a Skip List?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a Hash Table?",
"a": "1"
},
{
"q": "What is the average search time complexity for a Binary Search Tree?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a Cartesian Tree?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a Splay Tree?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the average search time complexity for a KD Tree?",
"a": "log n"
},
{
"q": "What is the worst search time complexity for an Array?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Stack?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Queue?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Singly-Linked List?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Double-Linked List?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Skip List?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Hash Table?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Binary Search Tree?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a Cartesian Tree?",
"a": "n"
},
{
"q": "What is the worst search time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the worst search time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the worst search time complexity for a Splay Tree?",
"a": "log n"
},
{
"q": "What is the worst search time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the worst search time complexity for a KD Tree?",
"a": "n"
}
]
},
{
"name": "Big-O Data Structure Insertion Time Complexities",
"cards": [
{
"q": "What is the average insertion time complexity for an Array?",
"a": "n"
},
{
"q": "What is the average insertion time complexity for a Stack?",
"a": "1"
},
{
"q": "What is the average insertion time complexity for a Queue?",
"a": "1"
},
{
"q": "What is the average insertion time complexity for a Singly-Linked List?",
"a": "1"
},
{
"q": "What is the average insertion time complexity for a Double-Linked List?",
"a": "1"
},
{
"q": "What is the average insertion time complexity for a Skip List?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a Hash Table?",
"a": "1"
},
{
"q": "What is the average insertion time complexity for a Binary Search Tree?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a Cartesian Tree?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a Splay Tree?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the average insertion time complexity for a KD Tree?",
"a": "log n"
},
{
"q": "What is the worst insertion time complexity for an Array?",
"a": "n"
},
{
"q": "What is the worst insertion time complexity for a Stack?",
"a": "1"
},
{
"q": "What is the worst insertion time complexity for a Queue?",
"a": "1"
},
{
"q": "What is the worst insertion time complexity for a Singly-Linked List?",
"a": "1"
},
{
"q": "What is the worst insertion time complexity for a Double-Linked List?",
"a": "1"
},
{
"q": "What is the worst insertion time complexity for a Skip List?",
"a": "n"
},
{
"q": "What is the worst insertion time complexity for a Hash Table?",
"a": "n"
},
{
"q": "What is the worst insertion time complexity for a Binary Search Tree?",
"a": "n"
},
{
"q": "What is the worst insertion time complexity for a Cartesian Tree?",
"a": "n"
},
{
"q": "What is the worst insertion time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the worst insertion time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the worst insertion time complexity for a Splay Tree?",
"a": "log n"
},
{
"q": "What is the worst insertion time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the worst insertion time complexity for a KD Tree?",
"a": "n"
}
]
},
{
"name": "Big-O Data Structure Deletion Time Complexities",
"cards": [
{
"q": "What is the average deletion time complexity for an Array?",
"a": "n"
},
{
"q": "What is the average deletion time complexity for a Stack?",
"a": "1"
},
{
"q": "What is the average deletion time complexity for a Queue?",
"a": "1"
},
{
"q": "What is the average deletion time complexity for a Singly-Linked List?",
"a": "1"
},
{
"q": "What is the average deletion time complexity for a Double-Linked List?",
"a": "1"
},
{
"q": "What is the average deletion time complexity for a Skip List?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a Hash Table?",
"a": "1"
},
{
"q": "What is the average deletion time complexity for a Binary Search Tree?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a Cartesian Tree?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a Splay Tree?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the average deletion time complexity for a KD Tree?",
"a": "log n"
},
{
"q": "What is the worst deletion time complexity for an Array?",
"a": "n"
},
{
"q": "What is the worst deletion time complexity for a Stack?",
"a": "1"
},
{
"q": "What is the worst deletion time complexity for a Queue?",
"a": "1"
},
{
"q": "What is the worst deletion time complexity for a Singly-Linked List?",
"a": "1"
},
{
"q": "What is the worst deletion time complexity for a Double-Linked List?",
"a": "1"
},
{
"q": "What is the worst deletion time complexity for a Skip List?",
"a": "n"
},
{
"q": "What is the worst deletion time complexity for a Hash Table?",
"a": "n"
},
{
"q": "What is the worst deletion time complexity for a Binary Search Tree?",
"a": "n"
},
{
"q": "What is the worst deletion time complexity for a Cartesian Tree?",
"a": "n"
},
{
"q": "What is the worst deletion time complexity for a B-Tree?",
"a": "log n"
},
{
"q": "What is the worst deletion time complexity for a Red-Black Tree?",
"a": "log n"
},
{
"q": "What is the worst deletion time complexity for a Splay Tree?",
"a": "log n"
},
{
"q": "What is the worst deletion time complexity for a AVL Tree?",
"a": "log n"
},
{
"q": "What is the worst deletion time complexity for a KD Tree?",
"a": "n"
}
]
},
{
"name": "Big-O Data Structure Space Complexities",
"cards": [
{
"q": "What is the worst space complexity for an Array?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Stack?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Queue?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Singly-Linked List?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Double-Linked List?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Skip List?",
"a": "n log n"
},
{
"q": "What is the worst space complexity for a Hash Table?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Binary Search Tree?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Cartesian Tree?",
"a": "n"
},
{
"q": "What is the worst space complexity for a B-Tree?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Red-Black Tree?",
"a": "n"
},
{
"q": "What is the worst space complexity for a Splay Tree?",
"a": "n"
},
{
"q": "What is the worst space complexity for a AVL Tree?",
"a": "n"
},
{
"q": "What is the worst space complexity for a KD Tree?",
"a": "n"
}
]
},
{
"name": "Big-O Data Structures",
"cards": [
{
"q": "A data structure consisting of a collection of elements, each identified by at least one index. A 'blank' is stored such that the position of each element can be computed from its index tuple by a mathematical formula.",
"a": "Array"
},
{
"q": "A last in, first out, abstract data type that serves as a collection of elements.",
"a": "Stack"
},
{
"q": "A first in, first out, abstract data type that serves as a collection of elements.",
"a": "Queue"
},
{
"q": "A data structure containing nodes which have a 'value' field as well as 'next' field, which points to the next node in line of nodes.",
"a": "Singly-Linked List"
},
{
"q": "In a 'blank', each node contains, besides the next-node link, a second link field pointing to the previous node in the sequence.",
"a": "Double-Linked List"
},
{
"q": "A 'blank' is built in layers. The bottom layer, 1, is an ordinary ordered linked list. Each higher layer acts as an \"express lane\" for the lists below, where an element in layer i appears in layer i+1 with some fixed probability.",
"a": "Skip List"
},
{
"q": "A data structure that implements an associative array or dictionary. It is an abstract data type that maps keys to values. A hash table uses a hash function to compute an index, also called a hash code, into an array of buckets or slots, from which the desired value can be found. During lookup, the key is hashed and the resulting hash indicates where the corresponding value is stored.",
"a": "Hash Table"
},
{
"q": "A 'blank' is a rooted binary tree in which the nodes are arranged in total order in which the nodes with keys greater than any particular node is stored on the right sub-trees and the ones with equal to or less than are stored on the left sub-tree satisfying the 'blank' property",
"a": "Binary Search Tree"
},
{
"q": "A binary tree derived from a sequence of numbers; it can be uniquely defined from the properties that it is heap-ordered and that a symmetric (in-order) traversal of the tree returns the original sequence.",
"a": "Cartesian Tree"
},
{
"q": "A 'blank' of order m is a tree which satisfies the following properties:\n1. Every node has at most m children.\n2. Every internal node has at least m/2 children.\n3. Every non-leaf node has at least two children.\n4. All leaves appear on the same level.\n5. A non-leaf node with k children contains k−1 keys.",
"a": "B-Tree"
},
{
"q": "A kind of self-balancing binary search tree. Each node stores an extra bit representing \"color\", used to ensure that the tree remains balanced during insertions and deletions. When the tree is modified, the new tree is rearranged and \"repainted\" to restore the coloring properties that constrain how unbalanced the tree can become in the worst case. The properties are designed such that this rearranging and recoloring can be performed efficiently.",
"a": "Red-Black Tree"
},
{
"q": "A binary search tree with the additional property that recently accessed elements are quick to access again.",
"a": "Splay Tree"
},
{
"q": "The first self-balancing binary search tree to be invented. The heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property.",
"a": "AVL Tree"
},
{
"q": "The 'blank' is a binary tree in which every node is a multi-dimensional point. Every non-leaf node can be thought of as implicitly generating a splitting hyperplane that divides the space into two parts, known as half-spaces. Points to the left of this hyperplane are represented by the left subtree of that node and points to the right of the hyperplane are represented by the right subtree.",
"a": "KD Tree"
}
]
},
{
"name": "Big-O Sorting Algorithm Time Complexities",
"cards": [
{
"q": "What is the best time complexity for Quicksort?",
"a": "n log n"
},
{
"q": "What is the best time complexity for Mergesort?",
"a": "n log n"
},
{
"q": "What is the best time complexity for Timsort?",
"a": "n"
},
{
"q": "What is the best time complexity for Heapsort?",
"a": "n log n"
},
{
"q": "What is the best time complexity for Bubble Sort?",
"a": "n"
},
{
"q": "What is the best time complexity for Insertion Sort?",
"a": "n"
},
{
"q": "What is the best time complexity for Selection Sort?",
"a": "n squared"
},
{
"q": "What is the best time complexity for Tree Sort?",
"a": "n log n"
},
{
"q": "What is the best time complexity for Shell Sort?",
"a": "n log n"
},
{
"q": "What is the best time complexity for Bucket Sort?",
"a": "n + k"
},
{
"q": "What is the best time complexity for Radix Sort?",
"a": "n k"
},
{
"q": "What is the best time complexity for Counting Sort?",
"a": "n + k"
},
{
"q": "What is the best time complexity for Cubesort?",
"a": "n"
},
{
"q": "What is the average time complexity for Quicksort?",
"a": "n log n"
},
{
"q": "What is the average time complexity for Mergesort?",
"a": "n log n"
},
{
"q": "What is the average time complexity for Timsort?",
"a": "n log n"
},
{
"q": "What is the average time complexity for Heapsort?",
"a": "n log n"
},
{
"q": "What is the average time complexity for Bubble Sort?",
"a": "n squared"
},
{
"q": "What is the average time complexity for Insertion Sort?",
"a": "n squared"
},
{
"q": "What is the average time complexity for Selection Sort?",
"a": "n squared"
},
{
"q": "What is the average time complexity for Tree Sort?",
"a": " n log n"
},
{
"q": "What is the average time complexity for Shell Sort?",
"a": "n log n squared"
},
{
"q": "What is the average time complexity for Bucket Sort?",
"a": "n + k"
},
{
"q": "What is the average time complexity for Radix Sort?",
"a": "n k"
},
{
"q": "What is the average time complexity for Counting Sort?",
"a": "n + k"
},
{
"q": "What is the average time complexity for Cubesort?",
"a": "n log n"
},
{
"q": "What is the worst time complexity for Quicksort?",
"a": "n squared"
},
{
"q": "What is the worst time complexity for Mergesort?",
"a": "n log n"
},
{
"q": "What is the worst time complexity for Timsort?",
"a": "n log n"
},
{
"q": "What is the worst time complexity for Heapsort?",
"a": "n log n"
},
{
"q": "What is the worst time complexity for Bubble Sort?",
"a": "n squared"
},
{
"q": "What is the worst time complexity for Insertion Sort?",
"a": "n squared"
},
{
"q": "What is the worst time complexity for Selection Sort?",
"a": "n squared"
},
{
"q": "What is the worst time complexity for Tree Sort?",
"a": "n squared"
},
{
"q": "What is the worst time complexity for Shell Sort?",
"a": "n log n squared"
},
{
"q": "What is the worst time complexity for Bucket Sort?",
"a": "n squared"
},
{
"q": "What is the worst time complexity for Radix Sort?",
"a": "n k"
},
{
"q": "What is the worst time complexity for Counting Sort?",
"a": "n + k"
},
{
"q": "What is the worst time complexity for Cubesort?",
"a": "n log n"
}
]
},
{
"name": "Big-O Sorting Algorithm Space Complexities",
"cards": [
{
"q": "What is the worst space complexity for Quicksort?",
"a": "log n"
},
{
"q": "What is the worst space complexity for Mergesort?",
"a": "n"
},
{
"q": "What is the worst space complexity for Timsort?",
"a": "n"
},
{
"q": "What is the worst space complexity for Heapsort?",
"a": "1"
},
{
"q": "What is the worst space complexity for Bubble Sort?",
"a": "1"
},
{
"q": "What is the worst space complexity for Insertion Sort?",
"a": "1"
},
{
"q": "What is the worst space complexity for Selection Sort?",
"a": "1"
},
{
"q": "What is the worst space complexity for Tree Sort?",
"a": "n"
},
{
"q": "What is the worst space complexity for Shell Sort?",
"a": "1"
},
{
"q": "What is the worst space complexity for Bucket Sort?",
"a": "n"
},
{
"q": "What is the worst space complexity for Radix Sort?",
"a": "n + k"
},
{
"q": "What is the worst space complexity for Counting Sort?",
"a": "k"
},
{
"q": "What is the worst space complexity for Cubesort?",
"a": "n"
}
]
},
{
"name": "Big-O Sorting Algorithms",
"cards": [
{
"q": "Slightly faster than merge sort and heapsort for randomized data, particularly on larger distributions. 'Blank' is a divide-and-conquer algorithm. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. For this reason, it is sometimes called partition-exchange sort. The sub-arrays are then sorted recursively. This can be done in-place, requiring small additional amounts of memory to perform the sorting.",
"a": "Quicksort"
},
{
"q": "'Blank' works as follows:\n1. Divide the unsorted list into n sublists, each containing one element (a list of one element is considered sorted).\n2. Repeatedly concatenate sublists to produce new sorted sublists until there is only one sublist remaining. This will be the sorted list.",
"a": "Mergesort"
},
{
"q": "Derived from merge sort and insertion sort, designed to perform well on many kinds of real-world data.",
"a": "Timsort"
},
{
"q": "An improved selection sort: divides its input into a sorted and an unsorted region, and it iteratively shrinks the unsorted region by extracting the largest element from it and inserting it into the sorted region. Unlike selection sort, does not waste time with a linear-time scan of the unsorted region; rather, heap sort maintains the unsorted region in a 'blank' data structure to more quickly find the largest element in each step.",
"a": "Heapsort"
},
{
"q": "A simple sorting algorithm that repeatedly steps through the input list element by element, comparing the current element with the one after it, swapping their values if needed. These passes through the list are repeated until no swaps had to be performed during a pass.",
"a": "Bubble Sort"
},
{
"q": "A simple sorting algorithm that builds the final sorted list one item at a time by comparisons.",
"a": "Insertion Sort"
},
{
"q": "An in-place comparison sorting algorithm. Inefficient on large lists, and generally performs worse than the similar insertion sort. 'Blank' is noted for its simplicity and has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited.",
"a": "Selection Sort"
},
{
"q": "A sort algorithm that builds a binary search tree from the elements to be sorted, and then traverses the tree (in-order) so that the elements come out in sorted order.",
"a": "Tree Sort"
},
{
"q": "An in-place comparison sort. It can be seen as either a generalization of sorting by exchange (bubble sort) or sorting by insertion (insertion sort). The method starts by sorting pairs of elements far apart from each other, then progressively reducing the gap between elements to be compared. By starting with far apart elements, it can move some out-of-place elements into position faster than a simple nearest neighbor exchange.",
"a": "Shell Sort"
},
{
"q": "A sorting algorithm that works by distributing the elements of an array into a number of 'blank'. Each 'blank' is then sorted individually, either using a different sorting algorithm, or by recursively applying the 'blank' sorting algorithm.",
"a": "Bucket Sort"
},
{
"q": "A non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their 'blank'. For elements with more than one significant digit, this bucketing process is repeated for each digit, while preserving the ordering of the prior step, until all digits have been considered.",
"a": "Radix Sort"
},
{
"q": "An integer sorting algorithm. It operates by counting the number of objects that possess distinct key values, and applying prefix sum on those counts to determine the positions of each key value in the output sequence.",
"a": "Counting Sort"
},
{
"q": "A parallel sorting algorithm that builds a self-balancing multi-dimensional array from the keys to be sorted. After each key is inserted it can be rapidly converted to an array.",
"a": "Cubesort"
}
]
}
];
if (typeof localStorage.getItem('decks') === 'string') {
d = JSON.parse(localStorage.getItem('decks')).decks; // overwrite default decks with saved decks