data-structure-typed 1.48.9 → 1.49.1

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 (163) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +16 -11
  3. package/dist/cjs/data-structures/binary-tree/avl-tree.js +12 -4
  4. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  5. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +70 -61
  6. package/dist/cjs/data-structures/binary-tree/binary-tree.js +25 -21
  7. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  8. package/dist/cjs/data-structures/binary-tree/bst.d.ts +20 -13
  9. package/dist/cjs/data-structures/binary-tree/bst.js +12 -3
  10. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +19 -25
  12. package/dist/cjs/data-structures/binary-tree/rb-tree.js +21 -35
  13. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  14. package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +20 -13
  15. package/dist/cjs/data-structures/binary-tree/tree-multimap.js +12 -3
  16. package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
  17. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +9 -3
  18. package/dist/cjs/data-structures/graph/abstract-graph.js +27 -31
  19. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  20. package/dist/cjs/data-structures/graph/directed-graph.d.ts +8 -1
  21. package/dist/cjs/data-structures/graph/directed-graph.js +1 -8
  22. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  23. package/dist/cjs/data-structures/graph/map-graph.d.ts +1 -1
  24. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +8 -1
  25. package/dist/cjs/data-structures/graph/undirected-graph.js +1 -8
  26. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  27. package/dist/cjs/data-structures/hash/hash-map.d.ts +14 -2
  28. package/dist/cjs/data-structures/hash/hash-map.js +19 -8
  29. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  30. package/dist/cjs/data-structures/hash/hash-table.d.ts +2 -2
  31. package/dist/cjs/data-structures/hash/hash-table.js.map +1 -1
  32. package/dist/cjs/data-structures/heap/heap.d.ts +14 -3
  33. package/dist/cjs/data-structures/heap/heap.js +12 -0
  34. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  35. package/dist/cjs/data-structures/heap/max-heap.d.ts +11 -1
  36. package/dist/cjs/data-structures/heap/max-heap.js +10 -7
  37. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
  38. package/dist/cjs/data-structures/heap/min-heap.d.ts +11 -1
  39. package/dist/cjs/data-structures/heap/min-heap.js +10 -7
  40. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
  41. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +8 -2
  42. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +6 -7
  43. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  44. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +2 -2
  45. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +0 -7
  46. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  47. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
  48. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +0 -7
  49. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  50. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
  51. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +0 -7
  52. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  53. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +9 -1
  54. package/dist/cjs/data-structures/priority-queue/priority-queue.js +8 -7
  55. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  56. package/dist/cjs/data-structures/queue/deque.d.ts +6 -5
  57. package/dist/cjs/data-structures/queue/deque.js +6 -12
  58. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  59. package/dist/cjs/data-structures/queue/queue.d.ts +18 -3
  60. package/dist/cjs/data-structures/queue/queue.js +16 -6
  61. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  62. package/dist/cjs/data-structures/stack/stack.d.ts +15 -5
  63. package/dist/cjs/data-structures/stack/stack.js +7 -4
  64. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  65. package/dist/cjs/data-structures/trie/trie.d.ts +13 -3
  66. package/dist/cjs/data-structures/trie/trie.js +11 -8
  67. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  68. package/dist/cjs/interfaces/binary-tree.d.ts +4 -4
  69. package/dist/cjs/types/common.d.ts +32 -8
  70. package/dist/cjs/types/common.js +22 -1
  71. package/dist/cjs/types/common.js.map +1 -1
  72. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -24
  73. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +0 -22
  74. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
  75. package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +1 -1
  76. package/dist/cjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
  77. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +16 -11
  78. package/dist/mjs/data-structures/binary-tree/avl-tree.js +12 -4
  79. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +70 -61
  80. package/dist/mjs/data-structures/binary-tree/binary-tree.js +25 -21
  81. package/dist/mjs/data-structures/binary-tree/bst.d.ts +20 -13
  82. package/dist/mjs/data-structures/binary-tree/bst.js +12 -3
  83. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +19 -25
  84. package/dist/mjs/data-structures/binary-tree/rb-tree.js +21 -34
  85. package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +20 -13
  86. package/dist/mjs/data-structures/binary-tree/tree-multimap.js +12 -3
  87. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +9 -3
  88. package/dist/mjs/data-structures/graph/abstract-graph.js +27 -31
  89. package/dist/mjs/data-structures/graph/directed-graph.d.ts +8 -1
  90. package/dist/mjs/data-structures/graph/directed-graph.js +1 -8
  91. package/dist/mjs/data-structures/graph/map-graph.d.ts +1 -1
  92. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +8 -1
  93. package/dist/mjs/data-structures/graph/undirected-graph.js +1 -8
  94. package/dist/mjs/data-structures/hash/hash-map.d.ts +14 -2
  95. package/dist/mjs/data-structures/hash/hash-map.js +18 -7
  96. package/dist/mjs/data-structures/hash/hash-table.d.ts +2 -2
  97. package/dist/mjs/data-structures/heap/heap.d.ts +14 -3
  98. package/dist/mjs/data-structures/heap/heap.js +13 -1
  99. package/dist/mjs/data-structures/heap/max-heap.d.ts +11 -1
  100. package/dist/mjs/data-structures/heap/max-heap.js +9 -6
  101. package/dist/mjs/data-structures/heap/min-heap.d.ts +11 -1
  102. package/dist/mjs/data-structures/heap/min-heap.js +9 -6
  103. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +8 -2
  104. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +7 -8
  105. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +2 -2
  106. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +0 -7
  107. package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
  108. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +0 -7
  109. package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
  110. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +0 -7
  111. package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +9 -1
  112. package/dist/mjs/data-structures/priority-queue/priority-queue.js +7 -6
  113. package/dist/mjs/data-structures/queue/deque.d.ts +6 -5
  114. package/dist/mjs/data-structures/queue/deque.js +6 -12
  115. package/dist/mjs/data-structures/queue/queue.d.ts +18 -3
  116. package/dist/mjs/data-structures/queue/queue.js +16 -6
  117. package/dist/mjs/data-structures/stack/stack.d.ts +15 -5
  118. package/dist/mjs/data-structures/stack/stack.js +8 -5
  119. package/dist/mjs/data-structures/trie/trie.d.ts +13 -3
  120. package/dist/mjs/data-structures/trie/trie.js +12 -9
  121. package/dist/mjs/interfaces/binary-tree.d.ts +4 -4
  122. package/dist/mjs/types/common.d.ts +32 -8
  123. package/dist/mjs/types/common.js +21 -0
  124. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -24
  125. package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +1 -21
  126. package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +1 -1
  127. package/dist/mjs/types/data-structures/binary-tree/tree-multimap.d.ts +1 -1
  128. package/dist/umd/data-structure-typed.js +241 -216
  129. package/dist/umd/data-structure-typed.min.js +2 -2
  130. package/dist/umd/data-structure-typed.min.js.map +1 -1
  131. package/package.json +1 -1
  132. package/src/data-structures/binary-tree/avl-tree.ts +23 -13
  133. package/src/data-structures/binary-tree/binary-tree.ts +93 -97
  134. package/src/data-structures/binary-tree/bst.ts +26 -15
  135. package/src/data-structures/binary-tree/rb-tree.ts +33 -48
  136. package/src/data-structures/binary-tree/tree-multimap.ts +32 -14
  137. package/src/data-structures/graph/abstract-graph.ts +35 -25
  138. package/src/data-structures/graph/directed-graph.ts +2 -2
  139. package/src/data-structures/graph/map-graph.ts +1 -1
  140. package/src/data-structures/graph/undirected-graph.ts +2 -2
  141. package/src/data-structures/hash/hash-map.ts +20 -3
  142. package/src/data-structures/hash/hash-table.ts +3 -3
  143. package/src/data-structures/heap/heap.ts +14 -3
  144. package/src/data-structures/heap/max-heap.ts +11 -2
  145. package/src/data-structures/heap/min-heap.ts +11 -2
  146. package/src/data-structures/linked-list/doubly-linked-list.ts +9 -3
  147. package/src/data-structures/linked-list/singly-linked-list.ts +3 -3
  148. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -1
  149. package/src/data-structures/priority-queue/min-priority-queue.ts +1 -1
  150. package/src/data-structures/priority-queue/priority-queue.ts +9 -2
  151. package/src/data-structures/queue/deque.ts +7 -9
  152. package/src/data-structures/queue/queue.ts +18 -3
  153. package/src/data-structures/stack/stack.ts +16 -6
  154. package/src/data-structures/trie/trie.ts +13 -4
  155. package/src/interfaces/binary-tree.ts +5 -5
  156. package/src/types/common.ts +37 -12
  157. package/src/types/data-structures/binary-tree/avl-tree.ts +0 -1
  158. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -26
  159. package/src/types/data-structures/binary-tree/bst.ts +0 -1
  160. package/src/types/data-structures/binary-tree/rb-tree.ts +1 -1
  161. package/src/types/data-structures/binary-tree/tree-multimap.ts +1 -1
  162. package/test/unit/data-structures/graph/directed-graph.test.ts +21 -1
  163. package/test/unit/data-structures/graph/undirected-graph.test.ts +39 -1
@@ -444,80 +444,6 @@ var dataStructureTyped = (() => {
444
444
  __publicField(_HashTable, "LOAD_FACTOR", 0.75);
445
445
  var HashTable = _HashTable;
446
446
 
447
- // src/utils/utils.ts
448
- var uuidV4 = function() {
449
- return "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/[x]/g, function(c) {
450
- const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
451
- return v.toString(16);
452
- });
453
- };
454
- var arrayRemove = function(array, predicate) {
455
- let i = -1, len = array ? array.length : 0;
456
- const result = [];
457
- while (++i < len) {
458
- const value = array[i];
459
- if (predicate(value, i, array)) {
460
- result.push(value);
461
- Array.prototype.splice.call(array, i--, 1);
462
- len--;
463
- }
464
- }
465
- return result;
466
- };
467
- var THUNK_SYMBOL = Symbol("thunk");
468
- var isThunk = (fnOrValue) => {
469
- return typeof fnOrValue === "function" && fnOrValue.__THUNK__ === THUNK_SYMBOL;
470
- };
471
- var toThunk = (fn) => {
472
- const thunk = () => fn();
473
- thunk.__THUNK__ = THUNK_SYMBOL;
474
- return thunk;
475
- };
476
- var trampoline = (fn) => {
477
- const cont = (...args) => toThunk(() => fn(...args));
478
- return Object.assign(
479
- (...args) => {
480
- let result = fn(...args);
481
- while (isThunk(result) && typeof result === "function") {
482
- result = result();
483
- }
484
- return result;
485
- },
486
- { cont }
487
- );
488
- };
489
- var trampolineAsync = (fn) => {
490
- const cont = (...args) => toThunk(() => fn(...args));
491
- return Object.assign(
492
- (...args) => __async(void 0, null, function* () {
493
- let result = yield fn(...args);
494
- while (isThunk(result) && typeof result === "function") {
495
- result = yield result();
496
- }
497
- return result;
498
- }),
499
- { cont }
500
- );
501
- };
502
- var getMSB = (value) => {
503
- if (value <= 0) {
504
- return 0;
505
- }
506
- return 1 << 31 - Math.clz32(value);
507
- };
508
- var rangeCheck = (index, min, max, message = "Index out of bounds.") => {
509
- if (index < min || index > max)
510
- throw new RangeError(message);
511
- };
512
- var throwRangeError = (message = "The value is off-limits.") => {
513
- throw new RangeError(message);
514
- };
515
- var isWeakKey = (input) => {
516
- const inputType = typeof input;
517
- return inputType === "object" && input !== null || inputType === "function";
518
- };
519
- var calcMinUnitsRequired = (totalQuantity, unitSize) => Math.floor((totalQuantity + unitSize - 1) / unitSize);
520
-
521
447
  // src/data-structures/base/iterable-base.ts
522
448
  var IterableEntryBase = class {
523
449
  /**
@@ -827,6 +753,80 @@ var dataStructureTyped = (() => {
827
753
  }
828
754
  };
829
755
 
756
+ // src/utils/utils.ts
757
+ var uuidV4 = function() {
758
+ return "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/[x]/g, function(c) {
759
+ const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
760
+ return v.toString(16);
761
+ });
762
+ };
763
+ var arrayRemove = function(array, predicate) {
764
+ let i = -1, len = array ? array.length : 0;
765
+ const result = [];
766
+ while (++i < len) {
767
+ const value = array[i];
768
+ if (predicate(value, i, array)) {
769
+ result.push(value);
770
+ Array.prototype.splice.call(array, i--, 1);
771
+ len--;
772
+ }
773
+ }
774
+ return result;
775
+ };
776
+ var THUNK_SYMBOL = Symbol("thunk");
777
+ var isThunk = (fnOrValue) => {
778
+ return typeof fnOrValue === "function" && fnOrValue.__THUNK__ === THUNK_SYMBOL;
779
+ };
780
+ var toThunk = (fn) => {
781
+ const thunk = () => fn();
782
+ thunk.__THUNK__ = THUNK_SYMBOL;
783
+ return thunk;
784
+ };
785
+ var trampoline = (fn) => {
786
+ const cont = (...args) => toThunk(() => fn(...args));
787
+ return Object.assign(
788
+ (...args) => {
789
+ let result = fn(...args);
790
+ while (isThunk(result) && typeof result === "function") {
791
+ result = result();
792
+ }
793
+ return result;
794
+ },
795
+ { cont }
796
+ );
797
+ };
798
+ var trampolineAsync = (fn) => {
799
+ const cont = (...args) => toThunk(() => fn(...args));
800
+ return Object.assign(
801
+ (...args) => __async(void 0, null, function* () {
802
+ let result = yield fn(...args);
803
+ while (isThunk(result) && typeof result === "function") {
804
+ result = yield result();
805
+ }
806
+ return result;
807
+ }),
808
+ { cont }
809
+ );
810
+ };
811
+ var getMSB = (value) => {
812
+ if (value <= 0) {
813
+ return 0;
814
+ }
815
+ return 1 << 31 - Math.clz32(value);
816
+ };
817
+ var rangeCheck = (index, min, max, message = "Index out of bounds.") => {
818
+ if (index < min || index > max)
819
+ throw new RangeError(message);
820
+ };
821
+ var throwRangeError = (message = "The value is off-limits.") => {
822
+ throw new RangeError(message);
823
+ };
824
+ var isWeakKey = (input) => {
825
+ const inputType = typeof input;
826
+ return inputType === "object" && input !== null || inputType === "function";
827
+ };
828
+ var calcMinUnitsRequired = (totalQuantity, unitSize) => Math.floor((totalQuantity + unitSize - 1) / unitSize);
829
+
830
830
  // src/data-structures/hash/hash-map.ts
831
831
  var HashMap = class _HashMap extends IterableEntryBase {
832
832
  /**
@@ -1171,6 +1171,13 @@ var dataStructureTyped = (() => {
1171
1171
  return hash in this._noObjMap;
1172
1172
  }
1173
1173
  }
1174
+ hasValue(value) {
1175
+ for (const [, elementValue] of this) {
1176
+ if (elementValue === value)
1177
+ return true;
1178
+ }
1179
+ return false;
1180
+ }
1174
1181
  setMany(entries) {
1175
1182
  for (const entry of entries) {
1176
1183
  const [key, value] = entry;
@@ -3157,7 +3164,7 @@ var dataStructureTyped = (() => {
3157
3164
  pop() {
3158
3165
  if (this.isEmpty())
3159
3166
  return void 0;
3160
- return this.elements.pop() || void 0;
3167
+ return this.elements.pop();
3161
3168
  }
3162
3169
  /**
3163
3170
  * Time Complexity: O(n)
@@ -3414,7 +3421,7 @@ var dataStructureTyped = (() => {
3414
3421
  * @param {E} value - The value parameter represents the value that you want to add to the queue.
3415
3422
  */
3416
3423
  enqueue(value) {
3417
- this.push(value);
3424
+ return this.push(value);
3418
3425
  }
3419
3426
  /**
3420
3427
  * Time Complexity: O(n) - same as shift().
@@ -5175,43 +5182,6 @@ var dataStructureTyped = (() => {
5175
5182
  }
5176
5183
  };
5177
5184
 
5178
- // src/data-structures/priority-queue/priority-queue.ts
5179
- var PriorityQueue = class extends Heap {
5180
- constructor(elements, options) {
5181
- super(elements, options);
5182
- }
5183
- };
5184
-
5185
- // src/data-structures/priority-queue/min-priority-queue.ts
5186
- var MinPriorityQueue = class extends PriorityQueue {
5187
- constructor(elements, options = {
5188
- comparator: (a, b) => {
5189
- if (!(typeof a === "number" && typeof b === "number")) {
5190
- throw new Error("The a, b params of compare function must be number");
5191
- } else {
5192
- return a - b;
5193
- }
5194
- }
5195
- }) {
5196
- super(elements, options);
5197
- }
5198
- };
5199
-
5200
- // src/data-structures/priority-queue/max-priority-queue.ts
5201
- var MaxPriorityQueue = class extends PriorityQueue {
5202
- constructor(elements, options = {
5203
- comparator: (a, b) => {
5204
- if (!(typeof a === "number" && typeof b === "number")) {
5205
- throw new Error("The a, b params of compare function must be number");
5206
- } else {
5207
- return b - a;
5208
- }
5209
- }
5210
- }) {
5211
- super(elements, options);
5212
- }
5213
- };
5214
-
5215
5185
  // src/data-structures/graph/abstract-graph.ts
5216
5186
  var AbstractVertex = class {
5217
5187
  /**
@@ -5638,13 +5608,7 @@ var dataStructureTyped = (() => {
5638
5608
  * shortest paths from the source vertex to all other vertexMap in the graph. If `genPaths
5639
5609
  * @returns The function `dijkstraWithoutHeap` returns an object of type `DijkstraResult<VO>`.
5640
5610
  */
5641
- dijkstraWithoutHeap(src, dest, getMinDist, genPaths) {
5642
- if (getMinDist === void 0)
5643
- getMinDist = false;
5644
- if (genPaths === void 0)
5645
- genPaths = false;
5646
- if (dest === void 0)
5647
- dest = void 0;
5611
+ dijkstraWithoutHeap(src, dest = void 0, getMinDist = false, genPaths = false) {
5648
5612
  let minDist = Infinity;
5649
5613
  let minDest = void 0;
5650
5614
  let minPath = [];
@@ -5771,14 +5735,8 @@ var dataStructureTyped = (() => {
5771
5735
  * shortest paths from the source vertex to all other vertexMap in the graph. If `genPaths
5772
5736
  * @returns The function `dijkstra` returns an object of type `DijkstraResult<VO>`.
5773
5737
  */
5774
- dijkstra(src, dest, getMinDist, genPaths) {
5738
+ dijkstra(src, dest = void 0, getMinDist = false, genPaths = false) {
5775
5739
  var _a;
5776
- if (getMinDist === void 0)
5777
- getMinDist = false;
5778
- if (genPaths === void 0)
5779
- genPaths = false;
5780
- if (dest === void 0)
5781
- dest = void 0;
5782
5740
  let minDist = Infinity;
5783
5741
  let minDest = void 0;
5784
5742
  let minPath = [];
@@ -5796,7 +5754,7 @@ var dataStructureTyped = (() => {
5796
5754
  if (vertexOrKey instanceof AbstractVertex)
5797
5755
  distMap.set(vertexOrKey, Infinity);
5798
5756
  }
5799
- const heap = new PriorityQueue([], { comparator: (a, b) => a.key - b.key });
5757
+ const heap = new Heap([], { comparator: (a, b) => a.key - b.key });
5800
5758
  heap.add({ key: 0, value: srcVertex });
5801
5759
  distMap.set(srcVertex, 0);
5802
5760
  preMap.set(srcVertex, void 0);
@@ -6152,13 +6110,27 @@ var dataStructureTyped = (() => {
6152
6110
  }
6153
6111
  const cycles = /* @__PURE__ */ new Map();
6154
6112
  if (needCycles) {
6155
- let SCCs2 = /* @__PURE__ */ new Map();
6156
- if (SCCs2.size < 1) {
6157
- SCCs2 = getSCCs();
6158
- }
6159
- SCCs2.forEach((SCC, low) => {
6160
- if (SCC.length > 1) {
6161
- cycles.set(low, SCC);
6113
+ const visitedMap = /* @__PURE__ */ new Map();
6114
+ const stack = [];
6115
+ const findCyclesDFS = (cur, parent) => {
6116
+ visitedMap.set(cur, true);
6117
+ stack.push(cur);
6118
+ const neighbors = this.getNeighbors(cur);
6119
+ for (const neighbor of neighbors) {
6120
+ if (!visitedMap.get(neighbor)) {
6121
+ findCyclesDFS(neighbor, cur);
6122
+ } else if (stack.includes(neighbor) && neighbor !== parent) {
6123
+ const cycleStartIndex = stack.indexOf(neighbor);
6124
+ const cycle = stack.slice(cycleStartIndex);
6125
+ const cycleLow = Math.min(...cycle.map((v) => dfnMap.get(v) || Infinity));
6126
+ cycles.set(cycleLow, cycle);
6127
+ }
6128
+ }
6129
+ stack.pop();
6130
+ };
6131
+ vertexMap.forEach((v) => {
6132
+ if (!visitedMap.get(v)) {
6133
+ findCyclesDFS(v, void 0);
6162
6134
  }
6163
6135
  });
6164
6136
  }
@@ -7285,23 +7257,6 @@ var dataStructureTyped = (() => {
7285
7257
  }
7286
7258
  };
7287
7259
 
7288
- // src/types/data-structures/binary-tree/binary-tree.ts
7289
- var IterationType = /* @__PURE__ */ ((IterationType3) => {
7290
- IterationType3["ITERATIVE"] = "ITERATIVE";
7291
- IterationType3["RECURSIVE"] = "RECURSIVE";
7292
- return IterationType3;
7293
- })(IterationType || {});
7294
- var FamilyPosition = /* @__PURE__ */ ((FamilyPosition2) => {
7295
- FamilyPosition2["ROOT"] = "ROOT";
7296
- FamilyPosition2["LEFT"] = "LEFT";
7297
- FamilyPosition2["RIGHT"] = "RIGHT";
7298
- FamilyPosition2["ROOT_LEFT"] = "ROOT_LEFT";
7299
- FamilyPosition2["ROOT_RIGHT"] = "ROOT_RIGHT";
7300
- FamilyPosition2["ISOLATED"] = "ISOLATED";
7301
- FamilyPosition2["MAL_NODE"] = "MAL_NODE";
7302
- return FamilyPosition2;
7303
- })(FamilyPosition || {});
7304
-
7305
7260
  // src/types/data-structures/binary-tree/rb-tree.ts
7306
7261
  var RBTNColor = /* @__PURE__ */ ((RBTNColor2) => {
7307
7262
  RBTNColor2[RBTNColor2["RED"] = 1] = "RED";
@@ -7321,6 +7276,21 @@ var dataStructureTyped = (() => {
7321
7276
  CP2["gt"] = "gt";
7322
7277
  return CP2;
7323
7278
  })(CP || {});
7279
+ var IterationType = /* @__PURE__ */ ((IterationType3) => {
7280
+ IterationType3["ITERATIVE"] = "ITERATIVE";
7281
+ IterationType3["RECURSIVE"] = "RECURSIVE";
7282
+ return IterationType3;
7283
+ })(IterationType || {});
7284
+ var FamilyPosition = /* @__PURE__ */ ((FamilyPosition2) => {
7285
+ FamilyPosition2["ROOT"] = "ROOT";
7286
+ FamilyPosition2["LEFT"] = "LEFT";
7287
+ FamilyPosition2["RIGHT"] = "RIGHT";
7288
+ FamilyPosition2["ROOT_LEFT"] = "ROOT_LEFT";
7289
+ FamilyPosition2["ROOT_RIGHT"] = "ROOT_RIGHT";
7290
+ FamilyPosition2["ISOLATED"] = "ISOLATED";
7291
+ FamilyPosition2["MAL_NODE"] = "MAL_NODE";
7292
+ return FamilyPosition2;
7293
+ })(FamilyPosition || {});
7324
7294
 
7325
7295
  // src/data-structures/binary-tree/binary-tree.ts
7326
7296
  var BinaryTreeNode = class {
@@ -7371,7 +7341,7 @@ var dataStructureTyped = (() => {
7371
7341
  var BinaryTree = class _BinaryTree extends IterableEntryBase {
7372
7342
  /**
7373
7343
  * The constructor function initializes a binary tree object with optional elements and options.
7374
- * @param [elements] - An optional iterable of BTNodeExemplar objects. These objects represent the
7344
+ * @param [elements] - An optional iterable of BTNExemplar objects. These objects represent the
7375
7345
  * elements to be added to the binary tree.
7376
7346
  * @param [options] - The `options` parameter is an optional object that can contain additional
7377
7347
  * configuration options for the binary tree. In this case, it is of type
@@ -7428,7 +7398,7 @@ var dataStructureTyped = (() => {
7428
7398
  }
7429
7399
  /**
7430
7400
  * The function "isNode" checks if an exemplar is an instance of the BinaryTreeNode class.
7431
- * @param exemplar - The `exemplar` parameter is a variable of type `BTNodeExemplar<K, V,N>`.
7401
+ * @param exemplar - The `exemplar` parameter is a variable of type `BTNExemplar<K, V,N>`.
7432
7402
  * @returns a boolean value indicating whether the exemplar is an instance of the class N.
7433
7403
  */
7434
7404
  isNode(exemplar) {
@@ -7436,7 +7406,7 @@ var dataStructureTyped = (() => {
7436
7406
  }
7437
7407
  /**
7438
7408
  * The function `exemplarToNode` converts an exemplar object into a node object.
7439
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
7409
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`.
7440
7410
  * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
7441
7411
  * `exemplarToNode` function. It represents the value associated with the exemplar node. If no value
7442
7412
  * is provided, it will be `undefined`.
@@ -7468,7 +7438,7 @@ var dataStructureTyped = (() => {
7468
7438
  }
7469
7439
  /**
7470
7440
  * The function checks if a given value is an entry in a binary tree node.
7471
- * @param kne - BTNodeExemplar<K, V,N> - A generic type representing a node in a binary tree. It has
7441
+ * @param kne - BTNExemplar<K, V,N> - A generic type representing a node in a binary tree. It has
7472
7442
  * two type parameters V and N, representing the value and node type respectively.
7473
7443
  * @returns a boolean value.
7474
7444
  */
@@ -7540,7 +7510,7 @@ var dataStructureTyped = (() => {
7540
7510
  *
7541
7511
  * The `addMany` function takes in a collection of nodes and an optional collection of values, and
7542
7512
  * adds each node with its corresponding value to the data structure.
7543
- * @param nodes - An iterable collection of BTNodeExemplar objects.
7513
+ * @param nodes - An iterable collection of BTNExemplar objects.
7544
7514
  * @param [values] - An optional iterable of values that will be assigned to each node being added.
7545
7515
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
7546
7516
  */
@@ -7583,7 +7553,7 @@ var dataStructureTyped = (() => {
7583
7553
  * @param {C} callback - The `callback` parameter is a function that is used to determine the
7584
7554
  * identifier of the node to be deleted. It is optional and has a default value of
7585
7555
  * `this._defaultOneParamCallback`. The `callback` function should return the identifier of the node.
7586
- * @returns an array of `BiTreeDeleteResult<N>`.
7556
+ * @returns an array of `BinaryTreeDeleteResult<N>`.
7587
7557
  */
7588
7558
  delete(identifier, callback = this._defaultOneParamCallback) {
7589
7559
  const deletedResult = [];
@@ -8248,7 +8218,7 @@ var dataStructureTyped = (() => {
8248
8218
  * @returns a boolean value.
8249
8219
  */
8250
8220
  isRealNode(node) {
8251
- return node instanceof BinaryTreeNode && node.key.toString() !== "NaN";
8221
+ return node instanceof BinaryTreeNode && String(node.key) !== "NaN";
8252
8222
  }
8253
8223
  /**
8254
8224
  * The function checks if a given node is a BinaryTreeNode instance and has a key value of NaN.
@@ -8256,7 +8226,7 @@ var dataStructureTyped = (() => {
8256
8226
  * @returns a boolean value.
8257
8227
  */
8258
8228
  isNIL(node) {
8259
- return node instanceof BinaryTreeNode && node.key.toString() === "NaN";
8229
+ return node instanceof BinaryTreeNode && String(node.key) === "NaN";
8260
8230
  }
8261
8231
  /**
8262
8232
  * The function checks if a given node is a real node or null.
@@ -8267,7 +8237,7 @@ var dataStructureTyped = (() => {
8267
8237
  return this.isRealNode(node) || node === null;
8268
8238
  }
8269
8239
  /**
8270
- * The function "isNotNodeInstance" checks if a potential key is a number.
8240
+ * The function "isNotNodeInstance" checks if a potential key is a K.
8271
8241
  * @param {any} potentialKey - The potentialKey parameter is of type any, which means it can be any
8272
8242
  * data type.
8273
8243
  * @returns a boolean value indicating whether the potentialKey is of type number or not.
@@ -8535,19 +8505,23 @@ var dataStructureTyped = (() => {
8535
8505
  return levelsNodes;
8536
8506
  }
8537
8507
  /**
8538
- * The function `getPredecessor` returns the predecessor node of a given node in a binary tree.
8539
- * @param {K | N | null | undefined} node - The `node` parameter can be of type `K`, `N`,
8540
- * `null`, or `undefined`.
8541
- * @returns The function `getPredecessor` returns a value of type `N | undefined`.
8508
+ * Time Complexity: O(log n)
8509
+ * Space Complexity: O(1)
8510
+ */
8511
+ /**
8512
+ * Time Complexity: O(log n)
8513
+ * Space Complexity: O(1)
8514
+ *
8515
+ * The function returns the predecessor of a given node in a tree.
8516
+ * @param {N} node - The parameter `node` is of type `RedBlackTreeNode`, which represents a node in a
8517
+ * tree.
8518
+ * @returns the predecessor of the given 'node'.
8542
8519
  */
8543
8520
  getPredecessor(node) {
8544
- node = this.ensureNode(node);
8545
- if (!this.isRealNode(node))
8546
- return void 0;
8547
- if (node.left) {
8521
+ if (this.isRealNode(node.left)) {
8548
8522
  let predecessor = node.left;
8549
8523
  while (!this.isRealNode(predecessor) || this.isRealNode(predecessor.right) && predecessor.right !== node) {
8550
- if (predecessor) {
8524
+ if (this.isRealNode(predecessor)) {
8551
8525
  predecessor = predecessor.right;
8552
8526
  }
8553
8527
  }
@@ -8564,13 +8538,13 @@ var dataStructureTyped = (() => {
8564
8538
  */
8565
8539
  getSuccessor(x) {
8566
8540
  x = this.ensureNode(x);
8567
- if (!x)
8541
+ if (!this.isRealNode(x))
8568
8542
  return void 0;
8569
- if (x.right) {
8543
+ if (this.isRealNode(x.right)) {
8570
8544
  return this.getLeftMost(x.right);
8571
8545
  }
8572
8546
  let y = x.parent;
8573
- while (y && y && x === y.right) {
8547
+ while (this.isRealNode(y) && x === y.right) {
8574
8548
  x = y;
8575
8549
  y = y.parent;
8576
8550
  }
@@ -8985,7 +8959,7 @@ var dataStructureTyped = (() => {
8985
8959
  /**
8986
8960
  * This is the constructor function for a binary search tree class in TypeScript, which initializes
8987
8961
  * the tree with optional elements and options.
8988
- * @param [elements] - An optional iterable of BTNodeExemplar objects that will be added to the
8962
+ * @param [elements] - An optional iterable of BTNExemplar objects that will be added to the
8989
8963
  * binary search tree.
8990
8964
  * @param [options] - The `options` parameter is an optional object that can contain additional
8991
8965
  * configuration options for the binary search tree. It can have the following properties:
@@ -9036,7 +9010,7 @@ var dataStructureTyped = (() => {
9036
9010
  }
9037
9011
  /**
9038
9012
  * The function checks if an exemplar is an instance of BSTNode.
9039
- * @param exemplar - The `exemplar` parameter is a variable of type `BTNodeExemplar<K, V, N>`.
9013
+ * @param exemplar - The `exemplar` parameter is a variable of type `BTNExemplar<K, V, N>`.
9040
9014
  * @returns a boolean value indicating whether the exemplar is an instance of the BSTNode class.
9041
9015
  */
9042
9016
  isNode(exemplar) {
@@ -9045,7 +9019,7 @@ var dataStructureTyped = (() => {
9045
9019
  /**
9046
9020
  * The function `exemplarToNode` takes an exemplar and returns a node if the exemplar is valid,
9047
9021
  * otherwise it returns undefined.
9048
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`, where:
9022
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`, where:
9049
9023
  * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
9050
9024
  * `exemplarToNode` function. It represents the value associated with the exemplar node.
9051
9025
  * @returns a node of type N or undefined.
@@ -9299,6 +9273,15 @@ var dataStructureTyped = (() => {
9299
9273
  }
9300
9274
  }
9301
9275
  }
9276
+ /**
9277
+ * The function "isNotNodeInstance" checks if a potential key is a K.
9278
+ * @param {any} potentialKey - The potentialKey parameter is of type any, which means it can be any
9279
+ * data type.
9280
+ * @returns a boolean value indicating whether the potentialKey is of type number or not.
9281
+ */
9282
+ isNotNodeInstance(potentialKey) {
9283
+ return !(potentialKey instanceof BSTNode);
9284
+ }
9302
9285
  /**
9303
9286
  * Time Complexity: O(log n) - Average case for a balanced tree.
9304
9287
  * Space Complexity: O(log n) - Space for the recursive call stack in the worst case.
@@ -10027,7 +10010,7 @@ var dataStructureTyped = (() => {
10027
10010
  var AVLTree = class _AVLTree extends BST {
10028
10011
  /**
10029
10012
  * The constructor function initializes an AVLTree object with optional elements and options.
10030
- * @param [elements] - The `elements` parameter is an optional iterable of `BTNodeExemplar<K, V, N>`
10013
+ * @param [elements] - The `elements` parameter is an optional iterable of `BTNExemplar<K, V, N>`
10031
10014
  * objects. It represents a collection of elements that will be added to the AVL tree during
10032
10015
  * initialization.
10033
10016
  * @param [options] - The `options` parameter is an optional object that allows you to customize the
@@ -10066,12 +10049,21 @@ var dataStructureTyped = (() => {
10066
10049
  }
10067
10050
  /**
10068
10051
  * The function checks if an exemplar is an instance of AVLTreeNode.
10069
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
10052
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`.
10070
10053
  * @returns a boolean value indicating whether the exemplar is an instance of the AVLTreeNode class.
10071
10054
  */
10072
10055
  isNode(exemplar) {
10073
10056
  return exemplar instanceof AVLTreeNode;
10074
10057
  }
10058
+ /**
10059
+ * The function "isNotNodeInstance" checks if a potential key is a K.
10060
+ * @param {any} potentialKey - The potentialKey parameter is of type any, which means it can be any
10061
+ * data type.
10062
+ * @returns a boolean value indicating whether the potentialKey is of type number or not.
10063
+ */
10064
+ isNotNodeInstance(potentialKey) {
10065
+ return !(potentialKey instanceof AVLTreeNode);
10066
+ }
10075
10067
  /**
10076
10068
  * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity.
10077
10069
  * Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
@@ -10113,7 +10105,7 @@ var dataStructureTyped = (() => {
10113
10105
  * that is deleted from the binary tree. It is an optional parameter and if not provided, it will
10114
10106
  * default to the `_defaultOneParamCallback` function. The `callback` function should have a single
10115
10107
  * parameter of type `N
10116
- * @returns The method is returning an array of `BiTreeDeleteResult<N>`.
10108
+ * @returns The method is returning an array of `BinaryTreeDeleteResult<N>`.
10117
10109
  */
10118
10110
  delete(identifier, callback = this._defaultOneParamCallback) {
10119
10111
  if (identifier instanceof AVLTreeNode)
@@ -10443,7 +10435,7 @@ var dataStructureTyped = (() => {
10443
10435
  /**
10444
10436
  * This is the constructor function for a Red-Black Tree data structure in TypeScript, which
10445
10437
  * initializes the tree with optional elements and options.
10446
- * @param [elements] - The `elements` parameter is an optional iterable of `BTNodeExemplar<K, V, N>`
10438
+ * @param [elements] - The `elements` parameter is an optional iterable of `BTNExemplar<K, V, N>`
10447
10439
  * objects. It represents the initial elements that will be added to the RBTree during its
10448
10440
  * construction. If this parameter is provided, the `addMany` method is called to add all the
10449
10441
  * elements to the
@@ -10496,16 +10488,25 @@ var dataStructureTyped = (() => {
10496
10488
  }
10497
10489
  /**
10498
10490
  * The function checks if an exemplar is an instance of the RedBlackTreeNode class.
10499
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
10491
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`.
10500
10492
  * @returns a boolean value indicating whether the exemplar is an instance of the RedBlackTreeNode
10501
10493
  * class.
10502
10494
  */
10503
10495
  isNode(exemplar) {
10504
10496
  return exemplar instanceof RedBlackTreeNode;
10505
10497
  }
10498
+ /**
10499
+ * The function "isNotNodeInstance" checks if a potential key is a K.
10500
+ * @param {any} potentialKey - The potentialKey parameter is of type any, which means it can be any
10501
+ * data type.
10502
+ * @returns a boolean value indicating whether the potentialKey is of type number or not.
10503
+ */
10504
+ isNotNodeInstance(potentialKey) {
10505
+ return !(potentialKey instanceof RedBlackTreeNode);
10506
+ }
10506
10507
  /**
10507
10508
  * The function `exemplarToNode` takes an exemplar and converts it into a node object if possible.
10508
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`, where:
10509
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`, where:
10509
10510
  * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
10510
10511
  * `exemplarToNode` function. It represents the value associated with the exemplar node. If a value
10511
10512
  * is provided, it will be used when creating the new node. If no value is provided, the new node
@@ -10607,7 +10608,7 @@ var dataStructureTyped = (() => {
10607
10608
  * @param {C} callback - The `callback` parameter is a function that takes a node of type `N` and
10608
10609
  * returns a value of type `ReturnType<C>`. It is used to determine if a node should be deleted based
10609
10610
  * on its identifier. The `callback` function is optional and defaults to `this._defaultOneParam
10610
- * @returns an array of `BiTreeDeleteResult<N>`.
10611
+ * @returns an array of `BinaryTreeDeleteResult<N>`.
10611
10612
  */
10612
10613
  delete(identifier, callback = this._defaultOneParamCallback) {
10613
10614
  const ans = [];
@@ -10667,7 +10668,9 @@ var dataStructureTyped = (() => {
10667
10668
  * Space Complexity: O(1)
10668
10669
  */
10669
10670
  isRealNode(node) {
10670
- return node !== this.Sentinel && node !== void 0;
10671
+ if (node === this.Sentinel || node === void 0)
10672
+ return false;
10673
+ return node instanceof RedBlackTreeNode;
10671
10674
  }
10672
10675
  /**
10673
10676
  * Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
@@ -10696,41 +10699,17 @@ var dataStructureTyped = (() => {
10696
10699
  */
10697
10700
  getNode(identifier, callback = this._defaultOneParamCallback, beginRoot = this.root, iterationType = this.iterationType) {
10698
10701
  var _a;
10699
- if (identifier instanceof BinaryTreeNode)
10702
+ if (identifier instanceof RedBlackTreeNode)
10700
10703
  callback = (node) => node;
10701
10704
  beginRoot = this.ensureNode(beginRoot);
10702
10705
  return (_a = this.getNodes(identifier, callback, true, beginRoot, iterationType)[0]) != null ? _a : void 0;
10703
10706
  }
10704
10707
  /**
10705
- * Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
10706
- * Space Complexity: O(1)
10707
- */
10708
- /**
10709
- * Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
10710
- * Space Complexity: O(1)
10711
- *
10712
- * The function returns the successor of a given node in a red-black tree.
10713
- * @param {RedBlackTreeNode} x - RedBlackTreeNode - The node for which we want to find the successor.
10714
- * @returns the successor of the given RedBlackTreeNode.
10715
- */
10716
- getSuccessor(x) {
10717
- var _a;
10718
- if (x.right !== this.Sentinel) {
10719
- return (_a = this.getLeftMost(x.right)) != null ? _a : void 0;
10720
- }
10721
- let y = x.parent;
10722
- while (y !== this.Sentinel && y !== void 0 && x === y.right) {
10723
- x = y;
10724
- y = y.parent;
10725
- }
10726
- return y;
10727
- }
10728
- /**
10729
- * Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
10708
+ * Time Complexity: O(log n)
10730
10709
  * Space Complexity: O(1)
10731
10710
  */
10732
10711
  /**
10733
- * Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
10712
+ * Time Complexity: O(log n)
10734
10713
  * Space Complexity: O(1)
10735
10714
  *
10736
10715
  * The function returns the predecessor of a given node in a red-black tree.
@@ -10739,11 +10718,11 @@ var dataStructureTyped = (() => {
10739
10718
  * @returns the predecessor of the given RedBlackTreeNode 'x'.
10740
10719
  */
10741
10720
  getPredecessor(x) {
10742
- if (x.left !== this.Sentinel) {
10721
+ if (this.isRealNode(x.left)) {
10743
10722
  return this.getRightMost(x.left);
10744
10723
  }
10745
10724
  let y = x.parent;
10746
- while (y !== this.Sentinel && x === y.left) {
10725
+ while (this.isRealNode(y) && x === y.left) {
10747
10726
  x = y;
10748
10727
  y = y.parent;
10749
10728
  }
@@ -11040,16 +11019,25 @@ var dataStructureTyped = (() => {
11040
11019
  }
11041
11020
  /**
11042
11021
  * The function checks if an exemplar is an instance of the TreeMultimapNode class.
11043
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
11022
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`.
11044
11023
  * @returns a boolean value indicating whether the exemplar is an instance of the TreeMultimapNode
11045
11024
  * class.
11046
11025
  */
11047
11026
  isNode(exemplar) {
11048
11027
  return exemplar instanceof TreeMultimapNode;
11049
11028
  }
11029
+ /**
11030
+ * The function "isNotNodeInstance" checks if a potential key is a K.
11031
+ * @param {any} potentialKey - The potentialKey parameter is of type any, which means it can be any
11032
+ * data type.
11033
+ * @returns a boolean value indicating whether the potentialKey is of type number or not.
11034
+ */
11035
+ isNotNodeInstance(potentialKey) {
11036
+ return !(potentialKey instanceof TreeMultimapNode);
11037
+ }
11050
11038
  /**
11051
11039
  * The function `exemplarToNode` converts an exemplar object into a node object.
11052
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`, which means it
11040
+ * @param exemplar - The `exemplar` parameter is of type `BTNExemplar<K, V, N>`, which means it
11053
11041
  * can be one of the following:
11054
11042
  * @param {V} [value] - The `value` parameter is an optional argument that represents the value
11055
11043
  * associated with the node. It is of type `V`, which can be any data type. If no value is provided,
@@ -11197,7 +11185,7 @@ var dataStructureTyped = (() => {
11197
11185
  * being deleted. If set to true, the count of the node will not be considered and the node will be
11198
11186
  * deleted regardless of its count. If set to false (default), the count of the node will be
11199
11187
  * decremented by 1 and
11200
- * @returns an array of `BiTreeDeleteResult<N>`.
11188
+ * @returns an array of `BinaryTreeDeleteResult<N>`.
11201
11189
  */
11202
11190
  delete(identifier, callback = this._defaultOneParamCallback, ignoreCount = false) {
11203
11191
  var _a;
@@ -11393,6 +11381,43 @@ var dataStructureTyped = (() => {
11393
11381
  }
11394
11382
  };
11395
11383
 
11384
+ // src/data-structures/priority-queue/priority-queue.ts
11385
+ var PriorityQueue = class extends Heap {
11386
+ constructor(elements, options) {
11387
+ super(elements, options);
11388
+ }
11389
+ };
11390
+
11391
+ // src/data-structures/priority-queue/min-priority-queue.ts
11392
+ var MinPriorityQueue = class extends PriorityQueue {
11393
+ constructor(elements, options = {
11394
+ comparator: (a, b) => {
11395
+ if (!(typeof a === "number" && typeof b === "number")) {
11396
+ throw new Error("The a, b params of compare function must be number");
11397
+ } else {
11398
+ return a - b;
11399
+ }
11400
+ }
11401
+ }) {
11402
+ super(elements, options);
11403
+ }
11404
+ };
11405
+
11406
+ // src/data-structures/priority-queue/max-priority-queue.ts
11407
+ var MaxPriorityQueue = class extends PriorityQueue {
11408
+ constructor(elements, options = {
11409
+ comparator: (a, b) => {
11410
+ if (!(typeof a === "number" && typeof b === "number")) {
11411
+ throw new Error("The a, b params of compare function must be number");
11412
+ } else {
11413
+ return b - a;
11414
+ }
11415
+ }
11416
+ }) {
11417
+ super(elements, options);
11418
+ }
11419
+ };
11420
+
11396
11421
  // src/data-structures/matrix/matrix.ts
11397
11422
  var MatrixNTI2D = class {
11398
11423
  /**