max-priority-queue-typed 2.5.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +174 -16
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +174 -16
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +174 -16
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +174 -16
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +191 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1061 -167
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1232 -355
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +916 -194
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1078 -141
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +150 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +171 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/max-priority-queue-typed.js +174 -16
- package/dist/umd/max-priority-queue-typed.js.map +1 -1
- package/dist/umd/max-priority-queue-typed.min.js +1 -1
- package/dist/umd/max-priority-queue-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +88 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +98 -0
- package/src/data-structures/binary-tree/binary-tree.ts +242 -81
- package/src/data-structures/binary-tree/bst.ts +173 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +139 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +948 -36
- package/src/data-structures/binary-tree/tree-multi-map.ts +893 -13
- package/src/data-structures/binary-tree/tree-multi-set.ts +761 -33
- package/src/data-structures/binary-tree/tree-set.ts +1260 -251
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +100 -12
- package/src/data-structures/heap/heap.ts +149 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +178 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +126 -0
- package/src/data-structures/matrix/matrix.ts +56 -0
- package/src/data-structures/queue/deque.ts +187 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +84 -0
- package/src/interfaces/binary-tree.ts +1 -9
|
@@ -57,7 +57,7 @@ export class SinglyLinkedListNode<E = any> extends LinkedListNode<E> {
|
|
|
57
57
|
* @remarks Time O(1), Space O(1)
|
|
58
58
|
* @template E
|
|
59
59
|
* @template R
|
|
60
|
-
* 1. Node Structure: Each node contains
|
|
60
|
+
* 1. Node Structure: Each node contains two parts: a data field and a pointer (or reference) to the next node. This structure allows forward-only traversal of the linked list.
|
|
61
61
|
* 2. Bidirectional Traversal: Unlike doubly linked lists, singly linked lists can be easily traversed forwards but not backwards.
|
|
62
62
|
* 3. No Centralized Index: Unlike arrays, elements in a linked list are not stored contiguously, so there is no centralized index. Accessing elements in a linked list typically requires traversing from the head or tail node.
|
|
63
63
|
* 4. High Efficiency in Insertion and Deletion: Adding or removing elements in a linked list does not require moving other elements, making these operations more efficient than in arrays.
|
|
@@ -323,6 +323,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
323
323
|
|
|
324
324
|
|
|
325
325
|
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
326
333
|
|
|
327
334
|
|
|
328
335
|
|
|
@@ -392,6 +399,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
392
399
|
|
|
393
400
|
|
|
394
401
|
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
395
409
|
|
|
396
410
|
|
|
397
411
|
|
|
@@ -466,6 +480,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
466
480
|
|
|
467
481
|
|
|
468
482
|
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
469
490
|
|
|
470
491
|
|
|
471
492
|
|
|
@@ -522,6 +543,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
522
543
|
|
|
523
544
|
|
|
524
545
|
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
525
553
|
|
|
526
554
|
|
|
527
555
|
|
|
@@ -647,6 +675,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
647
675
|
|
|
648
676
|
|
|
649
677
|
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
650
685
|
|
|
651
686
|
|
|
652
687
|
|
|
@@ -712,6 +747,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
712
747
|
|
|
713
748
|
|
|
714
749
|
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
715
757
|
|
|
716
758
|
|
|
717
759
|
|
|
@@ -762,6 +804,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
762
804
|
|
|
763
805
|
|
|
764
806
|
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
765
814
|
|
|
766
815
|
|
|
767
816
|
|
|
@@ -818,6 +867,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
818
867
|
|
|
819
868
|
|
|
820
869
|
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
821
877
|
|
|
822
878
|
|
|
823
879
|
|
|
@@ -880,6 +936,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
880
936
|
|
|
881
937
|
|
|
882
938
|
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
883
946
|
|
|
884
947
|
|
|
885
948
|
|
|
@@ -951,6 +1014,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
951
1014
|
|
|
952
1015
|
|
|
953
1016
|
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
954
1024
|
|
|
955
1025
|
|
|
956
1026
|
|
|
@@ -997,6 +1067,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
997
1067
|
|
|
998
1068
|
|
|
999
1069
|
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1000
1077
|
|
|
1001
1078
|
|
|
1002
1079
|
|
|
@@ -1049,6 +1126,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
1049
1126
|
|
|
1050
1127
|
|
|
1051
1128
|
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
|
|
1052
1136
|
|
|
1053
1137
|
|
|
1054
1138
|
|
|
@@ -1295,6 +1379,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
1295
1379
|
|
|
1296
1380
|
|
|
1297
1381
|
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
|
|
1388
|
+
|
|
1298
1389
|
|
|
1299
1390
|
|
|
1300
1391
|
|
|
@@ -1351,6 +1442,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
1351
1442
|
|
|
1352
1443
|
|
|
1353
1444
|
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1354
1452
|
|
|
1355
1453
|
|
|
1356
1454
|
|
|
@@ -1437,6 +1535,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
|
|
|
1437
1535
|
|
|
1438
1536
|
|
|
1439
1537
|
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
|
|
1440
1545
|
|
|
1441
1546
|
|
|
1442
1547
|
|
|
@@ -161,6 +161,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
164
171
|
|
|
165
172
|
|
|
166
173
|
|
|
@@ -204,6 +211,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
204
211
|
|
|
205
212
|
|
|
206
213
|
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
207
221
|
|
|
208
222
|
|
|
209
223
|
|
|
@@ -250,6 +264,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
250
264
|
|
|
251
265
|
|
|
252
266
|
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
253
274
|
|
|
254
275
|
|
|
255
276
|
|
|
@@ -305,6 +326,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
305
326
|
|
|
306
327
|
|
|
307
328
|
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
308
336
|
|
|
309
337
|
|
|
310
338
|
|
|
@@ -390,6 +418,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
390
418
|
|
|
391
419
|
|
|
392
420
|
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
393
428
|
|
|
394
429
|
|
|
395
430
|
|
|
@@ -454,6 +489,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
454
489
|
|
|
455
490
|
|
|
456
491
|
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
457
499
|
|
|
458
500
|
|
|
459
501
|
|
|
@@ -501,6 +543,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
501
543
|
|
|
502
544
|
|
|
503
545
|
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
504
553
|
|
|
505
554
|
|
|
506
555
|
|
|
@@ -573,6 +622,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
573
622
|
|
|
574
623
|
|
|
575
624
|
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
576
632
|
|
|
577
633
|
|
|
578
634
|
|
|
@@ -620,6 +676,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
620
676
|
|
|
621
677
|
|
|
622
678
|
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
623
686
|
|
|
624
687
|
|
|
625
688
|
|
|
@@ -669,6 +732,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
669
732
|
|
|
670
733
|
|
|
671
734
|
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
672
742
|
|
|
673
743
|
|
|
674
744
|
|
|
@@ -716,6 +786,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
716
786
|
|
|
717
787
|
|
|
718
788
|
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
719
796
|
|
|
720
797
|
|
|
721
798
|
|
|
@@ -766,6 +843,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
766
843
|
|
|
767
844
|
|
|
768
845
|
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
769
853
|
|
|
770
854
|
|
|
771
855
|
|
|
@@ -821,6 +905,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
821
905
|
|
|
822
906
|
|
|
823
907
|
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
824
915
|
|
|
825
916
|
|
|
826
917
|
|
|
@@ -876,6 +967,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
876
967
|
|
|
877
968
|
|
|
878
969
|
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
879
977
|
|
|
880
978
|
|
|
881
979
|
|
|
@@ -928,6 +1026,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
928
1026
|
|
|
929
1027
|
|
|
930
1028
|
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
931
1036
|
|
|
932
1037
|
|
|
933
1038
|
|
|
@@ -986,6 +1091,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
986
1091
|
|
|
987
1092
|
|
|
988
1093
|
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
989
1101
|
|
|
990
1102
|
|
|
991
1103
|
|
|
@@ -1059,6 +1171,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
1059
1171
|
|
|
1060
1172
|
|
|
1061
1173
|
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
|
|
1062
1181
|
|
|
1063
1182
|
|
|
1064
1183
|
|
|
@@ -1112,6 +1231,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
|
|
|
1112
1231
|
|
|
1113
1232
|
|
|
1114
1233
|
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1115
1241
|
|
|
1116
1242
|
|
|
1117
1243
|
|
|
@@ -216,6 +216,13 @@ export class Matrix {
|
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
219
226
|
|
|
220
227
|
|
|
221
228
|
|
|
@@ -285,6 +292,13 @@ export class Matrix {
|
|
|
285
292
|
|
|
286
293
|
|
|
287
294
|
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
288
302
|
|
|
289
303
|
|
|
290
304
|
|
|
@@ -351,6 +365,13 @@ export class Matrix {
|
|
|
351
365
|
|
|
352
366
|
|
|
353
367
|
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
354
375
|
|
|
355
376
|
|
|
356
377
|
|
|
@@ -441,6 +462,13 @@ export class Matrix {
|
|
|
441
462
|
|
|
442
463
|
|
|
443
464
|
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
444
472
|
|
|
445
473
|
|
|
446
474
|
|
|
@@ -514,6 +542,13 @@ export class Matrix {
|
|
|
514
542
|
|
|
515
543
|
|
|
516
544
|
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
517
552
|
|
|
518
553
|
|
|
519
554
|
|
|
@@ -609,6 +644,13 @@ export class Matrix {
|
|
|
609
644
|
|
|
610
645
|
|
|
611
646
|
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
612
654
|
|
|
613
655
|
|
|
614
656
|
|
|
@@ -691,6 +733,13 @@ export class Matrix {
|
|
|
691
733
|
|
|
692
734
|
|
|
693
735
|
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
694
743
|
|
|
695
744
|
|
|
696
745
|
|
|
@@ -817,6 +866,13 @@ export class Matrix {
|
|
|
817
866
|
|
|
818
867
|
|
|
819
868
|
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
820
876
|
|
|
821
877
|
|
|
822
878
|
|