tree-multimap-typed 2.5.3 → 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.
Files changed (53) hide show
  1. package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
  2. package/dist/types/data-structures/base/linear-base.d.ts +6 -0
  3. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
  4. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
  5. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
  6. package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
  7. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
  8. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
  9. package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
  10. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
  11. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
  12. package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
  13. package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
  14. package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
  15. package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
  16. package/dist/types/data-structures/heap/heap.d.ts +42 -0
  17. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
  18. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
  19. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
  20. package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
  21. package/dist/types/data-structures/queue/deque.d.ts +90 -1
  22. package/dist/types/data-structures/queue/queue.d.ts +36 -0
  23. package/dist/types/data-structures/stack/stack.d.ts +30 -0
  24. package/dist/types/data-structures/trie/trie.d.ts +36 -0
  25. package/dist/umd/tree-multimap-typed.js +2383 -3
  26. package/dist/umd/tree-multimap-typed.js.map +1 -1
  27. package/dist/umd/tree-multimap-typed.min.js +4 -4
  28. package/dist/umd/tree-multimap-typed.min.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/data-structures/base/iterable-element-base.ts +32 -0
  31. package/src/data-structures/base/linear-base.ts +11 -0
  32. package/src/data-structures/binary-tree/avl-tree.ts +36 -0
  33. package/src/data-structures/binary-tree/binary-indexed-tree.ts +42 -0
  34. package/src/data-structures/binary-tree/binary-tree.ts +75 -0
  35. package/src/data-structures/binary-tree/bst.ts +72 -0
  36. package/src/data-structures/binary-tree/red-black-tree.ts +57 -0
  37. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  38. package/src/data-structures/binary-tree/tree-map.ts +375 -0
  39. package/src/data-structures/binary-tree/tree-multi-map.ts +392 -0
  40. package/src/data-structures/binary-tree/tree-multi-set.ts +336 -0
  41. package/src/data-structures/binary-tree/tree-set.ts +492 -0
  42. package/src/data-structures/graph/directed-graph.ts +30 -0
  43. package/src/data-structures/graph/undirected-graph.ts +27 -0
  44. package/src/data-structures/hash/hash-map.ts +33 -0
  45. package/src/data-structures/heap/heap.ts +42 -0
  46. package/src/data-structures/linked-list/doubly-linked-list.ts +90 -2
  47. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  48. package/src/data-structures/linked-list/skip-linked-list.ts +54 -0
  49. package/src/data-structures/matrix/matrix.ts +24 -0
  50. package/src/data-structures/queue/deque.ts +103 -1
  51. package/src/data-structures/queue/queue.ts +36 -0
  52. package/src/data-structures/stack/stack.ts +30 -0
  53. package/src/data-structures/trie/trie.ts +36 -0
@@ -118,6 +118,23 @@ export declare abstract class IterableElementBase<E, R> implements Iterable<E> {
118
118
  * Time O(n) in the worst case. Space O(1).
119
119
  */
120
120
  has(element: E): boolean;
121
+ /**
122
+ * Check whether a value exists (Array-compatible alias for `has`).
123
+ * @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1).
124
+ * @param element - Element to search for (uses `===`).
125
+ * @returns `true` if found.
126
+ */
127
+ includes(element: E): boolean;
128
+ /**
129
+ * Return an iterator of `[index, value]` pairs (Array-compatible).
130
+ * @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
131
+ */
132
+ entries(): IterableIterator<[number, E]>;
133
+ /**
134
+ * Return an iterator of numeric indices (Array-compatible).
135
+ * @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
136
+ */
137
+ keys(): IterableIterator<number>;
121
138
  reduce(callbackfn: ReduceElementCallback<E, R>): E;
122
139
  reduce(callbackfn: ReduceElementCallback<E, R>, initialValue: E): E;
123
140
  reduce<U>(callbackfn: ReduceElementCallback<E, R, U>, initialValue: U): U;
@@ -173,6 +173,12 @@ export declare abstract class LinearBase<E, R = any, NODE extends LinkedListNode
173
173
  * @remarks Time O(n), Space O(1)
174
174
  */
175
175
  abstract reverse(): this;
176
+ /**
177
+ * Return a new instance of the same type with elements in reverse order (non-mutating).
178
+ * @remarks Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O(n), Space O(n).
179
+ * @returns A new reversed instance.
180
+ */
181
+ toReversed(): this;
176
182
  /**
177
183
  * Append one element or node to the tail.
178
184
  * @param elementOrNode - Element or node.
@@ -402,6 +402,18 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
402
402
 
403
403
 
404
404
 
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
405
417
 
406
418
 
407
419
 
@@ -536,6 +548,15 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
536
548
 
537
549
 
538
550
 
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
539
560
 
540
561
 
541
562
 
@@ -622,6 +643,12 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
622
643
 
623
644
 
624
645
 
646
+
647
+
648
+
649
+
650
+
651
+
625
652
 
626
653
 
627
654
 
@@ -746,6 +773,15 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
746
773
 
747
774
 
748
775
 
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
749
785
 
750
786
 
751
787
 
@@ -92,6 +92,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
92
92
 
93
93
 
94
94
 
95
+
96
+
97
+
98
+
99
+
100
+
95
101
 
96
102
 
97
103
 
@@ -173,6 +179,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
173
179
 
174
180
 
175
181
 
182
+
183
+
184
+
185
+
186
+
187
+
176
188
 
177
189
 
178
190
 
@@ -253,6 +265,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
253
265
 
254
266
 
255
267
 
268
+
269
+
270
+
271
+
272
+
273
+
256
274
 
257
275
 
258
276
 
@@ -334,6 +352,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
334
352
 
335
353
 
336
354
 
355
+
356
+
357
+
358
+
359
+
360
+
337
361
 
338
362
 
339
363
 
@@ -413,6 +437,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
413
437
 
414
438
 
415
439
 
440
+
441
+
442
+
443
+
444
+
445
+
416
446
 
417
447
 
418
448
 
@@ -495,6 +525,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
495
525
 
496
526
 
497
527
 
528
+
529
+
530
+
531
+
532
+
533
+
498
534
 
499
535
 
500
536
 
@@ -540,6 +576,9 @@ export declare class BinaryIndexedTree implements Iterable<number> {
540
576
 
541
577
 
542
578
 
579
+
580
+
581
+
543
582
 
544
583
 
545
584
 
@@ -584,6 +623,9 @@ export declare class BinaryIndexedTree implements Iterable<number> {
584
623
 
585
624
 
586
625
 
626
+
627
+
628
+
587
629
 
588
630
 
589
631
 
@@ -387,6 +387,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
387
387
 
388
388
 
389
389
 
390
+
391
+
392
+
390
393
 
391
394
 
392
395
 
@@ -443,6 +446,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
443
446
 
444
447
 
445
448
 
449
+
450
+
451
+
446
452
 
447
453
 
448
454
 
@@ -511,6 +517,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
511
517
 
512
518
 
513
519
 
520
+
521
+
522
+
514
523
 
515
524
 
516
525
 
@@ -555,6 +564,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
555
564
 
556
565
 
557
566
 
567
+
568
+
569
+
558
570
 
559
571
 
560
572
 
@@ -604,6 +616,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
604
616
 
605
617
 
606
618
 
619
+
620
+
621
+
607
622
 
608
623
 
609
624
 
@@ -666,6 +681,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
666
681
 
667
682
 
668
683
 
684
+
685
+
686
+
669
687
 
670
688
 
671
689
 
@@ -706,6 +724,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
706
724
 
707
725
 
708
726
 
727
+
728
+
729
+
709
730
 
710
731
 
711
732
 
@@ -759,6 +780,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
759
780
 
760
781
 
761
782
 
783
+
784
+
785
+
762
786
 
763
787
 
764
788
 
@@ -811,6 +835,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
811
835
 
812
836
 
813
837
 
838
+
839
+
840
+
814
841
 
815
842
 
816
843
 
@@ -864,6 +891,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
864
891
 
865
892
 
866
893
 
894
+
895
+
896
+
867
897
 
868
898
 
869
899
 
@@ -918,6 +948,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
918
948
 
919
949
 
920
950
 
951
+
952
+
953
+
921
954
 
922
955
 
923
956
 
@@ -988,6 +1021,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
988
1021
 
989
1022
 
990
1023
 
1024
+
1025
+
1026
+
991
1027
 
992
1028
 
993
1029
 
@@ -1037,6 +1073,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1037
1073
 
1038
1074
 
1039
1075
 
1076
+
1077
+
1078
+
1040
1079
 
1041
1080
 
1042
1081
 
@@ -1094,6 +1133,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1094
1133
 
1095
1134
 
1096
1135
 
1136
+
1137
+
1138
+
1097
1139
 
1098
1140
 
1099
1141
 
@@ -1147,6 +1189,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1147
1189
 
1148
1190
 
1149
1191
 
1192
+
1193
+
1194
+
1150
1195
 
1151
1196
 
1152
1197
 
@@ -1200,6 +1245,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1200
1245
 
1201
1246
 
1202
1247
 
1248
+
1249
+
1250
+
1203
1251
 
1204
1252
 
1205
1253
 
@@ -1278,6 +1326,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1278
1326
 
1279
1327
 
1280
1328
 
1329
+
1330
+
1331
+
1281
1332
 
1282
1333
 
1283
1334
 
@@ -1328,6 +1379,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1328
1379
 
1329
1380
 
1330
1381
 
1382
+
1383
+
1384
+
1331
1385
 
1332
1386
 
1333
1387
 
@@ -1398,6 +1452,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1398
1452
 
1399
1453
 
1400
1454
 
1455
+
1456
+
1457
+
1401
1458
 
1402
1459
 
1403
1460
 
@@ -1444,6 +1501,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1444
1501
 
1445
1502
 
1446
1503
 
1504
+
1505
+
1506
+
1447
1507
 
1448
1508
 
1449
1509
 
@@ -1492,6 +1552,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1492
1552
 
1493
1553
 
1494
1554
 
1555
+
1556
+
1557
+
1495
1558
 
1496
1559
 
1497
1560
 
@@ -1542,6 +1605,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1542
1605
 
1543
1606
 
1544
1607
 
1608
+
1609
+
1610
+
1545
1611
 
1546
1612
 
1547
1613
 
@@ -1594,6 +1660,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1594
1660
 
1595
1661
 
1596
1662
 
1663
+
1664
+
1665
+
1597
1666
 
1598
1667
 
1599
1668
 
@@ -1649,6 +1718,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1649
1718
 
1650
1719
 
1651
1720
 
1721
+
1722
+
1723
+
1652
1724
 
1653
1725
 
1654
1726
 
@@ -1708,6 +1780,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1708
1780
 
1709
1781
 
1710
1782
 
1783
+
1784
+
1785
+
1711
1786
 
1712
1787
 
1713
1788
 
@@ -382,6 +382,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
382
382
 
383
383
 
384
384
 
385
+
386
+
387
+
388
+
389
+
390
+
385
391
 
386
392
 
387
393
 
@@ -462,6 +468,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
462
468
 
463
469
 
464
470
 
471
+
472
+
473
+
474
+
475
+
476
+
465
477
 
466
478
 
467
479
 
@@ -545,6 +557,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
545
557
 
546
558
 
547
559
 
560
+
561
+
562
+
563
+
564
+
565
+
548
566
 
549
567
 
550
568
 
@@ -639,6 +657,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
639
657
 
640
658
 
641
659
 
660
+
661
+
662
+
663
+
664
+
665
+
642
666
 
643
667
 
644
668
 
@@ -717,6 +741,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
717
741
 
718
742
 
719
743
 
744
+
745
+
746
+
747
+
748
+
749
+
720
750
 
721
751
 
722
752
 
@@ -769,6 +799,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
769
799
 
770
800
 
771
801
 
802
+
803
+
804
+
772
805
 
773
806
 
774
807
 
@@ -949,6 +982,15 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
949
982
 
950
983
 
951
984
 
985
+
986
+
987
+
988
+
989
+
990
+
991
+
992
+
993
+
952
994
 
953
995
 
954
996
 
@@ -1038,6 +1080,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1038
1080
 
1039
1081
 
1040
1082
 
1083
+
1084
+
1085
+
1086
+
1087
+
1088
+
1041
1089
 
1042
1090
 
1043
1091
 
@@ -1093,6 +1141,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1093
1141
 
1094
1142
 
1095
1143
 
1144
+
1145
+
1146
+
1096
1147
 
1097
1148
 
1098
1149
 
@@ -1151,6 +1202,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1151
1202
 
1152
1203
 
1153
1204
 
1205
+
1206
+
1207
+
1154
1208
 
1155
1209
 
1156
1210
 
@@ -1208,6 +1262,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1208
1262
 
1209
1263
 
1210
1264
 
1265
+
1266
+
1267
+
1211
1268
 
1212
1269
 
1213
1270
 
@@ -1266,6 +1323,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1266
1323
 
1267
1324
 
1268
1325
 
1326
+
1327
+
1328
+
1269
1329
 
1270
1330
 
1271
1331
 
@@ -1324,6 +1384,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1324
1384
 
1325
1385
 
1326
1386
 
1387
+
1388
+
1389
+
1327
1390
 
1328
1391
 
1329
1392
 
@@ -1377,6 +1440,9 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1377
1440
 
1378
1441
 
1379
1442
 
1443
+
1444
+
1445
+
1380
1446
 
1381
1447
 
1382
1448
 
@@ -1467,6 +1533,12 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
1467
1533
 
1468
1534
 
1469
1535
 
1536
+
1537
+
1538
+
1539
+
1540
+
1541
+
1470
1542
 
1471
1543
 
1472
1544
 
@@ -353,6 +353,18 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
353
353
 
354
354
 
355
355
 
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
356
368
 
357
369
 
358
370
 
@@ -607,6 +619,18 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
607
619
 
608
620
 
609
621
 
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
610
634
 
611
635
 
612
636
 
@@ -781,6 +805,18 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
781
805
 
782
806
 
783
807
 
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
784
820
 
785
821
 
786
822
 
@@ -916,6 +952,15 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
916
952
 
917
953
 
918
954
 
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
919
964
 
920
965
 
921
966
 
@@ -1069,6 +1114,18 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
1069
1114
 
1070
1115
 
1071
1116
 
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+
1072
1129
 
1073
1130
 
1074
1131