data-structure-typed 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/cjs/binary-tree.cjs +2927 -23688
  3. package/dist/cjs/graph.cjs +845 -2634
  4. package/dist/cjs/hash.cjs +185 -616
  5. package/dist/cjs/heap.cjs +266 -818
  6. package/dist/cjs/index.cjs +5116 -31358
  7. package/dist/cjs/linked-list.cjs +644 -2615
  8. package/dist/cjs/matrix.cjs +220 -535
  9. package/dist/cjs/priority-queue.cjs +266 -818
  10. package/dist/cjs/queue.cjs +637 -2343
  11. package/dist/cjs/stack.cjs +124 -530
  12. package/dist/cjs/trie.cjs +145 -592
  13. package/dist/cjs-legacy/binary-tree.cjs +4352 -25113
  14. package/dist/cjs-legacy/graph.cjs +847 -2636
  15. package/dist/cjs-legacy/hash.cjs +181 -612
  16. package/dist/cjs-legacy/heap.cjs +266 -818
  17. package/dist/cjs-legacy/index.cjs +6657 -32899
  18. package/dist/cjs-legacy/linked-list.cjs +640 -2611
  19. package/dist/cjs-legacy/matrix.cjs +220 -535
  20. package/dist/cjs-legacy/priority-queue.cjs +266 -818
  21. package/dist/cjs-legacy/queue.cjs +634 -2340
  22. package/dist/cjs-legacy/stack.cjs +124 -530
  23. package/dist/cjs-legacy/trie.cjs +145 -592
  24. package/dist/esm/binary-tree.mjs +2927 -23688
  25. package/dist/esm/graph.mjs +845 -2634
  26. package/dist/esm/hash.mjs +185 -616
  27. package/dist/esm/heap.mjs +266 -818
  28. package/dist/esm/index.mjs +5116 -31358
  29. package/dist/esm/linked-list.mjs +644 -2615
  30. package/dist/esm/matrix.mjs +220 -535
  31. package/dist/esm/priority-queue.mjs +266 -818
  32. package/dist/esm/queue.mjs +637 -2343
  33. package/dist/esm/stack.mjs +124 -530
  34. package/dist/esm/trie.mjs +145 -592
  35. package/dist/esm-legacy/binary-tree.mjs +4352 -25113
  36. package/dist/esm-legacy/graph.mjs +847 -2636
  37. package/dist/esm-legacy/hash.mjs +181 -612
  38. package/dist/esm-legacy/heap.mjs +266 -818
  39. package/dist/esm-legacy/index.mjs +6657 -32899
  40. package/dist/esm-legacy/linked-list.mjs +640 -2611
  41. package/dist/esm-legacy/matrix.mjs +220 -535
  42. package/dist/esm-legacy/priority-queue.mjs +266 -818
  43. package/dist/esm-legacy/queue.mjs +634 -2340
  44. package/dist/esm-legacy/stack.mjs +124 -530
  45. package/dist/esm-legacy/trie.mjs +145 -592
  46. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +29 -500
  47. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +38 -563
  48. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +230 -1212
  49. package/dist/types/data-structures/binary-tree/bst.d.ts +124 -1063
  50. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +99 -854
  51. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +62 -314
  52. package/dist/types/data-structures/binary-tree/tree-map.d.ts +366 -5057
  53. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +277 -4885
  54. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +253 -3929
  55. package/dist/types/data-structures/binary-tree/tree-set.d.ts +261 -4782
  56. package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -44
  57. package/dist/types/data-structures/graph/directed-graph.d.ts +130 -527
  58. package/dist/types/data-structures/graph/undirected-graph.d.ts +125 -482
  59. package/dist/types/data-structures/hash/hash-map.d.ts +132 -562
  60. package/dist/types/data-structures/heap/heap.d.ts +194 -746
  61. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +120 -809
  62. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -733
  63. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +193 -863
  64. package/dist/types/data-structures/matrix/matrix.d.ts +159 -474
  65. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -6
  66. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +6 -11
  67. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  68. package/dist/types/data-structures/queue/deque.d.ts +196 -804
  69. package/dist/types/data-structures/queue/queue.d.ts +99 -585
  70. package/dist/types/data-structures/stack/stack.d.ts +75 -481
  71. package/dist/types/data-structures/trie/trie.d.ts +98 -584
  72. package/dist/umd/data-structure-typed.js +6580 -32822
  73. package/dist/umd/data-structure-typed.min.js +3 -3
  74. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +162 -215
  75. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +9 -9
  76. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +47 -47
  77. package/docs-site-docusaurus/docs/api/classes/BST.md +155 -208
  78. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +7 -7
  79. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -29
  80. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +104 -158
  81. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  82. package/docs-site-docusaurus/docs/api/classes/Deque.md +72 -104
  83. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +60 -80
  84. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +67 -101
  85. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +6 -6
  86. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  87. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  88. package/docs-site-docusaurus/docs/api/classes/HashMap.md +52 -48
  89. package/docs-site-docusaurus/docs/api/classes/Heap.md +40 -68
  90. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +17 -17
  91. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +38 -38
  92. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +45 -45
  93. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
  94. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +68 -96
  95. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +60 -80
  96. package/docs-site-docusaurus/docs/api/classes/Matrix.md +57 -52
  97. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +38 -66
  98. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +41 -74
  99. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +38 -66
  100. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +46 -79
  101. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +40 -68
  102. package/docs-site-docusaurus/docs/api/classes/Queue.md +54 -78
  103. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +171 -225
  104. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -22
  105. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +68 -98
  106. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +4 -4
  107. package/docs-site-docusaurus/docs/api/classes/SkipList.md +98 -75
  108. package/docs-site-docusaurus/docs/api/classes/Stack.md +33 -53
  109. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +104 -129
  110. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +57 -124
  111. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +45 -116
  112. package/docs-site-docusaurus/docs/api/classes/Trie.md +37 -61
  113. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  114. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +59 -77
  115. package/package.json +1 -1
  116. package/src/data-structures/binary-tree/tree-multi-set.ts +15 -11
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: MinPriorityQueue\<E, R\>
8
8
 
9
- Defined in: [data-structures/priority-queue/min-priority-queue.ts:79](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/priority-queue/min-priority-queue.ts#L79)
9
+ Defined in: [data-structures/priority-queue/min-priority-queue.ts:74](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/priority-queue/min-priority-queue.ts#L74)
10
10
 
11
11
  Min-oriented priority queue (min-heap) built on [PriorityQueue](PriorityQueue.md).
12
12
  The queue removes the smallest element first under the provided comparator.
@@ -18,10 +18,10 @@ Provide a custom comparator if you store non-primitive objects.
18
18
  // Shortest job first scheduling
19
19
  const jobs = new MinPriorityQueue<number>();
20
20
 
21
- jobs.add(8); // 8 seconds
22
- jobs.add(2); // 2 seconds
23
- jobs.add(5); // 5 seconds
24
- jobs.add(1); // 1 second
21
+ jobs.add(8); // 8 seconds
22
+ jobs.add(2); // 2 seconds
23
+ jobs.add(5); // 5 seconds
24
+ jobs.add(1); // 1 second
25
25
 
26
26
  // Shortest job first
27
27
  console.log(jobs.poll()); // 1;
@@ -50,12 +50,7 @@ Provide a custom comparator if you store non-primitive objects.
50
50
  while (timeline.size > 0) {
51
51
  order.push(timeline.poll()!.action);
52
52
  }
53
- console.log(order); // [
54
- // 'Request received',
55
- // 'Cache hit',
56
- // 'Processing done',
57
- // 'Timeout'
58
- // ];
53
+ console.log(order); // ['Request received', 'Cache hit', 'Processing done', 'Timeout'];
59
54
  ```
60
55
 
61
56
  ```ts
@@ -73,7 +68,7 @@ Provide a custom comparator if you store non-primitive objects.
73
68
  // Always pick two lowest frequencies
74
69
  const first = freq.poll()!;
75
70
  const second = freq.poll()!;
76
- console.log(first[1]); // 'd'; // freq 2
71
+ console.log(first[1]); // 'd'; // freq 2
77
72
  console.log(second[1]); // 'a'; // freq 5
78
73
 
79
74
  // Combined node goes back
@@ -107,7 +102,7 @@ Extra record/metadata associated with each element.
107
102
  new MinPriorityQueue<E, R>(elements?, options?): MinPriorityQueue<E, R>;
108
103
  ```
109
104
 
110
- Defined in: [data-structures/priority-queue/min-priority-queue.ts:86](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/priority-queue/min-priority-queue.ts#L86)
105
+ Defined in: [data-structures/priority-queue/min-priority-queue.ts:81](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/priority-queue/min-priority-queue.ts#L81)
111
106
 
112
107
  Creates a min-priority queue.
113
108
 
@@ -149,7 +144,7 @@ PriorityQueue<E, R>.constructor
149
144
  get comparator(): Comparator<E>;
150
145
  ```
151
146
 
152
- Defined in: [data-structures/heap/heap.ts:1314](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1314)
147
+ Defined in: [data-structures/heap/heap.ts:211](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L211)
153
148
 
154
149
  Get the comparator used to order elements.
155
150
 
@@ -177,7 +172,7 @@ Comparator function.
177
172
  get elements(): E[];
178
173
  ```
179
174
 
180
- Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L180)
175
+ Defined in: [data-structures/heap/heap.ts:175](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L175)
181
176
 
182
177
  Get the backing array of the heap.
183
178
 
@@ -205,7 +200,7 @@ Internal elements array.
205
200
  get leaf(): E | undefined;
206
201
  ```
207
202
 
208
- Defined in: [data-structures/heap/heap.ts:251](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L251)
203
+ Defined in: [data-structures/heap/heap.ts:202](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L202)
209
204
 
210
205
  Get the last leaf element.
211
206
 
@@ -233,7 +228,7 @@ Last element or undefined.
233
228
  get size(): number;
234
229
  ```
235
230
 
236
- Defined in: [data-structures/heap/heap.ts:241](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L241)
231
+ Defined in: [data-structures/heap/heap.ts:193](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L193)
237
232
 
238
233
  Get the number of elements.
239
234
 
@@ -260,8 +255,6 @@ Time O(1), Space O(1)
260
255
 
261
256
  Heap size.
262
257
 
263
- *
264
-
265
258
  #### Inherited from
266
259
 
267
260
  [`PriorityQueue`](PriorityQueue.md).[`size`](PriorityQueue.md#size)
@@ -336,7 +329,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
336
329
  add(element): boolean;
337
330
  ```
338
331
 
339
- Defined in: [data-structures/heap/heap.ts:352](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L352)
332
+ Defined in: [data-structures/heap/heap.ts:267](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L267)
340
333
 
341
334
  Insert an element.
342
335
 
@@ -354,8 +347,6 @@ Element to insert.
354
347
 
355
348
  True.
356
349
 
357
- *
358
-
359
350
  #### Remarks
360
351
 
361
352
  Time O(log N) amortized, Space O(1)
@@ -391,7 +382,7 @@ Time O(log N) amortized, Space O(1)
391
382
  addMany(elements): boolean[];
392
383
  ```
393
384
 
394
- Defined in: [data-structures/heap/heap.ts:409](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L409)
385
+ Defined in: [data-structures/heap/heap.ts:284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L284)
395
386
 
396
387
  Insert many elements from an iterable.
397
388
 
@@ -409,8 +400,6 @@ Iterable of elements or raw values.
409
400
 
410
401
  Array of per-element success flags.
411
402
 
412
- *
413
-
414
403
  #### Remarks
415
404
 
416
405
  Time O(N log N), Space O(1)
@@ -437,7 +426,7 @@ Time O(N log N), Space O(1)
437
426
  clear(): void;
438
427
  ```
439
428
 
440
- Defined in: [data-structures/heap/heap.ts:761](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L761)
429
+ Defined in: [data-structures/heap/heap.ts:469](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L469)
441
430
 
442
431
  Remove all elements.
443
432
 
@@ -447,8 +436,6 @@ Remove all elements.
447
436
 
448
437
  void
449
438
 
450
- *
451
-
452
439
  #### Remarks
453
440
 
454
441
  Time O(1), Space O(1)
@@ -474,7 +461,7 @@ Time O(1), Space O(1)
474
461
  clone(): this;
475
462
  ```
476
463
 
477
- Defined in: [data-structures/heap/heap.ts:1136](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1136)
464
+ Defined in: [data-structures/heap/heap.ts:648](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L648)
478
465
 
479
466
  Deep clone this heap.
480
467
 
@@ -484,8 +471,6 @@ Deep clone this heap.
484
471
 
485
472
  A new heap with the same elements.
486
473
 
487
- *
488
-
489
474
  #### Remarks
490
475
 
491
476
  Time O(N), Space O(N)
@@ -513,7 +498,7 @@ Time O(N), Space O(N)
513
498
  delete(element): boolean;
514
499
  ```
515
500
 
516
- Defined in: [data-structures/heap/heap.ts:868](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L868)
501
+ Defined in: [data-structures/heap/heap.ts:500](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L500)
517
502
 
518
503
  Delete one occurrence of an element.
519
504
 
@@ -531,8 +516,6 @@ Element to delete.
531
516
 
532
517
  True if an element was removed.
533
518
 
534
- *
535
-
536
519
  #### Remarks
537
520
 
538
521
  Time O(N), Space O(1)
@@ -558,7 +541,7 @@ Time O(N), Space O(1)
558
541
  deleteBy(predicate): boolean;
559
542
  ```
560
543
 
561
- Defined in: [data-structures/heap/heap.ts:892](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L892)
544
+ Defined in: [data-structures/heap/heap.ts:524](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L524)
562
545
 
563
546
  #### Parameters
564
547
 
@@ -586,7 +569,7 @@ Use `deleteWhere` instead. Will be removed in a future major version.
586
569
  deleteWhere(predicate): boolean;
587
570
  ```
588
571
 
589
- Defined in: [data-structures/heap/heap.ts:902](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L902)
572
+ Defined in: [data-structures/heap/heap.ts:534](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L534)
590
573
 
591
574
  Delete the first element that matches a predicate.
592
575
 
@@ -620,7 +603,7 @@ Time O(N), Space O(1)
620
603
  dfs(order?): E[];
621
604
  ```
622
605
 
623
- Defined in: [data-structures/heap/heap.ts:980](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L980)
606
+ Defined in: [data-structures/heap/heap.ts:577](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L577)
624
607
 
625
608
  Traverse the binary heap as a complete binary tree and collect elements.
626
609
 
@@ -638,8 +621,6 @@ Traversal order: 'PRE' | 'IN' | 'POST'.
638
621
 
639
622
  Array of visited elements.
640
623
 
641
- *
642
-
643
624
  #### Remarks
644
625
 
645
626
  Time O(N), Space O(H)
@@ -665,7 +646,7 @@ Time O(N), Space O(H)
665
646
  entries(): IterableIterator<[number, E]>;
666
647
  ```
667
648
 
668
- Defined in: [data-structures/base/iterable-element-base.ts:208](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L208)
649
+ Defined in: [data-structures/base/iterable-element-base.ts:207](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L207)
669
650
 
670
651
  Return an iterator of `[index, value]` pairs (Array-compatible).
671
652
 
@@ -729,7 +710,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
729
710
  filter(callback, thisArg?): this;
730
711
  ```
731
712
 
732
- Defined in: [data-structures/heap/heap.ts:1195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1195)
713
+ Defined in: [data-structures/heap/heap.ts:666](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L666)
733
714
 
734
715
  Filter elements into a new heap of the same class.
735
716
 
@@ -753,8 +734,6 @@ Value for `this` inside the callback.
753
734
 
754
735
  A new heap with the kept elements.
755
736
 
756
- *
757
-
758
737
  #### Remarks
759
738
 
760
739
  Time O(N log N), Space O(N)
@@ -870,7 +849,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
870
849
  fix(): boolean[];
871
850
  ```
872
851
 
873
- Defined in: [data-structures/heap/heap.ts:1011](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1011)
852
+ Defined in: [data-structures/heap/heap.ts:607](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L607)
874
853
 
875
854
  Restore heap order bottom-up (heapify in-place).
876
855
 
@@ -936,7 +915,7 @@ Time O(n), Space O(1).
936
915
  has(element): boolean;
937
916
  ```
938
917
 
939
- Defined in: [data-structures/heap/heap.ts:812](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L812)
918
+ Defined in: [data-structures/heap/heap.ts:484](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L484)
940
919
 
941
920
  Check if an equal element exists in the heap.
942
921
 
@@ -954,8 +933,6 @@ Element to search for.
954
933
 
955
934
  True if found.
956
935
 
957
- *
958
-
959
936
  #### Remarks
960
937
 
961
938
  Time O(N), Space O(1)
@@ -981,7 +958,7 @@ Time O(N), Space O(1)
981
958
  includes(element): boolean;
982
959
  ```
983
960
 
984
- Defined in: [data-structures/base/iterable-element-base.ts:200](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L200)
961
+ Defined in: [data-structures/base/iterable-element-base.ts:199](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L199)
985
962
 
986
963
  Check whether a value exists (Array-compatible alias for `has`).
987
964
 
@@ -1015,7 +992,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
1015
992
  isEmpty(): boolean;
1016
993
  ```
1017
994
 
1018
- Defined in: [data-structures/heap/heap.ts:706](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L706)
995
+ Defined in: [data-structures/heap/heap.ts:455](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L455)
1019
996
 
1020
997
  Check whether the heap is empty.
1021
998
 
@@ -1025,8 +1002,6 @@ Check whether the heap is empty.
1025
1002
 
1026
1003
  True if size is 0.
1027
1004
 
1028
- *
1029
-
1030
1005
  #### Remarks
1031
1006
 
1032
1007
  Time O(1), Space O(1)
@@ -1053,7 +1028,7 @@ Time O(1), Space O(1)
1053
1028
  keys(): IterableIterator<number>;
1054
1029
  ```
1055
1030
 
1056
- Defined in: [data-structures/base/iterable-element-base.ts:219](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L219)
1031
+ Defined in: [data-structures/base/iterable-element-base.ts:218](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L218)
1057
1032
 
1058
1033
  Return an iterator of numeric indices (Array-compatible).
1059
1034
 
@@ -1080,7 +1055,7 @@ map<EM, RM>(
1080
1055
  thisArg?): Heap<EM, RM>;
1081
1056
  ```
1082
1057
 
1083
- Defined in: [data-structures/heap/heap.ts:1263](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1263)
1058
+ Defined in: [data-structures/heap/heap.ts:694](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L694)
1084
1059
 
1085
1060
  Map elements into a new heap of possibly different element type.
1086
1061
 
@@ -1120,8 +1095,6 @@ Value for `this` inside the callback.
1120
1095
 
1121
1096
  A new heap with mapped elements.
1122
1097
 
1123
- *
1124
-
1125
1098
  #### Remarks
1126
1099
 
1127
1100
  Time O(N log N), Space O(N)
@@ -1147,7 +1120,7 @@ Time O(N log N), Space O(N)
1147
1120
  mapSame(callback, thisArg?): this;
1148
1121
  ```
1149
1122
 
1150
- Defined in: [data-structures/heap/heap.ts:1287](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1287)
1123
+ Defined in: [data-structures/heap/heap.ts:717](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L717)
1151
1124
 
1152
1125
  Map elements into a new heap of the same element type.
1153
1126
 
@@ -1187,7 +1160,7 @@ Time O(N log N), Space O(N)
1187
1160
  peek(): E | undefined;
1188
1161
  ```
1189
1162
 
1190
- Defined in: [data-structures/heap/heap.ts:650](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L650)
1163
+ Defined in: [data-structures/heap/heap.ts:440](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L440)
1191
1164
 
1192
1165
  Get the current top element without removing it.
1193
1166
 
@@ -1197,8 +1170,6 @@ Get the current top element without removing it.
1197
1170
 
1198
1171
  Top element or undefined.
1199
1172
 
1200
- *
1201
-
1202
1173
  #### Remarks
1203
1174
 
1204
1175
  Time O(1), Space O(1)
@@ -1278,7 +1249,7 @@ Time O(1), Space O(1)
1278
1249
  poll(): E | undefined;
1279
1250
  ```
1280
1251
 
1281
- Defined in: [data-structures/heap/heap.ts:523](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L523)
1252
+ Defined in: [data-structures/heap/heap.ts:356](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L356)
1282
1253
 
1283
1254
  #### Returns
1284
1255
 
@@ -1288,8 +1259,6 @@ Defined in: [data-structures/heap/heap.ts:523](https://github.com/zrwusa/data-st
1288
1259
 
1289
1260
  Use `pop` instead. Will be removed in a future major version.
1290
1261
 
1291
- *
1292
-
1293
1262
  #### Example
1294
1263
 
1295
1264
  ```ts
@@ -1331,7 +1300,7 @@ Use `pop` instead. Will be removed in a future major version.
1331
1300
  pop(): E | undefined;
1332
1301
  ```
1333
1302
 
1334
- Defined in: [data-structures/heap/heap.ts:532](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L532)
1303
+ Defined in: [data-structures/heap/heap.ts:365](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L365)
1335
1304
 
1336
1305
  Remove and return the top element (min or max depending on comparator).
1337
1306
 
@@ -1357,7 +1326,7 @@ Time O(log N) amortized, Space O(1)
1357
1326
  print(): void;
1358
1327
  ```
1359
1328
 
1360
- Defined in: [data-structures/base/iterable-element-base.ts:301](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L301)
1329
+ Defined in: [data-structures/base/iterable-element-base.ts:298](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L298)
1361
1330
 
1362
1331
  Prints `toVisual()` to the console. Intended for quick debugging.
1363
1332
 
@@ -1415,7 +1384,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
1415
1384
  reduce(callbackfn): E;
1416
1385
  ```
1417
1386
 
1418
- Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L226)
1387
+ Defined in: [data-structures/base/iterable-element-base.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L225)
1419
1388
 
1420
1389
  ##### Parameters
1421
1390
 
@@ -1437,7 +1406,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
1437
1406
  reduce(callbackfn, initialValue): E;
1438
1407
  ```
1439
1408
 
1440
- Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L227)
1409
+ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L226)
1441
1410
 
1442
1411
  ##### Parameters
1443
1412
 
@@ -1463,7 +1432,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
1463
1432
  reduce<U>(callbackfn, initialValue): U;
1464
1433
  ```
1465
1434
 
1466
- Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L228)
1435
+ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L227)
1467
1436
 
1468
1437
  ##### Type Parameters
1469
1438
 
@@ -1497,7 +1466,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
1497
1466
  setEquality(equals): this;
1498
1467
  ```
1499
1468
 
1500
- Defined in: [data-structures/heap/heap.ts:930](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L930)
1469
+ Defined in: [data-structures/heap/heap.ts:561](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L561)
1501
1470
 
1502
1471
  Set the equality comparator used by has/delete operations.
1503
1472
 
@@ -1571,7 +1540,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
1571
1540
  sort(): E[];
1572
1541
  ```
1573
1542
 
1574
- Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1072)
1543
+ Defined in: [data-structures/heap/heap.ts:625](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L625)
1575
1544
 
1576
1545
  Return all elements in ascending order by repeatedly polling.
1577
1546
 
@@ -1581,8 +1550,6 @@ Return all elements in ascending order by repeatedly polling.
1581
1550
 
1582
1551
  Sorted array of elements.
1583
1552
 
1584
- *
1585
-
1586
1553
  #### Remarks
1587
1554
 
1588
1555
  Time O(N log N), Space O(N)
@@ -1608,7 +1575,7 @@ Time O(N log N), Space O(N)
1608
1575
  toArray(): E[];
1609
1576
  ```
1610
1577
 
1611
- Defined in: [data-structures/base/iterable-element-base.ts:278](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L278)
1578
+ Defined in: [data-structures/base/iterable-element-base.ts:275](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L275)
1612
1579
 
1613
1580
  Materializes the elements into a new array.
1614
1581
 
@@ -1634,7 +1601,7 @@ Time O(n), Space O(n).
1634
1601
  toVisual(): E[];
1635
1602
  ```
1636
1603
 
1637
- Defined in: [data-structures/base/iterable-element-base.ts:290](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L290)
1604
+ Defined in: [data-structures/base/iterable-element-base.ts:287](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L287)
1638
1605
 
1639
1606
  Returns a representation of the structure suitable for quick visualization.
1640
1607
  Defaults to an array of elements; subclasses may override to provide richer visuals.
@@ -1690,7 +1657,7 @@ static from<T, R, S>(
1690
1657
  options?): S;
1691
1658
  ```
1692
1659
 
1693
- Defined in: [data-structures/heap/heap.ts:266](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L266)
1660
+ Defined in: [data-structures/heap/heap.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L225)
1694
1661
 
1695
1662
  Create a heap of the same class from an iterable.
1696
1663
 
@@ -1748,7 +1715,7 @@ Time O(N), Space O(N)
1748
1715
  static heapify<EE, RR>(elements, options): Heap<EE, RR>;
1749
1716
  ```
1750
1717
 
1751
- Defined in: [data-structures/heap/heap.ts:284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L284)
1718
+ Defined in: [data-structures/heap/heap.ts:242](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L242)
1752
1719
 
1753
1720
  Build a Heap from an iterable in linear time given a comparator.
1754
1721
 
@@ -1831,7 +1798,7 @@ Time O(1), Space O(1).
1831
1798
  protected _createInstance(options?): this;
1832
1799
  ```
1833
1800
 
1834
- Defined in: [data-structures/heap/heap.ts:1360](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1360)
1801
+ Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L779)
1835
1802
 
1836
1803
  (Protected) Create an empty instance of the same concrete class.
1837
1804
 
@@ -1865,7 +1832,7 @@ Time O(1), Space O(1)
1865
1832
  protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
1866
1833
  ```
1867
1834
 
1868
- Defined in: [data-structures/heap/heap.ts:1378](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1378)
1835
+ Defined in: [data-structures/heap/heap.ts:793](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L793)
1869
1836
 
1870
1837
  (Protected) Create a like-kind instance seeded by elements.
1871
1838
 
@@ -1915,7 +1882,7 @@ Time O(N log N), Space O(N)
1915
1882
  protected _getIterator(): IterableIterator<E>;
1916
1883
  ```
1917
1884
 
1918
- Defined in: [data-structures/heap/heap.ts:1318](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1318)
1885
+ Defined in: [data-structures/heap/heap.ts:738](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L738)
1919
1886
 
1920
1887
  Internal iterator factory used by the default iterator.
1921
1888
 
@@ -1941,7 +1908,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
1941
1908
  protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
1942
1909
  ```
1943
1910
 
1944
- Defined in: [data-structures/heap/heap.ts:1398](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1398)
1911
+ Defined in: [data-structures/heap/heap.ts:812](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L812)
1945
1912
 
1946
1913
  (Protected) Spawn an empty like-kind heap instance.
1947
1914