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
|
@@ -149,7 +149,7 @@ PriorityQueue<E, R>.constructor
|
|
|
149
149
|
get comparator(): Comparator<E>;
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
153
153
|
|
|
154
154
|
Get the comparator used to order elements.
|
|
155
155
|
|
|
@@ -205,7 +205,7 @@ Internal elements array.
|
|
|
205
205
|
get leaf(): E | undefined;
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
209
209
|
|
|
210
210
|
Get the last leaf element.
|
|
211
211
|
|
|
@@ -233,7 +233,7 @@ Last element or undefined.
|
|
|
233
233
|
get size(): number;
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
237
237
|
|
|
238
238
|
Get the number of elements.
|
|
239
239
|
|
|
@@ -336,7 +336,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
336
336
|
add(element): boolean;
|
|
337
337
|
```
|
|
338
338
|
|
|
339
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
340
340
|
|
|
341
341
|
Insert an element.
|
|
342
342
|
|
|
@@ -391,7 +391,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
391
391
|
addMany(elements): boolean[];
|
|
392
392
|
```
|
|
393
393
|
|
|
394
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
395
395
|
|
|
396
396
|
Insert many elements from an iterable.
|
|
397
397
|
|
|
@@ -437,7 +437,7 @@ Time O(N log N), Space O(1)
|
|
|
437
437
|
clear(): void;
|
|
438
438
|
```
|
|
439
439
|
|
|
440
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
441
441
|
|
|
442
442
|
Remove all elements.
|
|
443
443
|
|
|
@@ -474,7 +474,7 @@ Time O(1), Space O(1)
|
|
|
474
474
|
clone(): this;
|
|
475
475
|
```
|
|
476
476
|
|
|
477
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
478
478
|
|
|
479
479
|
Deep clone this heap.
|
|
480
480
|
|
|
@@ -513,7 +513,7 @@ Time O(N), Space O(N)
|
|
|
513
513
|
delete(element): boolean;
|
|
514
514
|
```
|
|
515
515
|
|
|
516
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
517
517
|
|
|
518
518
|
Delete one occurrence of an element.
|
|
519
519
|
|
|
@@ -558,7 +558,7 @@ Time O(N), Space O(1)
|
|
|
558
558
|
deleteBy(predicate): boolean;
|
|
559
559
|
```
|
|
560
560
|
|
|
561
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
562
562
|
|
|
563
563
|
#### Parameters
|
|
564
564
|
|
|
@@ -586,7 +586,7 @@ Use `deleteWhere` instead. Will be removed in a future major version.
|
|
|
586
586
|
deleteWhere(predicate): boolean;
|
|
587
587
|
```
|
|
588
588
|
|
|
589
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
590
590
|
|
|
591
591
|
Delete the first element that matches a predicate.
|
|
592
592
|
|
|
@@ -620,7 +620,7 @@ Time O(N), Space O(1)
|
|
|
620
620
|
dfs(order?): E[];
|
|
621
621
|
```
|
|
622
622
|
|
|
623
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
624
624
|
|
|
625
625
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
626
626
|
|
|
@@ -659,6 +659,30 @@ Time O(N), Space O(H)
|
|
|
659
659
|
|
|
660
660
|
***
|
|
661
661
|
|
|
662
|
+
### entries()
|
|
663
|
+
|
|
664
|
+
```ts
|
|
665
|
+
entries(): IterableIterator<[number, E]>;
|
|
666
|
+
```
|
|
667
|
+
|
|
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)
|
|
669
|
+
|
|
670
|
+
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
671
|
+
|
|
672
|
+
#### Returns
|
|
673
|
+
|
|
674
|
+
`IterableIterator`\<\[`number`, `E`\]\>
|
|
675
|
+
|
|
676
|
+
#### Remarks
|
|
677
|
+
|
|
678
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
679
|
+
|
|
680
|
+
#### Inherited from
|
|
681
|
+
|
|
682
|
+
[`PriorityQueue`](PriorityQueue.md).[`entries`](PriorityQueue.md#entries)
|
|
683
|
+
|
|
684
|
+
***
|
|
685
|
+
|
|
662
686
|
### every()
|
|
663
687
|
|
|
664
688
|
```ts
|
|
@@ -705,7 +729,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
705
729
|
filter(callback, thisArg?): this;
|
|
706
730
|
```
|
|
707
731
|
|
|
708
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
709
733
|
|
|
710
734
|
Filter elements into a new heap of the same class.
|
|
711
735
|
|
|
@@ -846,7 +870,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
846
870
|
fix(): boolean[];
|
|
847
871
|
```
|
|
848
872
|
|
|
849
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
850
874
|
|
|
851
875
|
Restore heap order bottom-up (heapify in-place).
|
|
852
876
|
|
|
@@ -912,7 +936,7 @@ Time O(n), Space O(1).
|
|
|
912
936
|
has(element): boolean;
|
|
913
937
|
```
|
|
914
938
|
|
|
915
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
916
940
|
|
|
917
941
|
Check if an equal element exists in the heap.
|
|
918
942
|
|
|
@@ -951,13 +975,47 @@ Time O(N), Space O(1)
|
|
|
951
975
|
|
|
952
976
|
***
|
|
953
977
|
|
|
978
|
+
### includes()
|
|
979
|
+
|
|
980
|
+
```ts
|
|
981
|
+
includes(element): boolean;
|
|
982
|
+
```
|
|
983
|
+
|
|
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)
|
|
985
|
+
|
|
986
|
+
Check whether a value exists (Array-compatible alias for `has`).
|
|
987
|
+
|
|
988
|
+
#### Parameters
|
|
989
|
+
|
|
990
|
+
##### element
|
|
991
|
+
|
|
992
|
+
`E`
|
|
993
|
+
|
|
994
|
+
Element to search for (uses `===`).
|
|
995
|
+
|
|
996
|
+
#### Returns
|
|
997
|
+
|
|
998
|
+
`boolean`
|
|
999
|
+
|
|
1000
|
+
`true` if found.
|
|
1001
|
+
|
|
1002
|
+
#### Remarks
|
|
1003
|
+
|
|
1004
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
1005
|
+
|
|
1006
|
+
#### Inherited from
|
|
1007
|
+
|
|
1008
|
+
[`PriorityQueue`](PriorityQueue.md).[`includes`](PriorityQueue.md#includes)
|
|
1009
|
+
|
|
1010
|
+
***
|
|
1011
|
+
|
|
954
1012
|
### isEmpty()
|
|
955
1013
|
|
|
956
1014
|
```ts
|
|
957
1015
|
isEmpty(): boolean;
|
|
958
1016
|
```
|
|
959
1017
|
|
|
960
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
961
1019
|
|
|
962
1020
|
Check whether the heap is empty.
|
|
963
1021
|
|
|
@@ -989,6 +1047,30 @@ Time O(1), Space O(1)
|
|
|
989
1047
|
|
|
990
1048
|
***
|
|
991
1049
|
|
|
1050
|
+
### keys()
|
|
1051
|
+
|
|
1052
|
+
```ts
|
|
1053
|
+
keys(): IterableIterator<number>;
|
|
1054
|
+
```
|
|
1055
|
+
|
|
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)
|
|
1057
|
+
|
|
1058
|
+
Return an iterator of numeric indices (Array-compatible).
|
|
1059
|
+
|
|
1060
|
+
#### Returns
|
|
1061
|
+
|
|
1062
|
+
`IterableIterator`\<`number`\>
|
|
1063
|
+
|
|
1064
|
+
#### Remarks
|
|
1065
|
+
|
|
1066
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
1067
|
+
|
|
1068
|
+
#### Inherited from
|
|
1069
|
+
|
|
1070
|
+
[`PriorityQueue`](PriorityQueue.md).[`keys`](PriorityQueue.md#keys)
|
|
1071
|
+
|
|
1072
|
+
***
|
|
1073
|
+
|
|
992
1074
|
### map()
|
|
993
1075
|
|
|
994
1076
|
```ts
|
|
@@ -998,7 +1080,7 @@ map<EM, RM>(
|
|
|
998
1080
|
thisArg?): Heap<EM, RM>;
|
|
999
1081
|
```
|
|
1000
1082
|
|
|
1001
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1002
1084
|
|
|
1003
1085
|
Map elements into a new heap of possibly different element type.
|
|
1004
1086
|
|
|
@@ -1065,7 +1147,7 @@ Time O(N log N), Space O(N)
|
|
|
1065
1147
|
mapSame(callback, thisArg?): this;
|
|
1066
1148
|
```
|
|
1067
1149
|
|
|
1068
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1069
1151
|
|
|
1070
1152
|
Map elements into a new heap of the same element type.
|
|
1071
1153
|
|
|
@@ -1105,7 +1187,7 @@ Time O(N log N), Space O(N)
|
|
|
1105
1187
|
peek(): E | undefined;
|
|
1106
1188
|
```
|
|
1107
1189
|
|
|
1108
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1109
1191
|
|
|
1110
1192
|
Get the current top element without removing it.
|
|
1111
1193
|
|
|
@@ -1196,7 +1278,7 @@ Time O(1), Space O(1)
|
|
|
1196
1278
|
poll(): E | undefined;
|
|
1197
1279
|
```
|
|
1198
1280
|
|
|
1199
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1200
1282
|
|
|
1201
1283
|
#### Returns
|
|
1202
1284
|
|
|
@@ -1205,6 +1287,7 @@ Defined in: [data-structures/heap/heap.ts:511](https://github.com/zrwusa/data-st
|
|
|
1205
1287
|
#### Deprecated
|
|
1206
1288
|
|
|
1207
1289
|
Use `pop` instead. Will be removed in a future major version.
|
|
1290
|
+
|
|
1208
1291
|
*
|
|
1209
1292
|
|
|
1210
1293
|
#### Example
|
|
@@ -1248,7 +1331,7 @@ Use `pop` instead. Will be removed in a future major version.
|
|
|
1248
1331
|
pop(): E | undefined;
|
|
1249
1332
|
```
|
|
1250
1333
|
|
|
1251
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1252
1335
|
|
|
1253
1336
|
Remove and return the top element (min or max depending on comparator).
|
|
1254
1337
|
|
|
@@ -1274,7 +1357,7 @@ Time O(log N) amortized, Space O(1)
|
|
|
1274
1357
|
print(): void;
|
|
1275
1358
|
```
|
|
1276
1359
|
|
|
1277
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
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)
|
|
1278
1361
|
|
|
1279
1362
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1280
1363
|
|
|
@@ -1332,7 +1415,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1332
1415
|
reduce(callbackfn): E;
|
|
1333
1416
|
```
|
|
1334
1417
|
|
|
1335
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
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)
|
|
1336
1419
|
|
|
1337
1420
|
##### Parameters
|
|
1338
1421
|
|
|
@@ -1354,7 +1437,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1354
1437
|
reduce(callbackfn, initialValue): E;
|
|
1355
1438
|
```
|
|
1356
1439
|
|
|
1357
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
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)
|
|
1358
1441
|
|
|
1359
1442
|
##### Parameters
|
|
1360
1443
|
|
|
@@ -1380,7 +1463,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1380
1463
|
reduce<U>(callbackfn, initialValue): U;
|
|
1381
1464
|
```
|
|
1382
1465
|
|
|
1383
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
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)
|
|
1384
1467
|
|
|
1385
1468
|
##### Type Parameters
|
|
1386
1469
|
|
|
@@ -1414,7 +1497,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1414
1497
|
setEquality(equals): this;
|
|
1415
1498
|
```
|
|
1416
1499
|
|
|
1417
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1418
1501
|
|
|
1419
1502
|
Set the equality comparator used by has/delete operations.
|
|
1420
1503
|
|
|
@@ -1488,7 +1571,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1488
1571
|
sort(): E[];
|
|
1489
1572
|
```
|
|
1490
1573
|
|
|
1491
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1492
1575
|
|
|
1493
1576
|
Return all elements in ascending order by repeatedly polling.
|
|
1494
1577
|
|
|
@@ -1525,7 +1608,7 @@ Time O(N log N), Space O(N)
|
|
|
1525
1608
|
toArray(): E[];
|
|
1526
1609
|
```
|
|
1527
1610
|
|
|
1528
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
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)
|
|
1529
1612
|
|
|
1530
1613
|
Materializes the elements into a new array.
|
|
1531
1614
|
|
|
@@ -1551,7 +1634,7 @@ Time O(n), Space O(n).
|
|
|
1551
1634
|
toVisual(): E[];
|
|
1552
1635
|
```
|
|
1553
1636
|
|
|
1554
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
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)
|
|
1555
1638
|
|
|
1556
1639
|
Returns a representation of the structure suitable for quick visualization.
|
|
1557
1640
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1607,7 +1690,7 @@ static from<T, R, S>(
|
|
|
1607
1690
|
options?): S;
|
|
1608
1691
|
```
|
|
1609
1692
|
|
|
1610
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1611
1694
|
|
|
1612
1695
|
Create a heap of the same class from an iterable.
|
|
1613
1696
|
|
|
@@ -1665,7 +1748,7 @@ Time O(N), Space O(N)
|
|
|
1665
1748
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1666
1749
|
```
|
|
1667
1750
|
|
|
1668
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1669
1752
|
|
|
1670
1753
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1671
1754
|
|
|
@@ -1748,7 +1831,7 @@ Time O(1), Space O(1).
|
|
|
1748
1831
|
protected _createInstance(options?): this;
|
|
1749
1832
|
```
|
|
1750
1833
|
|
|
1751
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1752
1835
|
|
|
1753
1836
|
(Protected) Create an empty instance of the same concrete class.
|
|
1754
1837
|
|
|
@@ -1782,7 +1865,7 @@ Time O(1), Space O(1)
|
|
|
1782
1865
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1783
1866
|
```
|
|
1784
1867
|
|
|
1785
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1786
1869
|
|
|
1787
1870
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1788
1871
|
|
|
@@ -1832,7 +1915,7 @@ Time O(N log N), Space O(N)
|
|
|
1832
1915
|
protected _getIterator(): IterableIterator<E>;
|
|
1833
1916
|
```
|
|
1834
1917
|
|
|
1835
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1836
1919
|
|
|
1837
1920
|
Internal iterator factory used by the default iterator.
|
|
1838
1921
|
|
|
@@ -1858,7 +1941,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1858
1941
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1859
1942
|
```
|
|
1860
1943
|
|
|
1861
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
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)
|
|
1862
1945
|
|
|
1863
1946
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1864
1947
|
|