data-structure-typed 1.52.3 → 1.52.5

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 (181) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/README.md +13 -13
  3. package/README_zh-CN.md +216 -26
  4. package/benchmark/report.html +13 -13
  5. package/benchmark/report.json +158 -158
  6. package/dist/cjs/data-structures/base/iterable-element-base.d.ts +1 -37
  7. package/dist/cjs/data-structures/base/iterable-element-base.js +1 -37
  8. package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
  9. package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +2 -54
  10. package/dist/cjs/data-structures/base/iterable-entry-base.js +1 -49
  11. package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
  13. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
  14. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
  16. package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -46
  17. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
  19. package/dist/cjs/data-structures/binary-tree/binary-tree.js +299 -331
  20. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/bst.d.ts +1 -40
  22. package/dist/cjs/data-structures/binary-tree/bst.js +12 -44
  23. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  24. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
  25. package/dist/cjs/data-structures/binary-tree/rb-tree.js +2 -50
  26. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  27. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
  28. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +9 -41
  29. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  30. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -75
  31. package/dist/cjs/data-structures/graph/abstract-graph.js +0 -75
  32. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  33. package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -98
  34. package/dist/cjs/data-structures/graph/directed-graph.js +0 -98
  35. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  36. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -50
  37. package/dist/cjs/data-structures/graph/undirected-graph.js +0 -50
  38. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  39. package/dist/cjs/data-structures/hash/hash-map.d.ts +5 -92
  40. package/dist/cjs/data-structures/hash/hash-map.js +29 -115
  41. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  42. package/dist/cjs/data-structures/heap/heap.d.ts +0 -32
  43. package/dist/cjs/data-structures/heap/heap.js +0 -32
  44. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  45. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
  46. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +5 -88
  47. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  48. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
  49. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +2 -84
  50. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  51. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
  52. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +1 -35
  53. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
  54. package/dist/cjs/data-structures/queue/deque.d.ts +1 -98
  55. package/dist/cjs/data-structures/queue/deque.js +3 -99
  56. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  57. package/dist/cjs/data-structures/queue/queue.d.ts +5 -58
  58. package/dist/cjs/data-structures/queue/queue.js +4 -57
  59. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  60. package/dist/cjs/data-structures/stack/stack.d.ts +1 -34
  61. package/dist/cjs/data-structures/stack/stack.js +1 -34
  62. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  63. package/dist/cjs/data-structures/tree/tree.js +0 -1
  64. package/dist/cjs/data-structures/tree/tree.js.map +1 -1
  65. package/dist/cjs/data-structures/trie/trie.d.ts +0 -64
  66. package/dist/cjs/data-structures/trie/trie.js +0 -64
  67. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  68. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
  69. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +6 -0
  70. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
  71. package/dist/cjs/types/utils/utils.d.ts +13 -12
  72. package/dist/cjs/utils/number.d.ts +13 -0
  73. package/dist/cjs/utils/number.js +13 -0
  74. package/dist/cjs/utils/number.js.map +1 -1
  75. package/dist/cjs/utils/utils.d.ts +125 -3
  76. package/dist/cjs/utils/utils.js +177 -21
  77. package/dist/cjs/utils/utils.js.map +1 -1
  78. package/dist/mjs/data-structures/base/iterable-element-base.d.ts +1 -37
  79. package/dist/mjs/data-structures/base/iterable-element-base.js +1 -37
  80. package/dist/mjs/data-structures/base/iterable-entry-base.d.ts +2 -54
  81. package/dist/mjs/data-structures/base/iterable-entry-base.js +1 -49
  82. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
  83. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
  84. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
  85. package/dist/mjs/data-structures/binary-tree/avl-tree.js +0 -46
  86. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
  87. package/dist/mjs/data-structures/binary-tree/binary-tree.js +298 -332
  88. package/dist/mjs/data-structures/binary-tree/bst.d.ts +1 -40
  89. package/dist/mjs/data-structures/binary-tree/bst.js +12 -44
  90. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
  91. package/dist/mjs/data-structures/binary-tree/rb-tree.js +2 -50
  92. package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
  93. package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +9 -41
  94. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +0 -75
  95. package/dist/mjs/data-structures/graph/abstract-graph.js +0 -75
  96. package/dist/mjs/data-structures/graph/directed-graph.d.ts +0 -98
  97. package/dist/mjs/data-structures/graph/directed-graph.js +0 -98
  98. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +0 -50
  99. package/dist/mjs/data-structures/graph/undirected-graph.js +0 -50
  100. package/dist/mjs/data-structures/hash/hash-map.d.ts +5 -92
  101. package/dist/mjs/data-structures/hash/hash-map.js +29 -115
  102. package/dist/mjs/data-structures/heap/heap.d.ts +0 -32
  103. package/dist/mjs/data-structures/heap/heap.js +0 -32
  104. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
  105. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +5 -88
  106. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
  107. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -84
  108. package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
  109. package/dist/mjs/data-structures/linked-list/skip-linked-list.js +1 -35
  110. package/dist/mjs/data-structures/queue/deque.d.ts +1 -98
  111. package/dist/mjs/data-structures/queue/deque.js +3 -99
  112. package/dist/mjs/data-structures/queue/queue.d.ts +5 -58
  113. package/dist/mjs/data-structures/queue/queue.js +4 -57
  114. package/dist/mjs/data-structures/stack/stack.d.ts +1 -34
  115. package/dist/mjs/data-structures/stack/stack.js +1 -34
  116. package/dist/mjs/data-structures/tree/tree.js +0 -1
  117. package/dist/mjs/data-structures/trie/trie.d.ts +0 -64
  118. package/dist/mjs/data-structures/trie/trie.js +0 -64
  119. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
  120. package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +5 -1
  121. package/dist/mjs/types/utils/utils.d.ts +13 -12
  122. package/dist/mjs/utils/number.d.ts +13 -0
  123. package/dist/mjs/utils/number.js +13 -0
  124. package/dist/mjs/utils/utils.d.ts +125 -3
  125. package/dist/mjs/utils/utils.js +177 -21
  126. package/dist/umd/data-structure-typed.js +414 -1482
  127. package/dist/umd/data-structure-typed.min.js +5 -4
  128. package/dist/umd/data-structure-typed.min.js.map +1 -1
  129. package/package.json +6 -6
  130. package/src/data-structures/base/iterable-element-base.ts +2 -42
  131. package/src/data-structures/base/iterable-entry-base.ts +3 -62
  132. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +8 -48
  133. package/src/data-structures/binary-tree/avl-tree.ts +0 -57
  134. package/src/data-structures/binary-tree/binary-tree.ts +329 -358
  135. package/src/data-structures/binary-tree/bst.ts +11 -54
  136. package/src/data-structures/binary-tree/rb-tree.ts +2 -62
  137. package/src/data-structures/binary-tree/tree-multi-map.ts +8 -48
  138. package/src/data-structures/graph/abstract-graph.ts +0 -92
  139. package/src/data-structures/graph/directed-graph.ts +0 -122
  140. package/src/data-structures/graph/undirected-graph.ts +0 -62
  141. package/src/data-structures/hash/hash-map.ts +31 -139
  142. package/src/data-structures/heap/heap.ts +0 -40
  143. package/src/data-structures/linked-list/doubly-linked-list.ts +5 -112
  144. package/src/data-structures/linked-list/singly-linked-list.ts +2 -104
  145. package/src/data-structures/linked-list/skip-linked-list.ts +1 -44
  146. package/src/data-structures/queue/deque.ts +2 -125
  147. package/src/data-structures/queue/queue.ts +5 -72
  148. package/src/data-structures/stack/stack.ts +1 -43
  149. package/src/data-structures/tree/tree.ts +1 -1
  150. package/src/data-structures/trie/trie.ts +0 -80
  151. package/src/types/data-structures/binary-tree/binary-tree.ts +8 -1
  152. package/src/types/utils/utils.ts +17 -15
  153. package/src/utils/number.ts +13 -0
  154. package/src/utils/utils.ts +174 -18
  155. package/test/config.ts +8 -0
  156. package/test/integration/all-in-one.test.ts +1 -1
  157. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +13 -13
  158. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +18 -13
  159. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +471 -64
  160. package/test/unit/data-structures/binary-tree/bst.test.ts +167 -23
  161. package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
  162. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +136 -13
  163. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +18 -13
  164. package/test/unit/data-structures/graph/directed-graph.test.ts +46 -32
  165. package/test/unit/data-structures/graph/map-graph.test.ts +24 -2
  166. package/test/unit/data-structures/graph/undirected-graph.test.ts +24 -24
  167. package/test/unit/data-structures/hash/hash-map.test.ts +225 -35
  168. package/test/unit/data-structures/heap/heap.test.ts +47 -39
  169. package/test/unit/data-structures/heap/min-heap.test.ts +5 -5
  170. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +34 -4
  171. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +32 -0
  172. package/test/unit/data-structures/matrix/matrix.test.ts +35 -5
  173. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +31 -0
  174. package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +18 -0
  175. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +17 -0
  176. package/test/unit/data-structures/queue/deque.test.ts +288 -47
  177. package/test/unit/data-structures/queue/queue.test.ts +62 -37
  178. package/test/unit/data-structures/stack/stack.test.ts +30 -5
  179. package/test/unit/data-structures/tree/tree.test.ts +58 -0
  180. package/test/unit/data-structures/trie/trie.test.ts +46 -5
  181. package/test/unit/utils/utils.test.ts +169 -0
@@ -114,6 +114,7 @@ var dataStructureTyped = (() => {
114
114
  BinaryTree: () => BinaryTree,
115
115
  BinaryTreeNode: () => BinaryTreeNode,
116
116
  Character: () => Character,
117
+ DFSOperation: () => DFSOperation,
117
118
  Deque: () => Deque,
118
119
  DirectedEdge: () => DirectedEdge,
119
120
  DirectedGraph: () => DirectedGraph,
@@ -196,10 +197,6 @@ var dataStructureTyped = (() => {
196
197
  *[Symbol.iterator](...args) {
197
198
  yield* __yieldStar(this._getIterator(...args));
198
199
  }
199
- /**
200
- * Time Complexity: O(n)
201
- * Space Complexity: O(n)
202
- */
203
200
  /**
204
201
  * Time Complexity: O(n)
205
202
  * Space Complexity: O(n)
@@ -212,10 +209,6 @@ var dataStructureTyped = (() => {
212
209
  yield item;
213
210
  }
214
211
  }
215
- /**
216
- * Time Complexity: O(n)
217
- * Space Complexity: O(n)
218
- */
219
212
  /**
220
213
  * Time Complexity: O(n)
221
214
  * Space Complexity: O(n)
@@ -227,10 +220,6 @@ var dataStructureTyped = (() => {
227
220
  yield item[0];
228
221
  }
229
222
  }
230
- /**
231
- * Time Complexity: O(n)
232
- * Space Complexity: O(n)
233
- */
234
223
  /**
235
224
  * Time Complexity: O(n)
236
225
  * Space Complexity: O(n)
@@ -242,10 +231,6 @@ var dataStructureTyped = (() => {
242
231
  yield item[1];
243
232
  }
244
233
  }
245
- /**
246
- * Time Complexity: O(n)
247
- * Space Complexity: O(1)
248
- */
249
234
  /**
250
235
  * Time Complexity: O(n)
251
236
  * Space Complexity: O(1)
@@ -269,10 +254,6 @@ var dataStructureTyped = (() => {
269
254
  }
270
255
  return true;
271
256
  }
272
- /**
273
- * Time Complexity: O(n)
274
- * Space Complexity: O(1)
275
- */
276
257
  /**
277
258
  * Time Complexity: O(n)
278
259
  * Space Complexity: O(1)
@@ -297,14 +278,6 @@ var dataStructureTyped = (() => {
297
278
  }
298
279
  return false;
299
280
  }
300
- /**
301
- * Time Complexity: O(n)
302
- * Space Complexity: O(1)
303
- */
304
- /**
305
- * Time Complexity: O(n)
306
- * Space Complexity: O(1)
307
- */
308
281
  /**
309
282
  * Time Complexity: O(n)
310
283
  * Space Complexity: O(1)
@@ -325,10 +298,6 @@ var dataStructureTyped = (() => {
325
298
  callbackfn.call(thisArg, value, key, index++, this);
326
299
  }
327
300
  }
328
- /**
329
- * Time Complexity: O(n)
330
- * Space Complexity: O(1)
331
- */
332
301
  /**
333
302
  * Time Complexity: O(n)
334
303
  * Space Complexity: O(1)
@@ -355,10 +324,6 @@ var dataStructureTyped = (() => {
355
324
  }
356
325
  return;
357
326
  }
358
- /**
359
- * Time Complexity: O(n)
360
- * Space Complexity: O(1)
361
- */
362
327
  /**
363
328
  * Time Complexity: O(n)
364
329
  * Space Complexity: O(1)
@@ -377,10 +342,6 @@ var dataStructureTyped = (() => {
377
342
  }
378
343
  return false;
379
344
  }
380
- /**
381
- * Time Complexity: O(n)
382
- * Space Complexity: O(1)
383
- */
384
345
  /**
385
346
  * Time Complexity: O(n)
386
347
  * Space Complexity: O(1)
@@ -397,10 +358,6 @@ var dataStructureTyped = (() => {
397
358
  }
398
359
  return false;
399
360
  }
400
- /**
401
- * Time Complexity: O(n)
402
- * Space Complexity: O(1)
403
- */
404
361
  /**
405
362
  * Time Complexity: O(n)
406
363
  * Space Complexity: O(1)
@@ -444,10 +401,6 @@ var dataStructureTyped = (() => {
444
401
  }
445
402
  return accumulator;
446
403
  }
447
- /**
448
- * Time Complexity: O(n)
449
- * Space Complexity: O(n)
450
- */
451
404
  /**
452
405
  * Time Complexity: O(n)
453
406
  * Space Complexity: O(n)
@@ -455,7 +408,7 @@ var dataStructureTyped = (() => {
455
408
  * The print function logs the elements of an array to the console.
456
409
  */
457
410
  print() {
458
- console.log([...this]);
411
+ return [...this];
459
412
  }
460
413
  };
461
414
 
@@ -486,10 +439,6 @@ var dataStructureTyped = (() => {
486
439
  get toElementFn() {
487
440
  return this._toElementFn;
488
441
  }
489
- /**
490
- * Time Complexity: O(n)
491
- * Space Complexity: O(1)
492
- */
493
442
  /**
494
443
  * Time Complexity: O(n)
495
444
  * Space Complexity: O(1)
@@ -502,10 +451,6 @@ var dataStructureTyped = (() => {
502
451
  *[Symbol.iterator](...args) {
503
452
  yield* __yieldStar(this._getIterator(...args));
504
453
  }
505
- /**
506
- * Time Complexity: O(n)
507
- * Space Complexity: O(n)
508
- */
509
454
  /**
510
455
  * Time Complexity: O(n)
511
456
  * Space Complexity: O(n)
@@ -517,10 +462,6 @@ var dataStructureTyped = (() => {
517
462
  yield item;
518
463
  }
519
464
  }
520
- /**
521
- * Time Complexity: O(n)
522
- * Space Complexity: O(1)
523
- */
524
465
  /**
525
466
  * Time Complexity: O(n)
526
467
  * Space Complexity: O(1)
@@ -544,14 +485,6 @@ var dataStructureTyped = (() => {
544
485
  }
545
486
  return true;
546
487
  }
547
- /**
548
- * Time Complexity: O(n)
549
- * Space Complexity: O(1)
550
- */
551
- /**
552
- * Time Complexity: O(n)
553
- * Space Complexity: O(1)
554
- */
555
488
  /**
556
489
  * Time Complexity: O(n)
557
490
  * Space Complexity: O(1)
@@ -575,10 +508,6 @@ var dataStructureTyped = (() => {
575
508
  }
576
509
  return false;
577
510
  }
578
- /**
579
- * Time Complexity: O(n)
580
- * Space Complexity: O(1)
581
- */
582
511
  /**
583
512
  * Time Complexity: O(n)
584
513
  * Space Complexity: O(1)
@@ -598,10 +527,6 @@ var dataStructureTyped = (() => {
598
527
  callbackfn.call(thisArg, item, index++, this);
599
528
  }
600
529
  }
601
- /**
602
- * Time Complexity: O(n)
603
- * Space Complexity: O(1)
604
- */
605
530
  /**
606
531
  * Time Complexity: O(n)
607
532
  * Space Complexity: O(1)
@@ -643,10 +568,6 @@ var dataStructureTyped = (() => {
643
568
  }
644
569
  return false;
645
570
  }
646
- /**
647
- * Time Complexity: O(n)
648
- * Space Complexity: O(1)
649
- */
650
571
  /**
651
572
  * Time Complexity: O(n)
652
573
  * Space Complexity: O(1)
@@ -668,10 +589,6 @@ var dataStructureTyped = (() => {
668
589
  }
669
590
  return accumulator;
670
591
  }
671
- /**
672
- * Time Complexity: O(n)
673
- * Space Complexity: O(n)
674
- */
675
592
  /**
676
593
  * Time Complexity: O(n)
677
594
  * Space Complexity: O(n)
@@ -679,7 +596,7 @@ var dataStructureTyped = (() => {
679
596
  * The print function logs the elements of an array to the console.
680
597
  */
681
598
  print() {
682
- console.log([...this]);
599
+ return [...this];
683
600
  }
684
601
  };
685
602
 
@@ -760,28 +677,44 @@ var dataStructureTyped = (() => {
760
677
  const multiplier = Math.pow(10, digit);
761
678
  return Math.round(num * multiplier) / multiplier;
762
679
  };
763
- function isComparable(key) {
764
- const keyType = typeof key;
765
- if (keyType === "number")
766
- return !isNaN(key);
767
- if (keyType === "string")
768
- return true;
769
- if (keyType === "bigint")
770
- return true;
771
- if (keyType === "boolean")
772
- return true;
773
- if (keyType === "symbol")
680
+ function isPrimitiveComparable(value) {
681
+ const valueType = typeof value;
682
+ if (valueType === "number")
683
+ return !Number.isNaN(value);
684
+ return valueType === "bigint" || valueType === "string" || valueType === "boolean";
685
+ }
686
+ function tryObjectToPrimitive(obj) {
687
+ if (typeof obj.valueOf === "function") {
688
+ const valueOfResult = obj.valueOf();
689
+ if (valueOfResult !== obj) {
690
+ if (isPrimitiveComparable(valueOfResult))
691
+ return valueOfResult;
692
+ if (typeof valueOfResult === "object" && valueOfResult !== null)
693
+ return tryObjectToPrimitive(valueOfResult);
694
+ }
695
+ }
696
+ if (typeof obj.toString === "function") {
697
+ const stringResult = obj.toString();
698
+ if (stringResult !== "[object Object]")
699
+ return stringResult;
700
+ }
701
+ return null;
702
+ }
703
+ function isComparable(value, isForceObjectComparable = false) {
704
+ if (value === null || value === void 0)
774
705
  return false;
775
- if (keyType === "undefined")
706
+ if (isPrimitiveComparable(value))
707
+ return true;
708
+ if (typeof value !== "object")
776
709
  return false;
777
- if (keyType === "function")
778
- return isComparable(key());
779
- if (keyType === "object") {
780
- if (key === null)
781
- return true;
710
+ if (value instanceof Date)
711
+ return !Number.isNaN(value.getTime());
712
+ if (isForceObjectComparable)
713
+ return true;
714
+ const comparableValue = tryObjectToPrimitive(value);
715
+ if (comparableValue === null || comparableValue === void 0)
782
716
  return false;
783
- }
784
- return false;
717
+ return isPrimitiveComparable(comparableValue);
785
718
  }
786
719
 
787
720
  // src/utils/number.ts
@@ -809,12 +742,10 @@ var dataStructureTyped = (() => {
809
742
  __publicField(this, "_hashFn", (key) => String(key));
810
743
  if (options) {
811
744
  const { hashFn, toEntryFn } = options;
812
- if (hashFn) {
745
+ if (hashFn)
813
746
  this._hashFn = hashFn;
814
- }
815
- if (toEntryFn) {
747
+ if (toEntryFn)
816
748
  this._toEntryFn = toEntryFn;
817
- }
818
749
  }
819
750
  if (entryOrRawElements) {
820
751
  this.setMany(entryOrRawElements);
@@ -922,8 +853,8 @@ var dataStructureTyped = (() => {
922
853
  if (this.isEntry(rawEle)) {
923
854
  key = rawEle[0];
924
855
  value = rawEle[1];
925
- } else if (this.toEntryFn) {
926
- const item = this.toEntryFn(rawEle);
856
+ } else if (this._toEntryFn) {
857
+ const item = this._toEntryFn(rawEle);
927
858
  key = item[0];
928
859
  value = item[1];
929
860
  }
@@ -989,8 +920,7 @@ var dataStructureTyped = (() => {
989
920
  /**
990
921
  * Time Complexity: O(n)
991
922
  * Space Complexity: O(n)
992
- */
993
- /**
923
+ *
994
924
  * The clone function creates a new HashMap with the same key-value pairs as
995
925
  * this one. The clone function is useful for creating a copy of an existing
996
926
  * HashMap, and then modifying that copy without affecting the original.
@@ -998,12 +928,8 @@ var dataStructureTyped = (() => {
998
928
  * @return A new hashmap with the same values as this one
999
929
  */
1000
930
  clone() {
1001
- return new _HashMap(this, { hashFn: this.hashFn, toEntryFn: this.toEntryFn });
931
+ return new _HashMap(this, { hashFn: this._hashFn, toEntryFn: this._toEntryFn });
1002
932
  }
1003
- /**
1004
- * Time Complexity: O(n)
1005
- * Space Complexity: O(n)
1006
- */
1007
933
  /**
1008
934
  * Time Complexity: O(n)
1009
935
  * Space Complexity: O(n)
@@ -1052,17 +978,6 @@ var dataStructureTyped = (() => {
1052
978
  }
1053
979
  return filteredMap;
1054
980
  }
1055
- /**
1056
- * The put function sets a value in a data structure using a specified key.
1057
- * @param {K} key - The key parameter is of type K, which represents the type of the key being passed
1058
- * to the function.
1059
- * @param {V} value - The value parameter represents the value that you want to associate with the
1060
- * specified key in the data structure.
1061
- * @returns The method is returning a boolean value.
1062
- */
1063
- put(key, value) {
1064
- return this.set(key, value);
1065
- }
1066
981
  /**
1067
982
  * The function returns an iterator that yields key-value pairs from both an object store and an
1068
983
  * object map.
@@ -1095,7 +1010,7 @@ var dataStructureTyped = (() => {
1095
1010
  const keyType = typeof key;
1096
1011
  let strKey;
1097
1012
  if (keyType !== "string" && keyType !== "number" && keyType !== "symbol") {
1098
- strKey = this.hashFn(key);
1013
+ strKey = this._hashFn(key);
1099
1014
  } else {
1100
1015
  if (keyType === "number") {
1101
1016
  strKey = key;
@@ -1148,10 +1063,7 @@ var dataStructureTyped = (() => {
1148
1063
  }
1149
1064
  }
1150
1065
  if (entryOrRawElements) {
1151
- for (const el of entryOrRawElements) {
1152
- const [key, value] = this.toEntryFn(el);
1153
- this.set(key, value);
1154
- }
1066
+ this.setMany(entryOrRawElements);
1155
1067
  }
1156
1068
  }
1157
1069
  /**
@@ -1213,10 +1125,6 @@ var dataStructureTyped = (() => {
1213
1125
  get size() {
1214
1126
  return this._size;
1215
1127
  }
1216
- /**
1217
- * Time Complexity: O(1)
1218
- * Space Complexity: O(1)
1219
- */
1220
1128
  /**
1221
1129
  * Time Complexity: O(1)
1222
1130
  * Space Complexity: O(1)
@@ -1230,10 +1138,6 @@ var dataStructureTyped = (() => {
1230
1138
  return;
1231
1139
  return [this.head.key, this.head.value];
1232
1140
  }
1233
- /**
1234
- * Time Complexity: O(1)
1235
- * Space Complexity: O(1)
1236
- */
1237
1141
  /**
1238
1142
  * Time Complexity: O(1)
1239
1143
  * Space Complexity: O(1)
@@ -1268,10 +1172,6 @@ var dataStructureTyped = (() => {
1268
1172
  node = node.prev;
1269
1173
  }
1270
1174
  }
1271
- /**
1272
- * Time Complexity: O(1)
1273
- * Space Complexity: O(1)
1274
- */
1275
1175
  /**
1276
1176
  * Time Complexity: O(1)
1277
1177
  * Space Complexity: O(1)
@@ -1288,7 +1188,7 @@ var dataStructureTyped = (() => {
1288
1188
  let node;
1289
1189
  const isNewKey = !this.has(key);
1290
1190
  if (isWeakKey(key)) {
1291
- const hash = this.objHashFn(key);
1191
+ const hash = this._objHashFn(key);
1292
1192
  node = this.objMap.get(hash);
1293
1193
  if (!node && isNewKey) {
1294
1194
  node = { key: hash, value, prev: this.tail, next: this._sentinel };
@@ -1297,7 +1197,7 @@ var dataStructureTyped = (() => {
1297
1197
  node.value = value;
1298
1198
  }
1299
1199
  } else {
1300
- const hash = this.hashFn(key);
1200
+ const hash = this._hashFn(key);
1301
1201
  node = this.noObjMap[hash];
1302
1202
  if (!node && isNewKey) {
1303
1203
  this.noObjMap[hash] = node = { key, value, prev: this.tail, next: this._sentinel };
@@ -1330,8 +1230,17 @@ var dataStructureTyped = (() => {
1330
1230
  setMany(entryOrRawElements) {
1331
1231
  const results = [];
1332
1232
  for (const rawEle of entryOrRawElements) {
1333
- const [key, value] = this.toEntryFn(rawEle);
1334
- results.push(this.set(key, value));
1233
+ let key, value;
1234
+ if (this.isEntry(rawEle)) {
1235
+ key = rawEle[0];
1236
+ value = rawEle[1];
1237
+ } else if (this._toEntryFn) {
1238
+ const item = this._toEntryFn(rawEle);
1239
+ key = item[0];
1240
+ value = item[1];
1241
+ }
1242
+ if (key !== void 0 && value !== void 0)
1243
+ results.push(this.set(key, value));
1335
1244
  }
1336
1245
  return results;
1337
1246
  }
@@ -1343,17 +1252,13 @@ var dataStructureTyped = (() => {
1343
1252
  */
1344
1253
  has(key) {
1345
1254
  if (isWeakKey(key)) {
1346
- const hash = this.objHashFn(key);
1255
+ const hash = this._objHashFn(key);
1347
1256
  return this.objMap.has(hash);
1348
1257
  } else {
1349
- const hash = this.hashFn(key);
1258
+ const hash = this._hashFn(key);
1350
1259
  return hash in this.noObjMap;
1351
1260
  }
1352
1261
  }
1353
- /**
1354
- * Time Complexity: O(1)
1355
- * Space Complexity: O(1)
1356
- */
1357
1262
  /**
1358
1263
  * Time Complexity: O(1)
1359
1264
  * Space Complexity: O(1)
@@ -1369,19 +1274,15 @@ var dataStructureTyped = (() => {
1369
1274
  */
1370
1275
  get(key) {
1371
1276
  if (isWeakKey(key)) {
1372
- const hash = this.objHashFn(key);
1277
+ const hash = this._objHashFn(key);
1373
1278
  const node = this.objMap.get(hash);
1374
1279
  return node ? node.value : void 0;
1375
1280
  } else {
1376
- const hash = this.hashFn(key);
1281
+ const hash = this._hashFn(key);
1377
1282
  const node = this.noObjMap[hash];
1378
1283
  return node ? node.value : void 0;
1379
1284
  }
1380
1285
  }
1381
- /**
1382
- * Time Complexity: O(n)
1383
- * Space Complexity: O(1)
1384
- */
1385
1286
  /**
1386
1287
  * Time Complexity: O(n)
1387
1288
  * Space Complexity: O(1)
@@ -1401,10 +1302,6 @@ var dataStructureTyped = (() => {
1401
1302
  }
1402
1303
  return node.value;
1403
1304
  }
1404
- /**
1405
- * Time Complexity: O(1)
1406
- * Space Complexity: O(1)
1407
- */
1408
1305
  /**
1409
1306
  * Time Complexity: O(1)
1410
1307
  * Space Complexity: O(1)
@@ -1418,14 +1315,14 @@ var dataStructureTyped = (() => {
1418
1315
  delete(key) {
1419
1316
  let node;
1420
1317
  if (isWeakKey(key)) {
1421
- const hash = this.objHashFn(key);
1318
+ const hash = this._objHashFn(key);
1422
1319
  node = this.objMap.get(hash);
1423
1320
  if (!node) {
1424
1321
  return false;
1425
1322
  }
1426
1323
  this.objMap.delete(hash);
1427
1324
  } else {
1428
- const hash = this.hashFn(key);
1325
+ const hash = this._hashFn(key);
1429
1326
  node = this.noObjMap[hash];
1430
1327
  if (!node) {
1431
1328
  return false;
@@ -1435,10 +1332,6 @@ var dataStructureTyped = (() => {
1435
1332
  this._deleteNode(node);
1436
1333
  return true;
1437
1334
  }
1438
- /**
1439
- * Time Complexity: O(n)
1440
- * Space Complexity: O(1)
1441
- */
1442
1335
  /**
1443
1336
  * Time Complexity: O(n)
1444
1337
  * Space Complexity: O(1)
@@ -1456,10 +1349,6 @@ var dataStructureTyped = (() => {
1456
1349
  }
1457
1350
  return this._deleteNode(node);
1458
1351
  }
1459
- /**
1460
- * Time Complexity: O(1)
1461
- * Space Complexity: O(1)
1462
- */
1463
1352
  /**
1464
1353
  * Time Complexity: O(1)
1465
1354
  * Space Complexity: O(1)
@@ -1480,10 +1369,6 @@ var dataStructureTyped = (() => {
1480
1369
  isEntry(rawElement) {
1481
1370
  return Array.isArray(rawElement) && rawElement.length === 2;
1482
1371
  }
1483
- /**
1484
- * Time Complexity: O(1)
1485
- * Space Complexity: O(1)
1486
- */
1487
1372
  /**
1488
1373
  * Time Complexity: O(1)
1489
1374
  * Space Complexity: O(1)
@@ -1495,10 +1380,6 @@ var dataStructureTyped = (() => {
1495
1380
  this._size = 0;
1496
1381
  this._head = this._tail = this._sentinel.prev = this._sentinel.next = this._sentinel;
1497
1382
  }
1498
- /**
1499
- * Time Complexity: O(n)
1500
- * Space Complexity: O(n)
1501
- */
1502
1383
  /**
1503
1384
  * Time Complexity: O(n)
1504
1385
  * Space Complexity: O(n)
@@ -1509,17 +1390,13 @@ var dataStructureTyped = (() => {
1509
1390
  * of the original `LinkedHashMap` object.
1510
1391
  */
1511
1392
  clone() {
1512
- const cloned = new _LinkedHashMap([], { hashFn: this.hashFn, objHashFn: this.objHashFn });
1393
+ const cloned = new _LinkedHashMap([], { hashFn: this._hashFn, objHashFn: this._objHashFn });
1513
1394
  for (const entry of this) {
1514
1395
  const [key, value] = entry;
1515
1396
  cloned.set(key, value);
1516
1397
  }
1517
1398
  return cloned;
1518
1399
  }
1519
- /**
1520
- * Time Complexity: O(n)
1521
- * Space Complexity: O(n)
1522
- */
1523
1400
  /**
1524
1401
  * Time Complexity: O(n)
1525
1402
  * Space Complexity: O(n)
@@ -1546,10 +1423,6 @@ var dataStructureTyped = (() => {
1546
1423
  }
1547
1424
  return filteredMap;
1548
1425
  }
1549
- /**
1550
- * Time Complexity: O(n)
1551
- * Space Complexity: O(n)
1552
- */
1553
1426
  /**
1554
1427
  * Time Complexity: O(n)
1555
1428
  * Space Complexity: O(n)
@@ -1577,29 +1450,6 @@ var dataStructureTyped = (() => {
1577
1450
  }
1578
1451
  return mappedMap;
1579
1452
  }
1580
- /**
1581
- * Time Complexity: O(1)
1582
- * Space Complexity: O(1)
1583
- */
1584
- /**
1585
- * Time Complexity: O(1)
1586
- * Space Complexity: O(1)
1587
- *
1588
- * The put function sets a value in a data structure using a specified key.
1589
- * @param {K} key - The key parameter is of type K, which represents the type of the key being passed
1590
- * to the function.
1591
- * @param {V} value - The value parameter represents the value that you want to associate with the
1592
- * specified key in the data structure.
1593
- * @returns The method is returning a boolean value.
1594
- */
1595
- put(key, value) {
1596
- return this.set(key, value);
1597
- }
1598
- /**
1599
- * Time Complexity: O(n)
1600
- * Space Complexity: O(1)
1601
- * where n is the number of entries in the LinkedHashMap.
1602
- */
1603
1453
  /**
1604
1454
  * Time Complexity: O(n)
1605
1455
  * Space Complexity: O(1)
@@ -1614,10 +1464,6 @@ var dataStructureTyped = (() => {
1614
1464
  node = node.next;
1615
1465
  }
1616
1466
  }
1617
- /**
1618
- * Time Complexity: O(1)
1619
- * Space Complexity: O(1)
1620
- */
1621
1467
  /**
1622
1468
  * Time Complexity: O(1)
1623
1469
  * Space Complexity: O(1)
@@ -1743,12 +1589,6 @@ var dataStructureTyped = (() => {
1743
1589
  get size() {
1744
1590
  return this._size;
1745
1591
  }
1746
- /**
1747
- * Time Complexity: O(n)
1748
- * Space Complexity: O(n)
1749
- * Linear time, where n is the length of the input array, as it performs a loop to push each element into the linked list.
1750
- * Linear space, as it creates a new node for each element in the array.
1751
- */
1752
1592
  /**
1753
1593
  * Time Complexity: O(n)
1754
1594
  * Space Complexity: O(n)
@@ -1765,10 +1605,6 @@ var dataStructureTyped = (() => {
1765
1605
  }
1766
1606
  return singlyLinkedList;
1767
1607
  }
1768
- /**
1769
- * Time Complexity: O(1)
1770
- * Space Complexity: O(1)
1771
- */
1772
1608
  /**
1773
1609
  * Time Complexity: O(1)
1774
1610
  * Space Complexity: O(1)
@@ -1790,11 +1626,6 @@ var dataStructureTyped = (() => {
1790
1626
  this._size++;
1791
1627
  return true;
1792
1628
  }
1793
- /**
1794
- * Time Complexity: O(n)
1795
- * Space Complexity: O(1)
1796
- * Linear time in the worst case, as it may need to traverse the list to find the last element.
1797
- */
1798
1629
  /**
1799
1630
  * Time Complexity: O(n)
1800
1631
  * Space Complexity: O(1)
@@ -1823,10 +1654,6 @@ var dataStructureTyped = (() => {
1823
1654
  this._size--;
1824
1655
  return value;
1825
1656
  }
1826
- /**
1827
- * Time Complexity: O(1)
1828
- * Space Complexity: O(1)
1829
- */
1830
1657
  /**
1831
1658
  * Time Complexity: O(1)
1832
1659
  * Space Complexity: O(1)
@@ -1842,10 +1669,6 @@ var dataStructureTyped = (() => {
1842
1669
  this._size--;
1843
1670
  return removedNode.value;
1844
1671
  }
1845
- /**
1846
- * Time Complexity: O(1)
1847
- * Space Complexity: O(1)
1848
- */
1849
1672
  /**
1850
1673
  * Time Complexity: O(1)
1851
1674
  * Space Complexity: O(1)
@@ -1867,10 +1690,6 @@ var dataStructureTyped = (() => {
1867
1690
  this._size++;
1868
1691
  return true;
1869
1692
  }
1870
- /**
1871
- * Time Complexity: O(n)
1872
- * Space Complexity: O(1)
1873
- */
1874
1693
  /**
1875
1694
  * Time Complexity: O(n)
1876
1695
  * Space Complexity: O(1)
@@ -1890,10 +1709,6 @@ var dataStructureTyped = (() => {
1890
1709
  }
1891
1710
  return current.value;
1892
1711
  }
1893
- /**
1894
- * Time Complexity: O(n)
1895
- * Space Complexity: O(1)
1896
- */
1897
1712
  /**
1898
1713
  * Time Complexity: O(n)
1899
1714
  * Space Complexity: O(1)
@@ -1911,10 +1726,6 @@ var dataStructureTyped = (() => {
1911
1726
  }
1912
1727
  return current;
1913
1728
  }
1914
- /**
1915
- * Time Complexity: O(n)
1916
- * Space Complexity: O(1)
1917
- */
1918
1729
  /**
1919
1730
  * Time Complexity: O(n)
1920
1731
  * Space Complexity: O(1)
@@ -1942,10 +1753,6 @@ var dataStructureTyped = (() => {
1942
1753
  this._size--;
1943
1754
  return true;
1944
1755
  }
1945
- /**
1946
- * Time Complexity: O(n)
1947
- * Space Complexity: O(1)
1948
- */
1949
1756
  /**
1950
1757
  * Time Complexity: O(n)
1951
1758
  * Space Complexity: O(1)
@@ -1957,7 +1764,7 @@ var dataStructureTyped = (() => {
1957
1764
  * successfully deleted from the linked list, and `false` if the value or node is not found in the linked list.
1958
1765
  */
1959
1766
  delete(valueOrNode) {
1960
- if (!valueOrNode)
1767
+ if (valueOrNode === void 0)
1961
1768
  return false;
1962
1769
  let value;
1963
1770
  if (valueOrNode instanceof SinglyLinkedListNode) {
@@ -1987,10 +1794,6 @@ var dataStructureTyped = (() => {
1987
1794
  }
1988
1795
  return false;
1989
1796
  }
1990
- /**
1991
- * Time Complexity: O(n)
1992
- * Space Complexity: O(1)
1993
- */
1994
1797
  /**
1995
1798
  * Time Complexity: O(n)
1996
1799
  * Space Complexity: O(1)
@@ -2037,12 +1840,6 @@ var dataStructureTyped = (() => {
2037
1840
  this._tail = void 0;
2038
1841
  this._size = 0;
2039
1842
  }
2040
- /**
2041
- * Time Complexity: O(n)
2042
- * Space Complexity: O(n)
2043
- * Linear time, where n is the length of the list, as it needs to traverse the entire list to convert it to an array.
2044
- * Linear space, as it creates an array with the same length as the list.
2045
- */
2046
1843
  /**
2047
1844
  * Time Complexity: O(n)
2048
1845
  * Space Complexity: O(n)
@@ -2059,10 +1856,6 @@ var dataStructureTyped = (() => {
2059
1856
  }
2060
1857
  return array;
2061
1858
  }
2062
- /**
2063
- * Time Complexity: O(n)
2064
- * Space Complexity: O(1)
2065
- */
2066
1859
  /**
2067
1860
  * Time Complexity: O(n)
2068
1861
  * Space Complexity: O(1)
@@ -2085,10 +1878,6 @@ var dataStructureTyped = (() => {
2085
1878
  [this._head, this._tail] = [this.tail, this.head];
2086
1879
  return this;
2087
1880
  }
2088
- /**
2089
- * Time Complexity: O(n)
2090
- * Space Complexity: O(1)
2091
- */
2092
1881
  /**
2093
1882
  * Time Complexity: O(n)
2094
1883
  * Space Complexity: O(1)
@@ -2110,10 +1899,6 @@ var dataStructureTyped = (() => {
2110
1899
  }
2111
1900
  return -1;
2112
1901
  }
2113
- /**
2114
- * Time Complexity: O(n)
2115
- * Space Complexity: O(1)
2116
- */
2117
1902
  /**
2118
1903
  * Time Complexity: O(n)
2119
1904
  * Space Complexity: O(1)
@@ -2134,10 +1919,6 @@ var dataStructureTyped = (() => {
2134
1919
  }
2135
1920
  return void 0;
2136
1921
  }
2137
- /**
2138
- * Time Complexity: O(n)
2139
- * Space Complexity: O(1)
2140
- */
2141
1922
  /**
2142
1923
  * Time Complexity: O(n)
2143
1924
  * Space Complexity: O(1)
@@ -2175,10 +1956,6 @@ var dataStructureTyped = (() => {
2175
1956
  }
2176
1957
  return false;
2177
1958
  }
2178
- /**
2179
- * Time Complexity: O(n)
2180
- * Space Complexity: O(1)
2181
- */
2182
1959
  /**
2183
1960
  * Time Complexity: O(n)
2184
1961
  * Space Complexity: O(1)
@@ -2209,10 +1986,6 @@ var dataStructureTyped = (() => {
2209
1986
  }
2210
1987
  return false;
2211
1988
  }
2212
- /**
2213
- * Time Complexity: O(n)
2214
- * Space Complexity: O(1)
2215
- */
2216
1989
  /**
2217
1990
  * Time Complexity: O(n)
2218
1991
  * Space Complexity: O(1)
@@ -2232,10 +2005,6 @@ var dataStructureTyped = (() => {
2232
2005
  }
2233
2006
  return count;
2234
2007
  }
2235
- /**
2236
- * Time Complexity: O(n)
2237
- * Space Complexity: O(n)
2238
- */
2239
2008
  /**
2240
2009
  * Time Complexity: O(n)
2241
2010
  * Space Complexity: O(n)
@@ -2248,10 +2017,6 @@ var dataStructureTyped = (() => {
2248
2017
  clone() {
2249
2018
  return new _SinglyLinkedList(this, { toElementFn: this.toElementFn });
2250
2019
  }
2251
- /**
2252
- * Time Complexity: O(n)
2253
- * Space Complexity: O(n)
2254
- */
2255
2020
  /**
2256
2021
  * Time Complexity: O(n)
2257
2022
  * Space Complexity: O(n)
@@ -2283,8 +2048,7 @@ var dataStructureTyped = (() => {
2283
2048
  /**
2284
2049
  * Time Complexity: O(n)
2285
2050
  * Space Complexity: O(n)
2286
- */
2287
- /**
2051
+ *
2288
2052
  * The `map` function takes a callback function and returns a new SinglyLinkedList with the results
2289
2053
  * of applying the callback to each element in the original list.
2290
2054
  * @param callback - The `callback` parameter is a function that will be called for each element in
@@ -2426,11 +2190,6 @@ var dataStructureTyped = (() => {
2426
2190
  get size() {
2427
2191
  return this._size;
2428
2192
  }
2429
- /**
2430
- * Time Complexity: O(1)
2431
- * Space Complexity: O(1)
2432
- * where n is the number of elements in the linked list.
2433
- */
2434
2193
  /**
2435
2194
  * Time Complexity: O(1)
2436
2195
  * Space Complexity: O(1)
@@ -2442,10 +2201,6 @@ var dataStructureTyped = (() => {
2442
2201
  var _a;
2443
2202
  return (_a = this.head) == null ? void 0 : _a.value;
2444
2203
  }
2445
- /**
2446
- * Time Complexity: O(1)
2447
- * Space Complexity: O(1)
2448
- */
2449
2204
  /**
2450
2205
  * Time Complexity: O(1)
2451
2206
  * Space Complexity: O(1)
@@ -2457,10 +2212,6 @@ var dataStructureTyped = (() => {
2457
2212
  var _a;
2458
2213
  return (_a = this.tail) == null ? void 0 : _a.value;
2459
2214
  }
2460
- /**
2461
- * Time Complexity: O(n)
2462
- * Space Complexity: O(n)
2463
- */
2464
2215
  /**
2465
2216
  * Time Complexity: O(n)
2466
2217
  * Space Complexity: O(n)
@@ -2476,8 +2227,7 @@ var dataStructureTyped = (() => {
2476
2227
  /**
2477
2228
  * Time Complexity: O(1)
2478
2229
  * Space Complexity: O(1)
2479
- */
2480
- /**
2230
+ *
2481
2231
  * The push function adds a new element to the end of a doubly linked list.
2482
2232
  * @param {E} element - The "element" parameter represents the value that you want to add to the
2483
2233
  * doubly linked list.
@@ -2499,8 +2249,7 @@ var dataStructureTyped = (() => {
2499
2249
  /**
2500
2250
  * Time Complexity: O(1)
2501
2251
  * Space Complexity: O(1)
2502
- */
2503
- /**
2252
+ *
2504
2253
  * The `pop()` function removes and returns the value of the last element in a linked list.
2505
2254
  * @returns The method is returning the value of the removed node.
2506
2255
  */
@@ -2521,8 +2270,7 @@ var dataStructureTyped = (() => {
2521
2270
  /**
2522
2271
  * Time Complexity: O(1)
2523
2272
  * Space Complexity: O(1)
2524
- */
2525
- /**
2273
+ *
2526
2274
  * The `shift()` function removes and returns the value of the first element in a doubly linked list.
2527
2275
  * @returns The value of the removed node.
2528
2276
  */
@@ -2543,8 +2291,7 @@ var dataStructureTyped = (() => {
2543
2291
  /**
2544
2292
  * Time Complexity: O(1)
2545
2293
  * Space Complexity: O(1)
2546
- */
2547
- /**
2294
+ *
2548
2295
  * The unshift function adds a new element to the beginning of a doubly linked list.
2549
2296
  * @param {E} element - The "element" parameter represents the value of the element that you want to
2550
2297
  * add to the beginning of the doubly linked list.
@@ -2563,10 +2310,6 @@ var dataStructureTyped = (() => {
2563
2310
  this._size++;
2564
2311
  return true;
2565
2312
  }
2566
- /**
2567
- * Time Complexity: O(n)
2568
- * Space Complexity: O(1)
2569
- */
2570
2313
  /**
2571
2314
  * Time Complexity: O(n)
2572
2315
  * Space Complexity: O(1)
@@ -2586,10 +2329,6 @@ var dataStructureTyped = (() => {
2586
2329
  }
2587
2330
  return current.value;
2588
2331
  }
2589
- /**
2590
- * Time Complexity: O(n)
2591
- * Space Complexity: O(1)
2592
- */
2593
2332
  /**
2594
2333
  * Time Complexity: O(n)
2595
2334
  * Space Complexity: O(1)
@@ -2610,10 +2349,6 @@ var dataStructureTyped = (() => {
2610
2349
  }
2611
2350
  return current;
2612
2351
  }
2613
- /**
2614
- * Time Complexity: O(n)
2615
- * Space Complexity: O(1)
2616
- */
2617
2352
  /**
2618
2353
  * Time Complexity: O(n)
2619
2354
  * Space Complexity: O(1)
@@ -2634,10 +2369,6 @@ var dataStructureTyped = (() => {
2634
2369
  }
2635
2370
  return void 0;
2636
2371
  }
2637
- /**
2638
- * Time Complexity: O(n)
2639
- * Space Complexity: O(1)
2640
- */
2641
2372
  /**
2642
2373
  * Time Complexity: O(n)
2643
2374
  * Space Complexity: O(1)
@@ -2671,11 +2402,6 @@ var dataStructureTyped = (() => {
2671
2402
  this._size++;
2672
2403
  return true;
2673
2404
  }
2674
- /**
2675
- * Time Complexity: O(1) or O(n)
2676
- * Space Complexity: O(1)
2677
- * where n is the number of elements in the linked list.
2678
- */
2679
2405
  /**
2680
2406
  * Time Complexity: O(1) or O(n)
2681
2407
  * Space Complexity: O(1)
@@ -2712,10 +2438,6 @@ var dataStructureTyped = (() => {
2712
2438
  }
2713
2439
  return false;
2714
2440
  }
2715
- /**
2716
- * Time Complexity: O(1) or O(n)
2717
- * Space Complexity: O(1)
2718
- */
2719
2441
  /**
2720
2442
  * Time Complexity: O(1) or O(n)
2721
2443
  * Space Complexity: O(1)
@@ -2780,10 +2502,6 @@ var dataStructureTyped = (() => {
2780
2502
  this._size--;
2781
2503
  return true;
2782
2504
  }
2783
- /**
2784
- * Time Complexity: O(1) or O(n)
2785
- * Space Complexity: O(1)
2786
- */
2787
2505
  /**
2788
2506
  * Time Complexity: O(1) or O(n)
2789
2507
  * Space Complexity: O(1)
@@ -2817,10 +2535,6 @@ var dataStructureTyped = (() => {
2817
2535
  }
2818
2536
  return false;
2819
2537
  }
2820
- /**
2821
- * Time Complexity: O(1)
2822
- * Space Complexity: O(1)
2823
- */
2824
2538
  /**
2825
2539
  * Time Complexity: O(1)
2826
2540
  * Space Complexity: O(1)
@@ -2831,10 +2545,6 @@ var dataStructureTyped = (() => {
2831
2545
  isEmpty() {
2832
2546
  return this.size === 0;
2833
2547
  }
2834
- /**
2835
- * Time Complexity: O(1)
2836
- * Space Complexity: O(1)
2837
- */
2838
2548
  /**
2839
2549
  * Time Complexity: O(1)
2840
2550
  * Space Complexity: O(1)
@@ -2846,10 +2556,6 @@ var dataStructureTyped = (() => {
2846
2556
  this._tail = void 0;
2847
2557
  this._size = 0;
2848
2558
  }
2849
- /**
2850
- * Time Complexity: O(n)
2851
- * Space Complexity: O(1)
2852
- */
2853
2559
  /**
2854
2560
  * Time Complexity: O(n)
2855
2561
  * Space Complexity: O(1)
@@ -2872,10 +2578,6 @@ var dataStructureTyped = (() => {
2872
2578
  }
2873
2579
  return -1;
2874
2580
  }
2875
- /**
2876
- * Time Complexity: O(n)
2877
- * Space Complexity: O(1)
2878
- */
2879
2581
  /**
2880
2582
  * Time Complexity: O(n)
2881
2583
  * Space Complexity: O(1)
@@ -2897,10 +2599,6 @@ var dataStructureTyped = (() => {
2897
2599
  }
2898
2600
  return void 0;
2899
2601
  }
2900
- /**
2901
- * Time Complexity: O(n)
2902
- * Space Complexity: O(1)
2903
- */
2904
2602
  /**
2905
2603
  * Time Complexity: O(n)
2906
2604
  * Space Complexity: O(1)
@@ -2917,10 +2615,6 @@ var dataStructureTyped = (() => {
2917
2615
  }
2918
2616
  return this;
2919
2617
  }
2920
- /**
2921
- * Time Complexity: O(n)
2922
- * Space Complexity: O(n)
2923
- */
2924
2618
  /**
2925
2619
  * Time Complexity: O(n)
2926
2620
  * Space Complexity: O(n)
@@ -2937,10 +2631,6 @@ var dataStructureTyped = (() => {
2937
2631
  }
2938
2632
  return array;
2939
2633
  }
2940
- /**
2941
- * Time Complexity: O(n)
2942
- * Space Complexity: O(n)
2943
- */
2944
2634
  /**
2945
2635
  * Time Complexity: O(n)
2946
2636
  * Space Complexity: O(n)
@@ -2957,10 +2647,6 @@ var dataStructureTyped = (() => {
2957
2647
  }
2958
2648
  return array;
2959
2649
  }
2960
- /**
2961
- * Time Complexity: O(n)
2962
- * Space Complexity: O(n)
2963
- */
2964
2650
  /**
2965
2651
  * Time Complexity: O(n)
2966
2652
  * Space Complexity: O(n)
@@ -2973,10 +2659,6 @@ var dataStructureTyped = (() => {
2973
2659
  clone() {
2974
2660
  return new _DoublyLinkedList(this);
2975
2661
  }
2976
- /**
2977
- * Time Complexity: O(n)
2978
- * Space Complexity: O(n)
2979
- */
2980
2662
  /**
2981
2663
  * Time Complexity: O(n)
2982
2664
  * Space Complexity: O(n)
@@ -3008,8 +2690,7 @@ var dataStructureTyped = (() => {
3008
2690
  /**
3009
2691
  * Time Complexity: O(n)
3010
2692
  * Space Complexity: O(n)
3011
- */
3012
- /**
2693
+ *
3013
2694
  * The `map` function takes a callback function and returns a new DoublyLinkedList with the results
3014
2695
  * of applying the callback to each element in the original list.
3015
2696
  * @param callback - The callback parameter is a function that will be called for each element in the
@@ -3112,10 +2793,6 @@ var dataStructureTyped = (() => {
3112
2793
  get probability() {
3113
2794
  return this._probability;
3114
2795
  }
3115
- /**
3116
- * Time Complexity: O(log n)
3117
- * Space Complexity: O(1)
3118
- */
3119
2796
  /**
3120
2797
  * Time Complexity: O(1)
3121
2798
  * Space Complexity: O(1)
@@ -3127,10 +2804,6 @@ var dataStructureTyped = (() => {
3127
2804
  const firstNode = this.head.forward[0];
3128
2805
  return firstNode ? firstNode.value : void 0;
3129
2806
  }
3130
- /**
3131
- * Time Complexity: O(log n)
3132
- * Space Complexity: O(1)
3133
- */
3134
2807
  /**
3135
2808
  * Time Complexity: O(log n)
3136
2809
  * Space Complexity: O(1)
@@ -3147,10 +2820,6 @@ var dataStructureTyped = (() => {
3147
2820
  }
3148
2821
  return current.value;
3149
2822
  }
3150
- /**
3151
- * Time Complexity: O(log n)
3152
- * Space Complexity: O(1)
3153
- */
3154
2823
  /**
3155
2824
  * Time Complexity: O(log n)
3156
2825
  * Space Complexity: O(1)
@@ -3178,10 +2847,6 @@ var dataStructureTyped = (() => {
3178
2847
  this._level = Math.max(this.level, newNode.forward.length);
3179
2848
  }
3180
2849
  }
3181
- /**
3182
- * Time Complexity: O(log n)
3183
- * Space Complexity: O(1)
3184
- */
3185
2850
  /**
3186
2851
  * Time Complexity: O(log n)
3187
2852
  * Space Complexity: O(1)
@@ -3207,8 +2872,7 @@ var dataStructureTyped = (() => {
3207
2872
  /**
3208
2873
  * Time Complexity: O(log n)
3209
2874
  * Space Complexity: O(1)
3210
- */
3211
- /**
2875
+ *
3212
2876
  * The function checks if a key exists in a data structure.
3213
2877
  * @param {K} key - The parameter "key" is of type K, which represents the type of the key being
3214
2878
  * checked.
@@ -3217,10 +2881,6 @@ var dataStructureTyped = (() => {
3217
2881
  has(key) {
3218
2882
  return this.get(key) !== void 0;
3219
2883
  }
3220
- /**
3221
- * Time Complexity: O(log n)
3222
- * Space Complexity: O(1)
3223
- */
3224
2884
  /**
3225
2885
  * Time Complexity: O(log n)
3226
2886
  * Space Complexity: O(1)
@@ -3254,10 +2914,6 @@ var dataStructureTyped = (() => {
3254
2914
  }
3255
2915
  return false;
3256
2916
  }
3257
- /**
3258
- * Time Complexity: O(log n)
3259
- * Space Complexity: O(1)
3260
- */
3261
2917
  /**
3262
2918
  * Time Complexity: O(log n)
3263
2919
  * Space Complexity: O(1)
@@ -3276,10 +2932,6 @@ var dataStructureTyped = (() => {
3276
2932
  const nextNode = current.forward[0];
3277
2933
  return nextNode ? nextNode.value : void 0;
3278
2934
  }
3279
- /**
3280
- * Time Complexity: O(log n)
3281
- * Space Complexity: O(1)
3282
- */
3283
2935
  /**
3284
2936
  * Time Complexity: O(log n)
3285
2937
  * Space Complexity: O(1)
@@ -3301,11 +2953,6 @@ var dataStructureTyped = (() => {
3301
2953
  }
3302
2954
  return lastLess ? lastLess.value : void 0;
3303
2955
  }
3304
- /**
3305
- * Time Complexity: O(maxLevel)
3306
- * Space Complexity: O(1)
3307
- * where maxLevel is the maximum level of the SkipList, as it may iterate up to maxLevel times in the worst case.
3308
- */
3309
2956
  /**
3310
2957
  * Time Complexity: O(maxLevel)
3311
2958
  * Space Complexity: O(1)
@@ -3374,10 +3021,6 @@ var dataStructureTyped = (() => {
3374
3021
  isEmpty() {
3375
3022
  return this.elements.length === 0;
3376
3023
  }
3377
- /**
3378
- * Time Complexity: O(1)
3379
- * Space Complexity: O(1)
3380
- */
3381
3024
  /**
3382
3025
  * Time Complexity: O(1)
3383
3026
  * Space Complexity: O(1)
@@ -3390,10 +3033,6 @@ var dataStructureTyped = (() => {
3390
3033
  return void 0;
3391
3034
  return this.elements[this.elements.length - 1];
3392
3035
  }
3393
- /**
3394
- * Time Complexity: O(1)
3395
- * Space Complexity: O(1)
3396
- */
3397
3036
  /**
3398
3037
  * Time Complexity: O(1)
3399
3038
  * Space Complexity: O(1)
@@ -3406,10 +3045,6 @@ var dataStructureTyped = (() => {
3406
3045
  this.elements.push(element);
3407
3046
  return true;
3408
3047
  }
3409
- /**
3410
- * Time Complexity: O(1)
3411
- * Space Complexity: O(1)
3412
- */
3413
3048
  /**
3414
3049
  * Time Complexity: O(1)
3415
3050
  * Space Complexity: O(1)
@@ -3441,10 +3076,6 @@ var dataStructureTyped = (() => {
3441
3076
  const spliced = this.elements.splice(index, 1);
3442
3077
  return spliced.length === 1;
3443
3078
  }
3444
- /**
3445
- * Time Complexity: O(n)
3446
- * Space Complexity: O(n)
3447
- */
3448
3079
  /**
3449
3080
  * Time Complexity: O(n)
3450
3081
  * Space Complexity: O(n)
@@ -3455,10 +3086,6 @@ var dataStructureTyped = (() => {
3455
3086
  toArray() {
3456
3087
  return this.elements.slice();
3457
3088
  }
3458
- /**
3459
- * Time Complexity: O(1)
3460
- * Space Complexity: O(1)
3461
- */
3462
3089
  /**
3463
3090
  * Time Complexity: O(1)
3464
3091
  * Space Complexity: O(1)
@@ -3468,10 +3095,6 @@ var dataStructureTyped = (() => {
3468
3095
  clear() {
3469
3096
  this._elements = [];
3470
3097
  }
3471
- /**
3472
- * Time Complexity: O(n)
3473
- * Space Complexity: O(n)
3474
- */
3475
3098
  /**
3476
3099
  * Time Complexity: O(n)
3477
3100
  * Space Complexity: O(n)
@@ -3482,10 +3105,6 @@ var dataStructureTyped = (() => {
3482
3105
  clone() {
3483
3106
  return new _Stack(this, { toElementFn: this.toElementFn });
3484
3107
  }
3485
- /**
3486
- * Time Complexity: O(n)
3487
- * Space Complexity: O(n)
3488
- */
3489
3108
  /**
3490
3109
  * Time Complexity: O(n)
3491
3110
  * Space Complexity: O(n)
@@ -3516,8 +3135,7 @@ var dataStructureTyped = (() => {
3516
3135
  /**
3517
3136
  * Time Complexity: O(n)
3518
3137
  * Space Complexity: O(n)
3519
- */
3520
- /**
3138
+ *
3521
3139
  * The `map` function takes a callback function and applies it to each element in the stack,
3522
3140
  * returning a new stack with the results.
3523
3141
  * @param callback - The callback parameter is a function that will be called for each element in the
@@ -3540,10 +3158,6 @@ var dataStructureTyped = (() => {
3540
3158
  }
3541
3159
  return newStack;
3542
3160
  }
3543
- /**
3544
- * Time Complexity: O(n)
3545
- * Space Complexity: O(n)
3546
- */
3547
3161
  /**
3548
3162
  * Time Complexity: O(n)
3549
3163
  * Space Complexity: O(n)
@@ -3599,10 +3213,6 @@ var dataStructureTyped = (() => {
3599
3213
  get size() {
3600
3214
  return this.elements.length - this.offset;
3601
3215
  }
3602
- /**
3603
- * Time Complexity: O(1)
3604
- * Space Complexity: O(1)
3605
- */
3606
3216
  /**
3607
3217
  * Time Complexity: O(1)
3608
3218
  * Space Complexity: O(1)
@@ -3614,10 +3224,6 @@ var dataStructureTyped = (() => {
3614
3224
  get first() {
3615
3225
  return this.size > 0 ? this.elements[this.offset] : void 0;
3616
3226
  }
3617
- /**
3618
- * Time Complexity: O(1)
3619
- * Space Complexity: O(1)
3620
- */
3621
3227
  /**
3622
3228
  * Time Complexity: O(1)
3623
3229
  * Space Complexity: O(1)
@@ -3644,10 +3250,6 @@ var dataStructureTyped = (() => {
3644
3250
  set autoCompactRatio(v) {
3645
3251
  this._autoCompactRatio = v;
3646
3252
  }
3647
- /**
3648
- * Time Complexity: O(n)
3649
- * Space Complexity: O(n)
3650
- */
3651
3253
  /**
3652
3254
  * Time Complexity: O(n)
3653
3255
  * Space Complexity: O(n)
@@ -3661,26 +3263,18 @@ var dataStructureTyped = (() => {
3661
3263
  static fromArray(elements) {
3662
3264
  return new _Queue(elements);
3663
3265
  }
3664
- /**
3665
- * Time Complexity: O(1)
3666
- * Space Complexity: O(1)
3667
- */
3668
3266
  /**
3669
3267
  * Time Complexity: O(1)
3670
3268
  * Space Complexity: O(1)
3671
3269
  *
3672
- * The push function adds an element to the end of the queue and returns the updated queue.Adds an element at the back of the queue.
3270
+ * The push function adds an element to the end of the queue and returns true. Adds an element at the back of the queue.
3673
3271
  * @param {E} element - The `element` parameter represents the element that you want to add to the queue.
3674
- * @returns The `add` method is returning a `Queue<E>` object.
3272
+ * @returns Always returns true, indicating the element was successfully added.
3675
3273
  */
3676
3274
  push(element) {
3677
3275
  this.elements.push(element);
3678
3276
  return true;
3679
3277
  }
3680
- /**
3681
- * Time Complexity: O(1)
3682
- * Space Complexity: O(1)
3683
- */
3684
3278
  /**
3685
3279
  * Time Complexity: O(1)
3686
3280
  * Space Complexity: O(1)
@@ -3700,7 +3294,7 @@ var dataStructureTyped = (() => {
3700
3294
  }
3701
3295
  /**
3702
3296
  * The delete function removes an element from the list.
3703
- * @param element: E Specify the element to be deleted
3297
+ * @param {E} element - Specify the element to be deleted
3704
3298
  * @return A boolean value indicating whether the element was successfully deleted or not
3705
3299
  */
3706
3300
  delete(element) {
@@ -3709,17 +3303,13 @@ var dataStructureTyped = (() => {
3709
3303
  }
3710
3304
  /**
3711
3305
  * The deleteAt function deletes the element at a given index.
3712
- * @param index: number Determine the index of the element to be deleted
3306
+ * @param {number} index - Determine the index of the element to be deleted
3713
3307
  * @return A boolean value
3714
3308
  */
3715
3309
  deleteAt(index) {
3716
3310
  const spliced = this.elements.splice(index, 1);
3717
3311
  return spliced.length === 1;
3718
3312
  }
3719
- /**
3720
- * Time Complexity: O(1)
3721
- * Space Complexity: O(1)
3722
- */
3723
3313
  /**
3724
3314
  * Time Complexity: O(1)
3725
3315
  * Space Complexity: O(1)
@@ -3729,10 +3319,6 @@ var dataStructureTyped = (() => {
3729
3319
  at(index) {
3730
3320
  return this.elements[index + this._offset];
3731
3321
  }
3732
- /**
3733
- * Time Complexity: O(1)
3734
- * Space Complexity: O(1)
3735
- */
3736
3322
  /**
3737
3323
  * Time Complexity: O(1)
3738
3324
  * Space Complexity: O(1)
@@ -3743,10 +3329,6 @@ var dataStructureTyped = (() => {
3743
3329
  isEmpty() {
3744
3330
  return this.size === 0;
3745
3331
  }
3746
- /**
3747
- * Time Complexity: O(1)
3748
- * Space Complexity: O(n)
3749
- */
3750
3332
  /**
3751
3333
  * Time Complexity: O(1)
3752
3334
  * Space Complexity: O(n)
@@ -3757,10 +3339,6 @@ var dataStructureTyped = (() => {
3757
3339
  toArray() {
3758
3340
  return this.elements.slice(this.offset);
3759
3341
  }
3760
- /**
3761
- * Time Complexity: O(1)
3762
- * Space Complexity: O(1)
3763
- */
3764
3342
  /**
3765
3343
  * Time Complexity: O(1)
3766
3344
  * Space Complexity: O(1)
@@ -3781,11 +3359,6 @@ var dataStructureTyped = (() => {
3781
3359
  this._offset = 0;
3782
3360
  return true;
3783
3361
  }
3784
- /**
3785
- * Time Complexity: O(n)
3786
- * Space Complexity: O(n)
3787
- * where n is the number of elements in the queue. It creates a shallow copy of the internal array. the space required is proportional to the number of elements in the queue.
3788
- */
3789
3362
  /**
3790
3363
  * Time Complexity: O(n)
3791
3364
  * Space Complexity: O(n)
@@ -3796,10 +3369,6 @@ var dataStructureTyped = (() => {
3796
3369
  clone() {
3797
3370
  return new _Queue(this.elements.slice(this.offset), { toElementFn: this.toElementFn });
3798
3371
  }
3799
- /**
3800
- * Time Complexity: O(n)
3801
- * Space Complexity: O(n)
3802
- */
3803
3372
  /**
3804
3373
  * Time Complexity: O(n)
3805
3374
  * Space Complexity: O(n)
@@ -3840,10 +3409,6 @@ var dataStructureTyped = (() => {
3840
3409
  }
3841
3410
  return newDeque;
3842
3411
  }
3843
- /**
3844
- * Time Complexity: O(n)
3845
- * Space Complexity: O(n)
3846
- */
3847
3412
  /**
3848
3413
  * Time Complexity: O(n)
3849
3414
  * Space Complexity: O(n)
@@ -3857,10 +3422,6 @@ var dataStructureTyped = (() => {
3857
3422
  }
3858
3423
  };
3859
3424
  var LinkedListQueue = class _LinkedListQueue extends SinglyLinkedList {
3860
- /**
3861
- * Time Complexity: O(n)
3862
- * Space Complexity: O(n)
3863
- */
3864
3425
  /**
3865
3426
  * Time Complexity: O(n)
3866
3427
  * Space Complexity: O(n)
@@ -4018,10 +3579,6 @@ var dataStructureTyped = (() => {
4018
3579
  return;
4019
3580
  return this._buckets[this._bucketLast][this._lastInBucket];
4020
3581
  }
4021
- /**
4022
- * Time Complexity - Amortized O(1) (possible reallocation)
4023
- * Space Complexity - O(n) (due to potential resizing).
4024
- */
4025
3582
  /**
4026
3583
  * Time Complexity - Amortized O(1) (possible reallocation),
4027
3584
  * Space Complexity - O(n) (due to potential resizing).
@@ -4051,10 +3608,6 @@ var dataStructureTyped = (() => {
4051
3608
  this.shift();
4052
3609
  return true;
4053
3610
  }
4054
- /**
4055
- * Time Complexity: O(1)
4056
- * Space Complexity: O(1)
4057
- */
4058
3611
  /**
4059
3612
  * Time Complexity: O(1)
4060
3613
  * Space Complexity: O(1)
@@ -4081,10 +3634,6 @@ var dataStructureTyped = (() => {
4081
3634
  this._size -= 1;
4082
3635
  return element;
4083
3636
  }
4084
- /**
4085
- * Time Complexity: Amortized O(1)
4086
- * Space Complexity: O(n)
4087
- */
4088
3637
  /**
4089
3638
  * Time Complexity: Amortized O(1)
4090
3639
  * Space Complexity: O(n)
@@ -4115,10 +3664,6 @@ var dataStructureTyped = (() => {
4115
3664
  this.pop();
4116
3665
  return true;
4117
3666
  }
4118
- /**
4119
- * Time Complexity: O(1)
4120
- * Space Complexity: O(1)
4121
- */
4122
3667
  /**
4123
3668
  * Time Complexity: O(1)
4124
3669
  * Space Complexity: O(1)
@@ -4146,10 +3691,6 @@ var dataStructureTyped = (() => {
4146
3691
  this._size -= 1;
4147
3692
  return element;
4148
3693
  }
4149
- /**
4150
- * Time Complexity: O(1)
4151
- * Space Complexity: O(1)
4152
- */
4153
3694
  /**
4154
3695
  * Time Complexity: O(1)
4155
3696
  * Space Complexity: O(1)
@@ -4160,10 +3701,6 @@ var dataStructureTyped = (() => {
4160
3701
  isEmpty() {
4161
3702
  return this.size === 0;
4162
3703
  }
4163
- /**
4164
- * Time Complexity: O(1)
4165
- * Space Complexity: O(1)
4166
- */
4167
3704
  /**
4168
3705
  * Time Complexity: O(1)
4169
3706
  * Space Complexity: O(1)
@@ -4198,10 +3735,6 @@ var dataStructureTyped = (() => {
4198
3735
  index--;
4199
3736
  }
4200
3737
  }
4201
- /**
4202
- * Time Complexity: O(1)
4203
- * Space Complexity: O(1)
4204
- */
4205
3738
  /**
4206
3739
  * Time Complexity: O(1)
4207
3740
  * Space Complexity: O(1)
@@ -4217,10 +3750,6 @@ var dataStructureTyped = (() => {
4217
3750
  const { bucketIndex, indexInBucket } = this._getBucketAndPosition(pos);
4218
3751
  return this._buckets[bucketIndex][indexInBucket];
4219
3752
  }
4220
- /**
4221
- * Time Complexity: O(1)
4222
- * Space Complexity: O(1)
4223
- */
4224
3753
  /**
4225
3754
  * Time Complexity: O(1)
4226
3755
  * Space Complexity: O(1)
@@ -4237,10 +3766,6 @@ var dataStructureTyped = (() => {
4237
3766
  this._buckets[bucketIndex][indexInBucket] = element;
4238
3767
  return true;
4239
3768
  }
4240
- /**
4241
- * Time Complexity: O(n)
4242
- * Space Complexity: O(n)
4243
- */
4244
3769
  /**
4245
3770
  * Time Complexity: O(n)
4246
3771
  * Space Complexity: O(n)
@@ -4278,10 +3803,6 @@ var dataStructureTyped = (() => {
4278
3803
  }
4279
3804
  return true;
4280
3805
  }
4281
- /**
4282
- * Time Complexity: O(1)
4283
- * Space Complexity: O(1)
4284
- */
4285
3806
  /**
4286
3807
  * Time Complexity: O(1)
4287
3808
  * Space Complexity: O(1)
@@ -4312,10 +3833,6 @@ var dataStructureTyped = (() => {
4312
3833
  return newDeque;
4313
3834
  }
4314
3835
  }
4315
- /**
4316
- * Time Complexity: O(1)
4317
- * Space Complexity: O(1) or O(n)
4318
- */
4319
3836
  /**
4320
3837
  * Time Complexity: O(1)
4321
3838
  * Space Complexity: O(1) or O(n)
@@ -4334,7 +3851,6 @@ var dataStructureTyped = (() => {
4334
3851
  cutRest(pos, isCutSelf = false) {
4335
3852
  if (isCutSelf) {
4336
3853
  if (pos < 0) {
4337
- this.clear();
4338
3854
  return this;
4339
3855
  }
4340
3856
  const { bucketIndex, indexInBucket } = this._getBucketAndPosition(pos);
@@ -4344,16 +3860,14 @@ var dataStructureTyped = (() => {
4344
3860
  return this;
4345
3861
  } else {
4346
3862
  const newDeque = new _Deque([], { bucketSize: this._bucketSize });
3863
+ if (pos < 0)
3864
+ pos = 0;
4347
3865
  for (let i = pos; i < this.size; i++) {
4348
3866
  newDeque.push(this.at(i));
4349
3867
  }
4350
3868
  return newDeque;
4351
3869
  }
4352
3870
  }
4353
- /**
4354
- * Time Complexity: O(n)
4355
- * Space Complexity: O(1) or O(n)
4356
- */
4357
3871
  /**
4358
3872
  * Time Complexity: O(n)
4359
3873
  * Space Complexity: O(1) or O(n)
@@ -4384,10 +3898,6 @@ var dataStructureTyped = (() => {
4384
3898
  }
4385
3899
  return true;
4386
3900
  }
4387
- /**
4388
- * Time Complexity: O(n)
4389
- * Space Complexity: O(1)
4390
- */
4391
3901
  /**
4392
3902
  * Time Complexity: O(n)
4393
3903
  * Space Complexity: O(1)
@@ -4415,10 +3925,6 @@ var dataStructureTyped = (() => {
4415
3925
  this.cut(index - 1, true);
4416
3926
  return true;
4417
3927
  }
4418
- /**
4419
- * Time Complexity: O(n)
4420
- * Space Complexity: O(1)
4421
- */
4422
3928
  /**
4423
3929
  * Time Complexity: O(n)
4424
3930
  * Space Complexity: O(1)
@@ -4439,10 +3945,6 @@ var dataStructureTyped = (() => {
4439
3945
  this._lastInBucket = this._bucketSize - _firstInBucket - 1;
4440
3946
  return this;
4441
3947
  }
4442
- /**
4443
- * Time Complexity: O(n)
4444
- * Space Complexity: O(1)
4445
- */
4446
3948
  /**
4447
3949
  * Time Complexity: O(n)
4448
3950
  * Space Complexity: O(1)
@@ -4467,10 +3969,6 @@ var dataStructureTyped = (() => {
4467
3969
  this.cut(index - 1, true);
4468
3970
  return this;
4469
3971
  }
4470
- /**
4471
- * Time Complexity: O(n log n)
4472
- * Space Complexity: O(n)
4473
- */
4474
3972
  /**
4475
3973
  * Time Complexity: O(n log n)
4476
3974
  * Space Complexity: O(n)
@@ -4492,10 +3990,6 @@ var dataStructureTyped = (() => {
4492
3990
  }
4493
3991
  return this;
4494
3992
  }
4495
- /**
4496
- * Time Complexity: O(n)
4497
- * Space Complexity: O(n)
4498
- */
4499
3993
  /**
4500
3994
  * Time Complexity: O(n)
4501
3995
  * Space Complexity: O(n)
@@ -4527,10 +4021,6 @@ var dataStructureTyped = (() => {
4527
4021
  this._bucketLast = newBuckets.length - 1;
4528
4022
  this._buckets = newBuckets;
4529
4023
  }
4530
- /**
4531
- * Time Complexity: O(n)
4532
- * Space Complexity: O(1)
4533
- */
4534
4024
  /**
4535
4025
  * Time Complexity: O(n)
4536
4026
  * Space Complexity: O(1)
@@ -4550,10 +4040,6 @@ var dataStructureTyped = (() => {
4550
4040
  }
4551
4041
  return -1;
4552
4042
  }
4553
- /**
4554
- * Time Complexity: O(n)
4555
- * Space Complexity: O(n)
4556
- */
4557
4043
  /**
4558
4044
  * Time Complexity: O(n)
4559
4045
  * Space Complexity: O(n)
@@ -4564,10 +4050,6 @@ var dataStructureTyped = (() => {
4564
4050
  toArray() {
4565
4051
  return [...this];
4566
4052
  }
4567
- /**
4568
- * Time Complexity: O(n)
4569
- * Space Complexity: O(n)
4570
- */
4571
4053
  /**
4572
4054
  * Time Complexity: O(n)
4573
4055
  * Space Complexity: O(n)
@@ -4580,10 +4062,6 @@ var dataStructureTyped = (() => {
4580
4062
  clone() {
4581
4063
  return new _Deque(this, { bucketSize: this.bucketSize, toElementFn: this.toElementFn });
4582
4064
  }
4583
- /**
4584
- * Time Complexity: O(n)
4585
- * Space Complexity: O(n)
4586
- */
4587
4065
  /**
4588
4066
  * Time Complexity: O(n)
4589
4067
  * Space Complexity: O(n)
@@ -4614,8 +4092,7 @@ var dataStructureTyped = (() => {
4614
4092
  /**
4615
4093
  * Time Complexity: O(n)
4616
4094
  * Space Complexity: O(n)
4617
- */
4618
- /**
4095
+ *
4619
4096
  * The `map` function takes a callback function and applies it to each element in the deque,
4620
4097
  * returning a new deque with the results.
4621
4098
  * @param callback - The callback parameter is a function that will be called for each element in the
@@ -4639,10 +4116,6 @@ var dataStructureTyped = (() => {
4639
4116
  }
4640
4117
  return newDeque;
4641
4118
  }
4642
- /**
4643
- * Time Complexity: O(n)
4644
- * Space Complexity: O(1)
4645
- */
4646
4119
  /**
4647
4120
  * Time Complexity: O(n)
4648
4121
  * Space Complexity: O(1)
@@ -4655,10 +4128,6 @@ var dataStructureTyped = (() => {
4655
4128
  yield this.at(i);
4656
4129
  }
4657
4130
  }
4658
- /**
4659
- * Time Complexity: O(n)
4660
- * Space Complexity: O(n)
4661
- */
4662
4131
  /**
4663
4132
  * Time Complexity: O(n)
4664
4133
  * Space Complexity: O(n)
@@ -4689,10 +4158,6 @@ var dataStructureTyped = (() => {
4689
4158
  this._buckets = newBuckets;
4690
4159
  this._bucketCount = newBuckets.length;
4691
4160
  }
4692
- /**
4693
- * Time Complexity: O(1)
4694
- * Space Complexity: O(1)
4695
- */
4696
4161
  /**
4697
4162
  * Time Complexity: O(1)
4698
4163
  * Space Complexity: O(1)
@@ -5214,10 +4679,6 @@ var dataStructureTyped = (() => {
5214
4679
  peek() {
5215
4680
  return this.min ? this.min.element : void 0;
5216
4681
  }
5217
- /**
5218
- * Time Complexity: O(n), where n is the number of elements in the linked list.
5219
- * Space Complexity: O(1)
5220
- */
5221
4682
  /**
5222
4683
  * Time Complexity: O(n), where n is the number of elements in the linked list.
5223
4684
  * Space Complexity: O(1)
@@ -5262,10 +4723,6 @@ var dataStructureTyped = (() => {
5262
4723
  parent.child.right = node;
5263
4724
  }
5264
4725
  }
5265
- /**
5266
- * Time Complexity: O(log n)
5267
- * Space Complexity: O(1)
5268
- */
5269
4726
  /**
5270
4727
  * Time Complexity: O(log n)
5271
4728
  * Space Complexity: O(1)
@@ -5276,10 +4733,6 @@ var dataStructureTyped = (() => {
5276
4733
  poll() {
5277
4734
  return this.pop();
5278
4735
  }
5279
- /**
5280
- * Time Complexity: O(log n)
5281
- * Space Complexity: O(1)
5282
- */
5283
4736
  /**
5284
4737
  * Time Complexity: O(log n)
5285
4738
  * Space Complexity: O(1)
@@ -5309,10 +4762,6 @@ var dataStructureTyped = (() => {
5309
4762
  this._size--;
5310
4763
  return z.element;
5311
4764
  }
5312
- /**
5313
- * Time Complexity: O(1)
5314
- * Space Complexity: O(1)
5315
- */
5316
4765
  /**
5317
4766
  * Time Complexity: O(1)
5318
4767
  * Space Complexity: O(1)
@@ -5361,10 +4810,6 @@ var dataStructureTyped = (() => {
5361
4810
  return 1;
5362
4811
  return 0;
5363
4812
  }
5364
- /**
5365
- * Time Complexity: O(1)
5366
- * Space Complexity: O(1)
5367
- */
5368
4813
  /**
5369
4814
  * Time Complexity: O(1)
5370
4815
  * Space Complexity: O(1)
@@ -5382,10 +4827,6 @@ var dataStructureTyped = (() => {
5382
4827
  this.root.right = node;
5383
4828
  }
5384
4829
  }
5385
- /**
5386
- * Time Complexity: O(1)
5387
- * Space Complexity: O(1)
5388
- */
5389
4830
  /**
5390
4831
  * Time Complexity: O(1)
5391
4832
  * Space Complexity: O(1)
@@ -5402,10 +4843,6 @@ var dataStructureTyped = (() => {
5402
4843
  if (node.right)
5403
4844
  node.right.left = node.left;
5404
4845
  }
5405
- /**
5406
- * Time Complexity: O(1)
5407
- * Space Complexity: O(1)
5408
- */
5409
4846
  /**
5410
4847
  * Time Complexity: O(1)
5411
4848
  * Space Complexity: O(1)
@@ -5423,10 +4860,6 @@ var dataStructureTyped = (() => {
5423
4860
  x.degree++;
5424
4861
  y.parent = x;
5425
4862
  }
5426
- /**
5427
- * Time Complexity: O(n log n)
5428
- * Space Complexity: O(n)
5429
- */
5430
4863
  /**
5431
4864
  * Time Complexity: O(n log n)
5432
4865
  * Space Complexity: O(n)
@@ -5677,10 +5110,6 @@ var dataStructureTyped = (() => {
5677
5110
  get size() {
5678
5111
  return this._vertexMap.size;
5679
5112
  }
5680
- /**
5681
- * Time Complexity: O(1) - Constant time for Map lookup.
5682
- * Space Complexity: O(1) - Constant space, as it creates only a few variables.
5683
- */
5684
5113
  /**
5685
5114
  * Time Complexity: O(1) - Constant time for Map lookup.
5686
5115
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -5694,10 +5123,6 @@ var dataStructureTyped = (() => {
5694
5123
  getVertex(vertexKey) {
5695
5124
  return this._vertexMap.get(vertexKey) || void 0;
5696
5125
  }
5697
- /**
5698
- * Time Complexity: O(1) - Constant time for Map lookup.
5699
- * Space Complexity: O(1) - Constant space, as it creates only a few variables.
5700
- */
5701
5126
  /**
5702
5127
  * Time Complexity: O(1) - Constant time for Map lookup.
5703
5128
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -5726,10 +5151,6 @@ var dataStructureTyped = (() => {
5726
5151
  const potentialKeyType = typeof potentialKey;
5727
5152
  return potentialKeyType === "string" || potentialKeyType === "number";
5728
5153
  }
5729
- /**
5730
- * Time Complexity: O(K), where K is the number of vertexMap to be removed.
5731
- * Space Complexity: O(1) - Constant space, as it creates only a few variables.
5732
- */
5733
5154
  /**
5734
5155
  * Time Complexity: O(K), where K is the number of vertexMap to be removed.
5735
5156
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -5747,10 +5168,6 @@ var dataStructureTyped = (() => {
5747
5168
  }
5748
5169
  return removed.length > 0;
5749
5170
  }
5750
- /**
5751
- * Time Complexity: O(1) - Depends on the implementation in the concrete class.
5752
- * Space Complexity: O(1) - Depends on the implementation in the concrete class.
5753
- */
5754
5171
  /**
5755
5172
  * Time Complexity: O(1) - Depends on the implementation in the concrete class.
5756
5173
  * Space Complexity: O(1) - Depends on the implementation in the concrete class.
@@ -5788,10 +5205,6 @@ var dataStructureTyped = (() => {
5788
5205
  }
5789
5206
  }
5790
5207
  }
5791
- /**
5792
- * Time Complexity: O(1) - Constant time for Map and Edge operations.
5793
- * Space Complexity: O(1) - Constant space, as it creates only a few variables.
5794
- */
5795
5208
  /**
5796
5209
  * Time Complexity: O(1) - Constant time for Map and Edge operations.
5797
5210
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -5815,10 +5228,6 @@ var dataStructureTyped = (() => {
5815
5228
  return false;
5816
5229
  }
5817
5230
  }
5818
- /**
5819
- * Time Complexity: O(P), where P is the number of paths found (in the worst case, exploring all paths).
5820
- * Space Complexity: O(P) - Linear space, where P is the number of paths found.
5821
- */
5822
5231
  /**
5823
5232
  * Time Complexity: O(P), where P is the number of paths found (in the worst case, exploring all paths).
5824
5233
  * Space Complexity: O(P) - Linear space, where P is the number of paths found.
@@ -5856,10 +5265,6 @@ var dataStructureTyped = (() => {
5856
5265
  }
5857
5266
  return paths;
5858
5267
  }
5859
- /**
5860
- * Time Complexity: O(L), where L is the length of the path.
5861
- * Space Complexity: O(1) - Constant space.
5862
- */
5863
5268
  /**
5864
5269
  * Time Complexity: O(L), where L is the length of the path.
5865
5270
  * Space Complexity: O(1) - Constant space.
@@ -5876,10 +5281,6 @@ var dataStructureTyped = (() => {
5876
5281
  }
5877
5282
  return sum;
5878
5283
  }
5879
- /**
5880
- * Time Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
5881
- * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
5882
- */
5883
5284
  /**
5884
5285
  * Time Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
5885
5286
  * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
@@ -5938,10 +5339,6 @@ var dataStructureTyped = (() => {
5938
5339
  return void 0;
5939
5340
  }
5940
5341
  }
5941
- /**
5942
- * Time Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm or DFS).
5943
- * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm or DFS).
5944
- */
5945
5342
  /**
5946
5343
  * Time Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm or DFS).
5947
5344
  * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm or DFS).
@@ -6009,13 +5406,6 @@ var dataStructureTyped = (() => {
6009
5406
  return minPath;
6010
5407
  }
6011
5408
  }
6012
- /**
6013
- * Dijkstra algorithm time: O(VE) space: O(VO + EO)
6014
- */
6015
- /**
6016
- * Time Complexity: O(V^2 + E) - Quadratic time in the worst case (no heap optimization).
6017
- * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
6018
- */
6019
5409
  /**
6020
5410
  * Time Complexity: O(V^2 + E) - Quadratic time in the worst case (no heap optimization).
6021
5411
  * Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
@@ -6129,18 +5519,6 @@ var dataStructureTyped = (() => {
6129
5519
  genPaths && getPaths(minDest);
6130
5520
  return { distMap, preMap, seen, paths, minDist, minPath };
6131
5521
  }
6132
- /**
6133
- * Dijkstra algorithm time: O(logVE) space: O(VO + EO)
6134
- *
6135
- * Dijkstra's algorithm only solves the single-source shortest path problem, while the Bellman-Ford algorithm and Floyd-Warshall algorithm can address shortest paths between all pairs of nodes.
6136
- * Dijkstra's algorithm is suitable for graphs with non-negative edge weights, whereas the Bellman-Ford algorithm and Floyd-Warshall algorithm can handle negative-weight edgeMap.
6137
- * The time complexity of Dijkstra's algorithm and the Bellman-Ford algorithm depends on the size of the graph, while the time complexity of the Floyd-Warshall algorithm is O(VO^3), where VO is the number of nodes. For dense graphs, Floyd-Warshall might become slower.
6138
- *
6139
- */
6140
- /**
6141
- * Time Complexity: O((V + E) * log(V)) - Depends on the implementation (using a binary heap).
6142
- * Space Complexity: O(V + E) - Depends on the implementation (using a binary heap).
6143
- */
6144
5522
  /**
6145
5523
  * Time Complexity: O((V + E) * log(V)) - Depends on the implementation (using a binary heap).
6146
5524
  * Space Complexity: O(V + E) - Depends on the implementation (using a binary heap).
@@ -6252,11 +5630,6 @@ var dataStructureTyped = (() => {
6252
5630
  }
6253
5631
  return { distMap, preMap, seen, paths, minDist, minPath };
6254
5632
  }
6255
- /**
6256
- * Time Complexity: O(V * E) - Quadratic time in the worst case (Bellman-Ford algorithm).
6257
- * Space Complexity: O(V + E) - Depends on the implementation (Bellman-Ford algorithm).
6258
- * one to rest pairs
6259
- */
6260
5633
  /**
6261
5634
  * Time Complexity: O(V * E) - Quadratic time in the worst case (Bellman-Ford algorithm).
6262
5635
  * Space Complexity: O(V + E) - Depends on the implementation (Bellman-Ford algorithm).
@@ -6372,13 +5745,6 @@ var dataStructureTyped = (() => {
6372
5745
  * The Bellman-Ford algorithm is also used to find the shortest paths from a source node to all other nodes in a graph. Unlike Dijkstra's algorithm, it can handle edge weights that are negative. Its basic idea involves iterative relaxation of all edgeMap for several rounds to gradually approximate the shortest paths. Due to its ability to handle negative-weight edgeMap, the Bellman-Ford algorithm is more flexible in some scenarios.
6373
5746
  * The `bellmanFord` function implements the Bellman-Ford algorithm to find the shortest path from a source vertex to
6374
5747
  */
6375
- /**
6376
- * Time Complexity: O(V^3) - Cubic time (Floyd-Warshall algorithm).
6377
- * Space Complexity: O(V^2) - Quadratic space (Floyd-Warshall algorithm).
6378
- * Not support graph with negative weight cycle
6379
- * all pairs
6380
- * The Floyd-Warshall algorithm is used to find the shortest paths between all pairs of nodes in a graph. It employs dynamic programming to compute the shortest paths from any node to any other node. The Floyd-Warshall algorithm's advantage lies in its ability to handle graphs with negative-weight edgeMap, and it can simultaneously compute shortest paths between any two nodes.
6381
- */
6382
5748
  /**
6383
5749
  * Time Complexity: O(V^3) - Cubic time (Floyd-Warshall algorithm).
6384
5750
  * Space Complexity: O(V^2) - Quadratic space (Floyd-Warshall algorithm).
@@ -6459,10 +5825,6 @@ var dataStructureTyped = (() => {
6459
5825
  }
6460
5826
  return [...uniqueCycles].map((cycleString) => cycleString[1]);
6461
5827
  }
6462
- /**
6463
- * Time Complexity: O(n)
6464
- * Space Complexity: O(n)
6465
- */
6466
5828
  /**
6467
5829
  * Time Complexity: O(n)
6468
5830
  * Space Complexity: O(n)
@@ -6490,10 +5852,6 @@ var dataStructureTyped = (() => {
6490
5852
  }
6491
5853
  return filtered;
6492
5854
  }
6493
- /**
6494
- * Time Complexity: O(n)
6495
- * Space Complexity: O(n)
6496
- */
6497
5855
  /**
6498
5856
  * Time Complexity: O(n)
6499
5857
  * Space Complexity: O(n)
@@ -6591,10 +5949,6 @@ var dataStructureTyped = (() => {
6591
5949
  set inEdgeMap(v) {
6592
5950
  this._inEdgeMap = v;
6593
5951
  }
6594
- /**
6595
- * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
6596
- * This means that using abstract methods in the parent class cannot constrain the grandchild classes. Defining methods within an interface also cannot constrain the descendant classes. When inheriting from this class, developers need to be aware that this method needs to be overridden.
6597
- */
6598
5952
  /**
6599
5953
  * The function creates a new vertex with an optional value and returns it.
6600
5954
  * @param {VertexKey} key - The `key` parameter is the unique identifier for the vertex. It is of type `VertexKey`, which
@@ -6607,10 +5961,6 @@ var dataStructureTyped = (() => {
6607
5961
  createVertex(key, value) {
6608
5962
  return new DirectedVertex(key, value);
6609
5963
  }
6610
- /**
6611
- * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.
6612
- * This means that using abstract methods in the parent class cannot constrain the grandchild classes. Defining methods within an interface also cannot constrain the descendant classes. When inheriting from this class, developers need to be aware that this method needs to be overridden.
6613
- */
6614
5964
  /**
6615
5965
  * The function creates a directed edge between two vertexMap with an optional weight and value.
6616
5966
  * @param {VertexKey} src - The source vertex ID of the edge. It represents the starting point of the edge.
@@ -6624,10 +5974,6 @@ var dataStructureTyped = (() => {
6624
5974
  createEdge(src, dest, weight, value) {
6625
5975
  return new DirectedEdge(src, dest, weight != null ? weight : 1, value);
6626
5976
  }
6627
- /**
6628
- * Time Complexity: O(|V|) where |V| is the number of vertexMap
6629
- * Space Complexity: O(1)
6630
- */
6631
5977
  /**
6632
5978
  * Time Complexity: O(|V|) where |V| is the number of vertexMap
6633
5979
  * Space Complexity: O(1)
@@ -6653,10 +5999,6 @@ var dataStructureTyped = (() => {
6653
5999
  }
6654
6000
  return edgeMap[0] || void 0;
6655
6001
  }
6656
- /**
6657
- * Time Complexity: O(|E|) where |E| is the number of edgeMap
6658
- * Space Complexity: O(1)
6659
- */
6660
6002
  /**
6661
6003
  * Time Complexity: O(|E|) where |E| is the number of edgeMap
6662
6004
  * Space Complexity: O(1)
@@ -6683,10 +6025,6 @@ var dataStructureTyped = (() => {
6683
6025
  }
6684
6026
  return removed;
6685
6027
  }
6686
- /**
6687
- * Time Complexity: O(E) where E is the number of edgeMap
6688
- * Space Complexity: O(1)
6689
- */
6690
6028
  /**
6691
6029
  * Time Complexity: O(E) where E is the number of edgeMap
6692
6030
  * Space Complexity: O(1)
@@ -6726,10 +6064,6 @@ var dataStructureTyped = (() => {
6726
6064
  }
6727
6065
  return removed;
6728
6066
  }
6729
- /**
6730
- * Time Complexity: O(1) - Constant time for Map operations.
6731
- * Space Complexity: O(1) - Constant space, as it creates only a few variables.
6732
- */
6733
6067
  /**
6734
6068
  * Time Complexity: O(1) - Constant time for Map operations.
6735
6069
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -6759,10 +6093,6 @@ var dataStructureTyped = (() => {
6759
6093
  }
6760
6094
  return this._vertexMap.delete(vertexKey);
6761
6095
  }
6762
- /**
6763
- * Time Complexity: O(|E|) where |E| is the number of edgeMap
6764
- * Space Complexity: O(1)
6765
- */
6766
6096
  /**
6767
6097
  * Time Complexity: O(|E|) where |E| is the number of edgeMap
6768
6098
  * Space Complexity: O(1)
@@ -6784,10 +6114,6 @@ var dataStructureTyped = (() => {
6784
6114
  }
6785
6115
  return removed;
6786
6116
  }
6787
- /**
6788
- * Time Complexity: O(1)
6789
- * Space Complexity: O(1)
6790
- */
6791
6117
  /**
6792
6118
  * Time Complexity: O(1)
6793
6119
  * Space Complexity: O(1)
@@ -6804,10 +6130,6 @@ var dataStructureTyped = (() => {
6804
6130
  }
6805
6131
  return [];
6806
6132
  }
6807
- /**
6808
- * Time Complexity: O(1)
6809
- * Space Complexity: O(1)
6810
- */
6811
6133
  /**
6812
6134
  * Time Complexity: O(1)
6813
6135
  * Space Complexity: O(1)
@@ -6824,10 +6146,6 @@ var dataStructureTyped = (() => {
6824
6146
  }
6825
6147
  return [];
6826
6148
  }
6827
- /**
6828
- * Time Complexity: O(1)
6829
- * Space Complexity: O(1)
6830
- */
6831
6149
  /**
6832
6150
  * Time Complexity: O(1)
6833
6151
  * Space Complexity: O(1)
@@ -6839,10 +6157,6 @@ var dataStructureTyped = (() => {
6839
6157
  degreeOf(vertexOrKey) {
6840
6158
  return this.outDegreeOf(vertexOrKey) + this.inDegreeOf(vertexOrKey);
6841
6159
  }
6842
- /**
6843
- * Time Complexity: O(1)
6844
- * Space Complexity: O(1)
6845
- */
6846
6160
  /**
6847
6161
  * Time Complexity: O(1)
6848
6162
  * Space Complexity: O(1)
@@ -6854,10 +6168,6 @@ var dataStructureTyped = (() => {
6854
6168
  inDegreeOf(vertexOrKey) {
6855
6169
  return this.incomingEdgesOf(vertexOrKey).length;
6856
6170
  }
6857
- /**
6858
- * Time Complexity: O(1)
6859
- * Space Complexity: O(1)
6860
- */
6861
6171
  /**
6862
6172
  * Time Complexity: O(1)
6863
6173
  * Space Complexity: O(1)
@@ -6869,10 +6179,6 @@ var dataStructureTyped = (() => {
6869
6179
  outDegreeOf(vertexOrKey) {
6870
6180
  return this.outgoingEdgesOf(vertexOrKey).length;
6871
6181
  }
6872
- /**
6873
- * Time Complexity: O(1)
6874
- * Space Complexity: O(1)
6875
- */
6876
6182
  /**
6877
6183
  * Time Complexity: O(1)
6878
6184
  * Space Complexity: O(1)
@@ -6884,10 +6190,6 @@ var dataStructureTyped = (() => {
6884
6190
  edgesOf(vertexOrKey) {
6885
6191
  return [...this.outgoingEdgesOf(vertexOrKey), ...this.incomingEdgesOf(vertexOrKey)];
6886
6192
  }
6887
- /**
6888
- * Time Complexity: O(1)
6889
- * Space Complexity: O(1)
6890
- */
6891
6193
  /**
6892
6194
  * Time Complexity: O(1)
6893
6195
  * Space Complexity: O(1)
@@ -6899,10 +6201,6 @@ var dataStructureTyped = (() => {
6899
6201
  getEdgeSrc(e) {
6900
6202
  return this._getVertex(e.src);
6901
6203
  }
6902
- /**
6903
- * Time Complexity: O(1)
6904
- * Space Complexity: O(1)
6905
- */
6906
6204
  /**
6907
6205
  * Time Complexity: O(1)
6908
6206
  * Space Complexity: O(1)
@@ -6914,10 +6212,6 @@ var dataStructureTyped = (() => {
6914
6212
  getEdgeDest(e) {
6915
6213
  return this._getVertex(e.dest);
6916
6214
  }
6917
- /**
6918
- * Time Complexity: O(|E|) where |E| is the number of edgeMap
6919
- * Space Complexity: O(1)
6920
- */
6921
6215
  /**
6922
6216
  * Time Complexity: O(|E|) where |E| is the number of edgeMap
6923
6217
  * Space Complexity: O(1)
@@ -6941,10 +6235,6 @@ var dataStructureTyped = (() => {
6941
6235
  }
6942
6236
  return destinations;
6943
6237
  }
6944
- /**
6945
- * Time Complexity: O(|V| + |E|) where |V| is the number of vertexMap and |E| is the number of edgeMap
6946
- * Space Complexity: O(|V|)
6947
- */
6948
6238
  /**
6949
6239
  * Time Complexity: O(|V| + |E|) where |V| is the number of vertexMap and |E| is the number of edgeMap
6950
6240
  * Space Complexity: O(|V|)
@@ -6989,10 +6279,6 @@ var dataStructureTyped = (() => {
6989
6279
  sorted = sorted.map((vertex) => vertex instanceof DirectedVertex ? vertex.key : vertex);
6990
6280
  return sorted.reverse();
6991
6281
  }
6992
- /**
6993
- * Time Complexity: O(|E|) where |E| is the number of edgeMap
6994
- * Space Complexity: O(|E|)
6995
- */
6996
6282
  /**
6997
6283
  * Time Complexity: O(|E|) where |E| is the number of edgeMap
6998
6284
  * Space Complexity: O(|E|)
@@ -7007,10 +6293,6 @@ var dataStructureTyped = (() => {
7007
6293
  });
7008
6294
  return edgeMap;
7009
6295
  }
7010
- /**
7011
- * Time Complexity: O(|E|) where |E| is the number of edgeMap
7012
- * Space Complexity: O(1)
7013
- */
7014
6296
  /**
7015
6297
  * Time Complexity: O(|E|) where |E| is the number of edgeMap
7016
6298
  * Space Complexity: O(1)
@@ -7034,10 +6316,6 @@ var dataStructureTyped = (() => {
7034
6316
  }
7035
6317
  return neighbors;
7036
6318
  }
7037
- /**
7038
- * Time Complexity: O(1)
7039
- * Space Complexity: O(1)
7040
- */
7041
6319
  /**
7042
6320
  * Time Complexity: O(1)
7043
6321
  * Space Complexity: O(1)
@@ -7068,10 +6346,6 @@ var dataStructureTyped = (() => {
7068
6346
  isEmpty() {
7069
6347
  return this.vertexMap.size === 0 && this.inEdgeMap.size === 0 && this.outEdgeMap.size === 0;
7070
6348
  }
7071
- /**
7072
- * Time Complexity: O(1)
7073
- * Space Complexity: O(1)
7074
- */
7075
6349
  /**
7076
6350
  * Time Complexity: O(1)
7077
6351
  * Space Complexity: O(1)
@@ -7095,12 +6369,6 @@ var dataStructureTyped = (() => {
7095
6369
  cloned.outEdgeMap = new Map(this.outEdgeMap);
7096
6370
  return cloned;
7097
6371
  }
7098
- /**
7099
- * Time Complexity: O(V + E)
7100
- * Space Complexity: O(V)
7101
- * Tarjan is an algorithm based on dfs,which is used to solve the connectivity problem of graphs.
7102
- * Tarjan can find the SSC(strongly connected components), articulation points, and bridges of directed graphs.
7103
- */
7104
6372
  /**
7105
6373
  * Time Complexity: O(V + E)
7106
6374
  * Space Complexity: O(V)
@@ -7152,10 +6420,6 @@ var dataStructureTyped = (() => {
7152
6420
  }
7153
6421
  return { dfnMap, lowMap, SCCs };
7154
6422
  }
7155
- /**
7156
- * Time Complexity: O(V + E) - Depends on the implementation (Tarjan's algorithm).
7157
- * Space Complexity: O(V) - Depends on the implementation (Tarjan's algorithm).
7158
- */
7159
6423
  /**
7160
6424
  * Time Complexity: O(V + E) - Depends on the implementation (Tarjan's algorithm).
7161
6425
  * Space Complexity: O(V) - Depends on the implementation (Tarjan's algorithm).
@@ -7184,10 +6448,6 @@ var dataStructureTyped = (() => {
7184
6448
  getSCCs() {
7185
6449
  return this.tarjan().SCCs;
7186
6450
  }
7187
- /**
7188
- * Time Complexity: O(1)
7189
- * Space Complexity: O(1)
7190
- */
7191
6451
  /**
7192
6452
  * Time Complexity: O(1)
7193
6453
  * Space Complexity: O(1)
@@ -7294,10 +6554,6 @@ var dataStructureTyped = (() => {
7294
6554
  createEdge(v1, v2, weight, value) {
7295
6555
  return new UndirectedEdge(v1, v2, weight != null ? weight : 1, value);
7296
6556
  }
7297
- /**
7298
- * Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
7299
- * Space Complexity: O(1)
7300
- */
7301
6557
  /**
7302
6558
  * Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
7303
6559
  * Space Complexity: O(1)
@@ -7321,10 +6577,6 @@ var dataStructureTyped = (() => {
7321
6577
  }
7322
6578
  return edgeMap ? edgeMap[0] || void 0 : void 0;
7323
6579
  }
7324
- /**
7325
- * Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
7326
- * Space Complexity: O(1)
7327
- */
7328
6580
  /**
7329
6581
  * Time Complexity: O(|E|), where |E| is the number of edgeMap incident to the given vertex.
7330
6582
  * Space Complexity: O(1)
@@ -7352,10 +6604,6 @@ var dataStructureTyped = (() => {
7352
6604
  }
7353
6605
  return removed;
7354
6606
  }
7355
- /**
7356
- * Time Complexity: O(E), where E is the number of edgeMap incident to the given vertex.
7357
- * Space Complexity: O(1)
7358
- */
7359
6607
  /**
7360
6608
  * Time Complexity: O(E), where E is the number of edgeMap incident to the given vertex.
7361
6609
  * Space Complexity: O(1)
@@ -7388,10 +6636,6 @@ var dataStructureTyped = (() => {
7388
6636
  return;
7389
6637
  }
7390
6638
  }
7391
- /**
7392
- * Time Complexity: O(1) - Constant time for Map operations.
7393
- * Space Complexity: O(1) - Constant space, as it creates only a few variables.
7394
- */
7395
6639
  /**
7396
6640
  * Time Complexity: O(1) - Constant time for Map operations.
7397
6641
  * Space Complexity: O(1) - Constant space, as it creates only a few variables.
@@ -7426,10 +6670,6 @@ var dataStructureTyped = (() => {
7426
6670
  }
7427
6671
  return this._vertexMap.delete(vertexKey);
7428
6672
  }
7429
- /**
7430
- * Time Complexity: O(1)
7431
- * Space Complexity: O(1)
7432
- */
7433
6673
  /**
7434
6674
  * Time Complexity: O(1)
7435
6675
  * Space Complexity: O(1)
@@ -7449,10 +6689,6 @@ var dataStructureTyped = (() => {
7449
6689
  return 0;
7450
6690
  }
7451
6691
  }
7452
- /**
7453
- * Time Complexity: O(1)
7454
- * Space Complexity: O(1)
7455
- */
7456
6692
  /**
7457
6693
  * Time Complexity: O(1)
7458
6694
  * Space Complexity: O(1)
@@ -7470,10 +6706,6 @@ var dataStructureTyped = (() => {
7470
6706
  return [];
7471
6707
  }
7472
6708
  }
7473
- /**
7474
- * Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
7475
- * Space Complexity: O(|E|)
7476
- */
7477
6709
  /**
7478
6710
  * Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
7479
6711
  * Space Complexity: O(|E|)
@@ -7490,10 +6722,6 @@ var dataStructureTyped = (() => {
7490
6722
  });
7491
6723
  return [...edgeSet];
7492
6724
  }
7493
- /**
7494
- * Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
7495
- * Space Complexity: O(|E|)
7496
- */
7497
6725
  /**
7498
6726
  * Time Complexity: O(|V| + |E|), where |V| is the number of vertexMap and |E| is the number of edgeMap.
7499
6727
  * Space Complexity: O(|E|)
@@ -7517,10 +6745,6 @@ var dataStructureTyped = (() => {
7517
6745
  }
7518
6746
  return neighbors;
7519
6747
  }
7520
- /**
7521
- * Time Complexity: O(1)
7522
- * Space Complexity: O(1)
7523
- */
7524
6748
  /**
7525
6749
  * Time Complexity: O(1)
7526
6750
  * Space Complexity: O(1)
@@ -7550,10 +6774,6 @@ var dataStructureTyped = (() => {
7550
6774
  isEmpty() {
7551
6775
  return this.vertexMap.size === 0 && this.edgeMap.size === 0;
7552
6776
  }
7553
- /**
7554
- * Time Complexity: O(1)
7555
- * Space Complexity: O(1)
7556
- */
7557
6777
  /**
7558
6778
  * Time Complexity: O(1)
7559
6779
  * Space Complexity: O(1)
@@ -7579,10 +6799,6 @@ var dataStructureTyped = (() => {
7579
6799
  cloned.edgeMap = new Map(this.edgeMap);
7580
6800
  return cloned;
7581
6801
  }
7582
- /**
7583
- * Time Complexity: O(1)
7584
- * Space Complexity: O(1)
7585
- */
7586
6802
  /**
7587
6803
  * Time Complexity: O(V + E)
7588
6804
  * Space Complexity: O(V)
@@ -7639,12 +6855,6 @@ var dataStructureTyped = (() => {
7639
6855
  cutVertices
7640
6856
  };
7641
6857
  }
7642
- /**
7643
- * Time Complexity: O(V + E)
7644
- * Space Complexity: O(V)
7645
- * Tarjan is an algorithm based on dfs,which is used to solve the connectivity problem of graphs.
7646
- * 1. Tarjan can find the articulation points and bridges(critical edgeMap) of undirected graphs in linear time
7647
- */
7648
6858
  /**
7649
6859
  * The function "getBridges" returns an array of bridges in a graph using the Tarjan's algorithm.
7650
6860
  * @returns The function `getBridges()` is returning the bridges found using the Tarjan's algorithm.
@@ -7804,6 +7014,13 @@ var dataStructureTyped = (() => {
7804
7014
  }
7805
7015
  };
7806
7016
 
7017
+ // src/types/data-structures/binary-tree/binary-tree.ts
7018
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
7019
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
7020
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
7021
+ return DFSOperation2;
7022
+ })(DFSOperation || {});
7023
+
7807
7024
  // src/data-structures/binary-tree/binary-tree.ts
7808
7025
  var BinaryTreeNode = class {
7809
7026
  /**
@@ -7974,30 +7191,26 @@ var dataStructureTyped = (() => {
7974
7191
  return null;
7975
7192
  if (this.isNode(keyOrNodeOrEntryOrRawElement))
7976
7193
  return keyOrNodeOrEntryOrRawElement;
7977
- if (this.toEntryFn) {
7978
- const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
7979
- if (key)
7980
- return this.createNode(key, entryValue != null ? entryValue : value);
7981
- else
7982
- return;
7983
- }
7984
7194
  if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
7985
- const [key, value2] = keyOrNodeOrEntryOrRawElement;
7195
+ const [key, entryValue] = keyOrNodeOrEntryOrRawElement;
7986
7196
  if (key === void 0)
7987
7197
  return;
7988
7198
  else if (key === null)
7989
7199
  return null;
7200
+ if (this.isKey(key))
7201
+ return this.createNode(key, value != null ? value : entryValue);
7202
+ }
7203
+ if (this.toEntryFn) {
7204
+ const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
7205
+ if (this.isKey(key))
7206
+ return this.createNode(key, value != null ? value : entryValue);
7990
7207
  else
7991
- return this.createNode(key, value2);
7208
+ return;
7992
7209
  }
7993
7210
  if (this.isKey(keyOrNodeOrEntryOrRawElement))
7994
7211
  return this.createNode(keyOrNodeOrEntryOrRawElement, value);
7995
7212
  return;
7996
7213
  }
7997
- /**
7998
- * Time Complexity: O(n)
7999
- * Space Complexity: O(log n)
8000
- */
8001
7214
  /**
8002
7215
  * Time Complexity: O(n)
8003
7216
  * Space Complexity: O(log n)
@@ -8012,7 +7225,7 @@ var dataStructureTyped = (() => {
8012
7225
  * default value of `'ITERATIVE'`.
8013
7226
  * @returns The function `ensureNode` returns either a `NODE` object, `null`, or `undefined`.
8014
7227
  */
8015
- ensureNode(keyOrNodeOrEntryOrRawElement, iterationType = "ITERATIVE") {
7228
+ ensureNode(keyOrNodeOrEntryOrRawElement, iterationType = this.iterationType) {
8016
7229
  if (keyOrNodeOrEntryOrRawElement === null)
8017
7230
  return null;
8018
7231
  if (keyOrNodeOrEntryOrRawElement === void 0)
@@ -8023,7 +7236,7 @@ var dataStructureTyped = (() => {
8023
7236
  return keyOrNodeOrEntryOrRawElement;
8024
7237
  if (this.toEntryFn) {
8025
7238
  const [key] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
8026
- if (key)
7239
+ if (this.isKey(key))
8027
7240
  return this.getNodeByKey(key);
8028
7241
  }
8029
7242
  if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
@@ -8065,7 +7278,7 @@ var dataStructureTyped = (() => {
8065
7278
  * `BTNKeyOrNodeOrEntry<K, V, NODE>`.
8066
7279
  * @returns a boolean value.
8067
7280
  */
8068
- isNodeOrNull(node) {
7281
+ isRealNodeOrNull(node) {
8069
7282
  return this.isRealNode(node) || node === null;
8070
7283
  }
8071
7284
  /**
@@ -8077,6 +7290,23 @@ var dataStructureTyped = (() => {
8077
7290
  isNIL(node) {
8078
7291
  return node === this.NIL;
8079
7292
  }
7293
+ /**
7294
+ * The function `isLeaf` determines whether a given node is a leaf node in a binary tree structure.
7295
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} node - The `node` parameter in the `isLeaf` function
7296
+ * can be either a regular node (`R`) or a `BTNKeyOrNodeOrEntry<K, V, NODE>`.
7297
+ * @returns The `isLeaf` function is checking if the provided node is a leaf node in a binary tree.
7298
+ * If the node is `undefined`, it returns `false`. If the node is `null`, it returns `true`.
7299
+ * Otherwise, it checks if both the left and right children of the node are not real nodes, and
7300
+ * returns `true` if they are not, indicating that the node is a
7301
+ */
7302
+ isLeaf(node) {
7303
+ node = this.ensureNode(node);
7304
+ if (node === void 0)
7305
+ return false;
7306
+ if (node === null)
7307
+ return true;
7308
+ return !this.isRealNode(node.left) && !this.isRealNode(node.right);
7309
+ }
8080
7310
  /**
8081
7311
  * The function checks if the input is an array with two elements, indicating it is a binary tree
8082
7312
  * node entry.
@@ -8088,41 +7318,21 @@ var dataStructureTyped = (() => {
8088
7318
  return Array.isArray(keyOrNodeOrEntryOrRawElement) && keyOrNodeOrEntryOrRawElement.length === 2;
8089
7319
  }
8090
7320
  /**
8091
- * The function checks if a given value is a valid key by evaluating its type and value.
8092
- * @param {any} key - The `key` parameter can be of any type. It is the value that we want to check
8093
- * if it is a valid key.
8094
- * @param [isCheckValueOf=true] - The `isCheckValueOf` parameter is a boolean flag that determines
8095
- * whether the function should check the valueOf() method of an object when the key is of type
8096
- * 'object'. If `isCheckValueOf` is true, the function will recursively call itself with the value
8097
- * returned by key.valueOf().
8098
- * @returns a boolean value.
7321
+ * Time Complexity O(1)
7322
+ * Space Complexity O(1)
7323
+ *
7324
+ * The function `isKey` checks if a given key is comparable.
7325
+ * @param {any} key - The `key` parameter is of type `any`, which means it can be any data type in
7326
+ * TypeScript.
7327
+ * @returns The function `isKey` is checking if the `key` parameter is `null` or if it is comparable.
7328
+ * If the `key` is `null`, the function returns `true`. Otherwise, it returns the result of the
7329
+ * `isComparable` function, which is not provided in the code snippet.
8099
7330
  */
8100
- isKey(key, isCheckValueOf = true) {
7331
+ isKey(key) {
8101
7332
  if (key === null)
8102
7333
  return true;
8103
- const keyType = typeof key;
8104
- if (keyType === "string" || keyType === "bigint" || keyType === "boolean")
8105
- return true;
8106
- if (keyType === "number")
8107
- return !isNaN(key);
8108
- if (keyType === "symbol" || keyType === "undefined")
8109
- return false;
8110
- if (keyType === "function")
8111
- return this.isKey(key());
8112
- if (keyType === "object") {
8113
- if (typeof key.toString === "function")
8114
- return true;
8115
- if (isCheckValueOf && typeof key.valueOf === "function") {
8116
- this.isKey(key.valueOf(), false);
8117
- }
8118
- return false;
8119
- }
8120
- return false;
7334
+ return isComparable(key);
8121
7335
  }
8122
- /**
8123
- * Time Complexity O(n)
8124
- * Space Complexity O(1)
8125
- */
8126
7336
  /**
8127
7337
  * Time Complexity O(n)
8128
7338
  * Space Complexity O(1)
@@ -8179,11 +7389,6 @@ var dataStructureTyped = (() => {
8179
7389
  }
8180
7390
  return false;
8181
7391
  }
8182
- /**
8183
- * Time Complexity: O(k * n)
8184
- * Space Complexity: O(1)
8185
- * Comments: The time complexity for adding a node depends on the depth of the tree. In the best case (when the tree is empty), it's O(1). In the worst case (when the tree is a degenerate tree), it's O(n). The space complexity is constant.
8186
- */
8187
7392
  /**
8188
7393
  * Time Complexity: O(k * n)
8189
7394
  * Space Complexity: O(1)
@@ -8216,11 +7421,6 @@ var dataStructureTyped = (() => {
8216
7421
  }
8217
7422
  return inserted;
8218
7423
  }
8219
- /**
8220
- * Time Complexity: O(k * n)
8221
- * Space Complexity: O(1)
8222
- * "n" is the number of nodes in the tree, and "k" is the number of keys to be inserted.
8223
- */
8224
7424
  /**
8225
7425
  * Time Complexity: O(k * n)
8226
7426
  * Space Complexity: O(1)
@@ -8236,10 +7436,6 @@ var dataStructureTyped = (() => {
8236
7436
  this.clear();
8237
7437
  this.addMany(keysOrNodesOrEntriesOrRawElements, values);
8238
7438
  }
8239
- /**
8240
- * Time Complexity: O(n)
8241
- * Space Complexity: O(1)
8242
- */
8243
7439
  /**
8244
7440
  * Time Complexity: O(n)
8245
7441
  * Space Complexity: O(1)
@@ -8269,7 +7465,7 @@ var dataStructureTyped = (() => {
8269
7465
  if (!curr.left && !curr.right && !parent) {
8270
7466
  this._setRoot(void 0);
8271
7467
  } else if (curr.left) {
8272
- const leftSubTreeRightMost = this.getRightMost(curr.left);
7468
+ const leftSubTreeRightMost = this.getRightMost((node) => node, curr.left);
8273
7469
  if (leftSubTreeRightMost) {
8274
7470
  const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
8275
7471
  orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
@@ -8297,10 +7493,6 @@ var dataStructureTyped = (() => {
8297
7493
  deletedResult.push({ deleted: orgCurrent, needBalanced });
8298
7494
  return deletedResult;
8299
7495
  }
8300
- /**
8301
- * Time Complexity: O(n)
8302
- * Space Complexity: O(k + log n)
8303
- */
8304
7496
  /**
8305
7497
  * Time Complexity: O(n)
8306
7498
  * Space Complexity: O(k + log n)
@@ -8326,6 +7518,10 @@ var dataStructureTyped = (() => {
8326
7518
  * @returns an array of NODE objects.
8327
7519
  */
8328
7520
  getNodes(identifier, callback = this._DEFAULT_CALLBACK, onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
7521
+ if (identifier === void 0)
7522
+ return [];
7523
+ if (identifier === null)
7524
+ return [];
8329
7525
  beginRoot = this.ensureNode(beginRoot);
8330
7526
  if (!beginRoot)
8331
7527
  return [];
@@ -8361,10 +7557,6 @@ var dataStructureTyped = (() => {
8361
7557
  }
8362
7558
  return ans;
8363
7559
  }
8364
- /**
8365
- * Time Complexity: O(n)
8366
- * Space Complexity: O(log n).
8367
- */
8368
7560
  /**
8369
7561
  * Time Complexity: O(n)
8370
7562
  * Space Complexity: O(log n).
@@ -8387,10 +7579,6 @@ var dataStructureTyped = (() => {
8387
7579
  var _a;
8388
7580
  return (_a = this.getNodes(identifier, callback, true, beginRoot, iterationType)[0]) != null ? _a : null;
8389
7581
  }
8390
- /**
8391
- * Time Complexity: O(n)
8392
- * Space Complexity: O(log n)
8393
- */
8394
7582
  /**
8395
7583
  * Time Complexity: O(n)
8396
7584
  * Space Complexity: O(log n)
@@ -8403,13 +7591,9 @@ var dataStructureTyped = (() => {
8403
7591
  * It has a default value of `'ITERATIVE'`.
8404
7592
  * @returns a value of type NODE, null, or undefined.
8405
7593
  */
8406
- getNodeByKey(key, iterationType = "ITERATIVE") {
7594
+ getNodeByKey(key, iterationType = this.iterationType) {
8407
7595
  return this.getNode(key, this._DEFAULT_CALLBACK, this.root, iterationType);
8408
7596
  }
8409
- /**
8410
- * Time Complexity: O(n)
8411
- * Space Complexity: O(log n)
8412
- */
8413
7597
  /**
8414
7598
  * Time Complexity: O(n)
8415
7599
  * Space Complexity: O(log n)
@@ -8435,10 +7619,6 @@ var dataStructureTyped = (() => {
8435
7619
  var _a;
8436
7620
  return (_a = this.getNode(identifier, callback, beginRoot, iterationType)) == null ? void 0 : _a.value;
8437
7621
  }
8438
- /**
8439
- * Time Complexity: O(n)
8440
- * Space Complexity: O(log n)
8441
- */
8442
7622
  /**
8443
7623
  * Time Complexity: O(n)
8444
7624
  * Space Complexity: O(log n)
@@ -8463,10 +7643,6 @@ var dataStructureTyped = (() => {
8463
7643
  callback = this._ensureCallback(identifier, callback);
8464
7644
  return this.getNodes(identifier, callback, true, beginRoot, iterationType).length > 0;
8465
7645
  }
8466
- /**
8467
- * Time Complexity: O(1)
8468
- * Space Complexity: O(1)
8469
- */
8470
7646
  /**
8471
7647
  * Time Complexity: O(1)
8472
7648
  * Space Complexity: O(1)
@@ -8477,10 +7653,6 @@ var dataStructureTyped = (() => {
8477
7653
  this._setRoot(void 0);
8478
7654
  this._size = 0;
8479
7655
  }
8480
- /**
8481
- * Time Complexity: O(1)
8482
- * Space Complexity: O(1)
8483
- */
8484
7656
  /**
8485
7657
  * Time Complexity: O(1)
8486
7658
  * Space Complexity: O(1)
@@ -8491,10 +7663,6 @@ var dataStructureTyped = (() => {
8491
7663
  isEmpty() {
8492
7664
  return this.size === 0;
8493
7665
  }
8494
- /**
8495
- * Time Complexity: O(n)
8496
- * Space Complexity: O(log n)
8497
- */
8498
7666
  /**
8499
7667
  * Time Complexity: O(n)
8500
7668
  * Space Complexity: O(log n)
@@ -8510,10 +7678,6 @@ var dataStructureTyped = (() => {
8510
7678
  isPerfectlyBalanced(beginRoot = this.root) {
8511
7679
  return this.getMinHeight(beginRoot) + 1 >= this.getHeight(beginRoot);
8512
7680
  }
8513
- /**
8514
- * Time Complexity: O(n)
8515
- * Space Complexity: O(1)
8516
- */
8517
7681
  /**
8518
7682
  * Time Complexity: O(n)
8519
7683
  * Space Complexity: O(1)
@@ -8567,10 +7731,6 @@ var dataStructureTyped = (() => {
8567
7731
  return isStandardBST || isInverseBST;
8568
7732
  }
8569
7733
  }
8570
- /**
8571
- * Time Complexity: O(n)
8572
- * Space Complexity: O(1)
8573
- */
8574
7734
  /**
8575
7735
  * Time Complexity: O(n)
8576
7736
  * Space Complexity: O(1)
@@ -8598,10 +7758,6 @@ var dataStructureTyped = (() => {
8598
7758
  }
8599
7759
  return depth;
8600
7760
  }
8601
- /**
8602
- * Time Complexity: O(n)
8603
- * Space Complexity: O(1)
8604
- */
8605
7761
  /**
8606
7762
  * Time Complexity: O(n)
8607
7763
  * Space Complexity: O(1)
@@ -8642,10 +7798,6 @@ var dataStructureTyped = (() => {
8642
7798
  return maxHeight;
8643
7799
  }
8644
7800
  }
8645
- /**
8646
- * Time Complexity: O(n)
8647
- * Space Complexity: O(log n)
8648
- */
8649
7801
  /**
8650
7802
  * Time Complexity: O(n)
8651
7803
  * Space Complexity: O(log n)
@@ -8704,10 +7856,6 @@ var dataStructureTyped = (() => {
8704
7856
  return (_c = depths.get(beginRoot)) != null ? _c : -1;
8705
7857
  }
8706
7858
  }
8707
- /**
8708
- * Time Complexity: O(log n)
8709
- * Space Complexity: O(log n)
8710
- */
8711
7859
  /**
8712
7860
  * Time Complexity: O(log n)
8713
7861
  * Space Complexity: O(log n)
@@ -8733,89 +7881,93 @@ var dataStructureTyped = (() => {
8733
7881
  result.push(beginNodeEnsured);
8734
7882
  return isReverse ? result.reverse() : result;
8735
7883
  }
8736
- /**
8737
- * Time Complexity: O(log n)
8738
- * Space Complexity: O(1)
8739
- */
8740
7884
  /**
8741
7885
  * Time Complexity: O(log n)
8742
7886
  * Space Complexity: O(1)
8743
7887
  *
8744
- * The `getLeftMost` function returns the leftmost node in a binary tree, either using recursive or
8745
- * iterative traversal.
8746
- * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} beginRoot - The `beginRoot` parameter represents the
8747
- * starting point for finding the leftmost node in a binary tree. It can be either a root node (`R`),
8748
- * a key or node or entry (`BTNKeyOrNodeOrEntry<K, V, NODE>`), or `null` or `undefined`.
8749
- * @param {IterationType} iterationType - The `iterationType` parameter is used to specify the type
8750
- * of iteration to be performed. It can have two possible values:
8751
- * @returns The function `getLeftMost` returns the leftmost node in a binary tree.
7888
+ * The function `getLeftMost` retrieves the leftmost node in a binary tree using either recursive or
7889
+ * tail-recursive iteration.
7890
+ * @param {C} callback - The `callback` parameter is a function that will be called with the leftmost
7891
+ * node of a binary tree or null if the tree is empty. It has a default value of `_DEFAULT_CALLBACK`
7892
+ * if not provided explicitly.
7893
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} beginRoot - The `beginRoot` parameter in the
7894
+ * `getLeftMost` function represents the starting point for finding the leftmost node in a binary
7895
+ * tree. It can be either a reference to the root node of the tree (`R`), or a key, node, or entry in
7896
+ * the binary tree structure (`
7897
+ * @param {IterationType} iterationType - The `iterationType` parameter in the `getLeftMost` function
7898
+ * specifies the type of iteration to be used when traversing the binary tree nodes. It can have two
7899
+ * possible values:
7900
+ * @returns The `getLeftMost` function returns the result of the callback function `C` applied to the
7901
+ * leftmost node in the binary tree starting from the `beginRoot` node. If the `beginRoot` is `NIL`,
7902
+ * it returns the result of the callback function applied to `undefined`. If the `beginRoot` is not a
7903
+ * real node, it returns the result of the callback function applied
8752
7904
  */
8753
- getLeftMost(beginRoot = this.root, iterationType = this.iterationType) {
7905
+ getLeftMost(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
8754
7906
  if (this.isNIL(beginRoot))
8755
- return beginRoot;
7907
+ return callback(void 0);
8756
7908
  beginRoot = this.ensureNode(beginRoot);
8757
7909
  if (!this.isRealNode(beginRoot))
8758
- return beginRoot;
7910
+ return callback(beginRoot);
8759
7911
  if (iterationType === "RECURSIVE") {
8760
7912
  const dfs = (cur) => {
8761
7913
  if (!this.isRealNode(cur.left))
8762
7914
  return cur;
8763
7915
  return dfs(cur.left);
8764
7916
  };
8765
- return dfs(beginRoot);
7917
+ return callback(dfs(beginRoot));
8766
7918
  } else {
8767
7919
  const dfs = trampoline((cur) => {
8768
7920
  if (!this.isRealNode(cur.left))
8769
7921
  return cur;
8770
7922
  return dfs.cont(cur.left);
8771
7923
  });
8772
- return dfs(beginRoot);
7924
+ return callback(dfs(beginRoot));
8773
7925
  }
8774
7926
  }
8775
- /**
8776
- * Time Complexity: O(log n)
8777
- * Space Complexity: O(1)
8778
- */
8779
7927
  /**
8780
7928
  * Time Complexity: O(log n)
8781
7929
  * Space Complexity: O(1)
8782
7930
  *
8783
- * The `getRightMost` function returns the rightmost node in a binary tree, either recursively or
8784
- * iteratively.
8785
- * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} beginRoot - The `beginRoot` parameter represents the
8786
- * starting point for finding the rightmost node in a binary tree. It can be either a root node
8787
- * (`R`), a key or node or entry (`BTNKeyOrNodeOrEntry<K, V, NODE>`), or `null` or `undefined`.
8788
- * @param {IterationType} iterationType - The `iterationType` parameter is used to specify the type
8789
- * of iteration to be performed when finding the rightmost node in a binary tree. It can have two
8790
- * possible values:
8791
- * @returns The function `getRightMost` returns a NODE object, `null`, or `undefined`.
7931
+ * The function `getRightMost` retrieves the rightmost node in a binary tree using either recursive
7932
+ * or iterative traversal methods.
7933
+ * @param {C} callback - The `callback` parameter is a function that will be called with the result
7934
+ * of the operation. It has a generic type `C` which extends `BTNCallback<OptBTNOrNull<NODE>>`. The
7935
+ * default value for `callback` is `this._DEFAULT_CALLBACK` if it is not provided.
7936
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} beginRoot - The `beginRoot` parameter in the
7937
+ * `getRightMost` function represents the starting point for finding the rightmost node in a binary
7938
+ * tree. It can be either a reference to the root node of the tree (`this.root`) or a specific key,
7939
+ * node, or entry in the tree. If
7940
+ * @param {IterationType} iterationType - The `iterationType` parameter in the `getRightMost`
7941
+ * function specifies the type of iteration to be used when finding the rightmost node in a binary
7942
+ * tree. It can have two possible values:
7943
+ * @returns The `getRightMost` function returns the result of the callback function `C` applied to
7944
+ * the rightmost node in the binary tree. The rightmost node is found either through a recursive
7945
+ * depth-first search (if `iterationType` is 'RECURSIVE') or through an indirect implementation of
7946
+ * iteration using tail recursion optimization. The result of the callback function applied to the
7947
+ * rightmost node is returned
8792
7948
  */
8793
- getRightMost(beginRoot = this.root, iterationType = this.iterationType) {
7949
+ getRightMost(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
8794
7950
  if (this.isNIL(beginRoot))
8795
- return beginRoot;
7951
+ return callback(void 0);
8796
7952
  beginRoot = this.ensureNode(beginRoot);
8797
7953
  if (!beginRoot)
8798
- return beginRoot;
7954
+ return callback(beginRoot);
8799
7955
  if (iterationType === "RECURSIVE") {
8800
7956
  const dfs = (cur) => {
8801
7957
  if (!this.isRealNode(cur.right))
8802
7958
  return cur;
8803
7959
  return dfs(cur.right);
8804
7960
  };
8805
- return dfs(beginRoot);
7961
+ return callback(dfs(beginRoot));
8806
7962
  } else {
8807
7963
  const dfs = trampoline((cur) => {
8808
7964
  if (!this.isRealNode(cur.right))
8809
7965
  return cur;
8810
7966
  return dfs.cont(cur.right);
8811
7967
  });
8812
- return dfs(beginRoot);
7968
+ return callback(dfs(beginRoot));
8813
7969
  }
8814
7970
  }
8815
- /**
8816
- * Time Complexity: O(log n)
8817
- * Space Complexity: O(1)
8818
- */
8819
7971
  /**
8820
7972
  * Time Complexity: O(log n)
8821
7973
  * Space Complexity: O(1)
@@ -8838,10 +7990,6 @@ var dataStructureTyped = (() => {
8838
7990
  return node;
8839
7991
  }
8840
7992
  }
8841
- /**
8842
- * Time Complexity: O(log n)
8843
- * Space Complexity: O(1)
8844
- */
8845
7993
  /**
8846
7994
  * Time Complexity: O(log n)
8847
7995
  * Space Complexity: O(1)
@@ -8856,7 +8004,7 @@ var dataStructureTyped = (() => {
8856
8004
  if (!this.isRealNode(x))
8857
8005
  return void 0;
8858
8006
  if (this.isRealNode(x.right)) {
8859
- return this.getLeftMost(x.right);
8007
+ return this.getLeftMost((node) => node, x.right);
8860
8008
  }
8861
8009
  let y = x.parent;
8862
8010
  while (this.isRealNode(y) && x === y.right) {
@@ -8865,10 +8013,6 @@ var dataStructureTyped = (() => {
8865
8013
  }
8866
8014
  return y;
8867
8015
  }
8868
- /**
8869
- * Time complexity: O(n)
8870
- * Space complexity: O(n)
8871
- */
8872
8016
  /**
8873
8017
  * Time complexity: O(n)
8874
8018
  * Space complexity: O(n)
@@ -8892,109 +8036,12 @@ var dataStructureTyped = (() => {
8892
8036
  * values will
8893
8037
  * @returns an array of the return types of the callback function.
8894
8038
  */
8895
- dfs(callback = this._DEFAULT_CALLBACK, pattern = "IN", beginRoot = this.root, iterationType = "ITERATIVE", includeNull = false) {
8039
+ dfs(callback = this._DEFAULT_CALLBACK, pattern = "IN", beginRoot = this.root, iterationType = this.iterationType, includeNull = false) {
8896
8040
  beginRoot = this.ensureNode(beginRoot);
8897
8041
  if (!beginRoot)
8898
8042
  return [];
8899
- const ans = [];
8900
- if (iterationType === "RECURSIVE") {
8901
- const dfs = (node) => {
8902
- switch (pattern) {
8903
- case "IN":
8904
- if (includeNull) {
8905
- if (this.isRealNode(node) && this.isNodeOrNull(node.left))
8906
- dfs(node.left);
8907
- this.isNodeOrNull(node) && ans.push(callback(node));
8908
- if (this.isRealNode(node) && this.isNodeOrNull(node.right))
8909
- dfs(node.right);
8910
- } else {
8911
- if (this.isRealNode(node) && this.isRealNode(node.left))
8912
- dfs(node.left);
8913
- this.isRealNode(node) && ans.push(callback(node));
8914
- if (this.isRealNode(node) && this.isRealNode(node.right))
8915
- dfs(node.right);
8916
- }
8917
- break;
8918
- case "PRE":
8919
- if (includeNull) {
8920
- this.isNodeOrNull(node) && ans.push(callback(node));
8921
- if (this.isRealNode(node) && this.isNodeOrNull(node.left))
8922
- dfs(node.left);
8923
- if (this.isRealNode(node) && this.isNodeOrNull(node.right))
8924
- dfs(node.right);
8925
- } else {
8926
- this.isRealNode(node) && ans.push(callback(node));
8927
- if (this.isRealNode(node) && this.isRealNode(node.left))
8928
- dfs(node.left);
8929
- if (this.isRealNode(node) && this.isRealNode(node.right))
8930
- dfs(node.right);
8931
- }
8932
- break;
8933
- case "POST":
8934
- if (includeNull) {
8935
- if (this.isRealNode(node) && this.isNodeOrNull(node.left))
8936
- dfs(node.left);
8937
- if (this.isRealNode(node) && this.isNodeOrNull(node.right))
8938
- dfs(node.right);
8939
- this.isNodeOrNull(node) && ans.push(callback(node));
8940
- } else {
8941
- if (this.isRealNode(node) && this.isRealNode(node.left))
8942
- dfs(node.left);
8943
- if (this.isRealNode(node) && this.isRealNode(node.right))
8944
- dfs(node.right);
8945
- this.isRealNode(node) && ans.push(callback(node));
8946
- }
8947
- break;
8948
- }
8949
- };
8950
- dfs(beginRoot);
8951
- } else {
8952
- const stack = [{ opt: 0, node: beginRoot }];
8953
- while (stack.length > 0) {
8954
- const cur = stack.pop();
8955
- if (cur === void 0 || this.isNIL(cur.node))
8956
- continue;
8957
- if (includeNull) {
8958
- if (cur.node === void 0)
8959
- continue;
8960
- } else {
8961
- if (cur.node === null || cur.node === void 0)
8962
- continue;
8963
- }
8964
- if (cur.opt === 1) {
8965
- ans.push(callback(cur.node));
8966
- } else {
8967
- switch (pattern) {
8968
- case "IN":
8969
- cur.node && stack.push({ opt: 0, node: cur.node.right });
8970
- stack.push({ opt: 1, node: cur.node });
8971
- cur.node && stack.push({ opt: 0, node: cur.node.left });
8972
- break;
8973
- case "PRE":
8974
- cur.node && stack.push({ opt: 0, node: cur.node.right });
8975
- cur.node && stack.push({ opt: 0, node: cur.node.left });
8976
- stack.push({ opt: 1, node: cur.node });
8977
- break;
8978
- case "POST":
8979
- stack.push({ opt: 1, node: cur.node });
8980
- cur.node && stack.push({ opt: 0, node: cur.node.right });
8981
- cur.node && stack.push({ opt: 0, node: cur.node.left });
8982
- break;
8983
- default:
8984
- cur.node && stack.push({ opt: 0, node: cur.node.right });
8985
- stack.push({ opt: 1, node: cur.node });
8986
- cur.node && stack.push({ opt: 0, node: cur.node.left });
8987
- break;
8988
- }
8989
- }
8990
- }
8991
- }
8992
- return ans;
8043
+ return this._dfs(callback, pattern, beginRoot, iterationType, includeNull);
8993
8044
  }
8994
- /**
8995
- * Time complexity: O(n)
8996
- * Space complexity: O(n)
8997
- */
8998
8045
  /**
8999
8046
  * Time complexity: O(n)
9000
8047
  * Space complexity: O(n)
@@ -9030,9 +8077,9 @@ var dataStructureTyped = (() => {
9030
8077
  const current = queue.shift();
9031
8078
  ans.push(callback(current));
9032
8079
  if (includeNull) {
9033
- if (current && this.isNodeOrNull(current.left))
8080
+ if (current && this.isRealNodeOrNull(current.left))
9034
8081
  queue.push(current.left);
9035
- if (current && this.isNodeOrNull(current.right))
8082
+ if (current && this.isRealNodeOrNull(current.right))
9036
8083
  queue.push(current.right);
9037
8084
  } else {
9038
8085
  if (this.isRealNode(current.left))
@@ -9051,9 +8098,9 @@ var dataStructureTyped = (() => {
9051
8098
  const current = queue.shift();
9052
8099
  ans.push(callback(current));
9053
8100
  if (includeNull) {
9054
- if (current && this.isNodeOrNull(current.left))
8101
+ if (current && this.isRealNodeOrNull(current.left))
9055
8102
  queue.push(current.left);
9056
- if (current && this.isNodeOrNull(current.right))
8103
+ if (current && this.isRealNodeOrNull(current.right))
9057
8104
  queue.push(current.right);
9058
8105
  } else {
9059
8106
  if (this.isRealNode(current.left))
@@ -9069,7 +8116,54 @@ var dataStructureTyped = (() => {
9069
8116
  /**
9070
8117
  * Time complexity: O(n)
9071
8118
  * Space complexity: O(n)
9072
- */
8119
+ *
8120
+ * The `leaves` function in TypeScript iterates through a binary tree to find and return the leaf
8121
+ * nodes based on a specified callback and iteration type.
8122
+ * @param {C} callback - The `callback` parameter is a function that will be called on each leaf node
8123
+ * in the binary tree. It is a generic type `C` that extends `BTNCallback<NODE | null>`, where `NODE`
8124
+ * represents a node in the binary tree. The default value for `callback` is
8125
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} beginRoot - The `beginRoot` parameter in the `leaves`
8126
+ * method is used to specify the starting point for finding and processing the leaves of a binary
8127
+ * tree. It represents the root node of the binary tree or a specific key, node, or entry within the
8128
+ * tree from which the search for leaves should begin
8129
+ * @param {IterationType} iterationType - The `iterationType` parameter in the `leaves` method
8130
+ * specifies the type of iteration to be performed when collecting the leaves of a binary tree. It
8131
+ * can have two possible values:
8132
+ * @returns The `leaves` method returns an array of values that are the result of applying the
8133
+ * provided callback function to the leaf nodes in the binary tree structure.
8134
+ */
8135
+ leaves(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
8136
+ beginRoot = this.ensureNode(beginRoot);
8137
+ const leaves = [];
8138
+ if (!this.isRealNode(beginRoot)) {
8139
+ return [];
8140
+ }
8141
+ if (iterationType === "RECURSIVE") {
8142
+ const dfs = (cur) => {
8143
+ if (this.isLeaf(cur)) {
8144
+ leaves.push(callback(cur));
8145
+ }
8146
+ if (!this.isRealNode(cur.left) && !this.isRealNode(cur.right))
8147
+ return;
8148
+ this.isRealNode(cur.left) && dfs(cur.left);
8149
+ this.isRealNode(cur.right) && dfs(cur.right);
8150
+ };
8151
+ dfs(beginRoot);
8152
+ } else {
8153
+ const queue = new Queue([beginRoot]);
8154
+ while (queue.size > 0) {
8155
+ const cur = queue.shift();
8156
+ if (this.isRealNode(cur)) {
8157
+ if (this.isLeaf(cur)) {
8158
+ leaves.push(callback(cur));
8159
+ }
8160
+ this.isRealNode(cur.left) && queue.push(cur.left);
8161
+ this.isRealNode(cur.right) && queue.push(cur.right);
8162
+ }
8163
+ }
8164
+ }
8165
+ return leaves;
8166
+ }
9073
8167
  /**
9074
8168
  * Time complexity: O(n)
9075
8169
  * Space complexity: O(n)
@@ -9102,9 +8196,9 @@ var dataStructureTyped = (() => {
9102
8196
  levelsNodes[level] = [];
9103
8197
  levelsNodes[level].push(callback(node));
9104
8198
  if (includeNull) {
9105
- if (node && this.isNodeOrNull(node.left))
8199
+ if (node && this.isRealNodeOrNull(node.left))
9106
8200
  _recursive(node.left, level + 1);
9107
- if (node && this.isNodeOrNull(node.right))
8201
+ if (node && this.isRealNodeOrNull(node.right))
9108
8202
  _recursive(node.right, level + 1);
9109
8203
  } else {
9110
8204
  if (node && node.left)
@@ -9123,9 +8217,9 @@ var dataStructureTyped = (() => {
9123
8217
  levelsNodes[level] = [];
9124
8218
  levelsNodes[level].push(callback(node));
9125
8219
  if (includeNull) {
9126
- if (node && this.isNodeOrNull(node.right))
8220
+ if (node && this.isRealNodeOrNull(node.right))
9127
8221
  stack.push([node.right, level + 1]);
9128
- if (node && this.isNodeOrNull(node.left))
8222
+ if (node && this.isRealNodeOrNull(node.left))
9129
8223
  stack.push([node.left, level + 1]);
9130
8224
  } else {
9131
8225
  if (node && node.right)
@@ -9137,10 +8231,6 @@ var dataStructureTyped = (() => {
9137
8231
  }
9138
8232
  return levelsNodes;
9139
8233
  }
9140
- /**
9141
- * Time complexity: O(n)
9142
- * Space complexity: O(n)
9143
- */
9144
8234
  /**
9145
8235
  * Time complexity: O(n)
9146
8236
  * Space complexity: O(n)
@@ -9241,10 +8331,6 @@ var dataStructureTyped = (() => {
9241
8331
  }
9242
8332
  return ans;
9243
8333
  }
9244
- /**
9245
- * Time complexity: O(n)
9246
- * Space complexity: O(n)
9247
- */
9248
8334
  /**
9249
8335
  * Time complexity: O(n)
9250
8336
  * Space complexity: O(n)
@@ -9267,10 +8353,6 @@ var dataStructureTyped = (() => {
9267
8353
  );
9268
8354
  return cloned;
9269
8355
  }
9270
- /**
9271
- * Time Complexity: O(n)
9272
- * Space Complexity: O(n)
9273
- */
9274
8356
  /**
9275
8357
  * Time Complexity: O(n)
9276
8358
  * Space Complexity: O(n)
@@ -9296,10 +8378,6 @@ var dataStructureTyped = (() => {
9296
8378
  }
9297
8379
  return newTree;
9298
8380
  }
9299
- /**
9300
- * Time Complexity: O(n)
9301
- * Space Complexity: O(n)
9302
- */
9303
8381
  /**
9304
8382
  * Time Complexity: O(n)
9305
8383
  * Space Complexity: O(n)
@@ -9332,10 +8410,6 @@ var dataStructureTyped = (() => {
9332
8410
  // // return newTree;
9333
8411
  // // }
9334
8412
  //
9335
- /**
9336
- * Time Complexity: O(n)
9337
- * Space Complexity: O(n)
9338
- */
9339
8413
  /**
9340
8414
  * Time Complexity: O(n)
9341
8415
  * Space Complexity: O(n)
@@ -9353,29 +8427,163 @@ var dataStructureTyped = (() => {
9353
8427
  print(beginRoot = this.root, options) {
9354
8428
  const opts = __spreadValues({ isShowUndefined: false, isShowNull: false, isShowRedBlackNIL: false }, options);
9355
8429
  beginRoot = this.ensureNode(beginRoot);
8430
+ let output = "";
9356
8431
  if (!beginRoot)
9357
- return;
8432
+ return output;
9358
8433
  if (opts.isShowUndefined)
9359
- console.log(`U for undefined
9360
- `);
8434
+ output += `U for undefined
8435
+ `;
9361
8436
  if (opts.isShowNull)
9362
- console.log(`N for null
9363
- `);
8437
+ output += `N for null
8438
+ `;
9364
8439
  if (opts.isShowRedBlackNIL)
9365
- console.log(`S for Sentinel Node(NIL)
9366
- `);
8440
+ output += `S for Sentinel Node(NIL)
8441
+ `;
9367
8442
  const display = (root) => {
9368
8443
  const [lines, , ,] = this._displayAux(root, opts);
8444
+ let paragraph = "";
9369
8445
  for (const line of lines) {
9370
- console.log(line);
8446
+ paragraph += line + "\n";
9371
8447
  }
8448
+ output += paragraph;
9372
8449
  };
9373
8450
  display(beginRoot);
8451
+ return output;
9374
8452
  }
9375
8453
  /**
9376
- * Time Complexity: O(1)
9377
- * Space Complexity: O(1)
9378
- */
8454
+ * Time complexity: O(n)
8455
+ * Space complexity: O(n)
8456
+ *
8457
+ * The function `_dfs` performs a depth-first search traversal on a binary tree structure based on
8458
+ * the specified order pattern and callback function.
8459
+ * @param {C} callback - The `callback` parameter is a function that will be called on each node
8460
+ * visited during the depth-first search. It is of type `C`, which extends
8461
+ * `BTNCallback<OptBTNOrNull<NODE>>`. The default value is set to `this._DEFAULT_CALLBACK` if not
8462
+ * provided.
8463
+ * @param {DFSOrderPattern} [pattern=IN] - The `pattern` parameter in the `_dfs` method specifies the
8464
+ * order in which the Depth-First Search (DFS) algorithm should traverse the nodes in a binary tree.
8465
+ * It can have one of the following values:
8466
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} beginRoot - The `beginRoot` parameter in the `_dfs`
8467
+ * method is used to specify the starting point for the depth-first search traversal in a binary
8468
+ * tree. It can be provided as either the root node of the tree or a key, node, or entry that exists
8469
+ * in the tree. If no specific `
8470
+ * @param {IterationType} iterationType - The `iterationType` parameter in the `_dfs` method
8471
+ * specifies the type of iteration to be performed during the Depth-First Search (DFS) traversal. It
8472
+ * can have two possible values:
8473
+ * @param [includeNull=false] - The `includeNull` parameter in the `_dfs` method is a boolean flag
8474
+ * that determines whether null nodes should be included in the depth-first search traversal. If
8475
+ * `includeNull` is set to `true`, the traversal will consider null nodes as valid nodes to visit and
8476
+ * process. If set to `
8477
+ * @param shouldVisitLeft - The `shouldVisitLeft` parameter is a function that takes a node as input
8478
+ * and returns a boolean value. It is used to determine whether the left child of a node should be
8479
+ * visited during the depth-first search traversal. By default, it checks if the node is truthy (not
8480
+ * null or undefined
8481
+ * @param shouldVisitRight - The `shouldVisitRight` parameter is a function that takes a node as
8482
+ * input and returns a boolean value. It is used to determine whether the right child of a node
8483
+ * should be visited during the depth-first search traversal. The default implementation checks if
8484
+ * the node is truthy before visiting the right child.
8485
+ * @param shouldVisitRoot - The `shouldVisitRoot` parameter is a function that takes a node as an
8486
+ * argument and returns a boolean value. It is used to determine whether a given node should be
8487
+ * visited during the depth-first search traversal based on certain conditions. The default
8488
+ * implementation checks if the node is a real node or null based
8489
+ * @param shouldProcessRoot - The `shouldProcessRoot` parameter is a function that takes a node as
8490
+ * input and returns a boolean value indicating whether the node should be processed during the
8491
+ * depth-first search traversal. The default implementation of this function simply returns `true`,
8492
+ * meaning that by default all nodes will be processed. However, you can
8493
+ * @returns The `_dfs` method returns an array of the return type of the callback function provided
8494
+ * as input.
8495
+ */
8496
+ _dfs(callback = this._DEFAULT_CALLBACK, pattern = "IN", beginRoot = this.root, iterationType = this.iterationType, includeNull = false, shouldVisitLeft = (node) => !!node, shouldVisitRight = (node) => !!node, shouldVisitRoot = (node) => {
8497
+ if (includeNull)
8498
+ return this.isRealNodeOrNull(node);
8499
+ return this.isRealNode(node);
8500
+ }, shouldProcessRoot = (node) => true) {
8501
+ beginRoot = this.ensureNode(beginRoot);
8502
+ if (!beginRoot)
8503
+ return [];
8504
+ const ans = [];
8505
+ if (iterationType === "RECURSIVE") {
8506
+ const dfs = (node) => {
8507
+ if (!shouldVisitRoot(node))
8508
+ return;
8509
+ const visitLeft = () => {
8510
+ if (shouldVisitLeft(node))
8511
+ dfs(node == null ? void 0 : node.left);
8512
+ };
8513
+ const visitRight = () => {
8514
+ if (shouldVisitRight(node))
8515
+ dfs(node == null ? void 0 : node.right);
8516
+ };
8517
+ switch (pattern) {
8518
+ case "IN":
8519
+ visitLeft();
8520
+ if (shouldProcessRoot(node))
8521
+ ans.push(callback(node));
8522
+ visitRight();
8523
+ break;
8524
+ case "PRE":
8525
+ if (shouldProcessRoot(node))
8526
+ ans.push(callback(node));
8527
+ visitLeft();
8528
+ visitRight();
8529
+ break;
8530
+ case "POST":
8531
+ visitLeft();
8532
+ visitRight();
8533
+ if (shouldProcessRoot(node))
8534
+ ans.push(callback(node));
8535
+ break;
8536
+ }
8537
+ };
8538
+ dfs(beginRoot);
8539
+ } else {
8540
+ const stack = [{ opt: 0 /* VISIT */, node: beginRoot }];
8541
+ const pushLeft = (cur) => {
8542
+ var _a;
8543
+ if (shouldVisitLeft(cur.node))
8544
+ stack.push({ opt: 0 /* VISIT */, node: (_a = cur.node) == null ? void 0 : _a.left });
8545
+ };
8546
+ const pushRight = (cur) => {
8547
+ var _a;
8548
+ if (shouldVisitRight(cur.node))
8549
+ stack.push({ opt: 0 /* VISIT */, node: (_a = cur.node) == null ? void 0 : _a.right });
8550
+ };
8551
+ const pushRoot = (cur) => {
8552
+ if (shouldVisitRoot(cur.node))
8553
+ stack.push({ opt: 1 /* PROCESS */, node: cur.node });
8554
+ };
8555
+ while (stack.length > 0) {
8556
+ const cur = stack.pop();
8557
+ if (cur === void 0)
8558
+ continue;
8559
+ if (!shouldVisitRoot(cur.node))
8560
+ continue;
8561
+ if (cur.opt === 1 /* PROCESS */) {
8562
+ if (shouldProcessRoot(cur.node))
8563
+ ans.push(callback(cur.node));
8564
+ } else {
8565
+ switch (pattern) {
8566
+ case "IN":
8567
+ pushRight(cur);
8568
+ pushRoot(cur);
8569
+ pushLeft(cur);
8570
+ break;
8571
+ case "PRE":
8572
+ pushRight(cur);
8573
+ pushLeft(cur);
8574
+ pushRoot(cur);
8575
+ break;
8576
+ case "POST":
8577
+ pushRoot(cur);
8578
+ pushRight(cur);
8579
+ pushLeft(cur);
8580
+ break;
8581
+ }
8582
+ }
8583
+ }
8584
+ }
8585
+ return ans;
8586
+ }
9379
8587
  /**
9380
8588
  * Time Complexity: O(1)
9381
8589
  * Space Complexity: O(1)
@@ -9413,10 +8621,6 @@ var dataStructureTyped = (() => {
9413
8621
  }
9414
8622
  }
9415
8623
  }
9416
- /**
9417
- * Time Complexity: O(n)
9418
- * Space Complexity: O(n)
9419
- */
9420
8624
  /**
9421
8625
  * Time Complexity: O(n)
9422
8626
  * Space Complexity: O(n)
@@ -9474,10 +8678,6 @@ var dataStructureTyped = (() => {
9474
8678
  ];
9475
8679
  }
9476
8680
  }
9477
- /**
9478
- * Time Complexity: O(1)
9479
- * Space Complexity: O(1)
9480
- */
9481
8681
  /**
9482
8682
  * Time Complexity: O(1)
9483
8683
  * Space Complexity: O(1)
@@ -9507,10 +8707,6 @@ var dataStructureTyped = (() => {
9507
8707
  }
9508
8708
  return void 0;
9509
8709
  }
9510
- /**
9511
- * Time Complexity: O(1)
9512
- * Space Complexity: O(1)
9513
- */
9514
8710
  /**
9515
8711
  * Time Complexity: O(1)
9516
8712
  * Space Complexity: O(1)
@@ -9539,10 +8735,6 @@ var dataStructureTyped = (() => {
9539
8735
  }
9540
8736
  return newNode;
9541
8737
  }
9542
- /**
9543
- * Time Complexity: O(1)
9544
- * Space Complexity: O(1)
9545
- */
9546
8738
  /**
9547
8739
  * Time Complexity: O(1)
9548
8740
  * Space Complexity: O(1)
@@ -9558,10 +8750,6 @@ var dataStructureTyped = (() => {
9558
8750
  }
9559
8751
  this._root = v;
9560
8752
  }
9561
- /**
9562
- * Time Complexity: O(1)
9563
- * Space Complexity: O(1)
9564
- */
9565
8753
  /**
9566
8754
  * Time Complexity: O(1)
9567
8755
  * Space Complexity: O(1)
@@ -9724,7 +8912,7 @@ var dataStructureTyped = (() => {
9724
8912
  * @returns The method is returning either the node that was ensured or `undefined` if the node could
9725
8913
  * not be ensured.
9726
8914
  */
9727
- ensureNode(keyOrNodeOrEntryOrRawElement, iterationType = "ITERATIVE") {
8915
+ ensureNode(keyOrNodeOrEntryOrRawElement, iterationType = this.iterationType) {
9728
8916
  var _a;
9729
8917
  return (_a = super.ensureNode(keyOrNodeOrEntryOrRawElement, iterationType)) != null ? _a : void 0;
9730
8918
  }
@@ -9738,6 +8926,9 @@ var dataStructureTyped = (() => {
9738
8926
  isNode(keyOrNodeOrEntryOrRawElement) {
9739
8927
  return keyOrNodeOrEntryOrRawElement instanceof BSTNode;
9740
8928
  }
8929
+ isKey(key) {
8930
+ return isComparable(key, this.comparator !== this._DEFAULT_COMPARATOR);
8931
+ }
9741
8932
  /**
9742
8933
  * Time Complexity: O(log n)
9743
8934
  * Space Complexity: O(1)
@@ -9781,10 +8972,6 @@ var dataStructureTyped = (() => {
9781
8972
  }
9782
8973
  return false;
9783
8974
  }
9784
- /**
9785
- * Time Complexity: O(log n)
9786
- * Space Complexity: O(log n)
9787
- */
9788
8975
  /**
9789
8976
  * Time Complexity: O(k log n)
9790
8977
  * Space Complexity: O(k + log n)
@@ -9911,6 +9098,10 @@ var dataStructureTyped = (() => {
9911
9098
  * @returns The method `getNodes` returns an array of `NODE` objects.
9912
9099
  */
9913
9100
  getNodes(identifier, callback = this._DEFAULT_CALLBACK, onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
9101
+ if (identifier === void 0)
9102
+ return [];
9103
+ if (identifier === null)
9104
+ return [];
9914
9105
  beginRoot = this.ensureNode(beginRoot);
9915
9106
  if (!beginRoot)
9916
9107
  return [];
@@ -9960,10 +9151,6 @@ var dataStructureTyped = (() => {
9960
9151
  }
9961
9152
  return ans;
9962
9153
  }
9963
- /**
9964
- * Time Complexity: O(log n)
9965
- * Space Complexity: O(1)
9966
- */
9967
9154
  /**
9968
9155
  * Time Complexity: O(log n)
9969
9156
  * Space Complexity: O(1)
@@ -9989,10 +9176,6 @@ var dataStructureTyped = (() => {
9989
9176
  var _a;
9990
9177
  return (_a = this.getNodes(identifier, callback, true, beginRoot, iterationType)[0]) != null ? _a : void 0;
9991
9178
  }
9992
- /**
9993
- * Time Complexity: O(k log n)
9994
- * Space Complexity: O(k + log n)
9995
- */
9996
9179
  /**
9997
9180
  * Time Complexity: O(log n)
9998
9181
  * Space Complexity: O(1)
@@ -10006,13 +9189,9 @@ var dataStructureTyped = (() => {
10006
9189
  * It has a default value of `'ITERATIVE'`.
10007
9190
  * @returns The method is returning a NODE object or undefined.
10008
9191
  */
10009
- getNodeByKey(key, iterationType = "ITERATIVE") {
9192
+ getNodeByKey(key, iterationType = this.iterationType) {
10010
9193
  return this.getNode(key, this._DEFAULT_CALLBACK, this.root, iterationType);
10011
9194
  }
10012
- /**
10013
- * Time Complexity: O(log n)
10014
- * Space Complexity: O(k + log n)
10015
- */
10016
9195
  /**
10017
9196
  * Time complexity: O(n)
10018
9197
  * Space complexity: O(n)
@@ -10033,13 +9212,9 @@ var dataStructureTyped = (() => {
10033
9212
  * following values:
10034
9213
  * @returns The method is returning an array of the return type of the callback function.
10035
9214
  */
10036
- dfs(callback = this._DEFAULT_CALLBACK, pattern = "IN", beginRoot = this.root, iterationType = "ITERATIVE") {
10037
- return super.dfs(callback, pattern, beginRoot, iterationType, false);
10038
- }
10039
- /**
10040
- * Time Complexity: O(log n)
10041
- * Space Complexity: O(1)
10042
- */
9215
+ dfs(callback = this._DEFAULT_CALLBACK, pattern = "IN", beginRoot = this.root, iterationType = this.iterationType) {
9216
+ return super.dfs(callback, pattern, beginRoot, iterationType);
9217
+ }
10043
9218
  /**
10044
9219
  * Time complexity: O(n)
10045
9220
  * Space complexity: O(n)
@@ -10060,10 +9235,6 @@ var dataStructureTyped = (() => {
10060
9235
  bfs(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
10061
9236
  return super.bfs(callback, beginRoot, iterationType, false);
10062
9237
  }
10063
- /**
10064
- * Time Complexity: O(log n)
10065
- * Space Complexity: O(1)
10066
- */
10067
9238
  /**
10068
9239
  * Time complexity: O(n)
10069
9240
  * Space complexity: O(n)
@@ -10085,10 +9256,6 @@ var dataStructureTyped = (() => {
10085
9256
  listLevels(callback = this._DEFAULT_CALLBACK, beginRoot = this.root, iterationType = this.iterationType) {
10086
9257
  return super.listLevels(callback, beginRoot, iterationType, false);
10087
9258
  }
10088
- /**
10089
- * Time complexity: O(n)
10090
- * Space complexity: O(n)
10091
- */
10092
9259
  /**
10093
9260
  * Time complexity: O(n)
10094
9261
  * Space complexity: O(n)
@@ -10147,10 +9314,6 @@ var dataStructureTyped = (() => {
10147
9314
  return ans;
10148
9315
  }
10149
9316
  }
10150
- /**
10151
- * Time complexity: O(n)
10152
- * Space complexity: O(n)
10153
- */
10154
9317
  /**
10155
9318
  * Time complexity: O(n)
10156
9319
  * Space complexity: O(n)
@@ -10198,10 +9361,6 @@ var dataStructureTyped = (() => {
10198
9361
  return true;
10199
9362
  }
10200
9363
  }
10201
- /**
10202
- * Time complexity: O(n)
10203
- * Space complexity: O(n)
10204
- */
10205
9364
  /**
10206
9365
  * Time Complexity: O(n)
10207
9366
  * Space Complexity: O(log n)
@@ -10257,10 +9416,6 @@ var dataStructureTyped = (() => {
10257
9416
  }
10258
9417
  return balanced;
10259
9418
  }
10260
- /**
10261
- * Time Complexity: O(n)
10262
- * Space Complexity: O(log n)
10263
- */
10264
9419
  /**
10265
9420
  * The function returns the value of the _comparator property.
10266
9421
  * @returns The `_comparator` property is being returned.
@@ -10929,11 +10084,6 @@ var dataStructureTyped = (() => {
10929
10084
  isNode(keyOrNodeOrEntryOrRawElement) {
10930
10085
  return keyOrNodeOrEntryOrRawElement instanceof AVLTreeNode;
10931
10086
  }
10932
- /**
10933
- * Time Complexity: O(log n)
10934
- * Space Complexity: O(1)
10935
- * logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity. constant space, as it doesn't use additional data structures that scale with input size.
10936
- */
10937
10087
  /**
10938
10088
  * Time Complexity: O(log n)
10939
10089
  * Space Complexity: O(1)
@@ -10955,10 +10105,6 @@ var dataStructureTyped = (() => {
10955
10105
  this._balancePath(keyOrNodeOrEntryOrRawElement);
10956
10106
  return inserted;
10957
10107
  }
10958
- /**
10959
- * Time Complexity: O(log n)
10960
- * Space Complexity: O(1)
10961
- */
10962
10108
  /**
10963
10109
  * Time Complexity: O(log n)
10964
10110
  * Space Complexity: O(1)
@@ -10981,10 +10127,6 @@ var dataStructureTyped = (() => {
10981
10127
  }
10982
10128
  return deletedResults;
10983
10129
  }
10984
- /**
10985
- * Time Complexity: O(1)
10986
- * Space Complexity: O(1)
10987
- */
10988
10130
  /**
10989
10131
  * Time Complexity: O(1)
10990
10132
  * Space Complexity: O(1)
@@ -11017,10 +10159,6 @@ var dataStructureTyped = (() => {
11017
10159
  }
11018
10160
  return void 0;
11019
10161
  }
11020
- /**
11021
- * Time Complexity: O(1)
11022
- * Space Complexity: O(1)
11023
- */
11024
10162
  /**
11025
10163
  * Time Complexity: O(1)
11026
10164
  * Space Complexity: O(1)
@@ -11039,10 +10177,6 @@ var dataStructureTyped = (() => {
11039
10177
  else
11040
10178
  return node.right.height - node.left.height;
11041
10179
  }
11042
- /**
11043
- * Time Complexity: O(1)
11044
- * Space Complexity: O(1)
11045
- */
11046
10180
  /**
11047
10181
  * Time Complexity: O(1)
11048
10182
  * Space Complexity: O(1)
@@ -11062,10 +10196,6 @@ var dataStructureTyped = (() => {
11062
10196
  else
11063
10197
  node.height = 1 + Math.max(node.right.height, node.left.height);
11064
10198
  }
11065
- /**
11066
- * Time Complexity: O(1)
11067
- * Space Complexity: O(1)
11068
- */
11069
10199
  /**
11070
10200
  * Time Complexity: O(1)
11071
10201
  * Space Complexity: O(1)
@@ -11101,10 +10231,6 @@ var dataStructureTyped = (() => {
11101
10231
  if (B)
11102
10232
  this._updateHeight(B);
11103
10233
  }
11104
- /**
11105
- * Time Complexity: O(1)
11106
- * Space Complexity: O(1)
11107
- */
11108
10234
  /**
11109
10235
  * Time Complexity: O(1)
11110
10236
  * Space Complexity: O(1)
@@ -11155,10 +10281,6 @@ var dataStructureTyped = (() => {
11155
10281
  B && this._updateHeight(B);
11156
10282
  C && this._updateHeight(C);
11157
10283
  }
11158
- /**
11159
- * Time Complexity: O(1)
11160
- * Space Complexity: O(1)
11161
- */
11162
10284
  /**
11163
10285
  * Time Complexity: O(1)
11164
10286
  * Space Complexity: O(1)
@@ -11195,10 +10317,6 @@ var dataStructureTyped = (() => {
11195
10317
  this._updateHeight(A);
11196
10318
  B && this._updateHeight(B);
11197
10319
  }
11198
- /**
11199
- * Time Complexity: O(1)
11200
- * Space Complexity: O(1)
11201
- */
11202
10320
  /**
11203
10321
  * Time Complexity: O(1)
11204
10322
  * Space Complexity: O(1)
@@ -11249,11 +10367,6 @@ var dataStructureTyped = (() => {
11249
10367
  B && this._updateHeight(B);
11250
10368
  C && this._updateHeight(C);
11251
10369
  }
11252
- /**
11253
- * Time Complexity: O(log n)
11254
- * Space Complexity: O(1)
11255
- * logarithmic time, where "n" is the number of nodes in the tree. The method traverses the path from the inserted node to the root. constant space, as it doesn't use additional data structures that scale with input size.
11256
- */
11257
10370
  /**
11258
10371
  * Time Complexity: O(log n)
11259
10372
  * Space Complexity: O(1)
@@ -11290,10 +10403,6 @@ var dataStructureTyped = (() => {
11290
10403
  }
11291
10404
  }
11292
10405
  }
11293
- /**
11294
- * Time Complexity: O(1)
11295
- * Space Complexity: O(1)
11296
- */
11297
10406
  /**
11298
10407
  * Time Complexity: O(1)
11299
10408
  * Space Complexity: O(1)
@@ -11400,10 +10509,6 @@ var dataStructureTyped = (() => {
11400
10509
  iterationType: this.iterationType
11401
10510
  }, options));
11402
10511
  }
11403
- /**
11404
- * Time Complexity: O(1)
11405
- * Space Complexity: O(1)
11406
- */
11407
10512
  /**
11408
10513
  * Time Complexity: O(1)
11409
10514
  * Space Complexity: O(1)
@@ -11439,7 +10544,7 @@ var dataStructureTyped = (() => {
11439
10544
  //
11440
10545
  // if (this.toEntryFn) {
11441
10546
  // const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement as R);
11442
- // if (key) return this.createNode(key, entryValue ?? value, 'RED');
10547
+ // if (this.isKey(key)) return this.createNode(key, entryValue ?? value, 'RED');
11443
10548
  // }
11444
10549
  //
11445
10550
  // if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
@@ -11452,10 +10557,6 @@ var dataStructureTyped = (() => {
11452
10557
  //
11453
10558
  // return ;
11454
10559
  // }
11455
- /**
11456
- * Time Complexity: O(1)
11457
- * Space Complexity: O(1)
11458
- */
11459
10560
  /**
11460
10561
  * Time Complexity: O(1)
11461
10562
  * Space Complexity: O(1)
@@ -11467,10 +10568,6 @@ var dataStructureTyped = (() => {
11467
10568
  super.clear();
11468
10569
  this._root = this.NIL;
11469
10570
  }
11470
- /**
11471
- * Time Complexity: O(log n)
11472
- * Space Complexity: O(1)
11473
- */
11474
10571
  /**
11475
10572
  * Time Complexity: O(log n)
11476
10573
  * Space Complexity: O(1)
@@ -11502,10 +10599,6 @@ var dataStructureTyped = (() => {
11502
10599
  } else
11503
10600
  return insertStatus === "UPDATED";
11504
10601
  }
11505
- /**
11506
- * Time Complexity: O(log n)
11507
- * Space Complexity: O(1)
11508
- */
11509
10602
  /**
11510
10603
  * Time Complexity: O(log n)
11511
10604
  * Space Complexity: O(1)
@@ -11540,7 +10633,7 @@ var dataStructureTyped = (() => {
11540
10633
  replacementNode = nodeToDelete.left;
11541
10634
  this._transplant(nodeToDelete, nodeToDelete.left);
11542
10635
  } else {
11543
- const successor = this.getLeftMost(nodeToDelete.right);
10636
+ const successor = this.getLeftMost((node) => node, nodeToDelete.right);
11544
10637
  if (successor) {
11545
10638
  originalColor = successor.color;
11546
10639
  replacementNode = successor.right;
@@ -11570,10 +10663,6 @@ var dataStructureTyped = (() => {
11570
10663
  results.push({ deleted: nodeToDelete, needBalanced: void 0 });
11571
10664
  return results;
11572
10665
  }
11573
- /**
11574
- * Time Complexity: O(1)
11575
- * Space Complexity: O(1)
11576
- */
11577
10666
  /**
11578
10667
  * Time Complexity: O(1)
11579
10668
  * Space Complexity: O(1)
@@ -11588,10 +10677,6 @@ var dataStructureTyped = (() => {
11588
10677
  }
11589
10678
  this._root = v;
11590
10679
  }
11591
- /**
11592
- * Time Complexity: O(1)
11593
- * Space Complexity: O(1)
11594
- */
11595
10680
  /**
11596
10681
  * Time Complexity: O(1)
11597
10682
  * Space Complexity: O(1)
@@ -11608,10 +10693,6 @@ var dataStructureTyped = (() => {
11608
10693
  newNode.color = oldNode.color;
11609
10694
  return super._replaceNode(oldNode, newNode);
11610
10695
  }
11611
- /**
11612
- * Time Complexity: O(log n)
11613
- * Space Complexity: O(1)
11614
- */
11615
10696
  /**
11616
10697
  * Time Complexity: O(log n)
11617
10698
  * Space Complexity: O(1)
@@ -11654,10 +10735,6 @@ var dataStructureTyped = (() => {
11654
10735
  this._insertFixup(node);
11655
10736
  return "CREATED";
11656
10737
  }
11657
- /**
11658
- * Time Complexity: O(1)
11659
- * Space Complexity: O(1)
11660
- */
11661
10738
  /**
11662
10739
  * Time Complexity: O(1)
11663
10740
  * Space Complexity: O(1)
@@ -11679,10 +10756,6 @@ var dataStructureTyped = (() => {
11679
10756
  v.parent = u.parent;
11680
10757
  }
11681
10758
  }
11682
- /**
11683
- * Time Complexity: O(log n)
11684
- * Space Complexity: O(1)
11685
- */
11686
10759
  /**
11687
10760
  * Time Complexity: O(log n)
11688
10761
  * Space Complexity: O(1)
@@ -11735,10 +10808,6 @@ var dataStructureTyped = (() => {
11735
10808
  if (this.isRealNode(this._root))
11736
10809
  this._root.color = "BLACK";
11737
10810
  }
11738
- /**
11739
- * Time Complexity: O(log n)
11740
- * Space Complexity: O(1)
11741
- */
11742
10811
  /**
11743
10812
  * Time Complexity: O(log n)
11744
10813
  * Space Complexity: O(1)
@@ -11814,10 +10883,6 @@ var dataStructureTyped = (() => {
11814
10883
  node.color = "BLACK";
11815
10884
  }
11816
10885
  }
11817
- /**
11818
- * Time Complexity: O(1)
11819
- * Space Complexity: O(1)
11820
- */
11821
10886
  /**
11822
10887
  * Time Complexity: O(1)
11823
10888
  * Space Complexity: O(1)
@@ -11847,10 +10912,6 @@ var dataStructureTyped = (() => {
11847
10912
  y.left = x;
11848
10913
  x.parent = y;
11849
10914
  }
11850
- /**
11851
- * Time Complexity: O(1)
11852
- * Space Complexity: O(1)
11853
- */
11854
10915
  /**
11855
10916
  * Time Complexity: O(1)
11856
10917
  * Space Complexity: O(1)
@@ -11938,10 +10999,6 @@ var dataStructureTyped = (() => {
11938
10999
  get count() {
11939
11000
  return this._count;
11940
11001
  }
11941
- /**
11942
- * Time Complexity: O(n)
11943
- * Space Complexity: O(1)
11944
- */
11945
11002
  /**
11946
11003
  * Time Complexity: O(n)
11947
11004
  * Space Complexity: O(1)
@@ -12009,26 +11066,22 @@ var dataStructureTyped = (() => {
12009
11066
  return;
12010
11067
  if (this.isNode(keyOrNodeOrEntryOrRawElement))
12011
11068
  return keyOrNodeOrEntryOrRawElement;
12012
- if (this.toEntryFn) {
12013
- const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
12014
- if (key)
12015
- return this.createNode(key, entryValue != null ? entryValue : value, count);
12016
- }
12017
11069
  if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
12018
- const [key, value2] = keyOrNodeOrEntryOrRawElement;
11070
+ const [key, entryValue] = keyOrNodeOrEntryOrRawElement;
12019
11071
  if (key === void 0 || key === null)
12020
11072
  return;
12021
- else
12022
- return this.createNode(key, value2, count);
11073
+ if (this.isKey(key))
11074
+ return this.createNode(key, value != null ? value : entryValue, count);
11075
+ }
11076
+ if (this.toEntryFn) {
11077
+ const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
11078
+ if (this.isKey(key))
11079
+ return this.createNode(key, value != null ? value : entryValue, count);
12023
11080
  }
12024
11081
  if (this.isKey(keyOrNodeOrEntryOrRawElement))
12025
11082
  return this.createNode(keyOrNodeOrEntryOrRawElement, value, count);
12026
11083
  return;
12027
11084
  }
12028
- /**
12029
- * Time Complexity: O(log n)
12030
- * Space Complexity: O(1)
12031
- */
12032
11085
  /**
12033
11086
  * Time Complexity: O(log n)
12034
11087
  * Space Complexity: O(1)
@@ -12057,10 +11110,6 @@ var dataStructureTyped = (() => {
12057
11110
  }
12058
11111
  return true;
12059
11112
  }
12060
- /**
12061
- * Time Complexity: O(log n)
12062
- * Space Complexity: O(1)
12063
- */
12064
11113
  /**
12065
11114
  * Time Complexity: O(log n)
12066
11115
  * Space Complexity: O(1)
@@ -12109,7 +11158,7 @@ var dataStructureTyped = (() => {
12109
11158
  needBalanced = parent;
12110
11159
  }
12111
11160
  } else {
12112
- const leftSubTreeRightMost = curr.left ? this.getRightMost(curr.left) : void 0;
11161
+ const leftSubTreeRightMost = curr.left ? this.getRightMost((node) => node, curr.left) : void 0;
12113
11162
  if (leftSubTreeRightMost) {
12114
11163
  const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
12115
11164
  orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
@@ -12133,10 +11182,6 @@ var dataStructureTyped = (() => {
12133
11182
  }
12134
11183
  return deletedResult;
12135
11184
  }
12136
- /**
12137
- * Time Complexity: O(1)
12138
- * Space Complexity: O(1)
12139
- */
12140
11185
  /**
12141
11186
  * Time Complexity: O(1)
12142
11187
  * Space Complexity: O(1)
@@ -12148,10 +11193,6 @@ var dataStructureTyped = (() => {
12148
11193
  super.clear();
12149
11194
  this._count = 0;
12150
11195
  }
12151
- /**
12152
- * Time Complexity: O(n log n)
12153
- * Space Complexity: O(log n)
12154
- */
12155
11196
  /**
12156
11197
  * Time Complexity: O(n log n)
12157
11198
  * Space Complexity: O(log n)
@@ -12199,10 +11240,6 @@ var dataStructureTyped = (() => {
12199
11240
  return true;
12200
11241
  }
12201
11242
  }
12202
- /**
12203
- * Time complexity: O(n)
12204
- * Space complexity: O(n)
12205
- */
12206
11243
  /**
12207
11244
  * Time complexity: O(n)
12208
11245
  * Space complexity: O(n)
@@ -12215,10 +11252,6 @@ var dataStructureTyped = (() => {
12215
11252
  this.bfs((node) => cloned.add(node.key, node.value, node.count));
12216
11253
  return cloned;
12217
11254
  }
12218
- /**
12219
- * Time Complexity: O(1)
12220
- * Space Complexity: O(1)
12221
- */
12222
11255
  /**
12223
11256
  * Time Complexity: O(1)
12224
11257
  * Space Complexity: O(1)
@@ -12253,10 +11286,6 @@ var dataStructureTyped = (() => {
12253
11286
  }
12254
11287
  return void 0;
12255
11288
  }
12256
- /**
12257
- * Time Complexity: O(1)
12258
- * Space Complexity: O(1)
12259
- */
12260
11289
  /**
12261
11290
  * Time Complexity: O(1)
12262
11291
  * Space Complexity: O(1)
@@ -12333,10 +11362,6 @@ var dataStructureTyped = (() => {
12333
11362
  get count() {
12334
11363
  return this._count;
12335
11364
  }
12336
- /**
12337
- * Time Complexity: O(n)
12338
- * Space Complexity: O(1)
12339
- */
12340
11365
  /**
12341
11366
  * Time Complexity: O(n)
12342
11367
  * Space Complexity: O(1)
@@ -12396,17 +11421,17 @@ var dataStructureTyped = (() => {
12396
11421
  return;
12397
11422
  if (this.isNode(keyOrNodeOrEntryOrRawElement))
12398
11423
  return keyOrNodeOrEntryOrRawElement;
12399
- if (this.toEntryFn) {
12400
- const [key] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
12401
- if (key)
12402
- return this.getNodeByKey(key);
12403
- }
12404
11424
  if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
12405
- const [key, value2] = keyOrNodeOrEntryOrRawElement;
11425
+ const [key, entryValue] = keyOrNodeOrEntryOrRawElement;
12406
11426
  if (key === void 0 || key === null)
12407
11427
  return;
12408
- else
12409
- return this.createNode(key, value2, "BLACK", count);
11428
+ if (this.isKey(key))
11429
+ return this.createNode(key, value != null ? value : entryValue, "BLACK", count);
11430
+ }
11431
+ if (this.toEntryFn) {
11432
+ const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
11433
+ if (this.isKey(key))
11434
+ return this.createNode(key, value != null ? value : entryValue, "BLACK", count);
12410
11435
  }
12411
11436
  if (this.isKey(keyOrNodeOrEntryOrRawElement))
12412
11437
  return this.createNode(keyOrNodeOrEntryOrRawElement, value, "BLACK", count);
@@ -12422,10 +11447,6 @@ var dataStructureTyped = (() => {
12422
11447
  isNode(keyOrNodeOrEntryOrRawElement) {
12423
11448
  return keyOrNodeOrEntryOrRawElement instanceof TreeMultiMapNode;
12424
11449
  }
12425
- /**
12426
- * Time Complexity: O(log n)
12427
- * Space Complexity: O(1)
12428
- */
12429
11450
  /**
12430
11451
  * Time Complexity: O(log n)
12431
11452
  * Space Complexity: O(1)
@@ -12453,10 +11474,6 @@ var dataStructureTyped = (() => {
12453
11474
  return false;
12454
11475
  }
12455
11476
  }
12456
- /**
12457
- * Time Complexity: O(log n)
12458
- * Space Complexity: O(1)
12459
- */
12460
11477
  /**
12461
11478
  * Time Complexity: O(log n)
12462
11479
  * Space Complexity: O(1)
@@ -12509,7 +11526,7 @@ var dataStructureTyped = (() => {
12509
11526
  return results;
12510
11527
  }
12511
11528
  } else {
12512
- const successor = this.getLeftMost(nodeToDelete.right);
11529
+ const successor = this.getLeftMost((node) => node, nodeToDelete.right);
12513
11530
  if (successor) {
12514
11531
  originalColor = successor.color;
12515
11532
  replacementNode = successor.right;
@@ -12555,10 +11572,6 @@ var dataStructureTyped = (() => {
12555
11572
  results.push({ deleted: nodeToDelete, needBalanced: void 0 });
12556
11573
  return results;
12557
11574
  }
12558
- /**
12559
- * Time Complexity: O(1)
12560
- * Space Complexity: O(1)
12561
- */
12562
11575
  /**
12563
11576
  * Time Complexity: O(1)
12564
11577
  * Space Complexity: O(1)
@@ -12570,10 +11583,6 @@ var dataStructureTyped = (() => {
12570
11583
  super.clear();
12571
11584
  this._count = 0;
12572
11585
  }
12573
- /**
12574
- * Time Complexity: O(n log n)
12575
- * Space Complexity: O(log n)
12576
- */
12577
11586
  /**
12578
11587
  * Time Complexity: O(n log n)
12579
11588
  * Space Complexity: O(log n)
@@ -12622,10 +11631,6 @@ var dataStructureTyped = (() => {
12622
11631
  return true;
12623
11632
  }
12624
11633
  }
12625
- /**
12626
- * Time complexity: O(n)
12627
- * Space complexity: O(n)
12628
- */
12629
11634
  /**
12630
11635
  * Time complexity: O(n)
12631
11636
  * Space complexity: O(n)
@@ -12638,10 +11643,6 @@ var dataStructureTyped = (() => {
12638
11643
  this.bfs((node) => cloned.add(node.key, node.value, node.count));
12639
11644
  return cloned;
12640
11645
  }
12641
- /**
12642
- * Time Complexity: O(1)
12643
- * Space Complexity: O(1)
12644
- */
12645
11646
  /**
12646
11647
  * Time Complexity: O(1)
12647
11648
  * Space Complexity: O(1)
@@ -12677,10 +11678,6 @@ var dataStructureTyped = (() => {
12677
11678
  }
12678
11679
  return void 0;
12679
11680
  }
12680
- /**
12681
- * Time Complexity: O(1)
12682
- * Space Complexity: O(1)
12683
- */
12684
11681
  /**
12685
11682
  * Time Complexity: O(1)
12686
11683
  * Space Complexity: O(1)
@@ -13618,10 +12615,6 @@ var dataStructureTyped = (() => {
13618
12615
  get root() {
13619
12616
  return this._root;
13620
12617
  }
13621
- /**
13622
- * Time Complexity: O(l), where l is the length of the word being added.
13623
- * Space Complexity: O(l) - Each character in the word adds a TrieNode.
13624
- */
13625
12618
  /**
13626
12619
  * Time Complexity: O(l), where l is the length of the word being added.
13627
12620
  * Space Complexity: O(l) - Each character in the word adds a TrieNode.
@@ -13649,10 +12642,6 @@ var dataStructureTyped = (() => {
13649
12642
  }
13650
12643
  return isNewWord;
13651
12644
  }
13652
- /**
13653
- * Time Complexity: O(l), where l is the length of the input word.
13654
- * Space Complexity: O(1) - Constant space.
13655
- */
13656
12645
  /**
13657
12646
  * Time Complexity: O(l), where l is the length of the input word.
13658
12647
  * Space Complexity: O(1) - Constant space.
@@ -13672,10 +12661,6 @@ var dataStructureTyped = (() => {
13672
12661
  }
13673
12662
  return cur.isEnd;
13674
12663
  }
13675
- /**
13676
- * Time Complexity: O(1)
13677
- * Space Complexity: O(1)
13678
- */
13679
12664
  /**
13680
12665
  * Time Complexity: O(1)
13681
12666
  * Space Complexity: O(1)
@@ -13686,10 +12671,6 @@ var dataStructureTyped = (() => {
13686
12671
  isEmpty() {
13687
12672
  return this.size === 0;
13688
12673
  }
13689
- /**
13690
- * Time Complexity: O(1)
13691
- * Space Complexity: O(1)
13692
- */
13693
12674
  /**
13694
12675
  * Time Complexity: O(1)
13695
12676
  * Space Complexity: O(1)
@@ -13700,10 +12681,6 @@ var dataStructureTyped = (() => {
13700
12681
  this._size = 0;
13701
12682
  this._root = new TrieNode("");
13702
12683
  }
13703
- /**
13704
- * Time Complexity: O(l), where l is the length of the word being deleted.
13705
- * Space Complexity: O(n) - Due to the recursive DFS approach.
13706
- */
13707
12684
  /**
13708
12685
  * Time Complexity: O(l), where l is the length of the word being deleted.
13709
12686
  * Space Complexity: O(n) - Due to the recursive DFS approach.
@@ -13746,10 +12723,6 @@ var dataStructureTyped = (() => {
13746
12723
  }
13747
12724
  return isDeleted;
13748
12725
  }
13749
- /**
13750
- * Time Complexity: O(n), where n is the total number of nodes in the trie.
13751
- * Space Complexity: O(1) - Constant space.
13752
- */
13753
12726
  /**
13754
12727
  * Time Complexity: O(n), where n is the total number of nodes in the trie.
13755
12728
  * Space Complexity: O(1) - Constant space.
@@ -13774,10 +12747,6 @@ var dataStructureTyped = (() => {
13774
12747
  }
13775
12748
  return maxDepth;
13776
12749
  }
13777
- /**
13778
- * Time Complexity: O(l), where l is the length of the input prefix.
13779
- * Space Complexity: O(1) - Constant space.
13780
- */
13781
12750
  /**
13782
12751
  * Time Complexity: O(l), where l is the length of the input prefix.
13783
12752
  * Space Complexity: O(1) - Constant space.
@@ -13797,10 +12766,6 @@ var dataStructureTyped = (() => {
13797
12766
  }
13798
12767
  return !cur.isEnd;
13799
12768
  }
13800
- /**
13801
- * Time Complexity: O(l), where l is the length of the input prefix.
13802
- * Space Complexity: O(1) - Constant space.
13803
- */
13804
12769
  /**
13805
12770
  * Time Complexity: O(l), where l is the length of the input prefix.
13806
12771
  * Space Complexity: O(1) - Constant space.
@@ -13820,10 +12785,6 @@ var dataStructureTyped = (() => {
13820
12785
  }
13821
12786
  return true;
13822
12787
  }
13823
- /**
13824
- * Time Complexity: O(n), where n is the total number of nodes in the trie.
13825
- * Space Complexity: O(l), where l is the length of the input prefix.
13826
- */
13827
12788
  /**
13828
12789
  * Time Complexity: O(n), where n is the total number of nodes in the trie.
13829
12790
  * Space Complexity: O(l), where l is the length of the input prefix.
@@ -13849,10 +12810,6 @@ var dataStructureTyped = (() => {
13849
12810
  dfs(this.root);
13850
12811
  return commonPre === input;
13851
12812
  }
13852
- /**
13853
- * Time Complexity: O(n), where n is the total number of nodes in the trie.
13854
- * Space Complexity: O(l), where l is the length of the longest common prefix.
13855
- */
13856
12813
  /**
13857
12814
  * Time Complexity: O(n), where n is the total number of nodes in the trie.
13858
12815
  * Space Complexity: O(l), where l is the length of the longest common prefix.
@@ -13874,10 +12831,6 @@ var dataStructureTyped = (() => {
13874
12831
  dfs(this.root);
13875
12832
  return commonPre;
13876
12833
  }
13877
- /**
13878
- * Time Complexity: O(w * l), where w is the number of words retrieved, and l is the average length of the words.
13879
- * Space Complexity: O(w * l) - The space required for the output array.
13880
- */
13881
12834
  /**
13882
12835
  * Time Complexity: O(w * l), where w is the number of words retrieved, and l is the average length of the words.
13883
12836
  * Space Complexity: O(w * l) - The space required for the output array.
@@ -13922,10 +12875,6 @@ var dataStructureTyped = (() => {
13922
12875
  dfs(startNode, prefix);
13923
12876
  return words;
13924
12877
  }
13925
- /**
13926
- * Time Complexity: O(n)
13927
- * Space Complexity: O(n)
13928
- */
13929
12878
  /**
13930
12879
  * Time Complexity: O(n)
13931
12880
  * Space Complexity: O(n)
@@ -13937,10 +12886,6 @@ var dataStructureTyped = (() => {
13937
12886
  clone() {
13938
12887
  return new _Trie(this, { caseSensitive: this.caseSensitive, toElementFn: this.toElementFn });
13939
12888
  }
13940
- /**
13941
- * Time Complexity: O(n)
13942
- * Space Complexity: O(n)
13943
- */
13944
12889
  /**
13945
12890
  * Time Complexity: O(n)
13946
12891
  * Space Complexity: O(n)
@@ -13966,10 +12911,6 @@ var dataStructureTyped = (() => {
13966
12911
  }
13967
12912
  return results;
13968
12913
  }
13969
- /**
13970
- * Time Complexity: O(n)
13971
- * Space Complexity: O(n)
13972
- */
13973
12914
  /**
13974
12915
  * Time Complexity: O(n)
13975
12916
  * Space Complexity: O(n)
@@ -13997,10 +12938,6 @@ var dataStructureTyped = (() => {
13997
12938
  }
13998
12939
  return newTrie;
13999
12940
  }
14000
- /**
14001
- * Time Complexity: O(n)
14002
- * Space Complexity: O(n)
14003
- */
14004
12941
  /**
14005
12942
  * Time Complexity: O(n)
14006
12943
  * Space Complexity: O(n)
@@ -14019,10 +12956,6 @@ var dataStructureTyped = (() => {
14019
12956
  }
14020
12957
  yield* __yieldStar(_dfs(this.root, ""));
14021
12958
  }
14022
- /**
14023
- * Time Complexity: O(l), where l is the length of the input string.
14024
- * Space Complexity: O(1) - Constant space.
14025
- */
14026
12959
  /**
14027
12960
  * Time Complexity: O(l), where l is the length of the input string.
14028
12961
  * Space Complexity: O(1) - Constant space.
@@ -14056,7 +12989,6 @@ var dataStructureTyped = (() => {
14056
12989
  __publicField(this, "_children");
14057
12990
  this._key = key;
14058
12991
  this._value = value || void 0;
14059
- this._children = children || [];
14060
12992
  }
14061
12993
  /**
14062
12994
  * The function returns the value of the protected variable _key.