data-structure-typed 2.5.2 → 2.6.0
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/.husky/pre-commit +3 -0
- package/CHANGELOG.md +3 -1
- package/MIGRATION.md +217 -0
- package/README.md +80 -8
- package/README_CN.md +569 -143
- package/SPECIFICATION.md +44 -14
- package/SPECIFICATION.zh-CN.md +44 -14
- package/dist/cjs/binary-tree.cjs +5841 -1678
- package/dist/cjs/graph.cjs +422 -14
- package/dist/cjs/hash.cjs +95 -7
- package/dist/cjs/heap.cjs +174 -16
- package/dist/cjs/index.cjs +7751 -2449
- package/dist/cjs/linked-list.cjs +443 -2
- package/dist/cjs/matrix.cjs +56 -0
- package/dist/cjs/priority-queue.cjs +172 -14
- package/dist/cjs/queue.cjs +435 -0
- package/dist/cjs/stack.cjs +103 -4
- package/dist/cjs/trie.cjs +106 -0
- package/dist/cjs-legacy/binary-tree.cjs +5933 -1772
- package/dist/cjs-legacy/graph.cjs +422 -14
- package/dist/cjs-legacy/hash.cjs +95 -7
- package/dist/cjs-legacy/heap.cjs +174 -16
- package/dist/cjs-legacy/index.cjs +8154 -2854
- package/dist/cjs-legacy/linked-list.cjs +443 -2
- package/dist/cjs-legacy/matrix.cjs +56 -0
- package/dist/cjs-legacy/priority-queue.cjs +172 -14
- package/dist/cjs-legacy/queue.cjs +435 -0
- package/dist/cjs-legacy/stack.cjs +103 -4
- package/dist/cjs-legacy/trie.cjs +106 -0
- package/dist/esm/binary-tree.mjs +5841 -1678
- package/dist/esm/graph.mjs +422 -14
- package/dist/esm/hash.mjs +95 -7
- package/dist/esm/heap.mjs +174 -16
- package/dist/esm/index.mjs +7751 -2449
- package/dist/esm/linked-list.mjs +443 -2
- package/dist/esm/matrix.mjs +56 -0
- package/dist/esm/priority-queue.mjs +172 -14
- package/dist/esm/queue.mjs +435 -0
- package/dist/esm/stack.mjs +103 -4
- package/dist/esm/trie.mjs +106 -0
- package/dist/esm-legacy/binary-tree.mjs +5933 -1772
- package/dist/esm-legacy/graph.mjs +422 -14
- package/dist/esm-legacy/hash.mjs +95 -7
- package/dist/esm-legacy/heap.mjs +174 -16
- package/dist/esm-legacy/index.mjs +8154 -2854
- package/dist/esm-legacy/linked-list.mjs +443 -2
- package/dist/esm-legacy/matrix.mjs +56 -0
- package/dist/esm-legacy/priority-queue.mjs +172 -14
- package/dist/esm-legacy/queue.mjs +435 -0
- package/dist/esm-legacy/stack.mjs +103 -4
- package/dist/esm-legacy/trie.mjs +106 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +191 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1061 -167
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1232 -355
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +916 -194
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1078 -141
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +150 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +171 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/data-structure-typed.js +7784 -2484
- package/dist/umd/data-structure-typed.min.js +4 -4
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
- package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
- 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 +143 -155
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +46 -42
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
- package/docs-site-docusaurus/docs/api/classes/Queue.md +111 -59
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
- package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
- package/docs-site-docusaurus/docs/guide/faq.md +53 -0
- package/docs-site-docusaurus/docs/guide/guides.md +8 -9
- package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
- package/docs-site-docusaurus/docs/guide/overview.md +131 -17
- package/docs-site-docusaurus/src/pages/index.tsx +4 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/jest.integration.config.js +1 -2
- package/package.json +10 -7
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +88 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +98 -0
- package/src/data-structures/binary-tree/binary-tree.ts +242 -81
- package/src/data-structures/binary-tree/bst.ts +173 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +139 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +948 -36
- package/src/data-structures/binary-tree/tree-multi-map.ts +893 -13
- package/src/data-structures/binary-tree/tree-multi-set.ts +761 -33
- package/src/data-structures/binary-tree/tree-set.ts +1260 -251
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +100 -12
- package/src/data-structures/heap/heap.ts +149 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +178 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +126 -0
- package/src/data-structures/matrix/matrix.ts +56 -0
- package/src/data-structures/queue/deque.ts +187 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +84 -0
- package/src/interfaces/binary-tree.ts +1 -9
- package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Abstract Class: LinearBase\<E, R, NODE\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/base/linear-base.ts:68](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/base/linear-base.ts:68](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L68)
|
|
10
10
|
|
|
11
11
|
Abstract linear container with array-like utilities.
|
|
12
12
|
|
|
@@ -52,7 +52,7 @@ Linked node type used by some implementations.
|
|
|
52
52
|
new LinearBase<E, R, NODE>(options?): LinearBase<E, R, NODE>;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Defined in: [data-structures/base/linear-base.ts:78](https://github.com/zrwusa/data-structure-typed/blob/
|
|
55
|
+
Defined in: [data-structures/base/linear-base.ts:78](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L78)
|
|
56
56
|
|
|
57
57
|
Construct a linear container with runtime options.
|
|
58
58
|
|
|
@@ -86,7 +86,7 @@ Time O(1), Space O(1)
|
|
|
86
86
|
get abstract length(): number;
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
Defined in: [data-structures/base/linear-base.ts:91](https://github.com/zrwusa/data-structure-typed/blob/
|
|
89
|
+
Defined in: [data-structures/base/linear-base.ts:91](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L91)
|
|
90
90
|
|
|
91
91
|
Element count.
|
|
92
92
|
|
|
@@ -110,7 +110,7 @@ Number of elements.
|
|
|
110
110
|
get maxLen(): number;
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/
|
|
113
|
+
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L100)
|
|
114
114
|
|
|
115
115
|
Upper bound for length (if positive), or `-1` when unbounded.
|
|
116
116
|
|
|
@@ -134,7 +134,7 @@ Maximum allowed length.
|
|
|
134
134
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/
|
|
137
|
+
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L48)
|
|
138
138
|
|
|
139
139
|
Exposes the current `toElementFn`, if configured.
|
|
140
140
|
|
|
@@ -160,7 +160,7 @@ The converter function or `undefined` when not set.
|
|
|
160
160
|
iterator: IterableIterator<E>;
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/
|
|
163
|
+
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L61)
|
|
164
164
|
|
|
165
165
|
Returns an iterator over the structure's elements.
|
|
166
166
|
|
|
@@ -194,7 +194,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
194
194
|
abstract addAt(index, newElementOrNode): boolean;
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
Defined in: [data-structures/base/linear-base.ts:377](https://github.com/zrwusa/data-structure-typed/blob/
|
|
197
|
+
Defined in: [data-structures/base/linear-base.ts:377](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L377)
|
|
198
198
|
|
|
199
199
|
Insert an element/node at a position.
|
|
200
200
|
|
|
@@ -230,7 +230,7 @@ Time O(1)~O(n) depending on implementation, Space O(1)
|
|
|
230
230
|
abstract at(index): E | undefined;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [data-structures/base/linear-base.ts:360](https://github.com/zrwusa/data-structure-typed/blob/
|
|
233
|
+
Defined in: [data-structures/base/linear-base.ts:360](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L360)
|
|
234
234
|
|
|
235
235
|
Get element at an index.
|
|
236
236
|
|
|
@@ -260,7 +260,7 @@ Time O(1)~O(n) depending on implementation, Space O(1)
|
|
|
260
260
|
abstract clear(): void;
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
-
Defined in: [data-structures/base/iterable-element-base.ts:289](https://github.com/zrwusa/data-structure-typed/blob/
|
|
263
|
+
Defined in: [data-structures/base/iterable-element-base.ts:289](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L289)
|
|
264
264
|
|
|
265
265
|
Removes all elements from the structure.
|
|
266
266
|
|
|
@@ -286,7 +286,7 @@ Expected Time O(1) or O(n) depending on the implementation; Space O(1).
|
|
|
286
286
|
abstract clone(): this;
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
Defined in: [data-structures/base/linear-base.ts:321](https://github.com/zrwusa/data-structure-typed/blob/
|
|
289
|
+
Defined in: [data-structures/base/linear-base.ts:321](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L321)
|
|
290
290
|
|
|
291
291
|
Deep clone while preserving concrete subtype.
|
|
292
292
|
|
|
@@ -312,7 +312,7 @@ Time O(n), Space O(n)
|
|
|
312
312
|
concat(...items): this;
|
|
313
313
|
```
|
|
314
314
|
|
|
315
|
-
Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/
|
|
315
|
+
Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L165)
|
|
316
316
|
|
|
317
317
|
Concatenate elements and/or containers.
|
|
318
318
|
|
|
@@ -342,7 +342,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
342
342
|
abstract delete(elementOrNode): boolean;
|
|
343
343
|
```
|
|
344
344
|
|
|
345
|
-
Defined in: [data-structures/base/linear-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/
|
|
345
|
+
Defined in: [data-structures/base/linear-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L352)
|
|
346
346
|
|
|
347
347
|
Remove one element or node if present.
|
|
348
348
|
|
|
@@ -372,7 +372,7 @@ Time O(1)~O(n) depending on implementation, Space O(1)
|
|
|
372
372
|
abstract deleteAt(pos): E | undefined;
|
|
373
373
|
```
|
|
374
374
|
|
|
375
|
-
Defined in: [data-structures/base/linear-base.ts:368](https://github.com/zrwusa/data-structure-typed/blob/
|
|
375
|
+
Defined in: [data-structures/base/linear-base.ts:368](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L368)
|
|
376
376
|
|
|
377
377
|
Remove element at a position.
|
|
378
378
|
|
|
@@ -402,7 +402,7 @@ Time O(1)~O(n) depending on implementation, Space O(1)
|
|
|
402
402
|
every(predicate, thisArg?): boolean;
|
|
403
403
|
```
|
|
404
404
|
|
|
405
|
-
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/
|
|
405
|
+
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L87)
|
|
406
406
|
|
|
407
407
|
Tests whether all elements satisfy the predicate.
|
|
408
408
|
|
|
@@ -445,7 +445,7 @@ fill(
|
|
|
445
445
|
end?): this;
|
|
446
446
|
```
|
|
447
447
|
|
|
448
|
-
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/
|
|
448
|
+
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L292)
|
|
449
449
|
|
|
450
450
|
Fill a range with a value.
|
|
451
451
|
|
|
@@ -487,7 +487,7 @@ Time O(n), Space O(1)
|
|
|
487
487
|
abstract filter(predicate, thisArg?): this;
|
|
488
488
|
```
|
|
489
489
|
|
|
490
|
-
Defined in: [data-structures/base/iterable-element-base.ts:341](https://github.com/zrwusa/data-structure-typed/blob/
|
|
490
|
+
Defined in: [data-structures/base/iterable-element-base.ts:341](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L341)
|
|
491
491
|
|
|
492
492
|
Filters elements using the provided predicate and returns the same concrete structure type.
|
|
493
493
|
|
|
@@ -529,7 +529,7 @@ Time O(n), Space O(k) where `k` is the number of kept elements.
|
|
|
529
529
|
find<S>(predicate, thisArg?): S | undefined;
|
|
530
530
|
```
|
|
531
531
|
|
|
532
|
-
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/
|
|
532
|
+
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L163)
|
|
533
533
|
|
|
534
534
|
Finds the first element that satisfies the predicate and returns it.
|
|
535
535
|
|
|
@@ -575,7 +575,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
575
575
|
find(predicate, thisArg?): E | undefined;
|
|
576
576
|
```
|
|
577
577
|
|
|
578
|
-
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/
|
|
578
|
+
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L164)
|
|
579
579
|
|
|
580
580
|
Finds the first element that satisfies the predicate and returns it.
|
|
581
581
|
|
|
@@ -617,7 +617,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
617
617
|
findIndex(predicate, thisArg?): number;
|
|
618
618
|
```
|
|
619
619
|
|
|
620
|
-
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/
|
|
620
|
+
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L151)
|
|
621
621
|
|
|
622
622
|
Find the first index matching a predicate.
|
|
623
623
|
|
|
@@ -653,7 +653,7 @@ Time O(n), Space O(1)
|
|
|
653
653
|
forEach(callbackfn, thisArg?): void;
|
|
654
654
|
```
|
|
655
655
|
|
|
656
|
-
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/
|
|
656
|
+
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L133)
|
|
657
657
|
|
|
658
658
|
Invokes a callback for each element in iteration order.
|
|
659
659
|
|
|
@@ -693,7 +693,7 @@ Time O(n), Space O(1).
|
|
|
693
693
|
has(element): boolean;
|
|
694
694
|
```
|
|
695
695
|
|
|
696
|
-
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/
|
|
696
|
+
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L189)
|
|
697
697
|
|
|
698
698
|
Checks whether a strictly-equal element exists in the structure.
|
|
699
699
|
|
|
@@ -727,7 +727,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
727
727
|
indexOf(searchElement, fromIndex?): number;
|
|
728
728
|
```
|
|
729
729
|
|
|
730
|
-
Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/
|
|
730
|
+
Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L111)
|
|
731
731
|
|
|
732
732
|
First index of a value from the left.
|
|
733
733
|
|
|
@@ -763,7 +763,7 @@ Time O(n), Space O(1)
|
|
|
763
763
|
abstract isEmpty(): boolean;
|
|
764
764
|
```
|
|
765
765
|
|
|
766
|
-
Defined in: [data-structures/base/iterable-element-base.ts:280](https://github.com/zrwusa/data-structure-typed/blob/
|
|
766
|
+
Defined in: [data-structures/base/iterable-element-base.ts:280](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L280)
|
|
767
767
|
|
|
768
768
|
Indicates whether the structure currently contains no elements.
|
|
769
769
|
|
|
@@ -789,7 +789,7 @@ Expected Time O(1), Space O(1) for most implementations.
|
|
|
789
789
|
join(separator?): string;
|
|
790
790
|
```
|
|
791
791
|
|
|
792
|
-
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/
|
|
792
|
+
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L228)
|
|
793
793
|
|
|
794
794
|
Join all elements into a string.
|
|
795
795
|
|
|
@@ -819,7 +819,7 @@ Time O(n), Space O(n)
|
|
|
819
819
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
820
820
|
```
|
|
821
821
|
|
|
822
|
-
Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/
|
|
822
|
+
Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L131)
|
|
823
823
|
|
|
824
824
|
Last index of a value from the right.
|
|
825
825
|
|
|
@@ -858,7 +858,7 @@ abstract map<EM, RM>(
|
|
|
858
858
|
thisArg?): IterableElementBase<EM, RM>;
|
|
859
859
|
```
|
|
860
860
|
|
|
861
|
-
Defined in: [data-structures/base/iterable-element-base.ts:313](https://github.com/zrwusa/data-structure-typed/blob/
|
|
861
|
+
Defined in: [data-structures/base/iterable-element-base.ts:313](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L313)
|
|
862
862
|
|
|
863
863
|
Maps each element to a new element and returns a new iterable structure.
|
|
864
864
|
|
|
@@ -918,7 +918,7 @@ Time O(n), Space O(n).
|
|
|
918
918
|
abstract mapSame(callback, thisArg?): this;
|
|
919
919
|
```
|
|
920
920
|
|
|
921
|
-
Defined in: [data-structures/base/iterable-element-base.ts:329](https://github.com/zrwusa/data-structure-typed/blob/
|
|
921
|
+
Defined in: [data-structures/base/iterable-element-base.ts:329](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L329)
|
|
922
922
|
|
|
923
923
|
Maps each element to the same element type and returns the same concrete structure type.
|
|
924
924
|
|
|
@@ -958,7 +958,7 @@ Time O(n), Space O(n).
|
|
|
958
958
|
print(): void;
|
|
959
959
|
```
|
|
960
960
|
|
|
961
|
-
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/
|
|
961
|
+
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L269)
|
|
962
962
|
|
|
963
963
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
964
964
|
|
|
@@ -984,7 +984,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
984
984
|
abstract push(elementOrNode): boolean;
|
|
985
985
|
```
|
|
986
986
|
|
|
987
|
-
Defined in: [data-structures/base/linear-base.ts:336](https://github.com/zrwusa/data-structure-typed/blob/
|
|
987
|
+
Defined in: [data-structures/base/linear-base.ts:336](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L336)
|
|
988
988
|
|
|
989
989
|
Append one element or node to the tail.
|
|
990
990
|
|
|
@@ -1014,7 +1014,7 @@ Time O(1) amortized typical, Space O(1)
|
|
|
1014
1014
|
abstract pushMany(elements): boolean[];
|
|
1015
1015
|
```
|
|
1016
1016
|
|
|
1017
|
-
Defined in: [data-structures/base/linear-base.ts:344](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1017
|
+
Defined in: [data-structures/base/linear-base.ts:344](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L344)
|
|
1018
1018
|
|
|
1019
1019
|
Append many elements/nodes at once.
|
|
1020
1020
|
|
|
@@ -1078,7 +1078,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1078
1078
|
reduce(callbackfn): E;
|
|
1079
1079
|
```
|
|
1080
1080
|
|
|
1081
|
-
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1081
|
+
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L194)
|
|
1082
1082
|
|
|
1083
1083
|
##### Parameters
|
|
1084
1084
|
|
|
@@ -1100,7 +1100,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1100
1100
|
reduce(callbackfn, initialValue): E;
|
|
1101
1101
|
```
|
|
1102
1102
|
|
|
1103
|
-
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1103
|
+
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L195)
|
|
1104
1104
|
|
|
1105
1105
|
##### Parameters
|
|
1106
1106
|
|
|
@@ -1126,7 +1126,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1126
1126
|
reduce<U>(callbackfn, initialValue): U;
|
|
1127
1127
|
```
|
|
1128
1128
|
|
|
1129
|
-
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1129
|
+
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L196)
|
|
1130
1130
|
|
|
1131
1131
|
##### Type Parameters
|
|
1132
1132
|
|
|
@@ -1160,7 +1160,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1160
1160
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1161
1161
|
```
|
|
1162
1162
|
|
|
1163
|
-
Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1163
|
+
Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L256)
|
|
1164
1164
|
|
|
1165
1165
|
Right-to-left reduction over elements.
|
|
1166
1166
|
|
|
@@ -1202,7 +1202,7 @@ Time O(n), Space O(1)
|
|
|
1202
1202
|
abstract reverse(): this;
|
|
1203
1203
|
```
|
|
1204
1204
|
|
|
1205
|
-
Defined in: [data-structures/base/linear-base.ts:328](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1205
|
+
Defined in: [data-structures/base/linear-base.ts:328](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L328)
|
|
1206
1206
|
|
|
1207
1207
|
Reverse the order of elements in-place (or equivalent).
|
|
1208
1208
|
|
|
@@ -1224,7 +1224,7 @@ Time O(n), Space O(1)
|
|
|
1224
1224
|
abstract setAt(index, value): boolean;
|
|
1225
1225
|
```
|
|
1226
1226
|
|
|
1227
|
-
Defined in: [data-structures/base/linear-base.ts:314](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1227
|
+
Defined in: [data-structures/base/linear-base.ts:314](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L314)
|
|
1228
1228
|
|
|
1229
1229
|
Set the value at an index.
|
|
1230
1230
|
|
|
@@ -1260,7 +1260,7 @@ Time O(1) typical, Space O(1)
|
|
|
1260
1260
|
slice(start?, end?): this;
|
|
1261
1261
|
```
|
|
1262
1262
|
|
|
1263
|
-
Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1263
|
+
Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L273)
|
|
1264
1264
|
|
|
1265
1265
|
Create a shallow copy of a subrange.
|
|
1266
1266
|
|
|
@@ -1296,7 +1296,7 @@ Time O(n), Space O(n)
|
|
|
1296
1296
|
some(predicate, thisArg?): boolean;
|
|
1297
1297
|
```
|
|
1298
1298
|
|
|
1299
|
-
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1299
|
+
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L110)
|
|
1300
1300
|
|
|
1301
1301
|
Tests whether at least one element satisfies the predicate.
|
|
1302
1302
|
|
|
@@ -1336,7 +1336,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1336
1336
|
sort(compareFn?): this;
|
|
1337
1337
|
```
|
|
1338
1338
|
|
|
1339
|
-
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1339
|
+
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L185)
|
|
1340
1340
|
|
|
1341
1341
|
In-place stable order via array sort semantics.
|
|
1342
1342
|
|
|
@@ -1369,7 +1369,7 @@ splice(
|
|
|
1369
1369
|
items): this;
|
|
1370
1370
|
```
|
|
1371
1371
|
|
|
1372
|
-
Defined in: [data-structures/base/linear-base.ts:201](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1372
|
+
Defined in: [data-structures/base/linear-base.ts:201](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L201)
|
|
1373
1373
|
|
|
1374
1374
|
Remove and/or insert elements at a position (array-compatible).
|
|
1375
1375
|
|
|
@@ -1411,7 +1411,7 @@ Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
|
1411
1411
|
toArray(): E[];
|
|
1412
1412
|
```
|
|
1413
1413
|
|
|
1414
|
-
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1414
|
+
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L246)
|
|
1415
1415
|
|
|
1416
1416
|
Materializes the elements into a new array.
|
|
1417
1417
|
|
|
@@ -1437,7 +1437,7 @@ Time O(n), Space O(n).
|
|
|
1437
1437
|
toReversedArray(): E[];
|
|
1438
1438
|
```
|
|
1439
1439
|
|
|
1440
|
-
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1440
|
+
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L237)
|
|
1441
1441
|
|
|
1442
1442
|
Snapshot elements into a reversed array.
|
|
1443
1443
|
|
|
@@ -1459,7 +1459,7 @@ Time O(n), Space O(n)
|
|
|
1459
1459
|
toVisual(): E[];
|
|
1460
1460
|
```
|
|
1461
1461
|
|
|
1462
|
-
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1462
|
+
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L258)
|
|
1463
1463
|
|
|
1464
1464
|
Returns a representation of the structure suitable for quick visualization.
|
|
1465
1465
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -1486,7 +1486,7 @@ Time O(n), Space O(n).
|
|
|
1486
1486
|
values(): IterableIterator<E>;
|
|
1487
1487
|
```
|
|
1488
1488
|
|
|
1489
|
-
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1489
|
+
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L72)
|
|
1490
1490
|
|
|
1491
1491
|
Returns an iterator over the values (alias of the default iterator).
|
|
1492
1492
|
|
|
@@ -1515,7 +1515,7 @@ Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
|
1515
1515
|
protected optional _toElementFn?: (rawElement) => E;
|
|
1516
1516
|
```
|
|
1517
1517
|
|
|
1518
|
-
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1518
|
+
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L39)
|
|
1519
1519
|
|
|
1520
1520
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1521
1521
|
|
|
@@ -1545,7 +1545,7 @@ Time O(1), Space O(1).
|
|
|
1545
1545
|
abstract protected _createInstance(options?): this;
|
|
1546
1546
|
```
|
|
1547
1547
|
|
|
1548
|
-
Defined in: [data-structures/base/linear-base.ts:385](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1548
|
+
Defined in: [data-structures/base/linear-base.ts:385](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L385)
|
|
1549
1549
|
|
|
1550
1550
|
Create an empty list of the same species.
|
|
1551
1551
|
|
|
@@ -1575,7 +1575,7 @@ Time O(1), Space O(1)
|
|
|
1575
1575
|
abstract protected _getIterator(...args): IterableIterator<E>;
|
|
1576
1576
|
```
|
|
1577
1577
|
|
|
1578
|
-
Defined in: [data-structures/base/iterable-element-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1578
|
+
Defined in: [data-structures/base/iterable-element-base.ts:352](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L352)
|
|
1579
1579
|
|
|
1580
1580
|
Internal iterator factory used by the default iterator.
|
|
1581
1581
|
|
|
@@ -1609,7 +1609,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
1609
1609
|
abstract protected _getReverseIterator(...args): IterableIterator<E>;
|
|
1610
1610
|
```
|
|
1611
1611
|
|
|
1612
|
-
Defined in: [data-structures/base/linear-base.ts:392](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1612
|
+
Defined in: [data-structures/base/linear-base.ts:392](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L392)
|
|
1613
1613
|
|
|
1614
1614
|
Reverse-direction iterator over elements.
|
|
1615
1615
|
|