data-structure-typed 2.5.2 → 2.5.3
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/MIGRATION.md +169 -0
- package/README.md +60 -6
- package/README_CN.md +551 -143
- package/SPECIFICATION.md +20 -14
- package/SPECIFICATION.zh-CN.md +20 -14
- package/dist/cjs/binary-tree.cjs +2417 -132
- package/dist/cjs/graph.cjs +248 -14
- package/dist/cjs/hash.cjs +62 -7
- package/dist/cjs/heap.cjs +103 -16
- package/dist/cjs/index.cjs +3046 -124
- package/dist/cjs/linked-list.cjs +219 -0
- package/dist/cjs/matrix.cjs +32 -0
- package/dist/cjs/priority-queue.cjs +101 -14
- package/dist/cjs/queue.cjs +215 -0
- package/dist/cjs/stack.cjs +44 -4
- package/dist/cjs/trie.cjs +44 -0
- package/dist/cjs-legacy/binary-tree.cjs +2406 -123
- package/dist/cjs-legacy/graph.cjs +248 -14
- package/dist/cjs-legacy/hash.cjs +62 -7
- package/dist/cjs-legacy/heap.cjs +103 -16
- package/dist/cjs-legacy/index.cjs +3105 -185
- package/dist/cjs-legacy/linked-list.cjs +219 -0
- package/dist/cjs-legacy/matrix.cjs +32 -0
- package/dist/cjs-legacy/priority-queue.cjs +101 -14
- package/dist/cjs-legacy/queue.cjs +215 -0
- package/dist/cjs-legacy/stack.cjs +44 -4
- package/dist/cjs-legacy/trie.cjs +44 -0
- package/dist/esm/binary-tree.mjs +2417 -132
- package/dist/esm/graph.mjs +248 -14
- package/dist/esm/hash.mjs +62 -7
- package/dist/esm/heap.mjs +103 -16
- package/dist/esm/index.mjs +3046 -124
- package/dist/esm/linked-list.mjs +219 -0
- package/dist/esm/matrix.mjs +32 -0
- package/dist/esm/priority-queue.mjs +101 -14
- package/dist/esm/queue.mjs +215 -0
- package/dist/esm/stack.mjs +44 -4
- package/dist/esm/trie.mjs +44 -0
- package/dist/esm-legacy/binary-tree.mjs +2406 -123
- package/dist/esm-legacy/graph.mjs +248 -14
- package/dist/esm-legacy/hash.mjs +62 -7
- package/dist/esm-legacy/heap.mjs +103 -16
- package/dist/esm-legacy/index.mjs +3105 -185
- package/dist/esm-legacy/linked-list.mjs +219 -0
- package/dist/esm-legacy/matrix.mjs +32 -0
- package/dist/esm-legacy/priority-queue.mjs +101 -14
- package/dist/esm-legacy/queue.mjs +215 -0
- package/dist/esm-legacy/stack.mjs +44 -4
- package/dist/esm-legacy/trie.mjs +44 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +50 -2
- 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 +116 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +99 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +79 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +520 -1
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +489 -1
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +393 -1
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +500 -1
- 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 +51 -6
- package/dist/types/data-structures/heap/heap.d.ts +98 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +61 -1
- 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 +82 -0
- package/dist/types/data-structures/queue/queue.d.ts +61 -0
- package/dist/types/data-structures/stack/stack.d.ts +42 -2
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/data-structure-typed.js +3105 -185
- 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 +42 -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/package.json +7 -6
- package/src/data-structures/binary-tree/avl-tree.ts +52 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +56 -0
- package/src/data-structures/binary-tree/binary-tree.ts +167 -81
- package/src/data-structures/binary-tree/bst.ts +101 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +82 -15
- package/src/data-structures/binary-tree/segment-tree.ts +24 -0
- package/src/data-structures/binary-tree/tree-map.ts +540 -3
- package/src/data-structures/binary-tree/tree-multi-map.ts +490 -2
- package/src/data-structures/binary-tree/tree-multi-set.ts +393 -1
- package/src/data-structures/binary-tree/tree-set.ts +520 -3
- package/src/data-structures/graph/directed-graph.ts +41 -1
- package/src/data-structures/graph/undirected-graph.ts +37 -1
- package/src/data-structures/hash/hash-map.ts +67 -12
- package/src/data-structures/heap/heap.ts +107 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +88 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +61 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +72 -0
- package/src/data-structures/matrix/matrix.ts +32 -0
- package/src/data-structures/queue/deque.ts +85 -0
- package/src/data-structures/queue/queue.ts +73 -0
- package/src/data-structures/stack/stack.ts +45 -5
- package/src/data-structures/trie/trie.ts +48 -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
|
# Class: DoublyLinkedList\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:150](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:150](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L150)
|
|
10
10
|
|
|
11
11
|
Doubly linked list with O(1) push/pop/unshift/shift and linear scans.
|
|
12
12
|
|
|
@@ -112,7 +112,7 @@ Caution: Although our linked list classes provide methods such as at, setAt, add
|
|
|
112
112
|
new DoublyLinkedList<E, R>(elements?, options?): DoublyLinkedList<E, R>;
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:161](https://github.com/zrwusa/data-structure-typed/blob/
|
|
115
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:161](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L161)
|
|
116
116
|
|
|
117
117
|
Create a DoublyLinkedList and optionally bulk-insert elements.
|
|
118
118
|
|
|
@@ -158,7 +158,7 @@ LinearLinkedBase<E, R, DoublyLinkedListNode<E>>.constructor
|
|
|
158
158
|
get first(): E | undefined;
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:219](https://github.com/zrwusa/data-structure-typed/blob/
|
|
161
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:219](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L219)
|
|
162
162
|
|
|
163
163
|
Get the first element value.
|
|
164
164
|
|
|
@@ -182,7 +182,7 @@ First element or undefined.
|
|
|
182
182
|
get head(): DoublyLinkedListNode<E> | undefined;
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:185](https://github.com/zrwusa/data-structure-typed/blob/
|
|
185
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:185](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L185)
|
|
186
186
|
|
|
187
187
|
Get the head node.
|
|
188
188
|
|
|
@@ -206,7 +206,7 @@ Head node or undefined.
|
|
|
206
206
|
get last(): E | undefined;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:229](https://github.com/zrwusa/data-structure-typed/blob/
|
|
209
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:229](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L229)
|
|
210
210
|
|
|
211
211
|
Get the last element value.
|
|
212
212
|
|
|
@@ -230,7 +230,7 @@ Last element or undefined.
|
|
|
230
230
|
get length(): number;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:209](https://github.com/zrwusa/data-structure-typed/blob/
|
|
233
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:209](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L209)
|
|
234
234
|
|
|
235
235
|
Get the number of elements.
|
|
236
236
|
|
|
@@ -258,7 +258,7 @@ Current length.
|
|
|
258
258
|
get maxLen(): number;
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
-
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/
|
|
261
|
+
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)
|
|
262
262
|
|
|
263
263
|
Upper bound for length (if positive), or `-1` when unbounded.
|
|
264
264
|
|
|
@@ -286,7 +286,7 @@ Maximum allowed length.
|
|
|
286
286
|
get tail(): DoublyLinkedListNode<E> | undefined;
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:197](https://github.com/zrwusa/data-structure-typed/blob/
|
|
289
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:197](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L197)
|
|
290
290
|
|
|
291
291
|
Get the tail node.
|
|
292
292
|
|
|
@@ -310,7 +310,7 @@ Tail node or undefined.
|
|
|
310
310
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
-
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/
|
|
313
|
+
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)
|
|
314
314
|
|
|
315
315
|
Exposes the current `toElementFn`, if configured.
|
|
316
316
|
|
|
@@ -336,7 +336,7 @@ The converter function or `undefined` when not set.
|
|
|
336
336
|
iterator: IterableIterator<E>;
|
|
337
337
|
```
|
|
338
338
|
|
|
339
|
-
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/
|
|
339
|
+
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)
|
|
340
340
|
|
|
341
341
|
Returns an iterator over the structure's elements.
|
|
342
342
|
|
|
@@ -370,7 +370,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
370
370
|
addAfter(existingElementOrNode, newElementOrNode): boolean;
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
373
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:829](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L829)
|
|
374
374
|
|
|
375
375
|
Insert a new element/node after an existing one.
|
|
376
376
|
|
|
@@ -410,7 +410,7 @@ Time O(N), Space O(1)
|
|
|
410
410
|
addAt(index, newElementOrNode): boolean;
|
|
411
411
|
```
|
|
412
412
|
|
|
413
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
413
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:778](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L778)
|
|
414
414
|
|
|
415
415
|
Insert a new element/node at an index, shifting following nodes.
|
|
416
416
|
|
|
@@ -461,7 +461,7 @@ Time O(N), Space O(1)
|
|
|
461
461
|
addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
464
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:802](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L802)
|
|
465
465
|
|
|
466
466
|
Insert a new element/node before an existing one.
|
|
467
467
|
|
|
@@ -501,7 +501,7 @@ Time O(N), Space O(1)
|
|
|
501
501
|
at(index): E | undefined;
|
|
502
502
|
```
|
|
503
503
|
|
|
504
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
504
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:629](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L629)
|
|
505
505
|
|
|
506
506
|
Get the element at a given index.
|
|
507
507
|
|
|
@@ -546,7 +546,7 @@ Time O(N), Space O(1)
|
|
|
546
546
|
clear(): void;
|
|
547
547
|
```
|
|
548
548
|
|
|
549
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
549
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1084](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1084)
|
|
550
550
|
|
|
551
551
|
Remove all nodes and reset length.
|
|
552
552
|
|
|
@@ -583,7 +583,7 @@ Time O(N), Space O(1)
|
|
|
583
583
|
clone(): this;
|
|
584
584
|
```
|
|
585
585
|
|
|
586
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
586
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1353](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1353)
|
|
587
587
|
|
|
588
588
|
Deep clone this list (values are copied by reference).
|
|
589
589
|
|
|
@@ -621,7 +621,7 @@ Time O(N), Space O(N)
|
|
|
621
621
|
concat(...items): this;
|
|
622
622
|
```
|
|
623
623
|
|
|
624
|
-
Defined in: [data-structures/base/linear-base.ts:473](https://github.com/zrwusa/data-structure-typed/blob/
|
|
624
|
+
Defined in: [data-structures/base/linear-base.ts:473](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L473)
|
|
625
625
|
|
|
626
626
|
Concatenate lists/elements preserving order.
|
|
627
627
|
|
|
@@ -657,7 +657,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
657
657
|
delete(elementOrNode?): boolean;
|
|
658
658
|
```
|
|
659
659
|
|
|
660
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
660
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:970](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L970)
|
|
661
661
|
|
|
662
662
|
Delete the first match by value/node.
|
|
663
663
|
|
|
@@ -702,7 +702,7 @@ Time O(N), Space O(1)
|
|
|
702
702
|
deleteAt(index): E | undefined;
|
|
703
703
|
```
|
|
704
704
|
|
|
705
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
705
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:908](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L908)
|
|
706
706
|
|
|
707
707
|
Delete the element at an index.
|
|
708
708
|
|
|
@@ -741,13 +741,43 @@ Time O(N), Space O(1)
|
|
|
741
741
|
|
|
742
742
|
***
|
|
743
743
|
|
|
744
|
+
### deleteWhere()
|
|
745
|
+
|
|
746
|
+
```ts
|
|
747
|
+
deleteWhere(predicate): boolean;
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1278](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1278)
|
|
751
|
+
|
|
752
|
+
Delete the first element that satisfies a predicate.
|
|
753
|
+
|
|
754
|
+
#### Parameters
|
|
755
|
+
|
|
756
|
+
##### predicate
|
|
757
|
+
|
|
758
|
+
(`value`, `index`, `list`) => `boolean`
|
|
759
|
+
|
|
760
|
+
Function (value, index, list) → boolean to decide deletion.
|
|
761
|
+
|
|
762
|
+
#### Returns
|
|
763
|
+
|
|
764
|
+
`boolean`
|
|
765
|
+
|
|
766
|
+
True if a match was removed.
|
|
767
|
+
|
|
768
|
+
#### Remarks
|
|
769
|
+
|
|
770
|
+
Time O(N), Space O(1)
|
|
771
|
+
|
|
772
|
+
***
|
|
773
|
+
|
|
744
774
|
### every()
|
|
745
775
|
|
|
746
776
|
```ts
|
|
747
777
|
every(predicate, thisArg?): boolean;
|
|
748
778
|
```
|
|
749
779
|
|
|
750
|
-
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/
|
|
780
|
+
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)
|
|
751
781
|
|
|
752
782
|
Tests whether all elements satisfy the predicate.
|
|
753
783
|
|
|
@@ -790,7 +820,7 @@ fill(
|
|
|
790
820
|
end?): this;
|
|
791
821
|
```
|
|
792
822
|
|
|
793
|
-
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/
|
|
823
|
+
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)
|
|
794
824
|
|
|
795
825
|
Fill a range with a value.
|
|
796
826
|
|
|
@@ -836,7 +866,7 @@ Time O(n), Space O(1)
|
|
|
836
866
|
filter(callback, thisArg?): this;
|
|
837
867
|
```
|
|
838
868
|
|
|
839
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
869
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1411](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1411)
|
|
840
870
|
|
|
841
871
|
Filter values into a new list of the same class.
|
|
842
872
|
|
|
@@ -889,7 +919,7 @@ Time O(N), Space O(N)
|
|
|
889
919
|
find<S>(predicate, thisArg?): S | undefined;
|
|
890
920
|
```
|
|
891
921
|
|
|
892
|
-
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/
|
|
922
|
+
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)
|
|
893
923
|
|
|
894
924
|
Finds the first element that satisfies the predicate and returns it.
|
|
895
925
|
|
|
@@ -935,7 +965,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
935
965
|
find(predicate, thisArg?): E | undefined;
|
|
936
966
|
```
|
|
937
967
|
|
|
938
|
-
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/
|
|
968
|
+
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)
|
|
939
969
|
|
|
940
970
|
Finds the first element that satisfies the predicate and returns it.
|
|
941
971
|
|
|
@@ -977,7 +1007,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
977
1007
|
findIndex(predicate, thisArg?): number;
|
|
978
1008
|
```
|
|
979
1009
|
|
|
980
|
-
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1010
|
+
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)
|
|
981
1011
|
|
|
982
1012
|
Find the first index matching a predicate.
|
|
983
1013
|
|
|
@@ -1017,7 +1047,7 @@ Time O(n), Space O(1)
|
|
|
1017
1047
|
forEach(callbackfn, thisArg?): void;
|
|
1018
1048
|
```
|
|
1019
1049
|
|
|
1020
|
-
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1050
|
+
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)
|
|
1021
1051
|
|
|
1022
1052
|
Invokes a callback for each element in iteration order.
|
|
1023
1053
|
|
|
@@ -1057,7 +1087,7 @@ Time O(n), Space O(1).
|
|
|
1057
1087
|
getBackward(elementNodeOrPredicate): E | undefined;
|
|
1058
1088
|
```
|
|
1059
1089
|
|
|
1060
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1090
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1199](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1199)
|
|
1061
1091
|
|
|
1062
1092
|
Find the first value matching a predicate scanning backward.
|
|
1063
1093
|
|
|
@@ -1101,7 +1131,7 @@ Time O(N), Space O(1)
|
|
|
1101
1131
|
getNode(elementNodeOrPredicate?): DoublyLinkedListNode<E> | undefined;
|
|
1102
1132
|
```
|
|
1103
1133
|
|
|
1104
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1134
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:697](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L697)
|
|
1105
1135
|
|
|
1106
1136
|
Find a node by value, reference, or predicate.
|
|
1107
1137
|
|
|
@@ -1133,7 +1163,7 @@ Time O(N), Space O(1)
|
|
|
1133
1163
|
getNodeAt(index): DoublyLinkedListNode<E> | undefined;
|
|
1134
1164
|
```
|
|
1135
1165
|
|
|
1136
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1166
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:683](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L683)
|
|
1137
1167
|
|
|
1138
1168
|
Get the node reference at a given index.
|
|
1139
1169
|
|
|
@@ -1177,7 +1207,7 @@ Time O(N), Space O(1)
|
|
|
1177
1207
|
has(element): boolean;
|
|
1178
1208
|
```
|
|
1179
1209
|
|
|
1180
|
-
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1210
|
+
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)
|
|
1181
1211
|
|
|
1182
1212
|
Checks whether a strictly-equal element exists in the structure.
|
|
1183
1213
|
|
|
@@ -1211,7 +1241,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1211
1241
|
indexOf(searchElement, fromIndex?): number;
|
|
1212
1242
|
```
|
|
1213
1243
|
|
|
1214
|
-
Defined in: [data-structures/base/linear-base.ts:422](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1244
|
+
Defined in: [data-structures/base/linear-base.ts:422](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L422)
|
|
1215
1245
|
|
|
1216
1246
|
Linked-list optimized `indexOf` (forwards scan).
|
|
1217
1247
|
|
|
@@ -1251,7 +1281,7 @@ Time O(n), Space O(1)
|
|
|
1251
1281
|
isEmpty(): boolean;
|
|
1252
1282
|
```
|
|
1253
1283
|
|
|
1254
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1284
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1032](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1032)
|
|
1255
1285
|
|
|
1256
1286
|
Check whether the list is empty.
|
|
1257
1287
|
|
|
@@ -1286,7 +1316,7 @@ Time O(1), Space O(1)
|
|
|
1286
1316
|
isNode(elementNodeOrPredicate): elementNodeOrPredicate is DoublyLinkedListNode<E>;
|
|
1287
1317
|
```
|
|
1288
1318
|
|
|
1289
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:260](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1319
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:260](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L260)
|
|
1290
1320
|
|
|
1291
1321
|
Type guard: check whether the input is a DoublyLinkedListNode.
|
|
1292
1322
|
|
|
@@ -1318,7 +1348,7 @@ Time O(1), Space O(1)
|
|
|
1318
1348
|
join(separator?): string;
|
|
1319
1349
|
```
|
|
1320
1350
|
|
|
1321
|
-
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1351
|
+
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)
|
|
1322
1352
|
|
|
1323
1353
|
Join all elements into a string.
|
|
1324
1354
|
|
|
@@ -1352,7 +1382,7 @@ Time O(n), Space O(n)
|
|
|
1352
1382
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1353
1383
|
```
|
|
1354
1384
|
|
|
1355
|
-
Defined in: [data-structures/base/linear-base.ts:448](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1385
|
+
Defined in: [data-structures/base/linear-base.ts:448](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L448)
|
|
1356
1386
|
|
|
1357
1387
|
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
1358
1388
|
|
|
@@ -1395,7 +1425,7 @@ map<EM, RM>(
|
|
|
1395
1425
|
thisArg?): DoublyLinkedList<EM, RM>;
|
|
1396
1426
|
```
|
|
1397
1427
|
|
|
1398
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1428
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1500](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1500)
|
|
1399
1429
|
|
|
1400
1430
|
Map values into a new list (possibly different element type).
|
|
1401
1431
|
|
|
@@ -1471,7 +1501,7 @@ Time O(N), Space O(N)
|
|
|
1471
1501
|
mapSame(callback, thisArg?): this;
|
|
1472
1502
|
```
|
|
1473
1503
|
|
|
1474
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1504
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1426](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1426)
|
|
1475
1505
|
|
|
1476
1506
|
Map values into a new list of the same class.
|
|
1477
1507
|
|
|
@@ -1511,7 +1541,7 @@ Time O(N), Space O(N)
|
|
|
1511
1541
|
pop(): E | undefined;
|
|
1512
1542
|
```
|
|
1513
1543
|
|
|
1514
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1544
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:402](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L402)
|
|
1515
1545
|
|
|
1516
1546
|
Remove and return the tail element.
|
|
1517
1547
|
|
|
@@ -1554,7 +1584,7 @@ Time O(1), Space O(1)
|
|
|
1554
1584
|
print(): void;
|
|
1555
1585
|
```
|
|
1556
1586
|
|
|
1557
|
-
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1587
|
+
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)
|
|
1558
1588
|
|
|
1559
1589
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1560
1590
|
|
|
@@ -1580,7 +1610,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1580
1610
|
push(elementOrNode): boolean;
|
|
1581
1611
|
```
|
|
1582
1612
|
|
|
1583
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1613
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:327](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L327)
|
|
1584
1614
|
|
|
1585
1615
|
Append an element/node to the tail.
|
|
1586
1616
|
|
|
@@ -1635,7 +1665,7 @@ Time O(1), Space O(1)
|
|
|
1635
1665
|
pushMany(elements): boolean[];
|
|
1636
1666
|
```
|
|
1637
1667
|
|
|
1638
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1668
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:553](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L553)
|
|
1639
1669
|
|
|
1640
1670
|
Append a sequence of elements/nodes.
|
|
1641
1671
|
|
|
@@ -1703,7 +1733,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1703
1733
|
reduce(callbackfn): E;
|
|
1704
1734
|
```
|
|
1705
1735
|
|
|
1706
|
-
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1736
|
+
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)
|
|
1707
1737
|
|
|
1708
1738
|
##### Parameters
|
|
1709
1739
|
|
|
@@ -1725,7 +1755,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1725
1755
|
reduce(callbackfn, initialValue): E;
|
|
1726
1756
|
```
|
|
1727
1757
|
|
|
1728
|
-
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1758
|
+
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)
|
|
1729
1759
|
|
|
1730
1760
|
##### Parameters
|
|
1731
1761
|
|
|
@@ -1751,7 +1781,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1751
1781
|
reduce<U>(callbackfn, initialValue): U;
|
|
1752
1782
|
```
|
|
1753
1783
|
|
|
1754
|
-
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1784
|
+
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)
|
|
1755
1785
|
|
|
1756
1786
|
##### Type Parameters
|
|
1757
1787
|
|
|
@@ -1785,7 +1815,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1785
1815
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1786
1816
|
```
|
|
1787
1817
|
|
|
1788
|
-
Defined in: [data-structures/base/linear-base.ts:574](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1818
|
+
Defined in: [data-structures/base/linear-base.ts:574](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L574)
|
|
1789
1819
|
|
|
1790
1820
|
Right-to-left reduction using reverse iterator.
|
|
1791
1821
|
|
|
@@ -1831,7 +1861,7 @@ Time O(n), Space O(1)
|
|
|
1831
1861
|
reverse(): this;
|
|
1832
1862
|
```
|
|
1833
1863
|
|
|
1834
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1864
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1261](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1261)
|
|
1835
1865
|
|
|
1836
1866
|
Reverse the list in place.
|
|
1837
1867
|
|
|
@@ -1868,7 +1898,7 @@ Time O(N), Space O(1)
|
|
|
1868
1898
|
search(elementNodeOrPredicate): E | undefined;
|
|
1869
1899
|
```
|
|
1870
1900
|
|
|
1871
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1901
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1138](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1138)
|
|
1872
1902
|
|
|
1873
1903
|
Find the first value matching a predicate scanning forward.
|
|
1874
1904
|
|
|
@@ -1911,7 +1941,7 @@ Time O(N), Space O(1)
|
|
|
1911
1941
|
setAt(index, value): boolean;
|
|
1912
1942
|
```
|
|
1913
1943
|
|
|
1914
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1944
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:853](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L853)
|
|
1915
1945
|
|
|
1916
1946
|
Set the element value at an index.
|
|
1917
1947
|
|
|
@@ -1951,7 +1981,7 @@ Time O(N), Space O(1)
|
|
|
1951
1981
|
setEquality(equals): this;
|
|
1952
1982
|
```
|
|
1953
1983
|
|
|
1954
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1984
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1299](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1299)
|
|
1955
1985
|
|
|
1956
1986
|
Set the equality comparator used to compare values.
|
|
1957
1987
|
|
|
@@ -1981,7 +2011,7 @@ Time O(1), Space O(1)
|
|
|
1981
2011
|
shift(): E | undefined;
|
|
1982
2012
|
```
|
|
1983
2013
|
|
|
1984
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2014
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:466](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L466)
|
|
1985
2015
|
|
|
1986
2016
|
Remove and return the head element.
|
|
1987
2017
|
|
|
@@ -2014,7 +2044,7 @@ Time O(1), Space O(1)
|
|
|
2014
2044
|
slice(start?, end?): this;
|
|
2015
2045
|
```
|
|
2016
2046
|
|
|
2017
|
-
Defined in: [data-structures/base/linear-base.ts:494](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2047
|
+
Defined in: [data-structures/base/linear-base.ts:494](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L494)
|
|
2018
2048
|
|
|
2019
2049
|
Slice via forward iteration (no random access required).
|
|
2020
2050
|
|
|
@@ -2054,7 +2084,7 @@ Time O(n), Space O(n)
|
|
|
2054
2084
|
some(predicate, thisArg?): boolean;
|
|
2055
2085
|
```
|
|
2056
2086
|
|
|
2057
|
-
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2087
|
+
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)
|
|
2058
2088
|
|
|
2059
2089
|
Tests whether at least one element satisfies the predicate.
|
|
2060
2090
|
|
|
@@ -2094,7 +2124,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2094
2124
|
sort(compareFn?): this;
|
|
2095
2125
|
```
|
|
2096
2126
|
|
|
2097
|
-
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2127
|
+
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)
|
|
2098
2128
|
|
|
2099
2129
|
In-place stable order via array sort semantics.
|
|
2100
2130
|
|
|
@@ -2131,7 +2161,7 @@ splice(
|
|
|
2131
2161
|
items): this;
|
|
2132
2162
|
```
|
|
2133
2163
|
|
|
2134
|
-
Defined in: [data-structures/base/linear-base.ts:522](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2164
|
+
Defined in: [data-structures/base/linear-base.ts:522](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L522)
|
|
2135
2165
|
|
|
2136
2166
|
Splice by walking node iterators from the start index.
|
|
2137
2167
|
|
|
@@ -2177,7 +2207,7 @@ Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
|
2177
2207
|
toArray(): E[];
|
|
2178
2208
|
```
|
|
2179
2209
|
|
|
2180
|
-
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2210
|
+
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)
|
|
2181
2211
|
|
|
2182
2212
|
Materializes the elements into a new array.
|
|
2183
2213
|
|
|
@@ -2203,7 +2233,7 @@ Time O(n), Space O(n).
|
|
|
2203
2233
|
toReversedArray(): E[];
|
|
2204
2234
|
```
|
|
2205
2235
|
|
|
2206
|
-
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2236
|
+
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)
|
|
2207
2237
|
|
|
2208
2238
|
Snapshot elements into a reversed array.
|
|
2209
2239
|
|
|
@@ -2229,7 +2259,7 @@ Time O(n), Space O(n)
|
|
|
2229
2259
|
toVisual(): E[];
|
|
2230
2260
|
```
|
|
2231
2261
|
|
|
2232
|
-
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2262
|
+
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)
|
|
2233
2263
|
|
|
2234
2264
|
Returns a representation of the structure suitable for quick visualization.
|
|
2235
2265
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2256,7 +2286,7 @@ Time O(n), Space O(n).
|
|
|
2256
2286
|
unshift(elementOrNode): boolean;
|
|
2257
2287
|
```
|
|
2258
2288
|
|
|
2259
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2289
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:531](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L531)
|
|
2260
2290
|
|
|
2261
2291
|
Prepend an element/node to the head.
|
|
2262
2292
|
|
|
@@ -2297,7 +2327,7 @@ Time O(1), Space O(1)
|
|
|
2297
2327
|
unshiftMany(elements): boolean[];
|
|
2298
2328
|
```
|
|
2299
2329
|
|
|
2300
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2330
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:569](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L569)
|
|
2301
2331
|
|
|
2302
2332
|
Prepend a sequence of elements/nodes.
|
|
2303
2333
|
|
|
@@ -2329,7 +2359,7 @@ Time O(N), Space O(1)
|
|
|
2329
2359
|
values(): IterableIterator<E>;
|
|
2330
2360
|
```
|
|
2331
2361
|
|
|
2332
|
-
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2362
|
+
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)
|
|
2333
2363
|
|
|
2334
2364
|
Returns an iterator over the values (alias of the default iterator).
|
|
2335
2365
|
|
|
@@ -2355,7 +2385,7 @@ Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
|
2355
2385
|
static fromArray<E, R>(this, data): any;
|
|
2356
2386
|
```
|
|
2357
2387
|
|
|
2358
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:243](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2388
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:243](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L243)
|
|
2359
2389
|
|
|
2360
2390
|
Create a new list from an array of elements.
|
|
2361
2391
|
|
|
@@ -2404,7 +2434,7 @@ Time O(N), Space O(N)
|
|
|
2404
2434
|
protected optional _toElementFn?: (rawElement) => E;
|
|
2405
2435
|
```
|
|
2406
2436
|
|
|
2407
|
-
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2437
|
+
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)
|
|
2408
2438
|
|
|
2409
2439
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
2410
2440
|
|
|
@@ -2434,7 +2464,7 @@ Time O(1), Space O(1).
|
|
|
2434
2464
|
protected _createInstance(options?): this;
|
|
2435
2465
|
```
|
|
2436
2466
|
|
|
2437
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2467
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1562](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1562)
|
|
2438
2468
|
|
|
2439
2469
|
(Protected) Create an empty instance of the same concrete class.
|
|
2440
2470
|
|
|
@@ -2468,7 +2498,7 @@ Time O(1), Space O(1)
|
|
|
2468
2498
|
protected _createLike<EM, RM>(elements?, options?): DoublyLinkedList<EM, RM>;
|
|
2469
2499
|
```
|
|
2470
2500
|
|
|
2471
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2501
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1580](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1580)
|
|
2472
2502
|
|
|
2473
2503
|
(Protected) Create a like-kind instance and seed it from an iterable.
|
|
2474
2504
|
|
|
@@ -2516,7 +2546,7 @@ Time O(N), Space O(N)
|
|
|
2516
2546
|
protected _ensureNode(elementOrNode): DoublyLinkedListNode<E>;
|
|
2517
2547
|
```
|
|
2518
2548
|
|
|
2519
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2549
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1518](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1518)
|
|
2520
2550
|
|
|
2521
2551
|
(Protected) Create or return a node for the given input (node or raw element).
|
|
2522
2552
|
|
|
@@ -2546,7 +2576,7 @@ Time O(1), Space O(1)
|
|
|
2546
2576
|
protected _ensurePredicate(elementNodeOrPredicate): (node) => boolean;
|
|
2547
2577
|
```
|
|
2548
2578
|
|
|
2549
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2579
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1530](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1530)
|
|
2550
2580
|
|
|
2551
2581
|
(Protected) Normalize input into a predicate over nodes.
|
|
2552
2582
|
|
|
@@ -2578,7 +2608,7 @@ Time O(1), Space O(1)
|
|
|
2578
2608
|
protected _getIterator(): IterableIterator<E>;
|
|
2579
2609
|
```
|
|
2580
2610
|
|
|
2581
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2611
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1591](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1591)
|
|
2582
2612
|
|
|
2583
2613
|
Internal iterator factory used by the default iterator.
|
|
2584
2614
|
|
|
@@ -2604,7 +2634,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
2604
2634
|
protected _getNodeIterator(): IterableIterator<DoublyLinkedListNode<E>>;
|
|
2605
2635
|
```
|
|
2606
2636
|
|
|
2607
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2637
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1607](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1607)
|
|
2608
2638
|
|
|
2609
2639
|
Iterate linked nodes from head to tail.
|
|
2610
2640
|
|
|
@@ -2630,7 +2660,7 @@ Time O(n), Space O(1)
|
|
|
2630
2660
|
protected _getPrevNode(node): DoublyLinkedListNode<E> | undefined;
|
|
2631
2661
|
```
|
|
2632
2662
|
|
|
2633
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2663
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1551](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1551)
|
|
2634
2664
|
|
|
2635
2665
|
(Protected) Get the previous node of a given node.
|
|
2636
2666
|
|
|
@@ -2664,7 +2694,7 @@ Time O(1), Space O(1)
|
|
|
2664
2694
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2665
2695
|
```
|
|
2666
2696
|
|
|
2667
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2697
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1599](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1599)
|
|
2668
2698
|
|
|
2669
2699
|
Reverse-direction iterator over elements.
|
|
2670
2700
|
|