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: PriorityQueue\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/priority-queue/priority-queue.ts:75](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/priority-queue/priority-queue.ts:75](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/priority-queue/priority-queue.ts#L75)
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
@@ -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:1184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1184)
|
|
110
110
|
|
|
111
111
|
Get the comparator used to order elements.
|
|
112
112
|
|
|
@@ -134,7 +134,7 @@ Comparator function.
|
|
|
134
134
|
get elements(): E[];
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/
|
|
137
|
+
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L180)
|
|
138
138
|
|
|
139
139
|
Get the backing array of the heap.
|
|
140
140
|
|
|
@@ -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:244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L244)
|
|
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:234](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L234)
|
|
194
194
|
|
|
195
195
|
Get the number of elements.
|
|
196
196
|
|
|
@@ -233,7 +233,7 @@ Heap size.
|
|
|
233
233
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
236
|
+
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)
|
|
237
237
|
|
|
238
238
|
Exposes the current `toElementFn`, if configured.
|
|
239
239
|
|
|
@@ -259,7 +259,7 @@ The converter function or `undefined` when not set.
|
|
|
259
259
|
iterator: IterableIterator<E>;
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
262
|
+
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)
|
|
263
263
|
|
|
264
264
|
Returns an iterator over the structure's elements.
|
|
265
265
|
|
|
@@ -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:338](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L338)
|
|
297
297
|
|
|
298
298
|
Insert an element.
|
|
299
299
|
|
|
@@ -348,7 +348,7 @@ Time O(1) 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:388](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L388)
|
|
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:676](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L676)
|
|
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:1020](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1020)
|
|
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:779](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L779)
|
|
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:807](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L807)
|
|
519
519
|
|
|
520
520
|
Delete the first element that matches a predicate.
|
|
521
521
|
|
|
@@ -549,7 +549,7 @@ Time O(N), Space O(1)
|
|
|
549
549
|
dfs(order?): E[];
|
|
550
550
|
```
|
|
551
551
|
|
|
552
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
552
|
+
Defined in: [data-structures/heap/heap.ts:878](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L878)
|
|
553
553
|
|
|
554
554
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
555
555
|
|
|
@@ -594,7 +594,7 @@ Time O(N), Space O(H)
|
|
|
594
594
|
every(predicate, thisArg?): boolean;
|
|
595
595
|
```
|
|
596
596
|
|
|
597
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
597
|
+
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)
|
|
598
598
|
|
|
599
599
|
Tests whether all elements satisfy the predicate.
|
|
600
600
|
|
|
@@ -634,7 +634,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
634
634
|
filter(callback, thisArg?): this;
|
|
635
635
|
```
|
|
636
636
|
|
|
637
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
637
|
+
Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1072)
|
|
638
638
|
|
|
639
639
|
Filter elements into a new heap of the same class.
|
|
640
640
|
|
|
@@ -687,7 +687,7 @@ Time O(N log N), Space O(N)
|
|
|
687
687
|
find<S>(predicate, thisArg?): S | undefined;
|
|
688
688
|
```
|
|
689
689
|
|
|
690
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
690
|
+
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)
|
|
691
691
|
|
|
692
692
|
Finds the first element that satisfies the predicate and returns it.
|
|
693
693
|
|
|
@@ -733,7 +733,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
733
733
|
find(predicate, thisArg?): E | undefined;
|
|
734
734
|
```
|
|
735
735
|
|
|
736
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
736
|
+
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)
|
|
737
737
|
|
|
738
738
|
Finds the first element that satisfies the predicate and returns it.
|
|
739
739
|
|
|
@@ -775,7 +775,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
775
775
|
fix(): boolean[];
|
|
776
776
|
```
|
|
777
777
|
|
|
778
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
778
|
+
Defined in: [data-structures/heap/heap.ts:909](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L909)
|
|
779
779
|
|
|
780
780
|
Restore heap order bottom-up (heapify in-place).
|
|
781
781
|
|
|
@@ -801,7 +801,7 @@ Time O(N), Space O(1)
|
|
|
801
801
|
forEach(callbackfn, thisArg?): void;
|
|
802
802
|
```
|
|
803
803
|
|
|
804
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
804
|
+
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)
|
|
805
805
|
|
|
806
806
|
Invokes a callback for each element in iteration order.
|
|
807
807
|
|
|
@@ -841,7 +841,7 @@ Time O(n), Space O(1).
|
|
|
841
841
|
has(element): boolean;
|
|
842
842
|
```
|
|
843
843
|
|
|
844
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
844
|
+
Defined in: [data-structures/heap/heap.ts:730](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L730)
|
|
845
845
|
|
|
846
846
|
Check if an equal element exists in the heap.
|
|
847
847
|
|
|
@@ -886,7 +886,7 @@ Time O(N), Space O(1)
|
|
|
886
886
|
isEmpty(): boolean;
|
|
887
887
|
```
|
|
888
888
|
|
|
889
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
889
|
+
Defined in: [data-structures/heap/heap.ts:628](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L628)
|
|
890
890
|
|
|
891
891
|
Check whether the heap is empty.
|
|
892
892
|
|
|
@@ -927,7 +927,7 @@ map<EM, RM>(
|
|
|
927
927
|
thisArg?): Heap<EM, RM>;
|
|
928
928
|
```
|
|
929
929
|
|
|
930
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
930
|
+
Defined in: [data-structures/heap/heap.ts:1133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1133)
|
|
931
931
|
|
|
932
932
|
Map elements into a new heap of possibly different element type.
|
|
933
933
|
|
|
@@ -994,7 +994,7 @@ Time O(N log N), Space O(N)
|
|
|
994
994
|
mapSame(callback, thisArg?): this;
|
|
995
995
|
```
|
|
996
996
|
|
|
997
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
997
|
+
Defined in: [data-structures/heap/heap.ts:1157](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1157)
|
|
998
998
|
|
|
999
999
|
Map elements into a new heap of the same element type.
|
|
1000
1000
|
|
|
@@ -1034,7 +1034,7 @@ Time O(N log N), Space O(N)
|
|
|
1034
1034
|
peek(): E | undefined;
|
|
1035
1035
|
```
|
|
1036
1036
|
|
|
1037
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1037
|
+
Defined in: [data-structures/heap/heap.ts:579](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L579)
|
|
1038
1038
|
|
|
1039
1039
|
Get the current top element without removing it.
|
|
1040
1040
|
|
|
@@ -1125,7 +1125,7 @@ Time O(1), Space O(1)
|
|
|
1125
1125
|
poll(): E | undefined;
|
|
1126
1126
|
```
|
|
1127
1127
|
|
|
1128
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1128
|
+
Defined in: [data-structures/heap/heap.ts:468](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L468)
|
|
1129
1129
|
|
|
1130
1130
|
Remove and return the top element.
|
|
1131
1131
|
|
|
@@ -1182,7 +1182,7 @@ Time O(log N), Space O(1)
|
|
|
1182
1182
|
print(): void;
|
|
1183
1183
|
```
|
|
1184
1184
|
|
|
1185
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1185
|
+
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)
|
|
1186
1186
|
|
|
1187
1187
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1188
1188
|
|
|
@@ -1240,7 +1240,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1240
1240
|
reduce(callbackfn): E;
|
|
1241
1241
|
```
|
|
1242
1242
|
|
|
1243
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1243
|
+
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)
|
|
1244
1244
|
|
|
1245
1245
|
##### Parameters
|
|
1246
1246
|
|
|
@@ -1262,7 +1262,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
1262
1262
|
reduce(callbackfn, initialValue): E;
|
|
1263
1263
|
```
|
|
1264
1264
|
|
|
1265
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1265
|
+
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)
|
|
1266
1266
|
|
|
1267
1267
|
##### Parameters
|
|
1268
1268
|
|
|
@@ -1288,7 +1288,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1288
1288
|
reduce<U>(callbackfn, initialValue): U;
|
|
1289
1289
|
```
|
|
1290
1290
|
|
|
1291
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1291
|
+
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)
|
|
1292
1292
|
|
|
1293
1293
|
##### Type Parameters
|
|
1294
1294
|
|
|
@@ -1322,7 +1322,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1322
1322
|
refill(elements): boolean[];
|
|
1323
1323
|
```
|
|
1324
1324
|
|
|
1325
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1325
|
+
Defined in: [data-structures/heap/heap.ts:687](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L687)
|
|
1326
1326
|
|
|
1327
1327
|
Replace the backing array and rebuild the heap.
|
|
1328
1328
|
|
|
@@ -1356,7 +1356,7 @@ Time O(N), Space O(N)
|
|
|
1356
1356
|
setEquality(equals): this;
|
|
1357
1357
|
```
|
|
1358
1358
|
|
|
1359
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1359
|
+
Defined in: [data-structures/heap/heap.ts:835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L835)
|
|
1360
1360
|
|
|
1361
1361
|
Set the equality comparator used by has/delete operations.
|
|
1362
1362
|
|
|
@@ -1390,7 +1390,7 @@ Time O(1), Space O(1)
|
|
|
1390
1390
|
some(predicate, thisArg?): boolean;
|
|
1391
1391
|
```
|
|
1392
1392
|
|
|
1393
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1393
|
+
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)
|
|
1394
1394
|
|
|
1395
1395
|
Tests whether at least one element satisfies the predicate.
|
|
1396
1396
|
|
|
@@ -1430,7 +1430,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1430
1430
|
sort(): E[];
|
|
1431
1431
|
```
|
|
1432
1432
|
|
|
1433
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1433
|
+
Defined in: [data-structures/heap/heap.ts:963](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L963)
|
|
1434
1434
|
|
|
1435
1435
|
Return all elements in ascending order by repeatedly polling.
|
|
1436
1436
|
|
|
@@ -1467,7 +1467,7 @@ Time O(N log N), Space O(N)
|
|
|
1467
1467
|
toArray(): E[];
|
|
1468
1468
|
```
|
|
1469
1469
|
|
|
1470
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1470
|
+
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)
|
|
1471
1471
|
|
|
1472
1472
|
Materializes the elements into a new array.
|
|
1473
1473
|
|
|
@@ -1493,7 +1493,7 @@ Time O(n), Space O(n).
|
|
|
1493
1493
|
toVisual(): E[];
|
|
1494
1494
|
```
|
|
1495
1495
|
|
|
1496
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1496
|
+
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)
|
|
1497
1497
|
|
|
1498
1498
|
Returns a representation of the structure suitable for quick visualization.
|
|
1499
1499
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1520,7 +1520,7 @@ Time O(n), Space O(n).
|
|
|
1520
1520
|
values(): IterableIterator<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:72](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L72)
|
|
1524
1524
|
|
|
1525
1525
|
Returns an iterator over the values (alias of the default iterator).
|
|
1526
1526
|
|
|
@@ -1549,7 +1549,7 @@ static from<T, R, S>(
|
|
|
1549
1549
|
options?): S;
|
|
1550
1550
|
```
|
|
1551
1551
|
|
|
1552
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1552
|
+
Defined in: [data-structures/heap/heap.ts:259](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L259)
|
|
1553
1553
|
|
|
1554
1554
|
Create a heap of the same class from an iterable.
|
|
1555
1555
|
|
|
@@ -1607,7 +1607,7 @@ Time O(N), Space O(N)
|
|
|
1607
1607
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1608
1608
|
```
|
|
1609
1609
|
|
|
1610
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1610
|
+
Defined in: [data-structures/heap/heap.ts:277](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L277)
|
|
1611
1611
|
|
|
1612
1612
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1613
1613
|
|
|
@@ -1660,7 +1660,7 @@ Time O(N), Space O(N)
|
|
|
1660
1660
|
protected optional _toElementFn?: (rawElement) => E;
|
|
1661
1661
|
```
|
|
1662
1662
|
|
|
1663
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1663
|
+
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)
|
|
1664
1664
|
|
|
1665
1665
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1666
1666
|
|
|
@@ -1690,7 +1690,7 @@ Time O(1), Space O(1).
|
|
|
1690
1690
|
protected _createInstance(options?): this;
|
|
1691
1691
|
```
|
|
1692
1692
|
|
|
1693
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1693
|
+
Defined in: [data-structures/heap/heap.ts:1230](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1230)
|
|
1694
1694
|
|
|
1695
1695
|
(Protected) Create an empty instance of the same concrete class.
|
|
1696
1696
|
|
|
@@ -1724,7 +1724,7 @@ Time O(1), Space O(1)
|
|
|
1724
1724
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1725
1725
|
```
|
|
1726
1726
|
|
|
1727
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1727
|
+
Defined in: [data-structures/heap/heap.ts:1248](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1248)
|
|
1728
1728
|
|
|
1729
1729
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1730
1730
|
|
|
@@ -1774,7 +1774,7 @@ Time O(N log N), Space O(N)
|
|
|
1774
1774
|
protected _getIterator(): IterableIterator<E>;
|
|
1775
1775
|
```
|
|
1776
1776
|
|
|
1777
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1777
|
+
Defined in: [data-structures/heap/heap.ts:1188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1188)
|
|
1778
1778
|
|
|
1779
1779
|
Internal iterator factory used by the default iterator.
|
|
1780
1780
|
|
|
@@ -1800,7 +1800,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1800
1800
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1801
1801
|
```
|
|
1802
1802
|
|
|
1803
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1803
|
+
Defined in: [data-structures/heap/heap.ts:1268](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1268)
|
|
1804
1804
|
|
|
1805
1805
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1806
1806
|
|