binary-tree-typed 2.5.1 → 2.5.3

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 (75) hide show
  1. package/dist/cjs/index.cjs +340 -107
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +339 -106
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +340 -108
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +339 -107
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/common/error.d.ts +9 -0
  10. package/dist/types/common/index.d.ts +1 -1
  11. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
  24. package/dist/types/data-structures/heap/heap.d.ts +140 -12
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +127 -0
  30. package/dist/types/data-structures/queue/queue.d.ts +97 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +72 -2
  32. package/dist/types/data-structures/trie/trie.d.ts +84 -0
  33. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  34. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  35. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  36. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  37. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  38. package/dist/umd/binary-tree-typed.js +337 -105
  39. package/dist/umd/binary-tree-typed.js.map +1 -1
  40. package/dist/umd/binary-tree-typed.min.js +5 -5
  41. package/dist/umd/binary-tree-typed.min.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/common/error.ts +19 -1
  44. package/src/common/index.ts +1 -1
  45. package/src/data-structures/base/iterable-element-base.ts +3 -2
  46. package/src/data-structures/binary-tree/avl-tree.ts +99 -5
  47. package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
  48. package/src/data-structures/binary-tree/binary-tree.ts +239 -78
  49. package/src/data-structures/binary-tree/bst.ts +542 -13
  50. package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
  51. package/src/data-structures/binary-tree/segment-tree.ts +42 -0
  52. package/src/data-structures/binary-tree/tree-map.ts +1223 -261
  53. package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
  54. package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
  55. package/src/data-structures/binary-tree/tree-set.ts +1018 -99
  56. package/src/data-structures/graph/abstract-graph.ts +2 -2
  57. package/src/data-structures/graph/directed-graph.ts +71 -1
  58. package/src/data-structures/graph/undirected-graph.ts +64 -1
  59. package/src/data-structures/hash/hash-map.ts +102 -16
  60. package/src/data-structures/heap/heap.ts +153 -23
  61. package/src/data-structures/heap/max-heap.ts +2 -2
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
  63. package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
  64. package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
  65. package/src/data-structures/matrix/matrix.ts +65 -9
  66. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  67. package/src/data-structures/queue/deque.ts +130 -0
  68. package/src/data-structures/queue/queue.ts +109 -0
  69. package/src/data-structures/stack/stack.ts +75 -5
  70. package/src/data-structures/trie/trie.ts +86 -2
  71. package/src/interfaces/binary-tree.ts +1 -9
  72. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  73. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  74. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  75. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -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 three parts: a data field, a pointer (or reference) to the previous node, and a pointer to the next node. This structure allows traversal of the linked list in both directions.
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.
@@ -320,6 +320,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
320
320
 
321
321
 
322
322
 
323
+
324
+
325
+
326
+
327
+
328
+
329
+
323
330
 
324
331
 
325
332
 
@@ -386,6 +393,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
386
393
 
387
394
 
388
395
 
396
+
397
+
398
+
399
+
400
+
401
+
402
+
389
403
 
390
404
 
391
405
 
@@ -457,6 +471,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
457
471
 
458
472
 
459
473
 
474
+
475
+
476
+
477
+
478
+
479
+
480
+
460
481
 
461
482
 
462
483
 
@@ -510,6 +531,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
510
531
 
511
532
 
512
533
 
534
+
535
+
536
+
537
+
538
+
539
+
540
+
513
541
 
514
542
 
515
543
 
@@ -632,6 +660,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
632
660
 
633
661
 
634
662
 
663
+
664
+
665
+
666
+
667
+
668
+
669
+
635
670
 
636
671
 
637
672
 
@@ -694,6 +729,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
694
729
 
695
730
 
696
731
 
732
+
733
+
734
+
735
+
736
+
737
+
738
+
697
739
 
698
740
 
699
741
 
@@ -741,6 +783,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
741
783
 
742
784
 
743
785
 
786
+
787
+
788
+
789
+
790
+
791
+
792
+
744
793
 
745
794
 
746
795
 
@@ -794,6 +843,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
794
843
 
795
844
 
796
845
 
846
+
847
+
848
+
849
+
850
+
851
+
852
+
797
853
 
798
854
 
799
855
 
@@ -853,6 +909,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
853
909
 
854
910
 
855
911
 
912
+
913
+
914
+
915
+
916
+
917
+
918
+
856
919
 
857
920
 
858
921
 
@@ -921,6 +984,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
921
984
 
922
985
 
923
986
 
987
+
988
+
989
+
990
+
991
+
992
+
993
+
924
994
 
925
995
 
926
996
 
@@ -964,6 +1034,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
964
1034
 
965
1035
 
966
1036
 
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
967
1044
 
968
1045
 
969
1046
 
@@ -1013,6 +1090,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
1013
1090
 
1014
1091
 
1015
1092
 
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+
1016
1100
 
1017
1101
 
1018
1102
 
@@ -1256,6 +1340,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
1256
1340
 
1257
1341
 
1258
1342
 
1343
+
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+
1259
1350
 
1260
1351
 
1261
1352
 
@@ -1309,6 +1400,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
1309
1400
 
1310
1401
 
1311
1402
 
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1312
1410
 
1313
1411
 
1314
1412
 
@@ -1392,6 +1490,13 @@ export class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, S
1392
1490
 
1393
1491
 
1394
1492
 
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1395
1500
 
1396
1501
 
1397
1502
 
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import type { Comparator, EntryCallback } from '../../types';
10
- import { ERR } from '../../common';
10
+ import { ERR, raise } from '../../common';
11
11
  import { IterableEntryBase } from '../base';
12
12
 
13
13
  export class SkipListNode<K, V> {
@@ -72,7 +72,7 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
72
72
  [k, v] = toEntryFn(item as R);
73
73
  } else {
74
74
  if (!Array.isArray(item) || item.length < 2) {
75
- throw new TypeError(ERR.invalidEntry('SkipList'));
75
+ raise(TypeError, ERR.invalidEntry('SkipList'));
76
76
  }
77
77
  [k, v] = item as [K, V];
78
78
  }
@@ -86,7 +86,7 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
86
86
  static createDefaultComparator<K>(): Comparator<K> {
87
87
  return (a: K, b: K): number => {
88
88
  if (typeof a === 'number' && typeof b === 'number') {
89
- if (Number.isNaN(a) || Number.isNaN(b)) throw new TypeError(ERR.invalidNaN('SkipList'));
89
+ if (Number.isNaN(a) || Number.isNaN(b)) raise(TypeError, ERR.invalidNaN('SkipList'));
90
90
  return a - b;
91
91
  }
92
92
  if (typeof a === 'string' && typeof b === 'string') {
@@ -95,13 +95,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
95
95
  if (a instanceof Date && b instanceof Date) {
96
96
  const ta = a.getTime(),
97
97
  tb = b.getTime();
98
- if (Number.isNaN(ta) || Number.isNaN(tb)) throw new TypeError(ERR.invalidDate('SkipList'));
98
+ if (Number.isNaN(ta) || Number.isNaN(tb)) raise(TypeError, ERR.invalidDate('SkipList'));
99
99
  return ta - tb;
100
100
  }
101
101
  if (typeof a === 'bigint' && typeof b === 'bigint') {
102
102
  return a < b ? -1 : a > b ? 1 : 0;
103
103
  }
104
- throw new TypeError(ERR.comparatorRequired('SkipList'));
104
+ raise(TypeError, ERR.comparatorRequired('SkipList'));
105
105
  };
106
106
  }
107
107
 
@@ -158,6 +158,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
158
158
 
159
159
 
160
160
 
161
+
162
+
163
+
164
+
165
+
166
+
167
+
161
168
 
162
169
 
163
170
 
@@ -198,6 +205,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
198
205
 
199
206
 
200
207
 
208
+
209
+
210
+
211
+
212
+
213
+
214
+
201
215
 
202
216
 
203
217
 
@@ -241,6 +255,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
241
255
 
242
256
 
243
257
 
258
+
259
+
260
+
261
+
262
+
263
+
264
+
244
265
 
245
266
 
246
267
 
@@ -293,6 +314,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
293
314
 
294
315
 
295
316
 
317
+
318
+
319
+
320
+
321
+
322
+
323
+
296
324
 
297
325
 
298
326
 
@@ -375,6 +403,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
375
403
 
376
404
 
377
405
 
406
+
407
+
408
+
409
+
410
+
411
+
412
+
378
413
 
379
414
 
380
415
 
@@ -436,6 +471,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
436
471
 
437
472
 
438
473
 
474
+
475
+
476
+
477
+
478
+
479
+
480
+
439
481
 
440
482
 
441
483
 
@@ -480,6 +522,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
480
522
 
481
523
 
482
524
 
525
+
526
+
527
+
528
+
529
+
530
+
531
+
483
532
 
484
533
 
485
534
 
@@ -549,6 +598,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
549
598
 
550
599
 
551
600
 
601
+
602
+
603
+
604
+
605
+
606
+
607
+
552
608
 
553
609
 
554
610
 
@@ -593,6 +649,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
593
649
 
594
650
 
595
651
 
652
+
653
+
654
+
655
+
656
+
657
+
658
+
596
659
 
597
660
 
598
661
 
@@ -639,6 +702,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
639
702
 
640
703
 
641
704
 
705
+
706
+
707
+
708
+
709
+
710
+
711
+
642
712
 
643
713
 
644
714
 
@@ -683,6 +753,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
683
753
 
684
754
 
685
755
 
756
+
757
+
758
+
759
+
760
+
761
+
762
+
686
763
 
687
764
 
688
765
 
@@ -730,6 +807,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
730
807
 
731
808
 
732
809
 
810
+
811
+
812
+
813
+
814
+
815
+
816
+
733
817
 
734
818
 
735
819
 
@@ -782,6 +866,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
782
866
 
783
867
 
784
868
 
869
+
870
+
871
+
872
+
873
+
874
+
875
+
785
876
 
786
877
 
787
878
 
@@ -834,6 +925,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
834
925
 
835
926
 
836
927
 
928
+
929
+
930
+
931
+
932
+
933
+
934
+
837
935
 
838
936
 
839
937
 
@@ -883,6 +981,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
883
981
 
884
982
 
885
983
 
984
+
985
+
986
+
987
+
988
+
989
+
990
+
886
991
 
887
992
 
888
993
 
@@ -938,6 +1043,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
938
1043
 
939
1044
 
940
1045
 
1046
+
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+
941
1053
 
942
1054
 
943
1055
 
@@ -1008,6 +1120,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
1008
1120
 
1009
1121
 
1010
1122
 
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+
1129
+
1011
1130
 
1012
1131
 
1013
1132
 
@@ -1058,6 +1177,13 @@ export class SkipList<K = any, V = any, R = [K, V]> extends IterableEntryBase<K,
1058
1177
 
1059
1178
 
1060
1179
 
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1061
1187
 
1062
1188
 
1063
1189
 
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import type { MatrixOptions } from '../../types';
9
- import { ERR } from '../../common';
9
+ import { ERR, raise } from '../../common';
10
10
 
11
11
  /**
12
12
  *
@@ -213,6 +213,13 @@ export class Matrix {
213
213
 
214
214
 
215
215
 
216
+
217
+
218
+
219
+
220
+
221
+
222
+
216
223
 
217
224
 
218
225
 
@@ -279,6 +286,13 @@ export class Matrix {
279
286
 
280
287
 
281
288
 
289
+
290
+
291
+
292
+
293
+
294
+
295
+
282
296
 
283
297
 
284
298
 
@@ -342,6 +356,13 @@ export class Matrix {
342
356
 
343
357
 
344
358
 
359
+
360
+
361
+
362
+
363
+
364
+
365
+
345
366
 
346
367
 
347
368
 
@@ -375,7 +396,7 @@ export class Matrix {
375
396
  */
376
397
  add(matrix: Matrix): Matrix | undefined {
377
398
  if (!this.isMatchForCalculate(matrix)) {
378
- throw new Error(ERR.matrixDimensionMismatch('addition'));
399
+ raise(Error, ERR.matrixDimensionMismatch('addition'));
379
400
  }
380
401
 
381
402
  const resultData: number[][] = [];
@@ -429,6 +450,13 @@ export class Matrix {
429
450
 
430
451
 
431
452
 
453
+
454
+
455
+
456
+
457
+
458
+
459
+
432
460
 
433
461
 
434
462
 
@@ -446,7 +474,7 @@ export class Matrix {
446
474
  */
447
475
  subtract(matrix: Matrix): Matrix | undefined {
448
476
  if (!this.isMatchForCalculate(matrix)) {
449
- throw new Error(ERR.matrixDimensionMismatch('subtraction'));
477
+ raise(Error, ERR.matrixDimensionMismatch('subtraction'));
450
478
  }
451
479
 
452
480
  const resultData: number[][] = [];
@@ -499,6 +527,13 @@ export class Matrix {
499
527
 
500
528
 
501
529
 
530
+
531
+
532
+
533
+
534
+
535
+
536
+
502
537
 
503
538
 
504
539
 
@@ -532,7 +567,7 @@ export class Matrix {
532
567
  */
533
568
  multiply(matrix: Matrix): Matrix | undefined {
534
569
  if (this.cols !== matrix.rows) {
535
- throw new Error(ERR.matrixDimensionMismatch('multiplication (A.cols must equal B.rows)'));
570
+ raise(Error, ERR.matrixDimensionMismatch('multiplication (A.cols must equal B.rows)'));
536
571
  }
537
572
 
538
573
  const resultData: number[][] = [];
@@ -591,6 +626,13 @@ export class Matrix {
591
626
 
592
627
 
593
628
 
629
+
630
+
631
+
632
+
633
+
634
+
635
+
594
636
 
595
637
 
596
638
 
@@ -621,7 +663,7 @@ export class Matrix {
621
663
  */
622
664
  transpose(): Matrix {
623
665
  if (this.data.some(row => row.length !== this.cols)) {
624
- throw new Error(ERR.matrixNotRectangular());
666
+ raise(Error, ERR.matrixNotRectangular());
625
667
  }
626
668
 
627
669
  const resultData: number[][] = [];
@@ -670,6 +712,13 @@ export class Matrix {
670
712
 
671
713
 
672
714
 
715
+
716
+
717
+
718
+
719
+
720
+
721
+
673
722
 
674
723
 
675
724
 
@@ -693,7 +742,7 @@ export class Matrix {
693
742
  inverse(): Matrix | undefined {
694
743
  // Check if the matrix is square
695
744
  if (this.rows !== this.cols) {
696
- throw new Error(ERR.matrixNotSquare());
745
+ raise(Error, ERR.matrixNotSquare());
697
746
  }
698
747
 
699
748
  // Create an augmented matrix [this | I]
@@ -723,7 +772,7 @@ export class Matrix {
723
772
 
724
773
  if (pivotRow === this.rows) {
725
774
  // Matrix is singular, and its inverse does not exist
726
- throw new Error(ERR.matrixSingular());
775
+ raise(Error, ERR.matrixSingular());
727
776
  }
728
777
 
729
778
  // Swap rows to make the pivot the current row
@@ -734,7 +783,7 @@ export class Matrix {
734
783
 
735
784
  if (pivotElement === 0) {
736
785
  // Handle division by zero
737
- throw new Error(ERR.matrixSingular());
786
+ raise(Error, ERR.matrixSingular());
738
787
  }
739
788
 
740
789
  augmentedMatrix._scaleRow(i, 1 / pivotElement);
@@ -793,6 +842,13 @@ export class Matrix {
793
842
 
794
843
 
795
844
 
845
+
846
+
847
+
848
+
849
+
850
+
851
+
796
852
 
797
853
 
798
854
 
@@ -810,7 +866,7 @@ export class Matrix {
810
866
  */
811
867
  dot(matrix: Matrix): Matrix | undefined {
812
868
  if (this.cols !== matrix.rows) {
813
- throw new Error(ERR.matrixDimensionMismatch('dot product (A.cols must equal B.rows)'));
869
+ raise(Error, ERR.matrixDimensionMismatch('dot product (A.cols must equal B.rows)'));
814
870
  }
815
871
 
816
872
  const resultData: number[][] = [];
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import type { PriorityQueueOptions } from '../../types';
9
9
  import { PriorityQueue } from './priority-queue';
10
- import { ERR } from '../../common';
10
+ import { ERR, raise } from '../../common';
11
11
 
12
12
  /**
13
13
  * Max-oriented priority queue (max-heap) built on {@link PriorityQueue}.
@@ -86,7 +86,7 @@ export class MaxPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
86
86
  super(elements, {
87
87
  comparator: (a: E, b: E): number => {
88
88
  if (typeof a === 'object' || typeof b === 'object') {
89
- throw new TypeError(ERR.comparatorRequired('MaxPriorityQueue'));
89
+ raise(TypeError, ERR.comparatorRequired('MaxPriorityQueue'));
90
90
  }
91
91
  if (a < b) return 1;
92
92
  if (a > b) return -1;