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.
- package/CHANGELOG.md +9 -1
- package/dist/cjs/binary-tree.cjs +2927 -23688
- package/dist/cjs/graph.cjs +845 -2634
- package/dist/cjs/hash.cjs +185 -616
- package/dist/cjs/heap.cjs +266 -818
- package/dist/cjs/index.cjs +5116 -31358
- package/dist/cjs/linked-list.cjs +644 -2615
- package/dist/cjs/matrix.cjs +220 -535
- package/dist/cjs/priority-queue.cjs +266 -818
- package/dist/cjs/queue.cjs +637 -2343
- package/dist/cjs/stack.cjs +124 -530
- package/dist/cjs/trie.cjs +145 -592
- package/dist/cjs-legacy/binary-tree.cjs +4352 -25113
- package/dist/cjs-legacy/graph.cjs +847 -2636
- package/dist/cjs-legacy/hash.cjs +181 -612
- package/dist/cjs-legacy/heap.cjs +266 -818
- package/dist/cjs-legacy/index.cjs +6657 -32899
- package/dist/cjs-legacy/linked-list.cjs +640 -2611
- package/dist/cjs-legacy/matrix.cjs +220 -535
- package/dist/cjs-legacy/priority-queue.cjs +266 -818
- package/dist/cjs-legacy/queue.cjs +634 -2340
- package/dist/cjs-legacy/stack.cjs +124 -530
- package/dist/cjs-legacy/trie.cjs +145 -592
- package/dist/esm/binary-tree.mjs +2927 -23688
- package/dist/esm/graph.mjs +845 -2634
- package/dist/esm/hash.mjs +185 -616
- package/dist/esm/heap.mjs +266 -818
- package/dist/esm/index.mjs +5116 -31358
- package/dist/esm/linked-list.mjs +644 -2615
- package/dist/esm/matrix.mjs +220 -535
- package/dist/esm/priority-queue.mjs +266 -818
- package/dist/esm/queue.mjs +637 -2343
- package/dist/esm/stack.mjs +124 -530
- package/dist/esm/trie.mjs +145 -592
- package/dist/esm-legacy/binary-tree.mjs +4352 -25113
- package/dist/esm-legacy/graph.mjs +847 -2636
- package/dist/esm-legacy/hash.mjs +181 -612
- package/dist/esm-legacy/heap.mjs +266 -818
- package/dist/esm-legacy/index.mjs +6657 -32899
- package/dist/esm-legacy/linked-list.mjs +640 -2611
- package/dist/esm-legacy/matrix.mjs +220 -535
- package/dist/esm-legacy/priority-queue.mjs +266 -818
- package/dist/esm-legacy/queue.mjs +634 -2340
- package/dist/esm-legacy/stack.mjs +124 -530
- package/dist/esm-legacy/trie.mjs +145 -592
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +29 -500
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +38 -563
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +230 -1212
- package/dist/types/data-structures/binary-tree/bst.d.ts +124 -1063
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +99 -854
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +62 -314
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +366 -5057
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +277 -4885
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +253 -3929
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +261 -4782
- package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -44
- package/dist/types/data-structures/graph/directed-graph.d.ts +130 -527
- package/dist/types/data-structures/graph/undirected-graph.d.ts +125 -482
- package/dist/types/data-structures/hash/hash-map.d.ts +132 -562
- package/dist/types/data-structures/heap/heap.d.ts +194 -746
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +120 -809
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -733
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +193 -863
- package/dist/types/data-structures/matrix/matrix.d.ts +159 -474
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -6
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +6 -11
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/types/data-structures/queue/deque.d.ts +196 -804
- package/dist/types/data-structures/queue/queue.d.ts +99 -585
- package/dist/types/data-structures/stack/stack.d.ts +75 -481
- package/dist/types/data-structures/trie/trie.d.ts +98 -584
- package/dist/umd/data-structure-typed.js +6580 -32822
- package/dist/umd/data-structure-typed.min.js +3 -3
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +162 -215
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/BST.md +155 -208
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +7 -7
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -29
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +104 -158
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +72 -104
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +60 -80
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +67 -101
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +52 -48
- package/docs-site-docusaurus/docs/api/classes/Heap.md +40 -68
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +17 -17
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +68 -96
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +60 -80
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +57 -52
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +38 -66
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +41 -74
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +38 -66
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +46 -79
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +40 -68
- package/docs-site-docusaurus/docs/api/classes/Queue.md +54 -78
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +171 -225
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -22
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +68 -98
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +4 -4
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +98 -75
- package/docs-site-docusaurus/docs/api/classes/Stack.md +33 -53
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +104 -129
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +57 -124
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +45 -116
- package/docs-site-docusaurus/docs/api/classes/Trie.md +37 -61
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +59 -77
- package/package.json +1 -1
- package/src/data-structures/binary-tree/tree-multi-set.ts +15 -11
|
@@ -146,7 +146,7 @@ Optional configuration.
|
|
|
146
146
|
get comparator(): Comparator<E>;
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
149
|
+
Defined in: [data-structures/heap/heap.ts:211](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L211)
|
|
150
150
|
|
|
151
151
|
Get the comparator used to order elements.
|
|
152
152
|
|
|
@@ -174,7 +174,7 @@ Comparator function.
|
|
|
174
174
|
get elements(): E[];
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
177
|
+
Defined in: [data-structures/heap/heap.ts:175](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L175)
|
|
178
178
|
|
|
179
179
|
Get the backing array of the heap.
|
|
180
180
|
|
|
@@ -202,7 +202,7 @@ Internal elements array.
|
|
|
202
202
|
get leaf(): E | undefined;
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
205
|
+
Defined in: [data-structures/heap/heap.ts:202](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L202)
|
|
206
206
|
|
|
207
207
|
Get the last leaf element.
|
|
208
208
|
|
|
@@ -230,7 +230,7 @@ Last element or undefined.
|
|
|
230
230
|
get size(): number;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
233
|
+
Defined in: [data-structures/heap/heap.ts:193](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L193)
|
|
234
234
|
|
|
235
235
|
Get the number of elements.
|
|
236
236
|
|
|
@@ -257,8 +257,6 @@ Time O(1), Space O(1)
|
|
|
257
257
|
|
|
258
258
|
Heap size.
|
|
259
259
|
|
|
260
|
-
*
|
|
261
|
-
|
|
262
260
|
#### Inherited from
|
|
263
261
|
|
|
264
262
|
[`Heap`](Heap.md).[`size`](Heap.md#size)
|
|
@@ -333,7 +331,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
333
331
|
add(element): boolean;
|
|
334
332
|
```
|
|
335
333
|
|
|
336
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
334
|
+
Defined in: [data-structures/heap/heap.ts:267](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L267)
|
|
337
335
|
|
|
338
336
|
Insert an element.
|
|
339
337
|
|
|
@@ -351,8 +349,6 @@ Element to insert.
|
|
|
351
349
|
|
|
352
350
|
True.
|
|
353
351
|
|
|
354
|
-
*
|
|
355
|
-
|
|
356
352
|
#### Remarks
|
|
357
353
|
|
|
358
354
|
Time O(log N) amortized, Space O(1)
|
|
@@ -388,7 +384,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
388
384
|
addMany(elements): boolean[];
|
|
389
385
|
```
|
|
390
386
|
|
|
391
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
387
|
+
Defined in: [data-structures/heap/heap.ts:284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L284)
|
|
392
388
|
|
|
393
389
|
Insert many elements from an iterable.
|
|
394
390
|
|
|
@@ -406,8 +402,6 @@ Iterable of elements or raw values.
|
|
|
406
402
|
|
|
407
403
|
Array of per-element success flags.
|
|
408
404
|
|
|
409
|
-
*
|
|
410
|
-
|
|
411
405
|
#### Remarks
|
|
412
406
|
|
|
413
407
|
Time O(N log N), Space O(1)
|
|
@@ -434,7 +428,7 @@ Time O(N log N), Space O(1)
|
|
|
434
428
|
clear(): void;
|
|
435
429
|
```
|
|
436
430
|
|
|
437
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
431
|
+
Defined in: [data-structures/heap/heap.ts:469](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L469)
|
|
438
432
|
|
|
439
433
|
Remove all elements.
|
|
440
434
|
|
|
@@ -444,8 +438,6 @@ Remove all elements.
|
|
|
444
438
|
|
|
445
439
|
void
|
|
446
440
|
|
|
447
|
-
*
|
|
448
|
-
|
|
449
441
|
#### Remarks
|
|
450
442
|
|
|
451
443
|
Time O(1), Space O(1)
|
|
@@ -471,7 +463,7 @@ Time O(1), Space O(1)
|
|
|
471
463
|
clone(): this;
|
|
472
464
|
```
|
|
473
465
|
|
|
474
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
466
|
+
Defined in: [data-structures/heap/heap.ts:648](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L648)
|
|
475
467
|
|
|
476
468
|
Deep clone this heap.
|
|
477
469
|
|
|
@@ -481,8 +473,6 @@ Deep clone this heap.
|
|
|
481
473
|
|
|
482
474
|
A new heap with the same elements.
|
|
483
475
|
|
|
484
|
-
*
|
|
485
|
-
|
|
486
476
|
#### Remarks
|
|
487
477
|
|
|
488
478
|
Time O(N), Space O(N)
|
|
@@ -510,7 +500,7 @@ Time O(N), Space O(N)
|
|
|
510
500
|
delete(element): boolean;
|
|
511
501
|
```
|
|
512
502
|
|
|
513
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
503
|
+
Defined in: [data-structures/heap/heap.ts:500](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L500)
|
|
514
504
|
|
|
515
505
|
Delete one occurrence of an element.
|
|
516
506
|
|
|
@@ -528,8 +518,6 @@ Element to delete.
|
|
|
528
518
|
|
|
529
519
|
True if an element was removed.
|
|
530
520
|
|
|
531
|
-
*
|
|
532
|
-
|
|
533
521
|
#### Remarks
|
|
534
522
|
|
|
535
523
|
Time O(N), Space O(1)
|
|
@@ -555,7 +543,7 @@ Time O(N), Space O(1)
|
|
|
555
543
|
deleteBy(predicate): boolean;
|
|
556
544
|
```
|
|
557
545
|
|
|
558
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
546
|
+
Defined in: [data-structures/heap/heap.ts:524](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L524)
|
|
559
547
|
|
|
560
548
|
#### Parameters
|
|
561
549
|
|
|
@@ -583,7 +571,7 @@ Use `deleteWhere` instead. Will be removed in a future major version.
|
|
|
583
571
|
deleteWhere(predicate): boolean;
|
|
584
572
|
```
|
|
585
573
|
|
|
586
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
574
|
+
Defined in: [data-structures/heap/heap.ts:534](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L534)
|
|
587
575
|
|
|
588
576
|
Delete the first element that matches a predicate.
|
|
589
577
|
|
|
@@ -617,7 +605,7 @@ Time O(N), Space O(1)
|
|
|
617
605
|
dfs(order?): E[];
|
|
618
606
|
```
|
|
619
607
|
|
|
620
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
608
|
+
Defined in: [data-structures/heap/heap.ts:577](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L577)
|
|
621
609
|
|
|
622
610
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
623
611
|
|
|
@@ -635,8 +623,6 @@ Traversal order: 'PRE' | 'IN' | 'POST'.
|
|
|
635
623
|
|
|
636
624
|
Array of visited elements.
|
|
637
625
|
|
|
638
|
-
*
|
|
639
|
-
|
|
640
626
|
#### Remarks
|
|
641
627
|
|
|
642
628
|
Time O(N), Space O(H)
|
|
@@ -662,7 +648,7 @@ Time O(N), Space O(H)
|
|
|
662
648
|
entries(): IterableIterator<[number, E]>;
|
|
663
649
|
```
|
|
664
650
|
|
|
665
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
651
|
+
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)
|
|
666
652
|
|
|
667
653
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
668
654
|
|
|
@@ -726,7 +712,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
726
712
|
filter(callback, thisArg?): this;
|
|
727
713
|
```
|
|
728
714
|
|
|
729
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
715
|
+
Defined in: [data-structures/heap/heap.ts:666](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L666)
|
|
730
716
|
|
|
731
717
|
Filter elements into a new heap of the same class.
|
|
732
718
|
|
|
@@ -750,8 +736,6 @@ Value for `this` inside the callback.
|
|
|
750
736
|
|
|
751
737
|
A new heap with the kept elements.
|
|
752
738
|
|
|
753
|
-
*
|
|
754
|
-
|
|
755
739
|
#### Remarks
|
|
756
740
|
|
|
757
741
|
Time O(N log N), Space O(N)
|
|
@@ -867,7 +851,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
867
851
|
fix(): boolean[];
|
|
868
852
|
```
|
|
869
853
|
|
|
870
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
854
|
+
Defined in: [data-structures/heap/heap.ts:607](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L607)
|
|
871
855
|
|
|
872
856
|
Restore heap order bottom-up (heapify in-place).
|
|
873
857
|
|
|
@@ -933,7 +917,7 @@ Time O(n), Space O(1).
|
|
|
933
917
|
has(element): boolean;
|
|
934
918
|
```
|
|
935
919
|
|
|
936
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
920
|
+
Defined in: [data-structures/heap/heap.ts:484](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L484)
|
|
937
921
|
|
|
938
922
|
Check if an equal element exists in the heap.
|
|
939
923
|
|
|
@@ -951,8 +935,6 @@ Element to search for.
|
|
|
951
935
|
|
|
952
936
|
True if found.
|
|
953
937
|
|
|
954
|
-
*
|
|
955
|
-
|
|
956
938
|
#### Remarks
|
|
957
939
|
|
|
958
940
|
Time O(N), Space O(1)
|
|
@@ -978,7 +960,7 @@ Time O(N), Space O(1)
|
|
|
978
960
|
includes(element): boolean;
|
|
979
961
|
```
|
|
980
962
|
|
|
981
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
963
|
+
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)
|
|
982
964
|
|
|
983
965
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
984
966
|
|
|
@@ -1012,7 +994,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
|
1012
994
|
isEmpty(): boolean;
|
|
1013
995
|
```
|
|
1014
996
|
|
|
1015
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
997
|
+
Defined in: [data-structures/heap/heap.ts:455](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L455)
|
|
1016
998
|
|
|
1017
999
|
Check whether the heap is empty.
|
|
1018
1000
|
|
|
@@ -1022,8 +1004,6 @@ Check whether the heap is empty.
|
|
|
1022
1004
|
|
|
1023
1005
|
True if size is 0.
|
|
1024
1006
|
|
|
1025
|
-
*
|
|
1026
|
-
|
|
1027
1007
|
#### Remarks
|
|
1028
1008
|
|
|
1029
1009
|
Time O(1), Space O(1)
|
|
@@ -1050,7 +1030,7 @@ Time O(1), Space O(1)
|
|
|
1050
1030
|
keys(): IterableIterator<number>;
|
|
1051
1031
|
```
|
|
1052
1032
|
|
|
1053
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1033
|
+
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)
|
|
1054
1034
|
|
|
1055
1035
|
Return an iterator of numeric indices (Array-compatible).
|
|
1056
1036
|
|
|
@@ -1077,7 +1057,7 @@ map<EM, RM>(
|
|
|
1077
1057
|
thisArg?): Heap<EM, RM>;
|
|
1078
1058
|
```
|
|
1079
1059
|
|
|
1080
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1060
|
+
Defined in: [data-structures/heap/heap.ts:694](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L694)
|
|
1081
1061
|
|
|
1082
1062
|
Map elements into a new heap of possibly different element type.
|
|
1083
1063
|
|
|
@@ -1117,8 +1097,6 @@ Value for `this` inside the callback.
|
|
|
1117
1097
|
|
|
1118
1098
|
A new heap with mapped elements.
|
|
1119
1099
|
|
|
1120
|
-
*
|
|
1121
|
-
|
|
1122
1100
|
#### Remarks
|
|
1123
1101
|
|
|
1124
1102
|
Time O(N log N), Space O(N)
|
|
@@ -1144,7 +1122,7 @@ Time O(N log N), Space O(N)
|
|
|
1144
1122
|
mapSame(callback, thisArg?): this;
|
|
1145
1123
|
```
|
|
1146
1124
|
|
|
1147
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1125
|
+
Defined in: [data-structures/heap/heap.ts:717](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L717)
|
|
1148
1126
|
|
|
1149
1127
|
Map elements into a new heap of the same element type.
|
|
1150
1128
|
|
|
@@ -1184,7 +1162,7 @@ Time O(N log N), Space O(N)
|
|
|
1184
1162
|
peek(): E | undefined;
|
|
1185
1163
|
```
|
|
1186
1164
|
|
|
1187
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1165
|
+
Defined in: [data-structures/heap/heap.ts:440](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L440)
|
|
1188
1166
|
|
|
1189
1167
|
Get the current top element without removing it.
|
|
1190
1168
|
|
|
@@ -1194,8 +1172,6 @@ Get the current top element without removing it.
|
|
|
1194
1172
|
|
|
1195
1173
|
Top element or undefined.
|
|
1196
1174
|
|
|
1197
|
-
*
|
|
1198
|
-
|
|
1199
1175
|
#### Remarks
|
|
1200
1176
|
|
|
1201
1177
|
Time O(1), Space O(1)
|
|
@@ -1275,7 +1251,7 @@ Time O(1), Space O(1)
|
|
|
1275
1251
|
poll(): E | undefined;
|
|
1276
1252
|
```
|
|
1277
1253
|
|
|
1278
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1254
|
+
Defined in: [data-structures/heap/heap.ts:356](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L356)
|
|
1279
1255
|
|
|
1280
1256
|
#### Returns
|
|
1281
1257
|
|
|
@@ -1285,8 +1261,6 @@ Defined in: [data-structures/heap/heap.ts:523](https://github.com/zrwusa/data-st
|
|
|
1285
1261
|
|
|
1286
1262
|
Use `pop` instead. Will be removed in a future major version.
|
|
1287
1263
|
|
|
1288
|
-
*
|
|
1289
|
-
|
|
1290
1264
|
#### Example
|
|
1291
1265
|
|
|
1292
1266
|
```ts
|
|
@@ -1328,7 +1302,7 @@ Use `pop` instead. Will be removed in a future major version.
|
|
|
1328
1302
|
pop(): E | undefined;
|
|
1329
1303
|
```
|
|
1330
1304
|
|
|
1331
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1305
|
+
Defined in: [data-structures/heap/heap.ts:365](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L365)
|
|
1332
1306
|
|
|
1333
1307
|
Remove and return the top element (min or max depending on comparator).
|
|
1334
1308
|
|
|
@@ -1354,7 +1328,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
1354
1328
|
print(): void;
|
|
1355
1329
|
```
|
|
1356
1330
|
|
|
1357
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1331
|
+
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)
|
|
1358
1332
|
|
|
1359
1333
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1360
1334
|
|
|
@@ -1412,7 +1386,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1412
1386
|
reduce(callbackfn): E;
|
|
1413
1387
|
```
|
|
1414
1388
|
|
|
1415
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1389
|
+
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)
|
|
1416
1390
|
|
|
1417
1391
|
##### Parameters
|
|
1418
1392
|
|
|
@@ -1434,7 +1408,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1434
1408
|
reduce(callbackfn, initialValue): E;
|
|
1435
1409
|
```
|
|
1436
1410
|
|
|
1437
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1411
|
+
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)
|
|
1438
1412
|
|
|
1439
1413
|
##### Parameters
|
|
1440
1414
|
|
|
@@ -1460,7 +1434,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1460
1434
|
reduce<U>(callbackfn, initialValue): U;
|
|
1461
1435
|
```
|
|
1462
1436
|
|
|
1463
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1437
|
+
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)
|
|
1464
1438
|
|
|
1465
1439
|
##### Type Parameters
|
|
1466
1440
|
|
|
@@ -1494,7 +1468,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
1494
1468
|
setEquality(equals): this;
|
|
1495
1469
|
```
|
|
1496
1470
|
|
|
1497
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1471
|
+
Defined in: [data-structures/heap/heap.ts:561](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L561)
|
|
1498
1472
|
|
|
1499
1473
|
Set the equality comparator used by has/delete operations.
|
|
1500
1474
|
|
|
@@ -1568,7 +1542,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1568
1542
|
sort(): E[];
|
|
1569
1543
|
```
|
|
1570
1544
|
|
|
1571
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1545
|
+
Defined in: [data-structures/heap/heap.ts:625](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L625)
|
|
1572
1546
|
|
|
1573
1547
|
Return all elements in ascending order by repeatedly polling.
|
|
1574
1548
|
|
|
@@ -1578,8 +1552,6 @@ Return all elements in ascending order by repeatedly polling.
|
|
|
1578
1552
|
|
|
1579
1553
|
Sorted array of elements.
|
|
1580
1554
|
|
|
1581
|
-
*
|
|
1582
|
-
|
|
1583
1555
|
#### Remarks
|
|
1584
1556
|
|
|
1585
1557
|
Time O(N log N), Space O(N)
|
|
@@ -1605,7 +1577,7 @@ Time O(N log N), Space O(N)
|
|
|
1605
1577
|
toArray(): E[];
|
|
1606
1578
|
```
|
|
1607
1579
|
|
|
1608
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1580
|
+
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)
|
|
1609
1581
|
|
|
1610
1582
|
Materializes the elements into a new array.
|
|
1611
1583
|
|
|
@@ -1631,7 +1603,7 @@ Time O(n), Space O(n).
|
|
|
1631
1603
|
toVisual(): E[];
|
|
1632
1604
|
```
|
|
1633
1605
|
|
|
1634
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1606
|
+
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)
|
|
1635
1607
|
|
|
1636
1608
|
Returns a representation of the structure suitable for quick visualization.
|
|
1637
1609
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1687,7 +1659,7 @@ static from<T, R, S>(
|
|
|
1687
1659
|
options?): S;
|
|
1688
1660
|
```
|
|
1689
1661
|
|
|
1690
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1662
|
+
Defined in: [data-structures/heap/heap.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L225)
|
|
1691
1663
|
|
|
1692
1664
|
Create a heap of the same class from an iterable.
|
|
1693
1665
|
|
|
@@ -1745,7 +1717,7 @@ Time O(N), Space O(N)
|
|
|
1745
1717
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1746
1718
|
```
|
|
1747
1719
|
|
|
1748
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1720
|
+
Defined in: [data-structures/heap/heap.ts:242](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L242)
|
|
1749
1721
|
|
|
1750
1722
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1751
1723
|
|
|
@@ -1828,7 +1800,7 @@ Time O(1), Space O(1).
|
|
|
1828
1800
|
protected _createInstance(options?): this;
|
|
1829
1801
|
```
|
|
1830
1802
|
|
|
1831
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1803
|
+
Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L779)
|
|
1832
1804
|
|
|
1833
1805
|
(Protected) Create an empty instance of the same concrete class.
|
|
1834
1806
|
|
|
@@ -1862,7 +1834,7 @@ Time O(1), Space O(1)
|
|
|
1862
1834
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1863
1835
|
```
|
|
1864
1836
|
|
|
1865
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1837
|
+
Defined in: [data-structures/heap/heap.ts:793](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L793)
|
|
1866
1838
|
|
|
1867
1839
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1868
1840
|
|
|
@@ -1912,7 +1884,7 @@ Time O(N log N), Space O(N)
|
|
|
1912
1884
|
protected _getIterator(): IterableIterator<E>;
|
|
1913
1885
|
```
|
|
1914
1886
|
|
|
1915
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1887
|
+
Defined in: [data-structures/heap/heap.ts:738](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L738)
|
|
1916
1888
|
|
|
1917
1889
|
Internal iterator factory used by the default iterator.
|
|
1918
1890
|
|
|
@@ -1938,7 +1910,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1938
1910
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1939
1911
|
```
|
|
1940
1912
|
|
|
1941
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1913
|
+
Defined in: [data-structures/heap/heap.ts:812](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L812)
|
|
1942
1914
|
|
|
1943
1915
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1944
1916
|
|