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: MaxPriorityQueue\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/priority-queue/max-priority-queue.ts:77](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/priority-queue/max-priority-queue.ts:77](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/priority-queue/max-priority-queue.ts#L77)
|
|
10
10
|
|
|
11
11
|
Max-oriented priority queue (max-heap) built on [PriorityQueue](PriorityQueue.md).
|
|
12
12
|
The default comparator orders primitive values in descending order. If you store objects,
|
|
@@ -104,7 +104,7 @@ Extra record/metadata associated with each element.
|
|
|
104
104
|
new MaxPriorityQueue<E, R>(elements?, options?): MaxPriorityQueue<E, R>;
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
Defined in: [data-structures/priority-queue/max-priority-queue.ts:85](https://github.com/zrwusa/data-structure-typed/blob/
|
|
107
|
+
Defined in: [data-structures/priority-queue/max-priority-queue.ts:85](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/priority-queue/max-priority-queue.ts#L85)
|
|
108
108
|
|
|
109
109
|
Creates a max-priority queue.
|
|
110
110
|
|
|
@@ -150,7 +150,7 @@ PriorityQueue<E, R>.constructor
|
|
|
150
150
|
get comparator(): Comparator<E>;
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
153
|
+
Defined in: [data-structures/heap/heap.ts:1184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1184)
|
|
154
154
|
|
|
155
155
|
Get the comparator used to order elements.
|
|
156
156
|
|
|
@@ -178,7 +178,7 @@ Comparator function.
|
|
|
178
178
|
get elements(): E[];
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/
|
|
181
|
+
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L180)
|
|
182
182
|
|
|
183
183
|
Get the backing array of the heap.
|
|
184
184
|
|
|
@@ -206,7 +206,7 @@ Internal elements array.
|
|
|
206
206
|
get leaf(): E | undefined;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
209
|
+
Defined in: [data-structures/heap/heap.ts:244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L244)
|
|
210
210
|
|
|
211
211
|
Get the last leaf element.
|
|
212
212
|
|
|
@@ -234,7 +234,7 @@ Last element or undefined.
|
|
|
234
234
|
get size(): number;
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
237
|
+
Defined in: [data-structures/heap/heap.ts:234](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L234)
|
|
238
238
|
|
|
239
239
|
Get the number of elements.
|
|
240
240
|
|
|
@@ -277,7 +277,7 @@ Heap size.
|
|
|
277
277
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
278
278
|
```
|
|
279
279
|
|
|
280
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
280
|
+
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)
|
|
281
281
|
|
|
282
282
|
Exposes the current `toElementFn`, if configured.
|
|
283
283
|
|
|
@@ -303,7 +303,7 @@ The converter function or `undefined` when not set.
|
|
|
303
303
|
iterator: IterableIterator<E>;
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
306
|
+
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)
|
|
307
307
|
|
|
308
308
|
Returns an iterator over the structure's elements.
|
|
309
309
|
|
|
@@ -337,7 +337,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
337
337
|
add(element): boolean;
|
|
338
338
|
```
|
|
339
339
|
|
|
340
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
340
|
+
Defined in: [data-structures/heap/heap.ts:338](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L338)
|
|
341
341
|
|
|
342
342
|
Insert an element.
|
|
343
343
|
|
|
@@ -392,7 +392,7 @@ Time O(1) amortized, Space O(1)
|
|
|
392
392
|
addMany(elements): boolean[];
|
|
393
393
|
```
|
|
394
394
|
|
|
395
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
395
|
+
Defined in: [data-structures/heap/heap.ts:388](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L388)
|
|
396
396
|
|
|
397
397
|
Insert many elements from an iterable.
|
|
398
398
|
|
|
@@ -438,7 +438,7 @@ Time O(N log N), Space O(1)
|
|
|
438
438
|
clear(): void;
|
|
439
439
|
```
|
|
440
440
|
|
|
441
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
441
|
+
Defined in: [data-structures/heap/heap.ts:676](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L676)
|
|
442
442
|
|
|
443
443
|
Remove all elements.
|
|
444
444
|
|
|
@@ -475,7 +475,7 @@ Time O(1), Space O(1)
|
|
|
475
475
|
clone(): this;
|
|
476
476
|
```
|
|
477
477
|
|
|
478
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
478
|
+
Defined in: [data-structures/heap/heap.ts:1020](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1020)
|
|
479
479
|
|
|
480
480
|
Deep clone this heap.
|
|
481
481
|
|
|
@@ -514,7 +514,7 @@ Time O(N), Space O(N)
|
|
|
514
514
|
delete(element): boolean;
|
|
515
515
|
```
|
|
516
516
|
|
|
517
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
517
|
+
Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L779)
|
|
518
518
|
|
|
519
519
|
Delete one occurrence of an element.
|
|
520
520
|
|
|
@@ -559,7 +559,7 @@ Time O(N), Space O(1)
|
|
|
559
559
|
deleteBy(predicate): boolean;
|
|
560
560
|
```
|
|
561
561
|
|
|
562
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
562
|
+
Defined in: [data-structures/heap/heap.ts:807](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L807)
|
|
563
563
|
|
|
564
564
|
Delete the first element that matches a predicate.
|
|
565
565
|
|
|
@@ -593,7 +593,7 @@ Time O(N), Space O(1)
|
|
|
593
593
|
dfs(order?): E[];
|
|
594
594
|
```
|
|
595
595
|
|
|
596
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
596
|
+
Defined in: [data-structures/heap/heap.ts:878](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L878)
|
|
597
597
|
|
|
598
598
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
599
599
|
|
|
@@ -638,7 +638,7 @@ Time O(N), Space O(H)
|
|
|
638
638
|
every(predicate, thisArg?): boolean;
|
|
639
639
|
```
|
|
640
640
|
|
|
641
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
641
|
+
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)
|
|
642
642
|
|
|
643
643
|
Tests whether all elements satisfy the predicate.
|
|
644
644
|
|
|
@@ -678,7 +678,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
678
678
|
filter(callback, thisArg?): this;
|
|
679
679
|
```
|
|
680
680
|
|
|
681
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
681
|
+
Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1072)
|
|
682
682
|
|
|
683
683
|
Filter elements into a new heap of the same class.
|
|
684
684
|
|
|
@@ -731,7 +731,7 @@ Time O(N log N), Space O(N)
|
|
|
731
731
|
find<S>(predicate, thisArg?): S | undefined;
|
|
732
732
|
```
|
|
733
733
|
|
|
734
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
734
|
+
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)
|
|
735
735
|
|
|
736
736
|
Finds the first element that satisfies the predicate and returns it.
|
|
737
737
|
|
|
@@ -777,7 +777,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
777
777
|
find(predicate, thisArg?): E | undefined;
|
|
778
778
|
```
|
|
779
779
|
|
|
780
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
780
|
+
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)
|
|
781
781
|
|
|
782
782
|
Finds the first element that satisfies the predicate and returns it.
|
|
783
783
|
|
|
@@ -819,7 +819,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
819
819
|
fix(): boolean[];
|
|
820
820
|
```
|
|
821
821
|
|
|
822
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
822
|
+
Defined in: [data-structures/heap/heap.ts:909](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L909)
|
|
823
823
|
|
|
824
824
|
Restore heap order bottom-up (heapify in-place).
|
|
825
825
|
|
|
@@ -845,7 +845,7 @@ Time O(N), Space O(1)
|
|
|
845
845
|
forEach(callbackfn, thisArg?): void;
|
|
846
846
|
```
|
|
847
847
|
|
|
848
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
848
|
+
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)
|
|
849
849
|
|
|
850
850
|
Invokes a callback for each element in iteration order.
|
|
851
851
|
|
|
@@ -885,7 +885,7 @@ Time O(n), Space O(1).
|
|
|
885
885
|
has(element): boolean;
|
|
886
886
|
```
|
|
887
887
|
|
|
888
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
888
|
+
Defined in: [data-structures/heap/heap.ts:730](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L730)
|
|
889
889
|
|
|
890
890
|
Check if an equal element exists in the heap.
|
|
891
891
|
|
|
@@ -930,7 +930,7 @@ Time O(N), Space O(1)
|
|
|
930
930
|
isEmpty(): boolean;
|
|
931
931
|
```
|
|
932
932
|
|
|
933
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
933
|
+
Defined in: [data-structures/heap/heap.ts:628](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L628)
|
|
934
934
|
|
|
935
935
|
Check whether the heap is empty.
|
|
936
936
|
|
|
@@ -971,7 +971,7 @@ map<EM, RM>(
|
|
|
971
971
|
thisArg?): Heap<EM, RM>;
|
|
972
972
|
```
|
|
973
973
|
|
|
974
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
974
|
+
Defined in: [data-structures/heap/heap.ts:1133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1133)
|
|
975
975
|
|
|
976
976
|
Map elements into a new heap of possibly different element type.
|
|
977
977
|
|
|
@@ -1038,7 +1038,7 @@ Time O(N log N), Space O(N)
|
|
|
1038
1038
|
mapSame(callback, thisArg?): this;
|
|
1039
1039
|
```
|
|
1040
1040
|
|
|
1041
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1041
|
+
Defined in: [data-structures/heap/heap.ts:1157](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1157)
|
|
1042
1042
|
|
|
1043
1043
|
Map elements into a new heap of the same element type.
|
|
1044
1044
|
|
|
@@ -1078,7 +1078,7 @@ Time O(N log N), Space O(N)
|
|
|
1078
1078
|
peek(): E | undefined;
|
|
1079
1079
|
```
|
|
1080
1080
|
|
|
1081
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1081
|
+
Defined in: [data-structures/heap/heap.ts:579](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L579)
|
|
1082
1082
|
|
|
1083
1083
|
Get the current top element without removing it.
|
|
1084
1084
|
|
|
@@ -1169,7 +1169,7 @@ Time O(1), Space O(1)
|
|
|
1169
1169
|
poll(): E | undefined;
|
|
1170
1170
|
```
|
|
1171
1171
|
|
|
1172
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1172
|
+
Defined in: [data-structures/heap/heap.ts:468](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L468)
|
|
1173
1173
|
|
|
1174
1174
|
Remove and return the top element.
|
|
1175
1175
|
|
|
@@ -1226,7 +1226,7 @@ Time O(log N), Space O(1)
|
|
|
1226
1226
|
print(): void;
|
|
1227
1227
|
```
|
|
1228
1228
|
|
|
1229
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1229
|
+
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)
|
|
1230
1230
|
|
|
1231
1231
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1232
1232
|
|
|
@@ -1284,7 +1284,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1284
1284
|
reduce(callbackfn): E;
|
|
1285
1285
|
```
|
|
1286
1286
|
|
|
1287
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1287
|
+
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)
|
|
1288
1288
|
|
|
1289
1289
|
##### Parameters
|
|
1290
1290
|
|
|
@@ -1306,7 +1306,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
1306
1306
|
reduce(callbackfn, initialValue): E;
|
|
1307
1307
|
```
|
|
1308
1308
|
|
|
1309
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1309
|
+
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)
|
|
1310
1310
|
|
|
1311
1311
|
##### Parameters
|
|
1312
1312
|
|
|
@@ -1332,7 +1332,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1332
1332
|
reduce<U>(callbackfn, initialValue): U;
|
|
1333
1333
|
```
|
|
1334
1334
|
|
|
1335
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1335
|
+
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)
|
|
1336
1336
|
|
|
1337
1337
|
##### Type Parameters
|
|
1338
1338
|
|
|
@@ -1366,7 +1366,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1366
1366
|
refill(elements): boolean[];
|
|
1367
1367
|
```
|
|
1368
1368
|
|
|
1369
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1369
|
+
Defined in: [data-structures/heap/heap.ts:687](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L687)
|
|
1370
1370
|
|
|
1371
1371
|
Replace the backing array and rebuild the heap.
|
|
1372
1372
|
|
|
@@ -1400,7 +1400,7 @@ Time O(N), Space O(N)
|
|
|
1400
1400
|
setEquality(equals): this;
|
|
1401
1401
|
```
|
|
1402
1402
|
|
|
1403
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1403
|
+
Defined in: [data-structures/heap/heap.ts:835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L835)
|
|
1404
1404
|
|
|
1405
1405
|
Set the equality comparator used by has/delete operations.
|
|
1406
1406
|
|
|
@@ -1434,7 +1434,7 @@ Time O(1), Space O(1)
|
|
|
1434
1434
|
some(predicate, thisArg?): boolean;
|
|
1435
1435
|
```
|
|
1436
1436
|
|
|
1437
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1437
|
+
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)
|
|
1438
1438
|
|
|
1439
1439
|
Tests whether at least one element satisfies the predicate.
|
|
1440
1440
|
|
|
@@ -1474,7 +1474,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1474
1474
|
sort(): E[];
|
|
1475
1475
|
```
|
|
1476
1476
|
|
|
1477
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1477
|
+
Defined in: [data-structures/heap/heap.ts:963](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L963)
|
|
1478
1478
|
|
|
1479
1479
|
Return all elements in ascending order by repeatedly polling.
|
|
1480
1480
|
|
|
@@ -1511,7 +1511,7 @@ Time O(N log N), Space O(N)
|
|
|
1511
1511
|
toArray(): E[];
|
|
1512
1512
|
```
|
|
1513
1513
|
|
|
1514
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1514
|
+
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)
|
|
1515
1515
|
|
|
1516
1516
|
Materializes the elements into a new array.
|
|
1517
1517
|
|
|
@@ -1537,7 +1537,7 @@ Time O(n), Space O(n).
|
|
|
1537
1537
|
toVisual(): E[];
|
|
1538
1538
|
```
|
|
1539
1539
|
|
|
1540
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1540
|
+
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)
|
|
1541
1541
|
|
|
1542
1542
|
Returns a representation of the structure suitable for quick visualization.
|
|
1543
1543
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1564,7 +1564,7 @@ Time O(n), Space O(n).
|
|
|
1564
1564
|
values(): IterableIterator<E>;
|
|
1565
1565
|
```
|
|
1566
1566
|
|
|
1567
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1567
|
+
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)
|
|
1568
1568
|
|
|
1569
1569
|
Returns an iterator over the values (alias of the default iterator).
|
|
1570
1570
|
|
|
@@ -1593,7 +1593,7 @@ static from<T, R, S>(
|
|
|
1593
1593
|
options?): S;
|
|
1594
1594
|
```
|
|
1595
1595
|
|
|
1596
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1596
|
+
Defined in: [data-structures/heap/heap.ts:259](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L259)
|
|
1597
1597
|
|
|
1598
1598
|
Create a heap of the same class from an iterable.
|
|
1599
1599
|
|
|
@@ -1651,7 +1651,7 @@ Time O(N), Space O(N)
|
|
|
1651
1651
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1652
1652
|
```
|
|
1653
1653
|
|
|
1654
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1654
|
+
Defined in: [data-structures/heap/heap.ts:277](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L277)
|
|
1655
1655
|
|
|
1656
1656
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1657
1657
|
|
|
@@ -1704,7 +1704,7 @@ Time O(N), Space O(N)
|
|
|
1704
1704
|
protected optional _toElementFn?: (rawElement) => E;
|
|
1705
1705
|
```
|
|
1706
1706
|
|
|
1707
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1707
|
+
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)
|
|
1708
1708
|
|
|
1709
1709
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1710
1710
|
|
|
@@ -1734,7 +1734,7 @@ Time O(1), Space O(1).
|
|
|
1734
1734
|
protected _createInstance(options?): this;
|
|
1735
1735
|
```
|
|
1736
1736
|
|
|
1737
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1737
|
+
Defined in: [data-structures/heap/heap.ts:1230](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1230)
|
|
1738
1738
|
|
|
1739
1739
|
(Protected) Create an empty instance of the same concrete class.
|
|
1740
1740
|
|
|
@@ -1768,7 +1768,7 @@ Time O(1), Space O(1)
|
|
|
1768
1768
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1769
1769
|
```
|
|
1770
1770
|
|
|
1771
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1771
|
+
Defined in: [data-structures/heap/heap.ts:1248](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1248)
|
|
1772
1772
|
|
|
1773
1773
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1774
1774
|
|
|
@@ -1818,7 +1818,7 @@ Time O(N log N), Space O(N)
|
|
|
1818
1818
|
protected _getIterator(): IterableIterator<E>;
|
|
1819
1819
|
```
|
|
1820
1820
|
|
|
1821
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1821
|
+
Defined in: [data-structures/heap/heap.ts:1188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1188)
|
|
1822
1822
|
|
|
1823
1823
|
Internal iterator factory used by the default iterator.
|
|
1824
1824
|
|
|
@@ -1844,7 +1844,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1844
1844
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1845
1845
|
```
|
|
1846
1846
|
|
|
1847
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1847
|
+
Defined in: [data-structures/heap/heap.ts:1268](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1268)
|
|
1848
1848
|
|
|
1849
1849
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1850
1850
|
|