tree-multimap-typed 2.5.1 → 2.5.2

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 (65) hide show
  1. package/dist/types/common/error.d.ts +9 -0
  2. package/dist/types/common/index.d.ts +1 -1
  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 +77 -2
  6. package/dist/types/data-structures/binary-tree/bst.d.ts +171 -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 +409 -0
  10. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +411 -6
  11. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +339 -6
  12. package/dist/types/data-structures/binary-tree/tree-set.d.ts +391 -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 +51 -0
  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 +45 -0
  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/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  26. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  27. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  28. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  29. package/dist/umd/tree-multimap-typed.js +3372 -233
  30. package/dist/umd/tree-multimap-typed.js.map +1 -1
  31. package/dist/umd/tree-multimap-typed.min.js +5 -5
  32. package/dist/umd/tree-multimap-typed.min.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/common/error.ts +19 -1
  35. package/src/common/index.ts +1 -1
  36. package/src/data-structures/base/iterable-element-base.ts +3 -2
  37. package/src/data-structures/binary-tree/avl-tree.ts +47 -0
  38. package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
  39. package/src/data-structures/binary-tree/binary-tree.ts +79 -4
  40. package/src/data-structures/binary-tree/bst.ts +441 -6
  41. package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
  42. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  43. package/src/data-structures/binary-tree/tree-map.ts +434 -9
  44. package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
  45. package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
  46. package/src/data-structures/binary-tree/tree-set.ts +410 -8
  47. package/src/data-structures/graph/abstract-graph.ts +2 -2
  48. package/src/data-structures/graph/directed-graph.ts +30 -0
  49. package/src/data-structures/graph/undirected-graph.ts +27 -0
  50. package/src/data-structures/hash/hash-map.ts +35 -4
  51. package/src/data-structures/heap/heap.ts +46 -4
  52. package/src/data-structures/heap/max-heap.ts +2 -2
  53. package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
  54. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  55. package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
  56. package/src/data-structures/matrix/matrix.ts +33 -9
  57. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  58. package/src/data-structures/queue/deque.ts +45 -0
  59. package/src/data-structures/queue/queue.ts +36 -0
  60. package/src/data-structures/stack/stack.ts +30 -0
  61. package/src/data-structures/trie/trie.ts +38 -2
  62. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  63. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  64. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  65. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Centralized error dispatch.
3
+ * All library errors go through this function for consistent messaging and easy grep.
4
+ * @remarks Always throws — data structure errors are never recoverable.
5
+ * @param ErrorClass - The error constructor (Error, TypeError, RangeError, etc.)
6
+ * @param message - The error message.
7
+ */
8
+ export declare function raise(ErrorClass: new (msg: string) => Error, message: string): never;
1
9
  /**
2
10
  * Centralized error message templates.
3
11
  * Keep using native Error/TypeError/RangeError — this only standardizes messages.
@@ -20,4 +28,5 @@ export declare const ERR: {
20
28
  readonly matrixNotSquare: () => string;
21
29
  readonly matrixNotRectangular: () => string;
22
30
  readonly matrixRowMismatch: (expected: number, got: number) => string;
31
+ readonly orderStatisticNotEnabled: (method: string, ctx?: string) => string;
23
32
  };
@@ -1,4 +1,4 @@
1
- export { ERR } from './error';
1
+ export { ERR, raise } from './error';
2
2
  export declare enum DFSOperation {
3
3
  VISIT = 0,
4
4
  PROCESS = 1
@@ -374,6 +374,18 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
374
374
 
375
375
 
376
376
 
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
377
389
 
378
390
 
379
391
 
@@ -487,6 +499,15 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
487
499
 
488
500
 
489
501
 
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
490
511
 
491
512
 
492
513
 
@@ -559,6 +580,12 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
559
580
 
560
581
 
561
582
 
583
+
584
+
585
+
586
+
587
+
588
+
562
589
 
563
590
 
564
591
 
@@ -662,6 +689,15 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
662
689
 
663
690
 
664
691
 
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
665
701
 
666
702
 
667
703
 
@@ -78,6 +78,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
78
78
 
79
79
 
80
80
 
81
+
82
+
83
+
84
+
85
+
86
+
81
87
 
82
88
 
83
89
 
@@ -145,6 +151,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
145
151
 
146
152
 
147
153
 
154
+
155
+
156
+
157
+
158
+
159
+
148
160
 
149
161
 
150
162
 
@@ -211,6 +223,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
211
223
 
212
224
 
213
225
 
226
+
227
+
228
+
229
+
230
+
231
+
214
232
 
215
233
 
216
234
 
@@ -278,6 +296,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
278
296
 
279
297
 
280
298
 
299
+
300
+
301
+
302
+
303
+
304
+
281
305
 
282
306
 
283
307
 
@@ -343,6 +367,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
343
367
 
344
368
 
345
369
 
370
+
371
+
372
+
373
+
374
+
375
+
346
376
 
347
377
 
348
378
 
@@ -411,6 +441,12 @@ export declare class BinaryIndexedTree implements Iterable<number> {
411
441
 
412
442
 
413
443
 
444
+
445
+
446
+
447
+
448
+
449
+
414
450
 
415
451
 
416
452
 
@@ -449,6 +485,9 @@ export declare class BinaryIndexedTree implements Iterable<number> {
449
485
 
450
486
 
451
487
 
488
+
489
+
490
+
452
491
 
453
492
 
454
493
 
@@ -486,6 +525,9 @@ export declare class BinaryIndexedTree implements Iterable<number> {
486
525
 
487
526
 
488
527
 
528
+
529
+
530
+
489
531
 
490
532
 
491
533
 
@@ -136,7 +136,7 @@ export declare class BinaryTreeNode<K = any, V = any> {
136
136
  * node?: BinaryTreeNode<string> | null,
137
137
  * conditions?: { [key: string]: boolean }
138
138
  * ): string {
139
- * if (!node) throw new Error('Invalid node');
139
+ * if (!node) raise(Error, 'Invalid node');
140
140
  *
141
141
  * // If it's a leaf node, return the decision result
142
142
  * if (!node.left && !node.right) return node.key;
@@ -181,7 +181,7 @@ export declare class BinaryTreeNode<K = any, V = any> {
181
181
  * case '/':
182
182
  * return rightValue !== 0 ? leftValue / rightValue : 0; // Handle division by zero
183
183
  * default:
184
- * throw new Error(`Unsupported operator: ${node.key}`);
184
+ * raise(Error, `Unsupported operator: ${node.key}`);
185
185
  * }
186
186
  * }
187
187
  *
@@ -380,6 +380,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
380
380
 
381
381
 
382
382
 
383
+
384
+
385
+
383
386
 
384
387
 
385
388
 
@@ -429,6 +432,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
429
432
 
430
433
 
431
434
 
435
+
436
+
437
+
432
438
 
433
439
 
434
440
 
@@ -490,6 +496,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
490
496
 
491
497
 
492
498
 
499
+
500
+
501
+
493
502
 
494
503
 
495
504
 
@@ -527,6 +536,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
527
536
 
528
537
 
529
538
 
539
+
540
+
541
+
530
542
 
531
543
 
532
544
 
@@ -569,6 +581,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
569
581
 
570
582
 
571
583
 
584
+
585
+
586
+
572
587
 
573
588
 
574
589
 
@@ -623,6 +638,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
623
638
 
624
639
 
625
640
 
641
+
642
+
643
+
626
644
 
627
645
 
628
646
 
@@ -656,6 +674,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
656
674
 
657
675
 
658
676
 
677
+
678
+
679
+
659
680
 
660
681
 
661
682
 
@@ -702,6 +723,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
702
723
 
703
724
 
704
725
 
726
+
727
+
728
+
705
729
 
706
730
 
707
731
 
@@ -747,6 +771,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
747
771
 
748
772
 
749
773
 
774
+
775
+
776
+
750
777
 
751
778
 
752
779
 
@@ -793,6 +820,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
793
820
 
794
821
 
795
822
 
823
+
824
+
825
+
796
826
 
797
827
 
798
828
 
@@ -840,6 +870,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
840
870
 
841
871
 
842
872
 
873
+
874
+
875
+
843
876
 
844
877
 
845
878
 
@@ -903,6 +936,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
903
936
 
904
937
 
905
938
 
939
+
940
+
941
+
906
942
 
907
943
 
908
944
 
@@ -945,6 +981,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
945
981
 
946
982
 
947
983
 
984
+
985
+
986
+
948
987
 
949
988
 
950
989
 
@@ -995,6 +1034,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
995
1034
 
996
1035
 
997
1036
 
1037
+
1038
+
1039
+
998
1040
 
999
1041
 
1000
1042
 
@@ -1041,6 +1083,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1041
1083
 
1042
1084
 
1043
1085
 
1086
+
1087
+
1088
+
1044
1089
 
1045
1090
 
1046
1091
 
@@ -1087,6 +1132,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1087
1132
 
1088
1133
 
1089
1134
 
1135
+
1136
+
1137
+
1090
1138
 
1091
1139
 
1092
1140
 
@@ -1158,6 +1206,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1158
1206
 
1159
1207
 
1160
1208
 
1209
+
1210
+
1211
+
1161
1212
 
1162
1213
 
1163
1214
 
@@ -1201,6 +1252,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1201
1252
 
1202
1253
 
1203
1254
 
1255
+
1256
+
1257
+
1204
1258
 
1205
1259
 
1206
1260
 
@@ -1264,6 +1318,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1264
1318
 
1265
1319
 
1266
1320
 
1321
+
1322
+
1323
+
1267
1324
 
1268
1325
 
1269
1326
 
@@ -1303,6 +1360,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1303
1360
 
1304
1361
 
1305
1362
 
1363
+
1364
+
1365
+
1306
1366
 
1307
1367
 
1308
1368
 
@@ -1344,6 +1404,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1344
1404
 
1345
1405
 
1346
1406
 
1407
+
1408
+
1409
+
1347
1410
 
1348
1411
 
1349
1412
 
@@ -1387,6 +1450,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1387
1450
 
1388
1451
 
1389
1452
 
1453
+
1454
+
1455
+
1390
1456
 
1391
1457
 
1392
1458
 
@@ -1432,6 +1498,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1432
1498
 
1433
1499
 
1434
1500
 
1501
+
1502
+
1503
+
1435
1504
 
1436
1505
 
1437
1506
 
@@ -1480,6 +1549,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1480
1549
 
1481
1550
 
1482
1551
 
1552
+
1553
+
1554
+
1483
1555
 
1484
1556
 
1485
1557
 
@@ -1532,6 +1604,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
1532
1604
 
1533
1605
 
1534
1606
 
1607
+
1608
+
1609
+
1535
1610
 
1536
1611
 
1537
1612