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
|
@@ -133,7 +133,7 @@ Optional configuration.
|
|
|
133
133
|
get comparator(): Comparator<E>;
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
136
|
+
Defined in: [data-structures/heap/heap.ts:211](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L211)
|
|
137
137
|
|
|
138
138
|
Get the comparator used to order elements.
|
|
139
139
|
|
|
@@ -161,7 +161,7 @@ Comparator function.
|
|
|
161
161
|
get elements(): E[];
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
164
|
+
Defined in: [data-structures/heap/heap.ts:175](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L175)
|
|
165
165
|
|
|
166
166
|
Get the backing array of the heap.
|
|
167
167
|
|
|
@@ -189,7 +189,7 @@ Internal elements array.
|
|
|
189
189
|
get leaf(): E | undefined;
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
192
|
+
Defined in: [data-structures/heap/heap.ts:202](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L202)
|
|
193
193
|
|
|
194
194
|
Get the last leaf element.
|
|
195
195
|
|
|
@@ -217,7 +217,7 @@ Last element or undefined.
|
|
|
217
217
|
get size(): number;
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
220
|
+
Defined in: [data-structures/heap/heap.ts:193](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L193)
|
|
221
221
|
|
|
222
222
|
Get the number of elements.
|
|
223
223
|
|
|
@@ -244,8 +244,6 @@ Time O(1), Space O(1)
|
|
|
244
244
|
|
|
245
245
|
Heap size.
|
|
246
246
|
|
|
247
|
-
*
|
|
248
|
-
|
|
249
247
|
#### Inherited from
|
|
250
248
|
|
|
251
249
|
[`Heap`](Heap.md).[`size`](Heap.md#size)
|
|
@@ -320,7 +318,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
320
318
|
add(element): boolean;
|
|
321
319
|
```
|
|
322
320
|
|
|
323
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
321
|
+
Defined in: [data-structures/heap/heap.ts:267](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L267)
|
|
324
322
|
|
|
325
323
|
Insert an element.
|
|
326
324
|
|
|
@@ -338,8 +336,6 @@ Element to insert.
|
|
|
338
336
|
|
|
339
337
|
True.
|
|
340
338
|
|
|
341
|
-
*
|
|
342
|
-
|
|
343
339
|
#### Remarks
|
|
344
340
|
|
|
345
341
|
Time O(log N) amortized, Space O(1)
|
|
@@ -375,7 +371,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
375
371
|
addMany(elements): boolean[];
|
|
376
372
|
```
|
|
377
373
|
|
|
378
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
374
|
+
Defined in: [data-structures/heap/heap.ts:284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L284)
|
|
379
375
|
|
|
380
376
|
Insert many elements from an iterable.
|
|
381
377
|
|
|
@@ -393,8 +389,6 @@ Iterable of elements or raw values.
|
|
|
393
389
|
|
|
394
390
|
Array of per-element success flags.
|
|
395
391
|
|
|
396
|
-
*
|
|
397
|
-
|
|
398
392
|
#### Remarks
|
|
399
393
|
|
|
400
394
|
Time O(N log N), Space O(1)
|
|
@@ -421,7 +415,7 @@ Time O(N log N), Space O(1)
|
|
|
421
415
|
clear(): void;
|
|
422
416
|
```
|
|
423
417
|
|
|
424
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
418
|
+
Defined in: [data-structures/heap/heap.ts:469](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L469)
|
|
425
419
|
|
|
426
420
|
Remove all elements.
|
|
427
421
|
|
|
@@ -431,8 +425,6 @@ Remove all elements.
|
|
|
431
425
|
|
|
432
426
|
void
|
|
433
427
|
|
|
434
|
-
*
|
|
435
|
-
|
|
436
428
|
#### Remarks
|
|
437
429
|
|
|
438
430
|
Time O(1), Space O(1)
|
|
@@ -458,7 +450,7 @@ Time O(1), Space O(1)
|
|
|
458
450
|
clone(): this;
|
|
459
451
|
```
|
|
460
452
|
|
|
461
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
453
|
+
Defined in: [data-structures/heap/heap.ts:648](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L648)
|
|
462
454
|
|
|
463
455
|
Deep clone this heap.
|
|
464
456
|
|
|
@@ -468,8 +460,6 @@ Deep clone this heap.
|
|
|
468
460
|
|
|
469
461
|
A new heap with the same elements.
|
|
470
462
|
|
|
471
|
-
*
|
|
472
|
-
|
|
473
463
|
#### Remarks
|
|
474
464
|
|
|
475
465
|
Time O(N), Space O(N)
|
|
@@ -497,7 +487,7 @@ Time O(N), Space O(N)
|
|
|
497
487
|
delete(element): boolean;
|
|
498
488
|
```
|
|
499
489
|
|
|
500
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
490
|
+
Defined in: [data-structures/heap/heap.ts:500](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L500)
|
|
501
491
|
|
|
502
492
|
Delete one occurrence of an element.
|
|
503
493
|
|
|
@@ -515,8 +505,6 @@ Element to delete.
|
|
|
515
505
|
|
|
516
506
|
True if an element was removed.
|
|
517
507
|
|
|
518
|
-
*
|
|
519
|
-
|
|
520
508
|
#### Remarks
|
|
521
509
|
|
|
522
510
|
Time O(N), Space O(1)
|
|
@@ -542,7 +530,7 @@ Time O(N), Space O(1)
|
|
|
542
530
|
deleteBy(predicate): boolean;
|
|
543
531
|
```
|
|
544
532
|
|
|
545
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
533
|
+
Defined in: [data-structures/heap/heap.ts:524](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L524)
|
|
546
534
|
|
|
547
535
|
#### Parameters
|
|
548
536
|
|
|
@@ -570,7 +558,7 @@ Use `deleteWhere` instead. Will be removed in a future major version.
|
|
|
570
558
|
deleteWhere(predicate): boolean;
|
|
571
559
|
```
|
|
572
560
|
|
|
573
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
561
|
+
Defined in: [data-structures/heap/heap.ts:534](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L534)
|
|
574
562
|
|
|
575
563
|
Delete the first element that matches a predicate.
|
|
576
564
|
|
|
@@ -604,7 +592,7 @@ Time O(N), Space O(1)
|
|
|
604
592
|
dfs(order?): E[];
|
|
605
593
|
```
|
|
606
594
|
|
|
607
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
595
|
+
Defined in: [data-structures/heap/heap.ts:577](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L577)
|
|
608
596
|
|
|
609
597
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
610
598
|
|
|
@@ -622,8 +610,6 @@ Traversal order: 'PRE' | 'IN' | 'POST'.
|
|
|
622
610
|
|
|
623
611
|
Array of visited elements.
|
|
624
612
|
|
|
625
|
-
*
|
|
626
|
-
|
|
627
613
|
#### Remarks
|
|
628
614
|
|
|
629
615
|
Time O(N), Space O(H)
|
|
@@ -649,7 +635,7 @@ Time O(N), Space O(H)
|
|
|
649
635
|
entries(): IterableIterator<[number, E]>;
|
|
650
636
|
```
|
|
651
637
|
|
|
652
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
638
|
+
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)
|
|
653
639
|
|
|
654
640
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
655
641
|
|
|
@@ -713,7 +699,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
713
699
|
filter(callback, thisArg?): this;
|
|
714
700
|
```
|
|
715
701
|
|
|
716
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
702
|
+
Defined in: [data-structures/heap/heap.ts:666](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L666)
|
|
717
703
|
|
|
718
704
|
Filter elements into a new heap of the same class.
|
|
719
705
|
|
|
@@ -737,8 +723,6 @@ Value for `this` inside the callback.
|
|
|
737
723
|
|
|
738
724
|
A new heap with the kept elements.
|
|
739
725
|
|
|
740
|
-
*
|
|
741
|
-
|
|
742
726
|
#### Remarks
|
|
743
727
|
|
|
744
728
|
Time O(N log N), Space O(N)
|
|
@@ -854,7 +838,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
854
838
|
fix(): boolean[];
|
|
855
839
|
```
|
|
856
840
|
|
|
857
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
841
|
+
Defined in: [data-structures/heap/heap.ts:607](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L607)
|
|
858
842
|
|
|
859
843
|
Restore heap order bottom-up (heapify in-place).
|
|
860
844
|
|
|
@@ -920,7 +904,7 @@ Time O(n), Space O(1).
|
|
|
920
904
|
has(element): boolean;
|
|
921
905
|
```
|
|
922
906
|
|
|
923
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
907
|
+
Defined in: [data-structures/heap/heap.ts:484](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L484)
|
|
924
908
|
|
|
925
909
|
Check if an equal element exists in the heap.
|
|
926
910
|
|
|
@@ -938,8 +922,6 @@ Element to search for.
|
|
|
938
922
|
|
|
939
923
|
True if found.
|
|
940
924
|
|
|
941
|
-
*
|
|
942
|
-
|
|
943
925
|
#### Remarks
|
|
944
926
|
|
|
945
927
|
Time O(N), Space O(1)
|
|
@@ -965,7 +947,7 @@ Time O(N), Space O(1)
|
|
|
965
947
|
includes(element): boolean;
|
|
966
948
|
```
|
|
967
949
|
|
|
968
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
950
|
+
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)
|
|
969
951
|
|
|
970
952
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
971
953
|
|
|
@@ -999,7 +981,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
|
999
981
|
isEmpty(): boolean;
|
|
1000
982
|
```
|
|
1001
983
|
|
|
1002
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
984
|
+
Defined in: [data-structures/heap/heap.ts:455](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L455)
|
|
1003
985
|
|
|
1004
986
|
Check whether the heap is empty.
|
|
1005
987
|
|
|
@@ -1009,8 +991,6 @@ Check whether the heap is empty.
|
|
|
1009
991
|
|
|
1010
992
|
True if size is 0.
|
|
1011
993
|
|
|
1012
|
-
*
|
|
1013
|
-
|
|
1014
994
|
#### Remarks
|
|
1015
995
|
|
|
1016
996
|
Time O(1), Space O(1)
|
|
@@ -1037,7 +1017,7 @@ Time O(1), Space O(1)
|
|
|
1037
1017
|
keys(): IterableIterator<number>;
|
|
1038
1018
|
```
|
|
1039
1019
|
|
|
1040
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1020
|
+
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)
|
|
1041
1021
|
|
|
1042
1022
|
Return an iterator of numeric indices (Array-compatible).
|
|
1043
1023
|
|
|
@@ -1064,7 +1044,7 @@ map<EM, RM>(
|
|
|
1064
1044
|
thisArg?): Heap<EM, RM>;
|
|
1065
1045
|
```
|
|
1066
1046
|
|
|
1067
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1047
|
+
Defined in: [data-structures/heap/heap.ts:694](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L694)
|
|
1068
1048
|
|
|
1069
1049
|
Map elements into a new heap of possibly different element type.
|
|
1070
1050
|
|
|
@@ -1104,8 +1084,6 @@ Value for `this` inside the callback.
|
|
|
1104
1084
|
|
|
1105
1085
|
A new heap with mapped elements.
|
|
1106
1086
|
|
|
1107
|
-
*
|
|
1108
|
-
|
|
1109
1087
|
#### Remarks
|
|
1110
1088
|
|
|
1111
1089
|
Time O(N log N), Space O(N)
|
|
@@ -1131,7 +1109,7 @@ Time O(N log N), Space O(N)
|
|
|
1131
1109
|
mapSame(callback, thisArg?): this;
|
|
1132
1110
|
```
|
|
1133
1111
|
|
|
1134
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1112
|
+
Defined in: [data-structures/heap/heap.ts:717](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L717)
|
|
1135
1113
|
|
|
1136
1114
|
Map elements into a new heap of the same element type.
|
|
1137
1115
|
|
|
@@ -1171,7 +1149,7 @@ Time O(N log N), Space O(N)
|
|
|
1171
1149
|
peek(): E | undefined;
|
|
1172
1150
|
```
|
|
1173
1151
|
|
|
1174
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1152
|
+
Defined in: [data-structures/heap/heap.ts:440](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L440)
|
|
1175
1153
|
|
|
1176
1154
|
Get the current top element without removing it.
|
|
1177
1155
|
|
|
@@ -1181,8 +1159,6 @@ Get the current top element without removing it.
|
|
|
1181
1159
|
|
|
1182
1160
|
Top element or undefined.
|
|
1183
1161
|
|
|
1184
|
-
*
|
|
1185
|
-
|
|
1186
1162
|
#### Remarks
|
|
1187
1163
|
|
|
1188
1164
|
Time O(1), Space O(1)
|
|
@@ -1262,7 +1238,7 @@ Time O(1), Space O(1)
|
|
|
1262
1238
|
poll(): E | undefined;
|
|
1263
1239
|
```
|
|
1264
1240
|
|
|
1265
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1241
|
+
Defined in: [data-structures/heap/heap.ts:356](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L356)
|
|
1266
1242
|
|
|
1267
1243
|
#### Returns
|
|
1268
1244
|
|
|
@@ -1272,8 +1248,6 @@ Defined in: [data-structures/heap/heap.ts:523](https://github.com/zrwusa/data-st
|
|
|
1272
1248
|
|
|
1273
1249
|
Use `pop` instead. Will be removed in a future major version.
|
|
1274
1250
|
|
|
1275
|
-
*
|
|
1276
|
-
|
|
1277
1251
|
#### Example
|
|
1278
1252
|
|
|
1279
1253
|
```ts
|
|
@@ -1315,7 +1289,7 @@ Use `pop` instead. Will be removed in a future major version.
|
|
|
1315
1289
|
pop(): E | undefined;
|
|
1316
1290
|
```
|
|
1317
1291
|
|
|
1318
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1292
|
+
Defined in: [data-structures/heap/heap.ts:365](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L365)
|
|
1319
1293
|
|
|
1320
1294
|
Remove and return the top element (min or max depending on comparator).
|
|
1321
1295
|
|
|
@@ -1341,7 +1315,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
1341
1315
|
print(): void;
|
|
1342
1316
|
```
|
|
1343
1317
|
|
|
1344
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1318
|
+
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)
|
|
1345
1319
|
|
|
1346
1320
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1347
1321
|
|
|
@@ -1399,7 +1373,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1399
1373
|
reduce(callbackfn): E;
|
|
1400
1374
|
```
|
|
1401
1375
|
|
|
1402
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1376
|
+
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)
|
|
1403
1377
|
|
|
1404
1378
|
##### Parameters
|
|
1405
1379
|
|
|
@@ -1421,7 +1395,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1421
1395
|
reduce(callbackfn, initialValue): E;
|
|
1422
1396
|
```
|
|
1423
1397
|
|
|
1424
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1398
|
+
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)
|
|
1425
1399
|
|
|
1426
1400
|
##### Parameters
|
|
1427
1401
|
|
|
@@ -1447,7 +1421,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1447
1421
|
reduce<U>(callbackfn, initialValue): U;
|
|
1448
1422
|
```
|
|
1449
1423
|
|
|
1450
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1424
|
+
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)
|
|
1451
1425
|
|
|
1452
1426
|
##### Type Parameters
|
|
1453
1427
|
|
|
@@ -1481,7 +1455,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
1481
1455
|
setEquality(equals): this;
|
|
1482
1456
|
```
|
|
1483
1457
|
|
|
1484
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1458
|
+
Defined in: [data-structures/heap/heap.ts:561](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L561)
|
|
1485
1459
|
|
|
1486
1460
|
Set the equality comparator used by has/delete operations.
|
|
1487
1461
|
|
|
@@ -1555,7 +1529,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1555
1529
|
sort(): E[];
|
|
1556
1530
|
```
|
|
1557
1531
|
|
|
1558
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1532
|
+
Defined in: [data-structures/heap/heap.ts:625](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L625)
|
|
1559
1533
|
|
|
1560
1534
|
Return all elements in ascending order by repeatedly polling.
|
|
1561
1535
|
|
|
@@ -1565,8 +1539,6 @@ Return all elements in ascending order by repeatedly polling.
|
|
|
1565
1539
|
|
|
1566
1540
|
Sorted array of elements.
|
|
1567
1541
|
|
|
1568
|
-
*
|
|
1569
|
-
|
|
1570
1542
|
#### Remarks
|
|
1571
1543
|
|
|
1572
1544
|
Time O(N log N), Space O(N)
|
|
@@ -1592,7 +1564,7 @@ Time O(N log N), Space O(N)
|
|
|
1592
1564
|
toArray(): E[];
|
|
1593
1565
|
```
|
|
1594
1566
|
|
|
1595
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1567
|
+
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)
|
|
1596
1568
|
|
|
1597
1569
|
Materializes the elements into a new array.
|
|
1598
1570
|
|
|
@@ -1618,7 +1590,7 @@ Time O(n), Space O(n).
|
|
|
1618
1590
|
toVisual(): E[];
|
|
1619
1591
|
```
|
|
1620
1592
|
|
|
1621
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1593
|
+
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)
|
|
1622
1594
|
|
|
1623
1595
|
Returns a representation of the structure suitable for quick visualization.
|
|
1624
1596
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1674,7 +1646,7 @@ static from<T, R, S>(
|
|
|
1674
1646
|
options?): S;
|
|
1675
1647
|
```
|
|
1676
1648
|
|
|
1677
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1649
|
+
Defined in: [data-structures/heap/heap.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L225)
|
|
1678
1650
|
|
|
1679
1651
|
Create a heap of the same class from an iterable.
|
|
1680
1652
|
|
|
@@ -1732,7 +1704,7 @@ Time O(N), Space O(N)
|
|
|
1732
1704
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1733
1705
|
```
|
|
1734
1706
|
|
|
1735
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1707
|
+
Defined in: [data-structures/heap/heap.ts:242](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L242)
|
|
1736
1708
|
|
|
1737
1709
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1738
1710
|
|
|
@@ -1815,7 +1787,7 @@ Time O(1), Space O(1).
|
|
|
1815
1787
|
protected _createInstance(options?): this;
|
|
1816
1788
|
```
|
|
1817
1789
|
|
|
1818
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1790
|
+
Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L779)
|
|
1819
1791
|
|
|
1820
1792
|
(Protected) Create an empty instance of the same concrete class.
|
|
1821
1793
|
|
|
@@ -1849,7 +1821,7 @@ Time O(1), Space O(1)
|
|
|
1849
1821
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1850
1822
|
```
|
|
1851
1823
|
|
|
1852
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1824
|
+
Defined in: [data-structures/heap/heap.ts:793](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L793)
|
|
1853
1825
|
|
|
1854
1826
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1855
1827
|
|
|
@@ -1899,7 +1871,7 @@ Time O(N log N), Space O(N)
|
|
|
1899
1871
|
protected _getIterator(): IterableIterator<E>;
|
|
1900
1872
|
```
|
|
1901
1873
|
|
|
1902
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1874
|
+
Defined in: [data-structures/heap/heap.ts:738](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L738)
|
|
1903
1875
|
|
|
1904
1876
|
Internal iterator factory used by the default iterator.
|
|
1905
1877
|
|
|
@@ -1925,7 +1897,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1925
1897
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1926
1898
|
```
|
|
1927
1899
|
|
|
1928
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1900
|
+
Defined in: [data-structures/heap/heap.ts:812](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L812)
|
|
1929
1901
|
|
|
1930
1902
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1931
1903
|
|