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: MinHeap\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/heap/min-heap.ts:86](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/heap/min-heap.ts:86](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/min-heap.ts#L86)
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
@@ -110,7 +110,7 @@ Notes and typical use-cases are documented in [Heap](Heap.md).
|
|
|
110
110
|
new MinHeap<E, R>(elements?, options?): MinHeap<E, R>;
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
Defined in: [data-structures/heap/min-heap.ts:92](https://github.com/zrwusa/data-structure-typed/blob/
|
|
113
|
+
Defined in: [data-structures/heap/min-heap.ts:92](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/min-heap.ts#L92)
|
|
114
114
|
|
|
115
115
|
Create a min-heap.
|
|
116
116
|
|
|
@@ -146,7 +146,7 @@ Optional configuration.
|
|
|
146
146
|
get comparator(): Comparator<E>;
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
149
|
+
Defined in: [data-structures/heap/heap.ts:1184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1184)
|
|
150
150
|
|
|
151
151
|
Get the comparator used to order elements.
|
|
152
152
|
|
|
@@ -174,7 +174,7 @@ Comparator function.
|
|
|
174
174
|
get elements(): E[];
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/
|
|
177
|
+
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L180)
|
|
178
178
|
|
|
179
179
|
Get the backing array of the heap.
|
|
180
180
|
|
|
@@ -202,7 +202,7 @@ Internal elements array.
|
|
|
202
202
|
get leaf(): E | undefined;
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
205
|
+
Defined in: [data-structures/heap/heap.ts:244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L244)
|
|
206
206
|
|
|
207
207
|
Get the last leaf element.
|
|
208
208
|
|
|
@@ -230,7 +230,7 @@ Last element or undefined.
|
|
|
230
230
|
get size(): number;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
233
|
+
Defined in: [data-structures/heap/heap.ts:234](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L234)
|
|
234
234
|
|
|
235
235
|
Get the number of elements.
|
|
236
236
|
|
|
@@ -273,7 +273,7 @@ Heap size.
|
|
|
273
273
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
274
274
|
```
|
|
275
275
|
|
|
276
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
276
|
+
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)
|
|
277
277
|
|
|
278
278
|
Exposes the current `toElementFn`, if configured.
|
|
279
279
|
|
|
@@ -299,7 +299,7 @@ The converter function or `undefined` when not set.
|
|
|
299
299
|
iterator: IterableIterator<E>;
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
302
|
+
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)
|
|
303
303
|
|
|
304
304
|
Returns an iterator over the structure's elements.
|
|
305
305
|
|
|
@@ -333,7 +333,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
333
333
|
add(element): boolean;
|
|
334
334
|
```
|
|
335
335
|
|
|
336
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
336
|
+
Defined in: [data-structures/heap/heap.ts:338](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L338)
|
|
337
337
|
|
|
338
338
|
Insert an element.
|
|
339
339
|
|
|
@@ -388,7 +388,7 @@ Time O(1) amortized, Space O(1)
|
|
|
388
388
|
addMany(elements): boolean[];
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
391
|
+
Defined in: [data-structures/heap/heap.ts:388](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L388)
|
|
392
392
|
|
|
393
393
|
Insert many elements from an iterable.
|
|
394
394
|
|
|
@@ -434,7 +434,7 @@ Time O(N log N), Space O(1)
|
|
|
434
434
|
clear(): void;
|
|
435
435
|
```
|
|
436
436
|
|
|
437
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
437
|
+
Defined in: [data-structures/heap/heap.ts:676](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L676)
|
|
438
438
|
|
|
439
439
|
Remove all elements.
|
|
440
440
|
|
|
@@ -471,7 +471,7 @@ Time O(1), Space O(1)
|
|
|
471
471
|
clone(): this;
|
|
472
472
|
```
|
|
473
473
|
|
|
474
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
474
|
+
Defined in: [data-structures/heap/heap.ts:1020](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1020)
|
|
475
475
|
|
|
476
476
|
Deep clone this heap.
|
|
477
477
|
|
|
@@ -510,7 +510,7 @@ Time O(N), Space O(N)
|
|
|
510
510
|
delete(element): boolean;
|
|
511
511
|
```
|
|
512
512
|
|
|
513
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
513
|
+
Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L779)
|
|
514
514
|
|
|
515
515
|
Delete one occurrence of an element.
|
|
516
516
|
|
|
@@ -555,7 +555,7 @@ Time O(N), Space O(1)
|
|
|
555
555
|
deleteBy(predicate): boolean;
|
|
556
556
|
```
|
|
557
557
|
|
|
558
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
558
|
+
Defined in: [data-structures/heap/heap.ts:807](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L807)
|
|
559
559
|
|
|
560
560
|
Delete the first element that matches a predicate.
|
|
561
561
|
|
|
@@ -589,7 +589,7 @@ Time O(N), Space O(1)
|
|
|
589
589
|
dfs(order?): E[];
|
|
590
590
|
```
|
|
591
591
|
|
|
592
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
592
|
+
Defined in: [data-structures/heap/heap.ts:878](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L878)
|
|
593
593
|
|
|
594
594
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
595
595
|
|
|
@@ -634,7 +634,7 @@ Time O(N), Space O(H)
|
|
|
634
634
|
every(predicate, thisArg?): boolean;
|
|
635
635
|
```
|
|
636
636
|
|
|
637
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
637
|
+
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)
|
|
638
638
|
|
|
639
639
|
Tests whether all elements satisfy the predicate.
|
|
640
640
|
|
|
@@ -674,7 +674,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
674
674
|
filter(callback, thisArg?): this;
|
|
675
675
|
```
|
|
676
676
|
|
|
677
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
677
|
+
Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1072)
|
|
678
678
|
|
|
679
679
|
Filter elements into a new heap of the same class.
|
|
680
680
|
|
|
@@ -727,7 +727,7 @@ Time O(N log N), Space O(N)
|
|
|
727
727
|
find<S>(predicate, thisArg?): S | undefined;
|
|
728
728
|
```
|
|
729
729
|
|
|
730
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
730
|
+
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)
|
|
731
731
|
|
|
732
732
|
Finds the first element that satisfies the predicate and returns it.
|
|
733
733
|
|
|
@@ -773,7 +773,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
773
773
|
find(predicate, thisArg?): E | undefined;
|
|
774
774
|
```
|
|
775
775
|
|
|
776
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
776
|
+
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)
|
|
777
777
|
|
|
778
778
|
Finds the first element that satisfies the predicate and returns it.
|
|
779
779
|
|
|
@@ -815,7 +815,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
815
815
|
fix(): boolean[];
|
|
816
816
|
```
|
|
817
817
|
|
|
818
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
818
|
+
Defined in: [data-structures/heap/heap.ts:909](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L909)
|
|
819
819
|
|
|
820
820
|
Restore heap order bottom-up (heapify in-place).
|
|
821
821
|
|
|
@@ -841,7 +841,7 @@ Time O(N), Space O(1)
|
|
|
841
841
|
forEach(callbackfn, thisArg?): void;
|
|
842
842
|
```
|
|
843
843
|
|
|
844
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
844
|
+
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)
|
|
845
845
|
|
|
846
846
|
Invokes a callback for each element in iteration order.
|
|
847
847
|
|
|
@@ -881,7 +881,7 @@ Time O(n), Space O(1).
|
|
|
881
881
|
has(element): boolean;
|
|
882
882
|
```
|
|
883
883
|
|
|
884
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
884
|
+
Defined in: [data-structures/heap/heap.ts:730](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L730)
|
|
885
885
|
|
|
886
886
|
Check if an equal element exists in the heap.
|
|
887
887
|
|
|
@@ -926,7 +926,7 @@ Time O(N), Space O(1)
|
|
|
926
926
|
isEmpty(): boolean;
|
|
927
927
|
```
|
|
928
928
|
|
|
929
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
929
|
+
Defined in: [data-structures/heap/heap.ts:628](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L628)
|
|
930
930
|
|
|
931
931
|
Check whether the heap is empty.
|
|
932
932
|
|
|
@@ -967,7 +967,7 @@ map<EM, RM>(
|
|
|
967
967
|
thisArg?): Heap<EM, RM>;
|
|
968
968
|
```
|
|
969
969
|
|
|
970
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
970
|
+
Defined in: [data-structures/heap/heap.ts:1133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1133)
|
|
971
971
|
|
|
972
972
|
Map elements into a new heap of possibly different element type.
|
|
973
973
|
|
|
@@ -1034,7 +1034,7 @@ Time O(N log N), Space O(N)
|
|
|
1034
1034
|
mapSame(callback, thisArg?): this;
|
|
1035
1035
|
```
|
|
1036
1036
|
|
|
1037
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1037
|
+
Defined in: [data-structures/heap/heap.ts:1157](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1157)
|
|
1038
1038
|
|
|
1039
1039
|
Map elements into a new heap of the same element type.
|
|
1040
1040
|
|
|
@@ -1074,7 +1074,7 @@ Time O(N log N), Space O(N)
|
|
|
1074
1074
|
peek(): E | undefined;
|
|
1075
1075
|
```
|
|
1076
1076
|
|
|
1077
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1077
|
+
Defined in: [data-structures/heap/heap.ts:579](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L579)
|
|
1078
1078
|
|
|
1079
1079
|
Get the current top element without removing it.
|
|
1080
1080
|
|
|
@@ -1165,7 +1165,7 @@ Time O(1), Space O(1)
|
|
|
1165
1165
|
poll(): E | undefined;
|
|
1166
1166
|
```
|
|
1167
1167
|
|
|
1168
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1168
|
+
Defined in: [data-structures/heap/heap.ts:468](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L468)
|
|
1169
1169
|
|
|
1170
1170
|
Remove and return the top element.
|
|
1171
1171
|
|
|
@@ -1222,7 +1222,7 @@ Time O(log N), Space O(1)
|
|
|
1222
1222
|
print(): void;
|
|
1223
1223
|
```
|
|
1224
1224
|
|
|
1225
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1225
|
+
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)
|
|
1226
1226
|
|
|
1227
1227
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1228
1228
|
|
|
@@ -1280,7 +1280,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1280
1280
|
reduce(callbackfn): E;
|
|
1281
1281
|
```
|
|
1282
1282
|
|
|
1283
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1283
|
+
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)
|
|
1284
1284
|
|
|
1285
1285
|
##### Parameters
|
|
1286
1286
|
|
|
@@ -1302,7 +1302,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
1302
1302
|
reduce(callbackfn, initialValue): E;
|
|
1303
1303
|
```
|
|
1304
1304
|
|
|
1305
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1305
|
+
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)
|
|
1306
1306
|
|
|
1307
1307
|
##### Parameters
|
|
1308
1308
|
|
|
@@ -1328,7 +1328,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1328
1328
|
reduce<U>(callbackfn, initialValue): U;
|
|
1329
1329
|
```
|
|
1330
1330
|
|
|
1331
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1331
|
+
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)
|
|
1332
1332
|
|
|
1333
1333
|
##### Type Parameters
|
|
1334
1334
|
|
|
@@ -1362,7 +1362,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1362
1362
|
refill(elements): boolean[];
|
|
1363
1363
|
```
|
|
1364
1364
|
|
|
1365
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1365
|
+
Defined in: [data-structures/heap/heap.ts:687](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L687)
|
|
1366
1366
|
|
|
1367
1367
|
Replace the backing array and rebuild the heap.
|
|
1368
1368
|
|
|
@@ -1396,7 +1396,7 @@ Time O(N), Space O(N)
|
|
|
1396
1396
|
setEquality(equals): this;
|
|
1397
1397
|
```
|
|
1398
1398
|
|
|
1399
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1399
|
+
Defined in: [data-structures/heap/heap.ts:835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L835)
|
|
1400
1400
|
|
|
1401
1401
|
Set the equality comparator used by has/delete operations.
|
|
1402
1402
|
|
|
@@ -1430,7 +1430,7 @@ Time O(1), Space O(1)
|
|
|
1430
1430
|
some(predicate, thisArg?): boolean;
|
|
1431
1431
|
```
|
|
1432
1432
|
|
|
1433
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1433
|
+
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)
|
|
1434
1434
|
|
|
1435
1435
|
Tests whether at least one element satisfies the predicate.
|
|
1436
1436
|
|
|
@@ -1470,7 +1470,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1470
1470
|
sort(): E[];
|
|
1471
1471
|
```
|
|
1472
1472
|
|
|
1473
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1473
|
+
Defined in: [data-structures/heap/heap.ts:963](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L963)
|
|
1474
1474
|
|
|
1475
1475
|
Return all elements in ascending order by repeatedly polling.
|
|
1476
1476
|
|
|
@@ -1507,7 +1507,7 @@ Time O(N log N), Space O(N)
|
|
|
1507
1507
|
toArray(): E[];
|
|
1508
1508
|
```
|
|
1509
1509
|
|
|
1510
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1510
|
+
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)
|
|
1511
1511
|
|
|
1512
1512
|
Materializes the elements into a new array.
|
|
1513
1513
|
|
|
@@ -1533,7 +1533,7 @@ Time O(n), Space O(n).
|
|
|
1533
1533
|
toVisual(): E[];
|
|
1534
1534
|
```
|
|
1535
1535
|
|
|
1536
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1536
|
+
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)
|
|
1537
1537
|
|
|
1538
1538
|
Returns a representation of the structure suitable for quick visualization.
|
|
1539
1539
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1560,7 +1560,7 @@ Time O(n), Space O(n).
|
|
|
1560
1560
|
values(): IterableIterator<E>;
|
|
1561
1561
|
```
|
|
1562
1562
|
|
|
1563
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1563
|
+
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)
|
|
1564
1564
|
|
|
1565
1565
|
Returns an iterator over the values (alias of the default iterator).
|
|
1566
1566
|
|
|
@@ -1589,7 +1589,7 @@ static from<T, R, S>(
|
|
|
1589
1589
|
options?): S;
|
|
1590
1590
|
```
|
|
1591
1591
|
|
|
1592
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1592
|
+
Defined in: [data-structures/heap/heap.ts:259](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L259)
|
|
1593
1593
|
|
|
1594
1594
|
Create a heap of the same class from an iterable.
|
|
1595
1595
|
|
|
@@ -1647,7 +1647,7 @@ Time O(N), Space O(N)
|
|
|
1647
1647
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1648
1648
|
```
|
|
1649
1649
|
|
|
1650
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1650
|
+
Defined in: [data-structures/heap/heap.ts:277](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L277)
|
|
1651
1651
|
|
|
1652
1652
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1653
1653
|
|
|
@@ -1700,7 +1700,7 @@ Time O(N), Space O(N)
|
|
|
1700
1700
|
protected optional _toElementFn?: (rawElement) => E;
|
|
1701
1701
|
```
|
|
1702
1702
|
|
|
1703
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1703
|
+
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)
|
|
1704
1704
|
|
|
1705
1705
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1706
1706
|
|
|
@@ -1730,7 +1730,7 @@ Time O(1), Space O(1).
|
|
|
1730
1730
|
protected _createInstance(options?): this;
|
|
1731
1731
|
```
|
|
1732
1732
|
|
|
1733
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1733
|
+
Defined in: [data-structures/heap/heap.ts:1230](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1230)
|
|
1734
1734
|
|
|
1735
1735
|
(Protected) Create an empty instance of the same concrete class.
|
|
1736
1736
|
|
|
@@ -1764,7 +1764,7 @@ Time O(1), Space O(1)
|
|
|
1764
1764
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1765
1765
|
```
|
|
1766
1766
|
|
|
1767
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1767
|
+
Defined in: [data-structures/heap/heap.ts:1248](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1248)
|
|
1768
1768
|
|
|
1769
1769
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1770
1770
|
|
|
@@ -1814,7 +1814,7 @@ Time O(N log N), Space O(N)
|
|
|
1814
1814
|
protected _getIterator(): IterableIterator<E>;
|
|
1815
1815
|
```
|
|
1816
1816
|
|
|
1817
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1817
|
+
Defined in: [data-structures/heap/heap.ts:1188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1188)
|
|
1818
1818
|
|
|
1819
1819
|
Internal iterator factory used by the default iterator.
|
|
1820
1820
|
|
|
@@ -1840,7 +1840,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1840
1840
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1841
1841
|
```
|
|
1842
1842
|
|
|
1843
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1843
|
+
Defined in: [data-structures/heap/heap.ts:1268](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1268)
|
|
1844
1844
|
|
|
1845
1845
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1846
1846
|
|