data-structure-typed 2.5.1 → 2.5.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 +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- 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 +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: MaxHeap\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/heap/max-heap.ts:73](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/heap/max-heap.ts:73](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/max-heap.ts#L73)
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
@@ -97,7 +97,7 @@ Notes and typical use-cases are documented in [Heap](Heap.md).
|
|
|
97
97
|
new MaxHeap<E, R>(elements?, options?): MaxHeap<E, R>;
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
Defined in: [data-structures/heap/max-heap.ts:79](https://github.com/zrwusa/data-structure-typed/blob/
|
|
100
|
+
Defined in: [data-structures/heap/max-heap.ts:79](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/max-heap.ts#L79)
|
|
101
101
|
|
|
102
102
|
Create a max-heap. For objects, supply a custom comparator.
|
|
103
103
|
|
|
@@ -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:1184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1184)
|
|
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:180](https://github.com/zrwusa/data-structure-typed/blob/
|
|
164
|
+
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L180)
|
|
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:244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L244)
|
|
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:234](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L234)
|
|
221
221
|
|
|
222
222
|
Get the number of elements.
|
|
223
223
|
|
|
@@ -260,7 +260,7 @@ Heap size.
|
|
|
260
260
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
263
|
+
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L48)
|
|
264
264
|
|
|
265
265
|
Exposes the current `toElementFn`, if configured.
|
|
266
266
|
|
|
@@ -286,7 +286,7 @@ The converter function or `undefined` when not set.
|
|
|
286
286
|
iterator: IterableIterator<E>;
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
289
|
+
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L61)
|
|
290
290
|
|
|
291
291
|
Returns an iterator over the structure's elements.
|
|
292
292
|
|
|
@@ -320,7 +320,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
320
320
|
add(element): boolean;
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
323
|
+
Defined in: [data-structures/heap/heap.ts:338](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L338)
|
|
324
324
|
|
|
325
325
|
Insert an element.
|
|
326
326
|
|
|
@@ -375,7 +375,7 @@ Time O(1) amortized, Space O(1)
|
|
|
375
375
|
addMany(elements): boolean[];
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
378
|
+
Defined in: [data-structures/heap/heap.ts:388](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L388)
|
|
379
379
|
|
|
380
380
|
Insert many elements from an iterable.
|
|
381
381
|
|
|
@@ -421,7 +421,7 @@ Time O(N log N), Space O(1)
|
|
|
421
421
|
clear(): void;
|
|
422
422
|
```
|
|
423
423
|
|
|
424
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
424
|
+
Defined in: [data-structures/heap/heap.ts:676](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L676)
|
|
425
425
|
|
|
426
426
|
Remove all elements.
|
|
427
427
|
|
|
@@ -458,7 +458,7 @@ Time O(1), Space O(1)
|
|
|
458
458
|
clone(): this;
|
|
459
459
|
```
|
|
460
460
|
|
|
461
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
461
|
+
Defined in: [data-structures/heap/heap.ts:1020](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1020)
|
|
462
462
|
|
|
463
463
|
Deep clone this heap.
|
|
464
464
|
|
|
@@ -497,7 +497,7 @@ Time O(N), Space O(N)
|
|
|
497
497
|
delete(element): boolean;
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
500
|
+
Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L779)
|
|
501
501
|
|
|
502
502
|
Delete one occurrence of an element.
|
|
503
503
|
|
|
@@ -542,7 +542,7 @@ Time O(N), Space O(1)
|
|
|
542
542
|
deleteBy(predicate): boolean;
|
|
543
543
|
```
|
|
544
544
|
|
|
545
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
545
|
+
Defined in: [data-structures/heap/heap.ts:807](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L807)
|
|
546
546
|
|
|
547
547
|
Delete the first element that matches a predicate.
|
|
548
548
|
|
|
@@ -576,7 +576,7 @@ Time O(N), Space O(1)
|
|
|
576
576
|
dfs(order?): E[];
|
|
577
577
|
```
|
|
578
578
|
|
|
579
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
579
|
+
Defined in: [data-structures/heap/heap.ts:878](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L878)
|
|
580
580
|
|
|
581
581
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
582
582
|
|
|
@@ -621,7 +621,7 @@ Time O(N), Space O(H)
|
|
|
621
621
|
every(predicate, thisArg?): boolean;
|
|
622
622
|
```
|
|
623
623
|
|
|
624
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
624
|
+
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L87)
|
|
625
625
|
|
|
626
626
|
Tests whether all elements satisfy the predicate.
|
|
627
627
|
|
|
@@ -661,7 +661,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
661
661
|
filter(callback, thisArg?): this;
|
|
662
662
|
```
|
|
663
663
|
|
|
664
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
664
|
+
Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1072)
|
|
665
665
|
|
|
666
666
|
Filter elements into a new heap of the same class.
|
|
667
667
|
|
|
@@ -714,7 +714,7 @@ Time O(N log N), Space O(N)
|
|
|
714
714
|
find<S>(predicate, thisArg?): S | undefined;
|
|
715
715
|
```
|
|
716
716
|
|
|
717
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
717
|
+
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L163)
|
|
718
718
|
|
|
719
719
|
Finds the first element that satisfies the predicate and returns it.
|
|
720
720
|
|
|
@@ -760,7 +760,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
760
760
|
find(predicate, thisArg?): E | undefined;
|
|
761
761
|
```
|
|
762
762
|
|
|
763
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
763
|
+
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L164)
|
|
764
764
|
|
|
765
765
|
Finds the first element that satisfies the predicate and returns it.
|
|
766
766
|
|
|
@@ -802,7 +802,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
802
802
|
fix(): boolean[];
|
|
803
803
|
```
|
|
804
804
|
|
|
805
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
805
|
+
Defined in: [data-structures/heap/heap.ts:909](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L909)
|
|
806
806
|
|
|
807
807
|
Restore heap order bottom-up (heapify in-place).
|
|
808
808
|
|
|
@@ -828,7 +828,7 @@ Time O(N), Space O(1)
|
|
|
828
828
|
forEach(callbackfn, thisArg?): void;
|
|
829
829
|
```
|
|
830
830
|
|
|
831
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
831
|
+
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L133)
|
|
832
832
|
|
|
833
833
|
Invokes a callback for each element in iteration order.
|
|
834
834
|
|
|
@@ -868,7 +868,7 @@ Time O(n), Space O(1).
|
|
|
868
868
|
has(element): boolean;
|
|
869
869
|
```
|
|
870
870
|
|
|
871
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
871
|
+
Defined in: [data-structures/heap/heap.ts:730](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L730)
|
|
872
872
|
|
|
873
873
|
Check if an equal element exists in the heap.
|
|
874
874
|
|
|
@@ -913,7 +913,7 @@ Time O(N), Space O(1)
|
|
|
913
913
|
isEmpty(): boolean;
|
|
914
914
|
```
|
|
915
915
|
|
|
916
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
916
|
+
Defined in: [data-structures/heap/heap.ts:628](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L628)
|
|
917
917
|
|
|
918
918
|
Check whether the heap is empty.
|
|
919
919
|
|
|
@@ -954,7 +954,7 @@ map<EM, RM>(
|
|
|
954
954
|
thisArg?): Heap<EM, RM>;
|
|
955
955
|
```
|
|
956
956
|
|
|
957
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
957
|
+
Defined in: [data-structures/heap/heap.ts:1133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1133)
|
|
958
958
|
|
|
959
959
|
Map elements into a new heap of possibly different element type.
|
|
960
960
|
|
|
@@ -1021,7 +1021,7 @@ Time O(N log N), Space O(N)
|
|
|
1021
1021
|
mapSame(callback, thisArg?): this;
|
|
1022
1022
|
```
|
|
1023
1023
|
|
|
1024
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1024
|
+
Defined in: [data-structures/heap/heap.ts:1157](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1157)
|
|
1025
1025
|
|
|
1026
1026
|
Map elements into a new heap of the same element type.
|
|
1027
1027
|
|
|
@@ -1061,7 +1061,7 @@ Time O(N log N), Space O(N)
|
|
|
1061
1061
|
peek(): E | undefined;
|
|
1062
1062
|
```
|
|
1063
1063
|
|
|
1064
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1064
|
+
Defined in: [data-structures/heap/heap.ts:579](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L579)
|
|
1065
1065
|
|
|
1066
1066
|
Get the current top element without removing it.
|
|
1067
1067
|
|
|
@@ -1152,7 +1152,7 @@ Time O(1), Space O(1)
|
|
|
1152
1152
|
poll(): E | undefined;
|
|
1153
1153
|
```
|
|
1154
1154
|
|
|
1155
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1155
|
+
Defined in: [data-structures/heap/heap.ts:468](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L468)
|
|
1156
1156
|
|
|
1157
1157
|
Remove and return the top element.
|
|
1158
1158
|
|
|
@@ -1209,7 +1209,7 @@ Time O(log N), Space O(1)
|
|
|
1209
1209
|
print(): void;
|
|
1210
1210
|
```
|
|
1211
1211
|
|
|
1212
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1212
|
+
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L269)
|
|
1213
1213
|
|
|
1214
1214
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1215
1215
|
|
|
@@ -1267,7 +1267,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1267
1267
|
reduce(callbackfn): E;
|
|
1268
1268
|
```
|
|
1269
1269
|
|
|
1270
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1270
|
+
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L194)
|
|
1271
1271
|
|
|
1272
1272
|
##### Parameters
|
|
1273
1273
|
|
|
@@ -1289,7 +1289,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
1289
1289
|
reduce(callbackfn, initialValue): E;
|
|
1290
1290
|
```
|
|
1291
1291
|
|
|
1292
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1292
|
+
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L195)
|
|
1293
1293
|
|
|
1294
1294
|
##### Parameters
|
|
1295
1295
|
|
|
@@ -1315,7 +1315,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1315
1315
|
reduce<U>(callbackfn, initialValue): U;
|
|
1316
1316
|
```
|
|
1317
1317
|
|
|
1318
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1318
|
+
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L196)
|
|
1319
1319
|
|
|
1320
1320
|
##### Type Parameters
|
|
1321
1321
|
|
|
@@ -1349,7 +1349,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1349
1349
|
refill(elements): boolean[];
|
|
1350
1350
|
```
|
|
1351
1351
|
|
|
1352
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1352
|
+
Defined in: [data-structures/heap/heap.ts:687](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L687)
|
|
1353
1353
|
|
|
1354
1354
|
Replace the backing array and rebuild the heap.
|
|
1355
1355
|
|
|
@@ -1383,7 +1383,7 @@ Time O(N), Space O(N)
|
|
|
1383
1383
|
setEquality(equals): this;
|
|
1384
1384
|
```
|
|
1385
1385
|
|
|
1386
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1386
|
+
Defined in: [data-structures/heap/heap.ts:835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L835)
|
|
1387
1387
|
|
|
1388
1388
|
Set the equality comparator used by has/delete operations.
|
|
1389
1389
|
|
|
@@ -1417,7 +1417,7 @@ Time O(1), Space O(1)
|
|
|
1417
1417
|
some(predicate, thisArg?): boolean;
|
|
1418
1418
|
```
|
|
1419
1419
|
|
|
1420
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1420
|
+
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L110)
|
|
1421
1421
|
|
|
1422
1422
|
Tests whether at least one element satisfies the predicate.
|
|
1423
1423
|
|
|
@@ -1457,7 +1457,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1457
1457
|
sort(): E[];
|
|
1458
1458
|
```
|
|
1459
1459
|
|
|
1460
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1460
|
+
Defined in: [data-structures/heap/heap.ts:963](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L963)
|
|
1461
1461
|
|
|
1462
1462
|
Return all elements in ascending order by repeatedly polling.
|
|
1463
1463
|
|
|
@@ -1494,7 +1494,7 @@ Time O(N log N), Space O(N)
|
|
|
1494
1494
|
toArray(): E[];
|
|
1495
1495
|
```
|
|
1496
1496
|
|
|
1497
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1497
|
+
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L246)
|
|
1498
1498
|
|
|
1499
1499
|
Materializes the elements into a new array.
|
|
1500
1500
|
|
|
@@ -1520,7 +1520,7 @@ Time O(n), Space O(n).
|
|
|
1520
1520
|
toVisual(): E[];
|
|
1521
1521
|
```
|
|
1522
1522
|
|
|
1523
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1523
|
+
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L258)
|
|
1524
1524
|
|
|
1525
1525
|
Returns a representation of the structure suitable for quick visualization.
|
|
1526
1526
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1547,7 +1547,7 @@ Time O(n), Space O(n).
|
|
|
1547
1547
|
values(): IterableIterator<E>;
|
|
1548
1548
|
```
|
|
1549
1549
|
|
|
1550
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1550
|
+
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L72)
|
|
1551
1551
|
|
|
1552
1552
|
Returns an iterator over the values (alias of the default iterator).
|
|
1553
1553
|
|
|
@@ -1576,7 +1576,7 @@ static from<T, R, S>(
|
|
|
1576
1576
|
options?): S;
|
|
1577
1577
|
```
|
|
1578
1578
|
|
|
1579
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1579
|
+
Defined in: [data-structures/heap/heap.ts:259](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L259)
|
|
1580
1580
|
|
|
1581
1581
|
Create a heap of the same class from an iterable.
|
|
1582
1582
|
|
|
@@ -1634,7 +1634,7 @@ Time O(N), Space O(N)
|
|
|
1634
1634
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1635
1635
|
```
|
|
1636
1636
|
|
|
1637
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1637
|
+
Defined in: [data-structures/heap/heap.ts:277](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L277)
|
|
1638
1638
|
|
|
1639
1639
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1640
1640
|
|
|
@@ -1687,7 +1687,7 @@ Time O(N), Space O(N)
|
|
|
1687
1687
|
protected optional _toElementFn?: (rawElement) => E;
|
|
1688
1688
|
```
|
|
1689
1689
|
|
|
1690
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1690
|
+
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L39)
|
|
1691
1691
|
|
|
1692
1692
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1693
1693
|
|
|
@@ -1717,7 +1717,7 @@ Time O(1), Space O(1).
|
|
|
1717
1717
|
protected _createInstance(options?): this;
|
|
1718
1718
|
```
|
|
1719
1719
|
|
|
1720
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1720
|
+
Defined in: [data-structures/heap/heap.ts:1230](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1230)
|
|
1721
1721
|
|
|
1722
1722
|
(Protected) Create an empty instance of the same concrete class.
|
|
1723
1723
|
|
|
@@ -1751,7 +1751,7 @@ Time O(1), Space O(1)
|
|
|
1751
1751
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1752
1752
|
```
|
|
1753
1753
|
|
|
1754
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1754
|
+
Defined in: [data-structures/heap/heap.ts:1248](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1248)
|
|
1755
1755
|
|
|
1756
1756
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1757
1757
|
|
|
@@ -1801,7 +1801,7 @@ Time O(N log N), Space O(N)
|
|
|
1801
1801
|
protected _getIterator(): IterableIterator<E>;
|
|
1802
1802
|
```
|
|
1803
1803
|
|
|
1804
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1804
|
+
Defined in: [data-structures/heap/heap.ts:1188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1188)
|
|
1805
1805
|
|
|
1806
1806
|
Internal iterator factory used by the default iterator.
|
|
1807
1807
|
|
|
@@ -1827,7 +1827,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1827
1827
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1828
1828
|
```
|
|
1829
1829
|
|
|
1830
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1830
|
+
Defined in: [data-structures/heap/heap.ts:1268](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1268)
|
|
1831
1831
|
|
|
1832
1832
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1833
1833
|
|