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: Heap\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/heap/heap.ts:150](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/heap/heap.ts:150](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L150)
|
|
10
10
|
|
|
11
11
|
Binary heap with pluggable comparator; supports fast insertion and removal of the top element.
|
|
12
12
|
|
|
@@ -186,7 +186,7 @@ Min Heap: The value of each parent node is less than or equal to the value of it
|
|
|
186
186
|
new Heap<E, R>(elements?, options?): Heap<E, R>;
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
Defined in: [data-structures/heap/heap.ts:161](https://github.com/zrwusa/data-structure-typed/blob/
|
|
189
|
+
Defined in: [data-structures/heap/heap.ts:161](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L161)
|
|
190
190
|
|
|
191
191
|
Create a Heap and optionally bulk-insert elements.
|
|
192
192
|
|
|
@@ -228,7 +228,7 @@ Time O(N), Space O(N)
|
|
|
228
228
|
get comparator(): Comparator<E>;
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
231
|
+
Defined in: [data-structures/heap/heap.ts:1184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1184)
|
|
232
232
|
|
|
233
233
|
Get the comparator used to order elements.
|
|
234
234
|
|
|
@@ -252,7 +252,7 @@ Comparator function.
|
|
|
252
252
|
get elements(): E[];
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/
|
|
255
|
+
Defined in: [data-structures/heap/heap.ts:180](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L180)
|
|
256
256
|
|
|
257
257
|
Get the backing array of the heap.
|
|
258
258
|
|
|
@@ -276,7 +276,7 @@ Internal elements array.
|
|
|
276
276
|
get leaf(): E | undefined;
|
|
277
277
|
```
|
|
278
278
|
|
|
279
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
279
|
+
Defined in: [data-structures/heap/heap.ts:244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L244)
|
|
280
280
|
|
|
281
281
|
Get the last leaf element.
|
|
282
282
|
|
|
@@ -300,7 +300,7 @@ Last element or undefined.
|
|
|
300
300
|
get size(): number;
|
|
301
301
|
```
|
|
302
302
|
|
|
303
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
303
|
+
Defined in: [data-structures/heap/heap.ts:234](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L234)
|
|
304
304
|
|
|
305
305
|
Get the number of elements.
|
|
306
306
|
|
|
@@ -339,7 +339,7 @@ Heap size.
|
|
|
339
339
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
342
|
+
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)
|
|
343
343
|
|
|
344
344
|
Exposes the current `toElementFn`, if configured.
|
|
345
345
|
|
|
@@ -365,7 +365,7 @@ The converter function or `undefined` when not set.
|
|
|
365
365
|
iterator: IterableIterator<E>;
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
368
|
+
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)
|
|
369
369
|
|
|
370
370
|
Returns an iterator over the structure's elements.
|
|
371
371
|
|
|
@@ -399,7 +399,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
399
399
|
add(element): boolean;
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
402
|
+
Defined in: [data-structures/heap/heap.ts:338](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L338)
|
|
403
403
|
|
|
404
404
|
Insert an element.
|
|
405
405
|
|
|
@@ -450,7 +450,7 @@ Time O(1) amortized, Space O(1)
|
|
|
450
450
|
addMany(elements): boolean[];
|
|
451
451
|
```
|
|
452
452
|
|
|
453
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
453
|
+
Defined in: [data-structures/heap/heap.ts:388](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L388)
|
|
454
454
|
|
|
455
455
|
Insert many elements from an iterable.
|
|
456
456
|
|
|
@@ -492,7 +492,7 @@ Time O(N log N), Space O(1)
|
|
|
492
492
|
clear(): void;
|
|
493
493
|
```
|
|
494
494
|
|
|
495
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
495
|
+
Defined in: [data-structures/heap/heap.ts:676](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L676)
|
|
496
496
|
|
|
497
497
|
Remove all elements.
|
|
498
498
|
|
|
@@ -529,7 +529,7 @@ Time O(1), Space O(1)
|
|
|
529
529
|
clone(): this;
|
|
530
530
|
```
|
|
531
531
|
|
|
532
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
532
|
+
Defined in: [data-structures/heap/heap.ts:1020](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1020)
|
|
533
533
|
|
|
534
534
|
Deep clone this heap.
|
|
535
535
|
|
|
@@ -568,7 +568,7 @@ Time O(N), Space O(N)
|
|
|
568
568
|
delete(element): boolean;
|
|
569
569
|
```
|
|
570
570
|
|
|
571
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
571
|
+
Defined in: [data-structures/heap/heap.ts:779](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L779)
|
|
572
572
|
|
|
573
573
|
Delete one occurrence of an element.
|
|
574
574
|
|
|
@@ -609,7 +609,7 @@ Time O(N), Space O(1)
|
|
|
609
609
|
deleteBy(predicate): boolean;
|
|
610
610
|
```
|
|
611
611
|
|
|
612
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
612
|
+
Defined in: [data-structures/heap/heap.ts:807](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L807)
|
|
613
613
|
|
|
614
614
|
Delete the first element that matches a predicate.
|
|
615
615
|
|
|
@@ -639,7 +639,7 @@ Time O(N), Space O(1)
|
|
|
639
639
|
dfs(order?): E[];
|
|
640
640
|
```
|
|
641
641
|
|
|
642
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
642
|
+
Defined in: [data-structures/heap/heap.ts:878](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L878)
|
|
643
643
|
|
|
644
644
|
Traverse the binary heap as a complete binary tree and collect elements.
|
|
645
645
|
|
|
@@ -680,7 +680,7 @@ Time O(N), Space O(H)
|
|
|
680
680
|
every(predicate, thisArg?): boolean;
|
|
681
681
|
```
|
|
682
682
|
|
|
683
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
683
|
+
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)
|
|
684
684
|
|
|
685
685
|
Tests whether all elements satisfy the predicate.
|
|
686
686
|
|
|
@@ -720,7 +720,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
720
720
|
filter(callback, thisArg?): this;
|
|
721
721
|
```
|
|
722
722
|
|
|
723
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
723
|
+
Defined in: [data-structures/heap/heap.ts:1072](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1072)
|
|
724
724
|
|
|
725
725
|
Filter elements into a new heap of the same class.
|
|
726
726
|
|
|
@@ -773,7 +773,7 @@ Time O(N log N), Space O(N)
|
|
|
773
773
|
find<S>(predicate, thisArg?): S | 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:163](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L163)
|
|
777
777
|
|
|
778
778
|
Finds the first element that satisfies the predicate and returns it.
|
|
779
779
|
|
|
@@ -819,7 +819,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
819
819
|
find(predicate, thisArg?): E | undefined;
|
|
820
820
|
```
|
|
821
821
|
|
|
822
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
822
|
+
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)
|
|
823
823
|
|
|
824
824
|
Finds the first element that satisfies the predicate and returns it.
|
|
825
825
|
|
|
@@ -861,7 +861,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
861
861
|
fix(): boolean[];
|
|
862
862
|
```
|
|
863
863
|
|
|
864
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
864
|
+
Defined in: [data-structures/heap/heap.ts:909](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L909)
|
|
865
865
|
|
|
866
866
|
Restore heap order bottom-up (heapify in-place).
|
|
867
867
|
|
|
@@ -883,7 +883,7 @@ Time O(N), Space O(1)
|
|
|
883
883
|
forEach(callbackfn, thisArg?): void;
|
|
884
884
|
```
|
|
885
885
|
|
|
886
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
886
|
+
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)
|
|
887
887
|
|
|
888
888
|
Invokes a callback for each element in iteration order.
|
|
889
889
|
|
|
@@ -923,7 +923,7 @@ Time O(n), Space O(1).
|
|
|
923
923
|
has(element): boolean;
|
|
924
924
|
```
|
|
925
925
|
|
|
926
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
926
|
+
Defined in: [data-structures/heap/heap.ts:730](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L730)
|
|
927
927
|
|
|
928
928
|
Check if an equal element exists in the heap.
|
|
929
929
|
|
|
@@ -968,7 +968,7 @@ Time O(N), Space O(1)
|
|
|
968
968
|
isEmpty(): boolean;
|
|
969
969
|
```
|
|
970
970
|
|
|
971
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
971
|
+
Defined in: [data-structures/heap/heap.ts:628](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L628)
|
|
972
972
|
|
|
973
973
|
Check whether the heap is empty.
|
|
974
974
|
|
|
@@ -1009,7 +1009,7 @@ map<EM, RM>(
|
|
|
1009
1009
|
thisArg?): Heap<EM, RM>;
|
|
1010
1010
|
```
|
|
1011
1011
|
|
|
1012
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1012
|
+
Defined in: [data-structures/heap/heap.ts:1133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1133)
|
|
1013
1013
|
|
|
1014
1014
|
Map elements into a new heap of possibly different element type.
|
|
1015
1015
|
|
|
@@ -1076,7 +1076,7 @@ Time O(N log N), Space O(N)
|
|
|
1076
1076
|
mapSame(callback, thisArg?): this;
|
|
1077
1077
|
```
|
|
1078
1078
|
|
|
1079
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1079
|
+
Defined in: [data-structures/heap/heap.ts:1157](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1157)
|
|
1080
1080
|
|
|
1081
1081
|
Map elements into a new heap of the same element type.
|
|
1082
1082
|
|
|
@@ -1116,7 +1116,7 @@ Time O(N log N), Space O(N)
|
|
|
1116
1116
|
peek(): E | undefined;
|
|
1117
1117
|
```
|
|
1118
1118
|
|
|
1119
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1119
|
+
Defined in: [data-structures/heap/heap.ts:579](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L579)
|
|
1120
1120
|
|
|
1121
1121
|
Get the current top element without removing it.
|
|
1122
1122
|
|
|
@@ -1203,7 +1203,7 @@ Time O(1), Space O(1)
|
|
|
1203
1203
|
poll(): E | undefined;
|
|
1204
1204
|
```
|
|
1205
1205
|
|
|
1206
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1206
|
+
Defined in: [data-structures/heap/heap.ts:468](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L468)
|
|
1207
1207
|
|
|
1208
1208
|
Remove and return the top element.
|
|
1209
1209
|
|
|
@@ -1256,7 +1256,7 @@ Time O(log N), Space O(1)
|
|
|
1256
1256
|
print(): void;
|
|
1257
1257
|
```
|
|
1258
1258
|
|
|
1259
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1259
|
+
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)
|
|
1260
1260
|
|
|
1261
1261
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1262
1262
|
|
|
@@ -1314,7 +1314,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1314
1314
|
reduce(callbackfn): E;
|
|
1315
1315
|
```
|
|
1316
1316
|
|
|
1317
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1317
|
+
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)
|
|
1318
1318
|
|
|
1319
1319
|
##### Parameters
|
|
1320
1320
|
|
|
@@ -1336,7 +1336,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
1336
1336
|
reduce(callbackfn, initialValue): E;
|
|
1337
1337
|
```
|
|
1338
1338
|
|
|
1339
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1339
|
+
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)
|
|
1340
1340
|
|
|
1341
1341
|
##### Parameters
|
|
1342
1342
|
|
|
@@ -1362,7 +1362,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1362
1362
|
reduce<U>(callbackfn, initialValue): U;
|
|
1363
1363
|
```
|
|
1364
1364
|
|
|
1365
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1365
|
+
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)
|
|
1366
1366
|
|
|
1367
1367
|
##### Type Parameters
|
|
1368
1368
|
|
|
@@ -1396,7 +1396,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1396
1396
|
refill(elements): boolean[];
|
|
1397
1397
|
```
|
|
1398
1398
|
|
|
1399
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1399
|
+
Defined in: [data-structures/heap/heap.ts:687](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L687)
|
|
1400
1400
|
|
|
1401
1401
|
Replace the backing array and rebuild the heap.
|
|
1402
1402
|
|
|
@@ -1426,7 +1426,7 @@ Time O(N), Space O(N)
|
|
|
1426
1426
|
setEquality(equals): this;
|
|
1427
1427
|
```
|
|
1428
1428
|
|
|
1429
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1429
|
+
Defined in: [data-structures/heap/heap.ts:835](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L835)
|
|
1430
1430
|
|
|
1431
1431
|
Set the equality comparator used by has/delete operations.
|
|
1432
1432
|
|
|
@@ -1456,7 +1456,7 @@ Time O(1), Space O(1)
|
|
|
1456
1456
|
some(predicate, thisArg?): boolean;
|
|
1457
1457
|
```
|
|
1458
1458
|
|
|
1459
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1459
|
+
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)
|
|
1460
1460
|
|
|
1461
1461
|
Tests whether at least one element satisfies the predicate.
|
|
1462
1462
|
|
|
@@ -1496,7 +1496,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1496
1496
|
sort(): E[];
|
|
1497
1497
|
```
|
|
1498
1498
|
|
|
1499
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1499
|
+
Defined in: [data-structures/heap/heap.ts:963](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L963)
|
|
1500
1500
|
|
|
1501
1501
|
Return all elements in ascending order by repeatedly polling.
|
|
1502
1502
|
|
|
@@ -1529,7 +1529,7 @@ Time O(N log N), Space O(N)
|
|
|
1529
1529
|
toArray(): E[];
|
|
1530
1530
|
```
|
|
1531
1531
|
|
|
1532
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1532
|
+
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)
|
|
1533
1533
|
|
|
1534
1534
|
Materializes the elements into a new array.
|
|
1535
1535
|
|
|
@@ -1555,7 +1555,7 @@ Time O(n), Space O(n).
|
|
|
1555
1555
|
toVisual(): E[];
|
|
1556
1556
|
```
|
|
1557
1557
|
|
|
1558
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1558
|
+
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)
|
|
1559
1559
|
|
|
1560
1560
|
Returns a representation of the structure suitable for quick visualization.
|
|
1561
1561
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1582,7 +1582,7 @@ Time O(n), Space O(n).
|
|
|
1582
1582
|
values(): IterableIterator<E>;
|
|
1583
1583
|
```
|
|
1584
1584
|
|
|
1585
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1585
|
+
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)
|
|
1586
1586
|
|
|
1587
1587
|
Returns an iterator over the values (alias of the default iterator).
|
|
1588
1588
|
|
|
@@ -1611,7 +1611,7 @@ static from<T, R, S>(
|
|
|
1611
1611
|
options?): S;
|
|
1612
1612
|
```
|
|
1613
1613
|
|
|
1614
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1614
|
+
Defined in: [data-structures/heap/heap.ts:259](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L259)
|
|
1615
1615
|
|
|
1616
1616
|
Create a heap of the same class from an iterable.
|
|
1617
1617
|
|
|
@@ -1665,7 +1665,7 @@ Time O(N), Space O(N)
|
|
|
1665
1665
|
static heapify<EE, RR>(elements, options): Heap<EE, RR>;
|
|
1666
1666
|
```
|
|
1667
1667
|
|
|
1668
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1668
|
+
Defined in: [data-structures/heap/heap.ts:277](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L277)
|
|
1669
1669
|
|
|
1670
1670
|
Build a Heap from an iterable in linear time given a comparator.
|
|
1671
1671
|
|
|
@@ -1714,7 +1714,7 @@ Time O(N), Space O(N)
|
|
|
1714
1714
|
protected optional _toElementFn?: (rawElement) => E;
|
|
1715
1715
|
```
|
|
1716
1716
|
|
|
1717
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1717
|
+
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)
|
|
1718
1718
|
|
|
1719
1719
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1720
1720
|
|
|
@@ -1744,7 +1744,7 @@ Time O(1), Space O(1).
|
|
|
1744
1744
|
protected _createInstance(options?): this;
|
|
1745
1745
|
```
|
|
1746
1746
|
|
|
1747
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1747
|
+
Defined in: [data-structures/heap/heap.ts:1230](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1230)
|
|
1748
1748
|
|
|
1749
1749
|
(Protected) Create an empty instance of the same concrete class.
|
|
1750
1750
|
|
|
@@ -1774,7 +1774,7 @@ Time O(1), Space O(1)
|
|
|
1774
1774
|
protected _createLike<EM, RM>(elements?, options?): Heap<EM, RM>;
|
|
1775
1775
|
```
|
|
1776
1776
|
|
|
1777
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1777
|
+
Defined in: [data-structures/heap/heap.ts:1248](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1248)
|
|
1778
1778
|
|
|
1779
1779
|
(Protected) Create a like-kind instance seeded by elements.
|
|
1780
1780
|
|
|
@@ -1820,7 +1820,7 @@ Time O(N log N), Space O(N)
|
|
|
1820
1820
|
protected _getIterator(): IterableIterator<E>;
|
|
1821
1821
|
```
|
|
1822
1822
|
|
|
1823
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1823
|
+
Defined in: [data-structures/heap/heap.ts:1188](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1188)
|
|
1824
1824
|
|
|
1825
1825
|
Internal iterator factory used by the default iterator.
|
|
1826
1826
|
|
|
@@ -1846,7 +1846,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1846
1846
|
protected _spawnLike<EM, RM>(options?): Heap<EM, RM>;
|
|
1847
1847
|
```
|
|
1848
1848
|
|
|
1849
|
-
Defined in: [data-structures/heap/heap.ts:
|
|
1849
|
+
Defined in: [data-structures/heap/heap.ts:1268](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/heap/heap.ts#L1268)
|
|
1850
1850
|
|
|
1851
1851
|
(Protected) Spawn an empty like-kind heap instance.
|
|
1852
1852
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Abstract Class: IterableElementBase\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
9
|
+
Defined in: [data-structures/base/iterable-element-base.ts:15](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L15)
|
|
10
10
|
|
|
11
11
|
Base class that makes a data structure iterable and provides common
|
|
12
12
|
element-wise utilities (e.g., map/filter/reduce/find).
|
|
@@ -51,7 +51,7 @@ The underlying "raw" element type used internally or by converters.
|
|
|
51
51
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
54
|
+
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)
|
|
55
55
|
|
|
56
56
|
Exposes the current `toElementFn`, if configured.
|
|
57
57
|
|
|
@@ -73,7 +73,7 @@ The converter function or `undefined` when not set.
|
|
|
73
73
|
iterator: IterableIterator<E>;
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
76
|
+
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)
|
|
77
77
|
|
|
78
78
|
Returns an iterator over the structure's elements.
|
|
79
79
|
|
|
@@ -109,7 +109,7 @@ Iterable.[iterator]
|
|
|
109
109
|
abstract clear(): void;
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
112
|
+
Defined in: [data-structures/base/iterable-element-base.ts:289](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L289)
|
|
113
113
|
|
|
114
114
|
Removes all elements from the structure.
|
|
115
115
|
|
|
@@ -131,7 +131,7 @@ Expected Time O(1) or O(n) depending on the implementation; Space O(1).
|
|
|
131
131
|
abstract clone(): this;
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
134
|
+
Defined in: [data-structures/base/iterable-element-base.ts:298](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L298)
|
|
135
135
|
|
|
136
136
|
Creates a structural copy with the same element values and configuration.
|
|
137
137
|
|
|
@@ -153,7 +153,7 @@ Expected Time O(n) to copy elements; Space O(n).
|
|
|
153
153
|
every(predicate, thisArg?): boolean;
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
156
|
+
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)
|
|
157
157
|
|
|
158
158
|
Tests whether all elements satisfy the predicate.
|
|
159
159
|
|
|
@@ -189,7 +189,7 @@ Time O(n) in the worst case; may exit early when the first failure is found. Spa
|
|
|
189
189
|
abstract filter(predicate, thisArg?): this;
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
192
|
+
Defined in: [data-structures/base/iterable-element-base.ts:341](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L341)
|
|
193
193
|
|
|
194
194
|
Filters elements using the provided predicate and returns the same concrete structure type.
|
|
195
195
|
|
|
@@ -227,7 +227,7 @@ Time O(n), Space O(k) where `k` is the number of kept elements.
|
|
|
227
227
|
find<S>(predicate, thisArg?): S | undefined;
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
230
|
+
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)
|
|
231
231
|
|
|
232
232
|
Finds the first element that satisfies the predicate and returns it.
|
|
233
233
|
|
|
@@ -269,7 +269,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
269
269
|
find(predicate, thisArg?): E | undefined;
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
272
|
+
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)
|
|
273
273
|
|
|
274
274
|
Finds the first element that satisfies the predicate and returns it.
|
|
275
275
|
|
|
@@ -307,7 +307,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
307
307
|
forEach(callbackfn, thisArg?): void;
|
|
308
308
|
```
|
|
309
309
|
|
|
310
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
310
|
+
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)
|
|
311
311
|
|
|
312
312
|
Invokes a callback for each element in iteration order.
|
|
313
313
|
|
|
@@ -343,7 +343,7 @@ Time O(n), Space O(1).
|
|
|
343
343
|
has(element): boolean;
|
|
344
344
|
```
|
|
345
345
|
|
|
346
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
346
|
+
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L189)
|
|
347
347
|
|
|
348
348
|
Checks whether a strictly-equal element exists in the structure.
|
|
349
349
|
|
|
@@ -373,7 +373,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
373
373
|
abstract isEmpty(): boolean;
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
376
|
+
Defined in: [data-structures/base/iterable-element-base.ts:280](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L280)
|
|
377
377
|
|
|
378
378
|
Indicates whether the structure currently contains no elements.
|
|
379
379
|
|
|
@@ -398,7 +398,7 @@ abstract map<EM, RM>(
|
|
|
398
398
|
thisArg?): IterableElementBase<EM, RM>;
|
|
399
399
|
```
|
|
400
400
|
|
|
401
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
401
|
+
Defined in: [data-structures/base/iterable-element-base.ts:313](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L313)
|
|
402
402
|
|
|
403
403
|
Maps each element to a new element and returns a new iterable structure.
|
|
404
404
|
|
|
@@ -454,7 +454,7 @@ Time O(n), Space O(n).
|
|
|
454
454
|
abstract mapSame(callback, thisArg?): this;
|
|
455
455
|
```
|
|
456
456
|
|
|
457
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
457
|
+
Defined in: [data-structures/base/iterable-element-base.ts:329](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L329)
|
|
458
458
|
|
|
459
459
|
Maps each element to the same element type and returns the same concrete structure type.
|
|
460
460
|
|
|
@@ -490,7 +490,7 @@ Time O(n), Space O(n).
|
|
|
490
490
|
print(): void;
|
|
491
491
|
```
|
|
492
492
|
|
|
493
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
493
|
+
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)
|
|
494
494
|
|
|
495
495
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
496
496
|
|
|
@@ -544,7 +544,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
544
544
|
reduce(callbackfn): E;
|
|
545
545
|
```
|
|
546
546
|
|
|
547
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
547
|
+
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)
|
|
548
548
|
|
|
549
549
|
##### Parameters
|
|
550
550
|
|
|
@@ -562,7 +562,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
562
562
|
reduce(callbackfn, initialValue): E;
|
|
563
563
|
```
|
|
564
564
|
|
|
565
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
565
|
+
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)
|
|
566
566
|
|
|
567
567
|
##### Parameters
|
|
568
568
|
|
|
@@ -584,7 +584,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
584
584
|
reduce<U>(callbackfn, initialValue): U;
|
|
585
585
|
```
|
|
586
586
|
|
|
587
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
587
|
+
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)
|
|
588
588
|
|
|
589
589
|
##### Type Parameters
|
|
590
590
|
|
|
@@ -614,7 +614,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
614
614
|
some(predicate, thisArg?): boolean;
|
|
615
615
|
```
|
|
616
616
|
|
|
617
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
617
|
+
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)
|
|
618
618
|
|
|
619
619
|
Tests whether at least one element satisfies the predicate.
|
|
620
620
|
|
|
@@ -650,7 +650,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
650
650
|
toArray(): E[];
|
|
651
651
|
```
|
|
652
652
|
|
|
653
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
653
|
+
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)
|
|
654
654
|
|
|
655
655
|
Materializes the elements into a new array.
|
|
656
656
|
|
|
@@ -672,7 +672,7 @@ Time O(n), Space O(n).
|
|
|
672
672
|
toVisual(): E[];
|
|
673
673
|
```
|
|
674
674
|
|
|
675
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
675
|
+
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)
|
|
676
676
|
|
|
677
677
|
Returns a representation of the structure suitable for quick visualization.
|
|
678
678
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -695,7 +695,7 @@ Time O(n), Space O(n).
|
|
|
695
695
|
values(): IterableIterator<E>;
|
|
696
696
|
```
|
|
697
697
|
|
|
698
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
698
|
+
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)
|
|
699
699
|
|
|
700
700
|
Returns an iterator over the values (alias of the default iterator).
|
|
701
701
|
|
|
@@ -720,7 +720,7 @@ Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
|
720
720
|
protected new IterableElementBase<E, R>(options?): IterableElementBase<E, R>;
|
|
721
721
|
```
|
|
722
722
|
|
|
723
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
723
|
+
Defined in: [data-structures/base/iterable-element-base.ts:25](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L25)
|
|
724
724
|
|
|
725
725
|
Create a new iterable base.
|
|
726
726
|
|
|
@@ -749,7 +749,7 @@ Time O(1), Space O(1).
|
|
|
749
749
|
protected optional _toElementFn?: (rawElement) => E;
|
|
750
750
|
```
|
|
751
751
|
|
|
752
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
752
|
+
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)
|
|
753
753
|
|
|
754
754
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
755
755
|
|
|
@@ -775,7 +775,7 @@ Time O(1), Space O(1).
|
|
|
775
775
|
abstract protected _getIterator(...args): IterableIterator<E>;
|
|
776
776
|
```
|
|
777
777
|
|
|
778
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
778
|
+
Defined in: [data-structures/base/iterable-element-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L352)
|
|
779
779
|
|
|
780
780
|
Internal iterator factory used by the default iterator.
|
|
781
781
|
|