data-structure-typed 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +7 -2
- package/.github/workflows/release-package.yml +9 -2
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +108 -108
- package/docs-site-docusaurus/docs/api/classes/BST.md +101 -101
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +66 -66
- package/docs-site-docusaurus/docs/api/classes/Deque.md +235 -51
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +21 -21
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +231 -67
- 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 +14 -14
- package/docs-site-docusaurus/docs/api/classes/Heap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +83 -13
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +124 -20
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +140 -32
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +159 -51
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +20 -20
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/Queue.md +142 -34
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +117 -117
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +158 -50
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +21 -21
- package/docs-site-docusaurus/docs/api/classes/Stack.md +108 -26
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +75 -39
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +301 -39
- package/docs-site-docusaurus/docs/api/classes/Trie.md +110 -28
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +20 -20
- package/package.json +45 -46
- package/src/common/error.ts +15 -32
- package/src/common/index.ts +0 -3
- package/src/data-structures/base/iterable-element-base.ts +0 -3
- package/src/data-structures/base/linear-base.ts +2 -36
- package/src/data-structures/binary-tree/avl-tree.ts +31 -529
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -572
- package/src/data-structures/binary-tree/binary-tree.ts +326 -1311
- package/src/data-structures/binary-tree/bst.ts +158 -1082
- package/src/data-structures/binary-tree/red-black-tree.ts +451 -1290
- package/src/data-structures/binary-tree/segment-tree.ts +73 -351
- package/src/data-structures/binary-tree/tree-map.ts +462 -5124
- package/src/data-structures/binary-tree/tree-multi-map.ts +302 -4914
- package/src/data-structures/binary-tree/tree-multi-set.ts +284 -3972
- package/src/data-structures/binary-tree/tree-set.ts +338 -4836
- package/src/data-structures/graph/abstract-graph.ts +98 -167
- package/src/data-structures/graph/directed-graph.ts +137 -562
- package/src/data-structures/graph/map-graph.ts +0 -3
- package/src/data-structures/graph/undirected-graph.ts +132 -511
- package/src/data-structures/hash/hash-map.ts +154 -582
- package/src/data-structures/heap/heap.ts +200 -795
- package/src/data-structures/linked-list/doubly-linked-list.ts +121 -865
- package/src/data-structures/linked-list/singly-linked-list.ts +122 -794
- package/src/data-structures/linked-list/skip-linked-list.ts +211 -918
- package/src/data-structures/matrix/matrix.ts +179 -518
- package/src/data-structures/matrix/navigator.ts +0 -1
- package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
- package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
- package/src/data-structures/priority-queue/priority-queue.ts +1 -2
- package/src/data-structures/queue/deque.ts +214 -882
- package/src/data-structures/queue/queue.ts +102 -625
- package/src/data-structures/stack/stack.ts +76 -505
- package/src/data-structures/trie/trie.ts +98 -628
- package/src/types/common.ts +0 -10
- package/src/types/data-structures/binary-tree/bst.ts +0 -7
- package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
- package/src/types/data-structures/graph/abstract-graph.ts +0 -2
- package/src/types/data-structures/hash/hash-map.ts +0 -3
- package/src/types/data-structures/hash/index.ts +0 -1
- package/src/types/data-structures/matrix/navigator.ts +0 -2
- package/src/types/utils/utils.ts +0 -7
- package/src/types/utils/validate-type.ts +0 -7
- package/src/utils/number.ts +0 -2
- package/src/utils/utils.ts +0 -5
|
@@ -106,7 +106,7 @@ Defined in: [data-structures/priority-queue/priority-queue.ts:75](https://github
|
|
|
106
106
|
get comparator(): Comparator<E>;
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
109
|
+
Defined in: [data-structures/heap/heap.ts:1314](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1314)
|
|
110
110
|
|
|
111
111
|
Get the comparator used to order elements.
|
|
112
112
|
|
|
@@ -162,7 +162,7 @@ Internal elements array.
|
|
|
162
162
|
get leaf(): E | undefined;
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
165
|
+
Defined in: [data-structures/heap/heap.ts:251](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L251)
|
|
166
166
|
|
|
167
167
|
Get the last leaf element.
|
|
168
168
|
|
|
@@ -190,7 +190,7 @@ Last element or undefined.
|
|
|
190
190
|
get size(): number;
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
193
|
+
Defined in: [data-structures/heap/heap.ts:241](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L241)
|
|
194
194
|
|
|
195
195
|
Get the number of elements.
|
|
196
196
|
|
|
@@ -293,7 +293,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
293
293
|
add(element): boolean;
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
296
|
+
Defined in: [data-structures/heap/heap.ts:352](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L352)
|
|
297
297
|
|
|
298
298
|
Insert an element.
|
|
299
299
|
|
|
@@ -348,7 +348,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
348
348
|
addMany(elements): boolean[];
|
|
349
349
|
```
|
|
350
350
|
|
|
351
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
351
|
+
Defined in: [data-structures/heap/heap.ts:409](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L409)
|
|
352
352
|
|
|
353
353
|
Insert many elements from an iterable.
|
|
354
354
|
|
|
@@ -394,7 +394,7 @@ Time O(N log N), Space O(1)
|
|
|
394
394
|
clear(): void;
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
397
|
+
Defined in: [data-structures/heap/heap.ts:761](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L761)
|
|
398
398
|
|
|
399
399
|
Remove all elements.
|
|
400
400
|
|
|
@@ -431,7 +431,7 @@ Time O(1), Space O(1)
|
|
|
431
431
|
clone(): this;
|
|
432
432
|
```
|
|
433
433
|
|
|
434
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
434
|
+
Defined in: [data-structures/heap/heap.ts:1136](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1136)
|
|
435
435
|
|
|
436
436
|
Deep clone this heap.
|
|
437
437
|
|
|
@@ -470,7 +470,7 @@ Time O(N), Space O(N)
|
|
|
470
470
|
delete(element): boolean;
|
|
471
471
|
```
|
|
472
472
|
|
|
473
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
473
|
+
Defined in: [data-structures/heap/heap.ts:868](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L868)
|
|
474
474
|
|
|
475
475
|
Delete one occurrence of an element.
|
|
476
476
|
|
|
@@ -515,7 +515,7 @@ Time O(N), Space O(1)
|
|
|
515
515
|
deleteBy(predicate): boolean;
|
|
516
516
|
```
|
|
517
517
|
|
|
518
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
518
|
+
Defined in: [data-structures/heap/heap.ts:892](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L892)
|
|
519
519
|
|
|
520
520
|
#### Parameters
|
|
521
521
|
|
|
@@ -543,7 +543,7 @@ Use `deleteWhere` instead. Will be removed in a future major version.
|
|
|
543
543
|
deleteWhere(predicate): boolean;
|
|
544
544
|
```
|
|
545
545
|
|
|
546
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
546
|
+
Defined in: [data-structures/heap/heap.ts:902](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L902)
|
|
547
547
|
|
|
548
548
|
Delete the first element that matches a predicate.
|
|
549
549
|
|
|
@@ -577,7 +577,7 @@ Time O(N), Space O(1)
|
|
|
577
577
|
dfs(order?): E[];
|
|
578
578
|
```
|
|
579
579
|
|
|
580
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
580
|
+
Defined in: [data-structures/heap/heap.ts:980](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L980)
|
|
581
581
|
|
|
582
582
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
583
583
|
|
|
@@ -616,6 +616,30 @@ Time O(N), Space O(H)
|
|
|
616
616
|
|
|
617
617
|
***
|
|
618
618
|
|
|
619
|
+
### entries()
|
|
620
|
+
|
|
621
|
+
```ts
|
|
622
|
+
entries(): IterableIterator<[number, E]>;
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
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)
|
|
626
|
+
|
|
627
|
+
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
628
|
+
|
|
629
|
+
#### Returns
|
|
630
|
+
|
|
631
|
+
`IterableIterator`\<\[`number`, `E`\]\>
|
|
632
|
+
|
|
633
|
+
#### Remarks
|
|
634
|
+
|
|
635
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
636
|
+
|
|
637
|
+
#### Inherited from
|
|
638
|
+
|
|
639
|
+
[`Heap`](Heap.md).[`entries`](Heap.md#entries)
|
|
640
|
+
|
|
641
|
+
***
|
|
642
|
+
|
|
619
643
|
### every()
|
|
620
644
|
|
|
621
645
|
```ts
|
|
@@ -662,7 +686,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
662
686
|
filter(callback, thisArg?): this;
|
|
663
687
|
```
|
|
664
688
|
|
|
665
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
689
|
+
Defined in: [data-structures/heap/heap.ts:1195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1195)
|
|
666
690
|
|
|
667
691
|
Filter elements into a new heap of the same class.
|
|
668
692
|
|
|
@@ -803,7 +827,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
803
827
|
fix(): boolean[];
|
|
804
828
|
```
|
|
805
829
|
|
|
806
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
830
|
+
Defined in: [data-structures/heap/heap.ts:1011](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1011)
|
|
807
831
|
|
|
808
832
|
Restore heap order bottom-up (heapify in-place).
|
|
809
833
|
|
|
@@ -869,7 +893,7 @@ Time O(n), Space O(1).
|
|
|
869
893
|
has(element): boolean;
|
|
870
894
|
```
|
|
871
895
|
|
|
872
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
896
|
+
Defined in: [data-structures/heap/heap.ts:812](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L812)
|
|
873
897
|
|
|
874
898
|
Check if an equal element exists in the heap.
|
|
875
899
|
|
|
@@ -908,13 +932,47 @@ Time O(N), Space O(1)
|
|
|
908
932
|
|
|
909
933
|
***
|
|
910
934
|
|
|
935
|
+
### includes()
|
|
936
|
+
|
|
937
|
+
```ts
|
|
938
|
+
includes(element): boolean;
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
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)
|
|
942
|
+
|
|
943
|
+
Check whether a value exists (Array-compatible alias for `has`).
|
|
944
|
+
|
|
945
|
+
#### Parameters
|
|
946
|
+
|
|
947
|
+
##### element
|
|
948
|
+
|
|
949
|
+
`E`
|
|
950
|
+
|
|
951
|
+
Element to search for (uses `===`).
|
|
952
|
+
|
|
953
|
+
#### Returns
|
|
954
|
+
|
|
955
|
+
`boolean`
|
|
956
|
+
|
|
957
|
+
`true` if found.
|
|
958
|
+
|
|
959
|
+
#### Remarks
|
|
960
|
+
|
|
961
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
962
|
+
|
|
963
|
+
#### Inherited from
|
|
964
|
+
|
|
965
|
+
[`Heap`](Heap.md).[`includes`](Heap.md#includes)
|
|
966
|
+
|
|
967
|
+
***
|
|
968
|
+
|
|
911
969
|
### isEmpty()
|
|
912
970
|
|
|
913
971
|
```ts
|
|
914
972
|
isEmpty(): boolean;
|
|
915
973
|
```
|
|
916
974
|
|
|
917
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
975
|
+
Defined in: [data-structures/heap/heap.ts:706](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L706)
|
|
918
976
|
|
|
919
977
|
Check whether the heap is empty.
|
|
920
978
|
|
|
@@ -946,6 +1004,30 @@ Time O(1), Space O(1)
|
|
|
946
1004
|
|
|
947
1005
|
***
|
|
948
1006
|
|
|
1007
|
+
### keys()
|
|
1008
|
+
|
|
1009
|
+
```ts
|
|
1010
|
+
keys(): IterableIterator<number>;
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
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)
|
|
1014
|
+
|
|
1015
|
+
Return an iterator of numeric indices (Array-compatible).
|
|
1016
|
+
|
|
1017
|
+
#### Returns
|
|
1018
|
+
|
|
1019
|
+
`IterableIterator`\<`number`\>
|
|
1020
|
+
|
|
1021
|
+
#### Remarks
|
|
1022
|
+
|
|
1023
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
1024
|
+
|
|
1025
|
+
#### Inherited from
|
|
1026
|
+
|
|
1027
|
+
[`Heap`](Heap.md).[`keys`](Heap.md#keys)
|
|
1028
|
+
|
|
1029
|
+
***
|
|
1030
|
+
|
|
949
1031
|
### map()
|
|
950
1032
|
|
|
951
1033
|
```ts
|
|
@@ -955,7 +1037,7 @@ map<EM, RM>(
|
|
|
955
1037
|
thisArg?): Heap<EM, RM>;
|
|
956
1038
|
```
|
|
957
1039
|
|
|
958
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1040
|
+
Defined in: [data-structures/heap/heap.ts:1263](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1263)
|
|
959
1041
|
|
|
960
1042
|
Map elements into a new heap of possibly different element type.
|
|
961
1043
|
|
|
@@ -1022,7 +1104,7 @@ Time O(N log N), Space O(N)
|
|
|
1022
1104
|
mapSame(callback, thisArg?): this;
|
|
1023
1105
|
```
|
|
1024
1106
|
|
|
1025
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1107
|
+
Defined in: [data-structures/heap/heap.ts:1287](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1287)
|
|
1026
1108
|
|
|
1027
1109
|
Map elements into a new heap of the same element type.
|
|
1028
1110
|
|
|
@@ -1062,7 +1144,7 @@ Time O(N log N), Space O(N)
|
|
|
1062
1144
|
peek(): E | undefined;
|
|
1063
1145
|
```
|
|
1064
1146
|
|
|
1065
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1147
|
+
Defined in: [data-structures/heap/heap.ts:650](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L650)
|
|
1066
1148
|
|
|
1067
1149
|
Get the current top element without removing it.
|
|
1068
1150
|
|
|
@@ -1153,7 +1235,7 @@ Time O(1), Space O(1)
|
|
|
1153
1235
|
poll(): E | undefined;
|
|
1154
1236
|
```
|
|
1155
1237
|
|
|
1156
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1238
|
+
Defined in: [data-structures/heap/heap.ts:523](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L523)
|
|
1157
1239
|
|
|
1158
1240
|
#### Returns
|
|
1159
1241
|
|
|
@@ -1162,6 +1244,7 @@ Defined in: [data-structures/heap/heap.ts:511](https://github.com/zrwusa/data-st
|
|
|
1162
1244
|
#### Deprecated
|
|
1163
1245
|
|
|
1164
1246
|
Use `pop` instead. Will be removed in a future major version.
|
|
1247
|
+
|
|
1165
1248
|
*
|
|
1166
1249
|
|
|
1167
1250
|
#### Example
|
|
@@ -1205,7 +1288,7 @@ Use `pop` instead. Will be removed in a future major version.
|
|
|
1205
1288
|
pop(): E | undefined;
|
|
1206
1289
|
```
|
|
1207
1290
|
|
|
1208
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1291
|
+
Defined in: [data-structures/heap/heap.ts:532](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L532)
|
|
1209
1292
|
|
|
1210
1293
|
Remove and return the top element (min or max depending on comparator).
|
|
1211
1294
|
|
|
@@ -1231,7 +1314,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
1231
1314
|
print(): void;
|
|
1232
1315
|
```
|
|
1233
1316
|
|
|
1234
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1317
|
+
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)
|
|
1235
1318
|
|
|
1236
1319
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1237
1320
|
|
|
@@ -1289,7 +1372,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1289
1372
|
reduce(callbackfn): E;
|
|
1290
1373
|
```
|
|
1291
1374
|
|
|
1292
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1375
|
+
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)
|
|
1293
1376
|
|
|
1294
1377
|
##### Parameters
|
|
1295
1378
|
|
|
@@ -1311,7 +1394,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1311
1394
|
reduce(callbackfn, initialValue): E;
|
|
1312
1395
|
```
|
|
1313
1396
|
|
|
1314
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1397
|
+
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)
|
|
1315
1398
|
|
|
1316
1399
|
##### Parameters
|
|
1317
1400
|
|
|
@@ -1337,7 +1420,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1337
1420
|
reduce<U>(callbackfn, initialValue): U;
|
|
1338
1421
|
```
|
|
1339
1422
|
|
|
1340
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1423
|
+
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)
|
|
1341
1424
|
|
|
1342
1425
|
##### Type Parameters
|
|
1343
1426
|
|
|
@@ -1371,7 +1454,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1371
1454
|
setEquality(equals): this;
|
|
1372
1455
|
```
|
|
1373
1456
|
|
|
1374
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1457
|
+
Defined in: [data-structures/heap/heap.ts:930](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L930)
|
|
1375
1458
|
|
|
1376
1459
|
Set the equality comparator used by has/delete operations.
|
|
1377
1460
|
|
|
@@ -1445,7 +1528,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1445
1528
|
sort(): E[];
|
|
1446
1529
|
```
|
|
1447
1530
|
|
|
1448
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1531
|
+
Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1072)
|
|
1449
1532
|
|
|
1450
1533
|
Return all elements in ascending order by repeatedly polling.
|
|
1451
1534
|
|
|
@@ -1482,7 +1565,7 @@ Time O(N log N), Space O(N)
|
|
|
1482
1565
|
toArray(): E[];
|
|
1483
1566
|
```
|
|
1484
1567
|
|
|
1485
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1568
|
+
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)
|
|
1486
1569
|
|
|
1487
1570
|
Materializes the elements into a new array.
|
|
1488
1571
|
|
|
@@ -1508,7 +1591,7 @@ Time O(n), Space O(n).
|
|
|
1508
1591
|
toVisual(): E[];
|
|
1509
1592
|
```
|
|
1510
1593
|
|
|
1511
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1594
|
+
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)
|
|
1512
1595
|
|
|
1513
1596
|
Returns a representation of the structure suitable for quick visualization.
|
|
1514
1597
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1564,7 +1647,7 @@ static from<T, R, S>(
|
|
|
1564
1647
|
options?): S;
|
|
1565
1648
|
```
|
|
1566
1649
|
|
|
1567
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1650
|
+
Defined in: [data-structures/heap/heap.ts:266](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L266)
|
|
1568
1651
|
|
|
1569
1652
|
Create a heap of the same class from an iterable.
|
|
1570
1653
|
|
|
@@ -1622,7 +1705,7 @@ Time O(N), Space O(N)
|
|
|
1622
1705
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1623
1706
|
```
|
|
1624
1707
|
|
|
1625
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1708
|
+
Defined in: [data-structures/heap/heap.ts:284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L284)
|
|
1626
1709
|
|
|
1627
1710
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1628
1711
|
|
|
@@ -1705,7 +1788,7 @@ Time O(1), Space O(1).
|
|
|
1705
1788
|
protected _createInstance(options?): this;
|
|
1706
1789
|
```
|
|
1707
1790
|
|
|
1708
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1791
|
+
Defined in: [data-structures/heap/heap.ts:1360](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1360)
|
|
1709
1792
|
|
|
1710
1793
|
(Protected) Create an empty instance of the same concrete class.
|
|
1711
1794
|
|
|
@@ -1739,7 +1822,7 @@ Time O(1), Space O(1)
|
|
|
1739
1822
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1740
1823
|
```
|
|
1741
1824
|
|
|
1742
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1825
|
+
Defined in: [data-structures/heap/heap.ts:1378](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1378)
|
|
1743
1826
|
|
|
1744
1827
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1745
1828
|
|
|
@@ -1789,7 +1872,7 @@ Time O(N log N), Space O(N)
|
|
|
1789
1872
|
protected _getIterator(): IterableIterator<E>;
|
|
1790
1873
|
```
|
|
1791
1874
|
|
|
1792
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1875
|
+
Defined in: [data-structures/heap/heap.ts:1318](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1318)
|
|
1793
1876
|
|
|
1794
1877
|
Internal iterator factory used by the default iterator.
|
|
1795
1878
|
|
|
@@ -1815,7 +1898,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1815
1898
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1816
1899
|
```
|
|
1817
1900
|
|
|
1818
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1901
|
+
Defined in: [data-structures/heap/heap.ts:1398](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/heap/heap.ts#L1398)
|
|
1819
1902
|
|
|
1820
1903
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1821
1904
|
|