data-structure-typed 2.5.0 → 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/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +12984 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +3 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +4505 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +9731 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +347 -0
- package/CHANGELOG.md +5 -1
- package/README.md +124 -29
- package/dist/cjs/binary-tree.cjs +26282 -0
- package/dist/cjs/graph.cjs +5422 -0
- package/dist/cjs/hash.cjs +1310 -0
- package/dist/cjs/heap.cjs +1602 -0
- package/dist/cjs/index.cjs +31257 -14673
- package/dist/cjs/linked-list.cjs +4576 -0
- package/dist/cjs/matrix.cjs +1080 -0
- package/dist/cjs/priority-queue.cjs +1376 -0
- package/dist/cjs/queue.cjs +4264 -0
- package/dist/cjs/stack.cjs +907 -0
- package/dist/cjs/trie.cjs +1223 -0
- package/dist/cjs-legacy/binary-tree.cjs +26319 -0
- package/dist/cjs-legacy/graph.cjs +5420 -0
- package/dist/cjs-legacy/hash.cjs +1310 -0
- package/dist/cjs-legacy/heap.cjs +1599 -0
- package/dist/cjs-legacy/index.cjs +31268 -14679
- package/dist/cjs-legacy/linked-list.cjs +4582 -0
- package/dist/cjs-legacy/matrix.cjs +1083 -0
- package/dist/cjs-legacy/priority-queue.cjs +1374 -0
- package/dist/cjs-legacy/queue.cjs +4262 -0
- package/dist/cjs-legacy/stack.cjs +907 -0
- package/dist/cjs-legacy/trie.cjs +1222 -0
- package/dist/esm/binary-tree.mjs +26267 -0
- package/dist/esm/graph.mjs +5409 -0
- package/dist/esm/hash.mjs +1307 -0
- package/dist/esm/heap.mjs +1596 -0
- package/dist/esm/index.mjs +31254 -14674
- package/dist/esm/linked-list.mjs +4569 -0
- package/dist/esm/matrix.mjs +1076 -0
- package/dist/esm/priority-queue.mjs +1372 -0
- package/dist/esm/queue.mjs +4260 -0
- package/dist/esm/stack.mjs +905 -0
- package/dist/esm/trie.mjs +1220 -0
- package/dist/esm-legacy/binary-tree.mjs +26304 -0
- package/dist/esm-legacy/graph.mjs +5407 -0
- package/dist/esm-legacy/hash.mjs +1307 -0
- package/dist/esm-legacy/heap.mjs +1593 -0
- package/dist/esm-legacy/index.mjs +31265 -14680
- package/dist/esm-legacy/linked-list.mjs +4575 -0
- package/dist/esm-legacy/matrix.mjs +1079 -0
- package/dist/esm-legacy/priority-queue.mjs +1370 -0
- package/dist/esm-legacy/queue.mjs +4258 -0
- package/dist/esm-legacy/stack.mjs +905 -0
- package/dist/esm-legacy/trie.mjs +1219 -0
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
- package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
- package/dist/types/data-structures/heap/heap.d.ts +336 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
- package/dist/types/data-structures/queue/deque.d.ts +364 -4
- package/dist/types/data-structures/queue/queue.d.ts +288 -0
- package/dist/types/data-structures/stack/stack.d.ts +240 -0
- package/dist/types/data-structures/trie/trie.d.ts +292 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- 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/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/data-structure-typed.js +31196 -14608
- package/dist/umd/data-structure-typed.min.js +11 -5
- package/docs-site-docusaurus/README.md +41 -0
- package/docs-site-docusaurus/docs/api/README.md +52 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +6644 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +282 -0
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +2266 -0
- package/docs-site-docusaurus/docs/api/classes/BST.md +6293 -0
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +333 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +455 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +4647 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +331 -0
- package/docs-site-docusaurus/docs/api/classes/Deque.md +2767 -0
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +2999 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +2685 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +221 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +253 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +21 -0
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +1333 -0
- package/docs-site-docusaurus/docs/api/classes/Heap.md +1881 -0
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +800 -0
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +644 -0
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +1632 -0
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +1853 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +1108 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +156 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +2824 -0
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +2929 -0
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +1026 -0
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +1866 -0
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +1883 -0
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +1879 -0
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +1882 -0
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +109 -0
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +1839 -0
- package/docs-site-docusaurus/docs/api/classes/Queue.md +2244 -0
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +6888 -0
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +372 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +2897 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +169 -0
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +1229 -0
- package/docs-site-docusaurus/docs/api/classes/Stack.md +1573 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +1389 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +1591 -0
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +1246 -0
- package/docs-site-docusaurus/docs/api/classes/Trie.md +1708 -0
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +199 -0
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +2979 -0
- package/docs-site-docusaurus/docs/guide/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/architecture.md +615 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +451 -0
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +597 -0
- package/docs-site-docusaurus/docs/guide/installation.md +62 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +825 -0
- package/docs-site-docusaurus/docs/guide/overview.md +645 -0
- package/docs-site-docusaurus/docs/guide/performance.md +835 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +104 -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 +159 -0
- package/docs-site-docusaurus/fix-mdx-generics.mjs +75 -0
- package/docs-site-docusaurus/package-lock.json +18667 -0
- package/docs-site-docusaurus/package.json +50 -0
- package/docs-site-docusaurus/prefix-class-to-methods.mjs +48 -0
- package/docs-site-docusaurus/sidebars.ts +23 -0
- package/docs-site-docusaurus/sort-protected.mjs +87 -0
- package/docs-site-docusaurus/src/css/custom.css +96 -0
- package/docs-site-docusaurus/src/pages/index.module.css +13 -0
- package/docs-site-docusaurus/src/pages/index.tsx +120 -0
- package/docs-site-docusaurus/src/pages/markdown-page.md +7 -0
- package/docs-site-docusaurus/src/theme/TOCItems/index.tsx +34 -0
- package/docs-site-docusaurus/static/.nojekyll +0 -0
- package/docs-site-docusaurus/static/img/docusaurus-social-card.jpg +0 -0
- package/docs-site-docusaurus/static/img/docusaurus.png +0 -0
- package/docs-site-docusaurus/static/img/favicon.ico +0 -0
- package/docs-site-docusaurus/static/img/favicon.png +0 -0
- package/docs-site-docusaurus/static/img/logo-180.png +0 -0
- package/docs-site-docusaurus/static/img/logo.jpg +0 -0
- package/docs-site-docusaurus/static/img/logo.png +0 -0
- package/docs-site-docusaurus/static/img/logo.svg +1 -0
- package/docs-site-docusaurus/static/img/og-image.png +0 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/docs-site-docusaurus/static/robots.txt +4 -0
- package/docs-site-docusaurus/typedoc.json +23 -0
- package/llms.txt +37 -0
- package/package.json +159 -55
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +287 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +327 -5
- package/src/data-structures/binary-tree/binary-tree.ts +581 -6
- package/src/data-structures/binary-tree/bst.ts +922 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +453 -0
- package/src/data-structures/binary-tree/segment-tree.ts +139 -2
- package/src/data-structures/binary-tree/tree-map.ts +3300 -495
- package/src/data-structures/binary-tree/tree-multi-map.ts +3384 -563
- package/src/data-structures/binary-tree/tree-multi-set.ts +2757 -493
- package/src/data-structures/binary-tree/tree-set.ts +3122 -440
- package/src/data-structures/graph/abstract-graph.ts +6 -6
- package/src/data-structures/graph/directed-graph.ts +230 -0
- package/src/data-structures/graph/undirected-graph.ts +207 -0
- package/src/data-structures/hash/hash-map.ts +270 -19
- package/src/data-structures/heap/heap.ts +326 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +394 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +348 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +421 -7
- package/src/data-structures/matrix/matrix.ts +194 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +350 -5
- package/src/data-structures/queue/queue.ts +276 -0
- package/src/data-structures/stack/stack.ts +230 -0
- package/src/data-structures/trie/trie.ts +283 -7
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -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
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
- package/vercel.json +6 -0
- package/dist/leetcode/avl-tree-counter.mjs +0 -2957
- package/dist/leetcode/avl-tree-multi-map.mjs +0 -2889
- package/dist/leetcode/avl-tree.mjs +0 -2720
- package/dist/leetcode/binary-tree.mjs +0 -1594
- package/dist/leetcode/bst.mjs +0 -2398
- package/dist/leetcode/deque.mjs +0 -683
- package/dist/leetcode/directed-graph.mjs +0 -1733
- package/dist/leetcode/doubly-linked-list.mjs +0 -709
- package/dist/leetcode/hash-map.mjs +0 -493
- package/dist/leetcode/heap.mjs +0 -542
- package/dist/leetcode/max-heap.mjs +0 -375
- package/dist/leetcode/max-priority-queue.mjs +0 -383
- package/dist/leetcode/min-heap.mjs +0 -363
- package/dist/leetcode/min-priority-queue.mjs +0 -371
- package/dist/leetcode/priority-queue.mjs +0 -363
- package/dist/leetcode/queue.mjs +0 -943
- package/dist/leetcode/red-black-tree.mjs +0 -2765
- package/dist/leetcode/singly-linked-list.mjs +0 -754
- package/dist/leetcode/stack.mjs +0 -217
- package/dist/leetcode/tree-counter.mjs +0 -3039
- package/dist/leetcode/tree-multi-map.mjs +0 -2913
- package/dist/leetcode/trie.mjs +0 -413
- package/dist/leetcode/undirected-graph.mjs +0 -1650
|
@@ -0,0 +1,1853 @@
|
|
|
1
|
+
[**data-structure-typed**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[data-structure-typed](../README.md) / LinearLinkedBase
|
|
6
|
+
|
|
7
|
+
# Abstract Class: LinearLinkedBase\<E, R, NODE\>
|
|
8
|
+
|
|
9
|
+
Defined in: [data-structures/base/linear-base.ts:402](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L402)
|
|
10
|
+
|
|
11
|
+
Linked-list specialized linear container.
|
|
12
|
+
|
|
13
|
+
## Remarks
|
|
14
|
+
|
|
15
|
+
Time O(1), Space O(1)
|
|
16
|
+
|
|
17
|
+
## Extends
|
|
18
|
+
|
|
19
|
+
- [`LinearBase`](LinearBase.md)\<`E`, `R`, `NODE`\>
|
|
20
|
+
|
|
21
|
+
## Extended by
|
|
22
|
+
|
|
23
|
+
- [`SinglyLinkedList`](SinglyLinkedList.md)
|
|
24
|
+
- [`DoublyLinkedList`](DoublyLinkedList.md)
|
|
25
|
+
|
|
26
|
+
## Type Parameters
|
|
27
|
+
|
|
28
|
+
### E
|
|
29
|
+
|
|
30
|
+
`E`
|
|
31
|
+
|
|
32
|
+
Element type.
|
|
33
|
+
|
|
34
|
+
### R
|
|
35
|
+
|
|
36
|
+
`R` = `any`
|
|
37
|
+
|
|
38
|
+
Return type for mapped/derived views.
|
|
39
|
+
|
|
40
|
+
### NODE
|
|
41
|
+
|
|
42
|
+
`NODE` *extends* [`LinkedListNode`](LinkedListNode.md)\<`E`\> = [`LinkedListNode`](LinkedListNode.md)\<`E`\>
|
|
43
|
+
|
|
44
|
+
Linked node type.
|
|
45
|
+
|
|
46
|
+
## Properties
|
|
47
|
+
|
|
48
|
+
### length
|
|
49
|
+
|
|
50
|
+
#### Get Signature
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
get abstract length(): number;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Defined in: [data-structures/base/linear-base.ts:91](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L91)
|
|
57
|
+
|
|
58
|
+
Element count.
|
|
59
|
+
|
|
60
|
+
##### Remarks
|
|
61
|
+
|
|
62
|
+
Time O(1), Space O(1)
|
|
63
|
+
|
|
64
|
+
##### Returns
|
|
65
|
+
|
|
66
|
+
`number`
|
|
67
|
+
|
|
68
|
+
Number of elements.
|
|
69
|
+
|
|
70
|
+
#### Inherited from
|
|
71
|
+
|
|
72
|
+
[`LinearBase`](LinearBase.md).[`length`](LinearBase.md#length)
|
|
73
|
+
|
|
74
|
+
***
|
|
75
|
+
|
|
76
|
+
### maxLen
|
|
77
|
+
|
|
78
|
+
#### Get Signature
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
get maxLen(): number;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L100)
|
|
85
|
+
|
|
86
|
+
Upper bound for length (if positive), or `-1` when unbounded.
|
|
87
|
+
|
|
88
|
+
##### Remarks
|
|
89
|
+
|
|
90
|
+
Time O(1), Space O(1)
|
|
91
|
+
|
|
92
|
+
##### Returns
|
|
93
|
+
|
|
94
|
+
`number`
|
|
95
|
+
|
|
96
|
+
Maximum allowed length.
|
|
97
|
+
|
|
98
|
+
#### Inherited from
|
|
99
|
+
|
|
100
|
+
[`LinearBase`](LinearBase.md).[`maxLen`](LinearBase.md#maxlen)
|
|
101
|
+
|
|
102
|
+
***
|
|
103
|
+
|
|
104
|
+
### toElementFn
|
|
105
|
+
|
|
106
|
+
#### Get Signature
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
get toElementFn(): ((rawElement) => E) | undefined;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
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)
|
|
113
|
+
|
|
114
|
+
Exposes the current `toElementFn`, if configured.
|
|
115
|
+
|
|
116
|
+
##### Remarks
|
|
117
|
+
|
|
118
|
+
Time O(1), Space O(1).
|
|
119
|
+
|
|
120
|
+
##### Returns
|
|
121
|
+
|
|
122
|
+
((`rawElement`) => `E`) \| `undefined`
|
|
123
|
+
|
|
124
|
+
The converter function or `undefined` when not set.
|
|
125
|
+
|
|
126
|
+
#### Inherited from
|
|
127
|
+
|
|
128
|
+
[`LinearBase`](LinearBase.md).[`toElementFn`](LinearBase.md#toelementfn)
|
|
129
|
+
|
|
130
|
+
## Methods
|
|
131
|
+
|
|
132
|
+
### \[iterator\]()
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
iterator: IterableIterator<E>;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
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)
|
|
139
|
+
|
|
140
|
+
Returns an iterator over the structure's elements.
|
|
141
|
+
|
|
142
|
+
#### Parameters
|
|
143
|
+
|
|
144
|
+
##### args
|
|
145
|
+
|
|
146
|
+
...`unknown`[]
|
|
147
|
+
|
|
148
|
+
Optional iterator arguments forwarded to the internal iterator.
|
|
149
|
+
|
|
150
|
+
#### Returns
|
|
151
|
+
|
|
152
|
+
`IterableIterator`\<`E`\>
|
|
153
|
+
|
|
154
|
+
An `IterableIterator<E>` that yields the elements in traversal order.
|
|
155
|
+
|
|
156
|
+
#### Remarks
|
|
157
|
+
|
|
158
|
+
Producing the iterator is O(1); consuming the entire iterator is Time O(n) with O(1) extra space.
|
|
159
|
+
|
|
160
|
+
#### Inherited from
|
|
161
|
+
|
|
162
|
+
[`LinearBase`](LinearBase.md).[`[iterator]`](LinearBase.md#iterator)
|
|
163
|
+
|
|
164
|
+
***
|
|
165
|
+
|
|
166
|
+
### addAfter()
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
abstract addAfter(existingElementOrNode, newElementOrNode): boolean;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Defined in: [data-structures/base/linear-base.ts:609](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L609)
|
|
173
|
+
|
|
174
|
+
Insert new element/node after an existing node.
|
|
175
|
+
|
|
176
|
+
#### Parameters
|
|
177
|
+
|
|
178
|
+
##### existingElementOrNode
|
|
179
|
+
|
|
180
|
+
`E` \| `NODE`
|
|
181
|
+
|
|
182
|
+
Reference element/node.
|
|
183
|
+
|
|
184
|
+
##### newElementOrNode
|
|
185
|
+
|
|
186
|
+
`E` \| `NODE`
|
|
187
|
+
|
|
188
|
+
Element/node to insert.
|
|
189
|
+
|
|
190
|
+
#### Returns
|
|
191
|
+
|
|
192
|
+
`boolean`
|
|
193
|
+
|
|
194
|
+
`true` if inserted.
|
|
195
|
+
|
|
196
|
+
#### Remarks
|
|
197
|
+
|
|
198
|
+
Time O(1)~O(n) depending on reference access, Space O(1)
|
|
199
|
+
|
|
200
|
+
***
|
|
201
|
+
|
|
202
|
+
### addAt()
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
abstract addAt(index, newElementOrNode): boolean;
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Defined in: [data-structures/base/linear-base.ts:377](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L377)
|
|
209
|
+
|
|
210
|
+
Insert an element/node at a position.
|
|
211
|
+
|
|
212
|
+
#### Parameters
|
|
213
|
+
|
|
214
|
+
##### index
|
|
215
|
+
|
|
216
|
+
`number`
|
|
217
|
+
|
|
218
|
+
Position (0-based).
|
|
219
|
+
|
|
220
|
+
##### newElementOrNode
|
|
221
|
+
|
|
222
|
+
`E` \| `NODE`
|
|
223
|
+
|
|
224
|
+
Element or node to insert.
|
|
225
|
+
|
|
226
|
+
#### Returns
|
|
227
|
+
|
|
228
|
+
`boolean`
|
|
229
|
+
|
|
230
|
+
`true` if inserted.
|
|
231
|
+
|
|
232
|
+
#### Remarks
|
|
233
|
+
|
|
234
|
+
Time O(1)~O(n) depending on implementation, Space O(1)
|
|
235
|
+
|
|
236
|
+
#### Inherited from
|
|
237
|
+
|
|
238
|
+
[`LinearBase`](LinearBase.md).[`addAt`](LinearBase.md#addat)
|
|
239
|
+
|
|
240
|
+
***
|
|
241
|
+
|
|
242
|
+
### addBefore()
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
abstract addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Defined in: [data-structures/base/linear-base.ts:600](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L600)
|
|
249
|
+
|
|
250
|
+
Insert new element/node before an existing node.
|
|
251
|
+
|
|
252
|
+
#### Parameters
|
|
253
|
+
|
|
254
|
+
##### existingElementOrNode
|
|
255
|
+
|
|
256
|
+
`E` \| `NODE`
|
|
257
|
+
|
|
258
|
+
Reference element/node.
|
|
259
|
+
|
|
260
|
+
##### newElementOrNode
|
|
261
|
+
|
|
262
|
+
`E` \| `NODE`
|
|
263
|
+
|
|
264
|
+
Element/node to insert.
|
|
265
|
+
|
|
266
|
+
#### Returns
|
|
267
|
+
|
|
268
|
+
`boolean`
|
|
269
|
+
|
|
270
|
+
`true` if inserted.
|
|
271
|
+
|
|
272
|
+
#### Remarks
|
|
273
|
+
|
|
274
|
+
Time O(1)~O(n) depending on reference access, Space O(1)
|
|
275
|
+
|
|
276
|
+
***
|
|
277
|
+
|
|
278
|
+
### at()
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
abstract at(index): E | undefined;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Defined in: [data-structures/base/linear-base.ts:360](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L360)
|
|
285
|
+
|
|
286
|
+
Get element at an index.
|
|
287
|
+
|
|
288
|
+
#### Parameters
|
|
289
|
+
|
|
290
|
+
##### index
|
|
291
|
+
|
|
292
|
+
`number`
|
|
293
|
+
|
|
294
|
+
Position (0-based).
|
|
295
|
+
|
|
296
|
+
#### Returns
|
|
297
|
+
|
|
298
|
+
`E` \| `undefined`
|
|
299
|
+
|
|
300
|
+
Element or `undefined`.
|
|
301
|
+
|
|
302
|
+
#### Remarks
|
|
303
|
+
|
|
304
|
+
Time O(1)~O(n) depending on implementation, Space O(1)
|
|
305
|
+
|
|
306
|
+
#### Inherited from
|
|
307
|
+
|
|
308
|
+
[`LinearBase`](LinearBase.md).[`at`](LinearBase.md#at)
|
|
309
|
+
|
|
310
|
+
***
|
|
311
|
+
|
|
312
|
+
### clear()
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
abstract clear(): void;
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
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)
|
|
319
|
+
|
|
320
|
+
Removes all elements from the structure.
|
|
321
|
+
|
|
322
|
+
#### Returns
|
|
323
|
+
|
|
324
|
+
`void`
|
|
325
|
+
|
|
326
|
+
`void`.
|
|
327
|
+
|
|
328
|
+
#### Remarks
|
|
329
|
+
|
|
330
|
+
Expected Time O(1) or O(n) depending on the implementation; Space O(1).
|
|
331
|
+
|
|
332
|
+
#### Inherited from
|
|
333
|
+
|
|
334
|
+
[`LinearBase`](LinearBase.md).[`clear`](LinearBase.md#clear)
|
|
335
|
+
|
|
336
|
+
***
|
|
337
|
+
|
|
338
|
+
### clone()
|
|
339
|
+
|
|
340
|
+
```ts
|
|
341
|
+
abstract clone(): this;
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Defined in: [data-structures/base/linear-base.ts:321](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L321)
|
|
345
|
+
|
|
346
|
+
Deep clone while preserving concrete subtype.
|
|
347
|
+
|
|
348
|
+
#### Returns
|
|
349
|
+
|
|
350
|
+
`this`
|
|
351
|
+
|
|
352
|
+
New list of the same species (`this` type).
|
|
353
|
+
|
|
354
|
+
#### Remarks
|
|
355
|
+
|
|
356
|
+
Time O(n), Space O(n)
|
|
357
|
+
|
|
358
|
+
#### Inherited from
|
|
359
|
+
|
|
360
|
+
[`LinearBase`](LinearBase.md).[`clone`](LinearBase.md#clone)
|
|
361
|
+
|
|
362
|
+
***
|
|
363
|
+
|
|
364
|
+
### concat()
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
concat(...items): this;
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Defined in: [data-structures/base/linear-base.ts:473](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L473)
|
|
371
|
+
|
|
372
|
+
Concatenate lists/elements preserving order.
|
|
373
|
+
|
|
374
|
+
#### Parameters
|
|
375
|
+
|
|
376
|
+
##### items
|
|
377
|
+
|
|
378
|
+
...(
|
|
379
|
+
\| `E`
|
|
380
|
+
\| [`LinearBase`](LinearBase.md)\<`E`, `R`, [`LinkedListNode`](LinkedListNode.md)\<`E`\>\>)[]
|
|
381
|
+
|
|
382
|
+
Elements or `LinearBase` instances.
|
|
383
|
+
|
|
384
|
+
#### Returns
|
|
385
|
+
|
|
386
|
+
`this`
|
|
387
|
+
|
|
388
|
+
New list with combined elements (`this` type).
|
|
389
|
+
|
|
390
|
+
#### Remarks
|
|
391
|
+
|
|
392
|
+
Time O(sum(length)), Space O(sum(length))
|
|
393
|
+
|
|
394
|
+
#### Overrides
|
|
395
|
+
|
|
396
|
+
[`LinearBase`](LinearBase.md).[`concat`](LinearBase.md#concat)
|
|
397
|
+
|
|
398
|
+
***
|
|
399
|
+
|
|
400
|
+
### delete()
|
|
401
|
+
|
|
402
|
+
```ts
|
|
403
|
+
abstract delete(elementOrNode): boolean;
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Defined in: [data-structures/base/linear-base.ts:591](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L591)
|
|
407
|
+
|
|
408
|
+
Delete by element or node in a linked list.
|
|
409
|
+
|
|
410
|
+
#### Parameters
|
|
411
|
+
|
|
412
|
+
##### elementOrNode
|
|
413
|
+
|
|
414
|
+
`E` \| `NODE` \| `undefined`
|
|
415
|
+
|
|
416
|
+
Element or node.
|
|
417
|
+
|
|
418
|
+
#### Returns
|
|
419
|
+
|
|
420
|
+
`boolean`
|
|
421
|
+
|
|
422
|
+
`true` if removed.
|
|
423
|
+
|
|
424
|
+
#### Remarks
|
|
425
|
+
|
|
426
|
+
Time O(1)~O(n) depending on availability of links, Space O(1)
|
|
427
|
+
|
|
428
|
+
#### Overrides
|
|
429
|
+
|
|
430
|
+
[`LinearBase`](LinearBase.md).[`delete`](LinearBase.md#delete)
|
|
431
|
+
|
|
432
|
+
***
|
|
433
|
+
|
|
434
|
+
### deleteAt()
|
|
435
|
+
|
|
436
|
+
```ts
|
|
437
|
+
abstract deleteAt(pos): E | undefined;
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Defined in: [data-structures/base/linear-base.ts:368](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L368)
|
|
441
|
+
|
|
442
|
+
Remove element at a position.
|
|
443
|
+
|
|
444
|
+
#### Parameters
|
|
445
|
+
|
|
446
|
+
##### pos
|
|
447
|
+
|
|
448
|
+
`number`
|
|
449
|
+
|
|
450
|
+
Position (0-based).
|
|
451
|
+
|
|
452
|
+
#### Returns
|
|
453
|
+
|
|
454
|
+
`E` \| `undefined`
|
|
455
|
+
|
|
456
|
+
Removed element or `undefined`.
|
|
457
|
+
|
|
458
|
+
#### Remarks
|
|
459
|
+
|
|
460
|
+
Time O(1)~O(n) depending on implementation, Space O(1)
|
|
461
|
+
|
|
462
|
+
#### Inherited from
|
|
463
|
+
|
|
464
|
+
[`LinearBase`](LinearBase.md).[`deleteAt`](LinearBase.md#deleteat)
|
|
465
|
+
|
|
466
|
+
***
|
|
467
|
+
|
|
468
|
+
### every()
|
|
469
|
+
|
|
470
|
+
```ts
|
|
471
|
+
every(predicate, thisArg?): boolean;
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
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)
|
|
475
|
+
|
|
476
|
+
Tests whether all elements satisfy the predicate.
|
|
477
|
+
|
|
478
|
+
#### Parameters
|
|
479
|
+
|
|
480
|
+
##### predicate
|
|
481
|
+
|
|
482
|
+
`ElementCallback`\<`E`, `R`, `boolean`\>
|
|
483
|
+
|
|
484
|
+
Function invoked for each element with signature `(value, index, self)`.
|
|
485
|
+
|
|
486
|
+
##### thisArg?
|
|
487
|
+
|
|
488
|
+
`unknown`
|
|
489
|
+
|
|
490
|
+
Optional `this` binding for the predicate.
|
|
491
|
+
|
|
492
|
+
#### Returns
|
|
493
|
+
|
|
494
|
+
`boolean`
|
|
495
|
+
|
|
496
|
+
`true` if every element passes; otherwise `false`.
|
|
497
|
+
|
|
498
|
+
#### Remarks
|
|
499
|
+
|
|
500
|
+
Time O(n) in the worst case; may exit early when the first failure is found. Space O(1).
|
|
501
|
+
|
|
502
|
+
#### Inherited from
|
|
503
|
+
|
|
504
|
+
[`LinearBase`](LinearBase.md).[`every`](LinearBase.md#every)
|
|
505
|
+
|
|
506
|
+
***
|
|
507
|
+
|
|
508
|
+
### fill()
|
|
509
|
+
|
|
510
|
+
```ts
|
|
511
|
+
fill(
|
|
512
|
+
value,
|
|
513
|
+
start?,
|
|
514
|
+
end?): this;
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L292)
|
|
518
|
+
|
|
519
|
+
Fill a range with a value.
|
|
520
|
+
|
|
521
|
+
#### Parameters
|
|
522
|
+
|
|
523
|
+
##### value
|
|
524
|
+
|
|
525
|
+
`E`
|
|
526
|
+
|
|
527
|
+
Value to set.
|
|
528
|
+
|
|
529
|
+
##### start?
|
|
530
|
+
|
|
531
|
+
`number` = `0`
|
|
532
|
+
|
|
533
|
+
Inclusive start.
|
|
534
|
+
|
|
535
|
+
##### end?
|
|
536
|
+
|
|
537
|
+
`number` = `...`
|
|
538
|
+
|
|
539
|
+
Exclusive end.
|
|
540
|
+
|
|
541
|
+
#### Returns
|
|
542
|
+
|
|
543
|
+
`this`
|
|
544
|
+
|
|
545
|
+
This list.
|
|
546
|
+
|
|
547
|
+
#### Remarks
|
|
548
|
+
|
|
549
|
+
Time O(n), Space O(1)
|
|
550
|
+
|
|
551
|
+
#### Inherited from
|
|
552
|
+
|
|
553
|
+
[`LinearBase`](LinearBase.md).[`fill`](LinearBase.md#fill)
|
|
554
|
+
|
|
555
|
+
***
|
|
556
|
+
|
|
557
|
+
### filter()
|
|
558
|
+
|
|
559
|
+
```ts
|
|
560
|
+
abstract filter(predicate, thisArg?): this;
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
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)
|
|
564
|
+
|
|
565
|
+
Filters elements using the provided predicate and returns the same concrete structure type.
|
|
566
|
+
|
|
567
|
+
#### Parameters
|
|
568
|
+
|
|
569
|
+
##### predicate
|
|
570
|
+
|
|
571
|
+
`ElementCallback`\<`E`, `R`, `boolean`\>
|
|
572
|
+
|
|
573
|
+
Function with signature `(value, index, self) => boolean`.
|
|
574
|
+
|
|
575
|
+
##### thisArg?
|
|
576
|
+
|
|
577
|
+
`unknown`
|
|
578
|
+
|
|
579
|
+
Optional `this` binding for the predicate.
|
|
580
|
+
|
|
581
|
+
#### Returns
|
|
582
|
+
|
|
583
|
+
`this`
|
|
584
|
+
|
|
585
|
+
A new instance of the same concrete type containing only elements that pass the predicate.
|
|
586
|
+
|
|
587
|
+
#### Remarks
|
|
588
|
+
|
|
589
|
+
Time O(n), Space O(k) where `k` is the number of kept elements.
|
|
590
|
+
|
|
591
|
+
#### Inherited from
|
|
592
|
+
|
|
593
|
+
[`LinearBase`](LinearBase.md).[`filter`](LinearBase.md#filter)
|
|
594
|
+
|
|
595
|
+
***
|
|
596
|
+
|
|
597
|
+
### find()
|
|
598
|
+
|
|
599
|
+
#### Call Signature
|
|
600
|
+
|
|
601
|
+
```ts
|
|
602
|
+
find<S>(predicate, thisArg?): S | undefined;
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
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)
|
|
606
|
+
|
|
607
|
+
Finds the first element that satisfies the predicate and returns it.
|
|
608
|
+
|
|
609
|
+
Finds the first element of type `S` (a subtype of `E`) that satisfies the predicate and returns it.
|
|
610
|
+
|
|
611
|
+
##### Type Parameters
|
|
612
|
+
|
|
613
|
+
###### S
|
|
614
|
+
|
|
615
|
+
`S`
|
|
616
|
+
|
|
617
|
+
##### Parameters
|
|
618
|
+
|
|
619
|
+
###### predicate
|
|
620
|
+
|
|
621
|
+
`ElementCallback`\<`E`, `R`, `S`\>
|
|
622
|
+
|
|
623
|
+
Type-guard predicate: `(value, index, self) => value is S`.
|
|
624
|
+
|
|
625
|
+
###### thisArg?
|
|
626
|
+
|
|
627
|
+
`unknown`
|
|
628
|
+
|
|
629
|
+
Optional `this` binding for the predicate.
|
|
630
|
+
|
|
631
|
+
##### Returns
|
|
632
|
+
|
|
633
|
+
`S` \| `undefined`
|
|
634
|
+
|
|
635
|
+
The matched element typed as `S`, or `undefined` if not found.
|
|
636
|
+
|
|
637
|
+
##### Remarks
|
|
638
|
+
|
|
639
|
+
Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
640
|
+
|
|
641
|
+
##### Inherited from
|
|
642
|
+
|
|
643
|
+
[`LinearBase`](LinearBase.md).[`find`](LinearBase.md#find)
|
|
644
|
+
|
|
645
|
+
#### Call Signature
|
|
646
|
+
|
|
647
|
+
```ts
|
|
648
|
+
find(predicate, thisArg?): E | undefined;
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
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)
|
|
652
|
+
|
|
653
|
+
Finds the first element that satisfies the predicate and returns it.
|
|
654
|
+
|
|
655
|
+
Finds the first element of type `S` (a subtype of `E`) that satisfies the predicate and returns it.
|
|
656
|
+
|
|
657
|
+
##### Parameters
|
|
658
|
+
|
|
659
|
+
###### predicate
|
|
660
|
+
|
|
661
|
+
`ElementCallback`\<`E`, `R`, `unknown`\>
|
|
662
|
+
|
|
663
|
+
Type-guard predicate: `(value, index, self) => value is S`.
|
|
664
|
+
|
|
665
|
+
###### thisArg?
|
|
666
|
+
|
|
667
|
+
`unknown`
|
|
668
|
+
|
|
669
|
+
Optional `this` binding for the predicate.
|
|
670
|
+
|
|
671
|
+
##### Returns
|
|
672
|
+
|
|
673
|
+
`E` \| `undefined`
|
|
674
|
+
|
|
675
|
+
The matched element typed as `S`, or `undefined` if not found.
|
|
676
|
+
|
|
677
|
+
##### Remarks
|
|
678
|
+
|
|
679
|
+
Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
680
|
+
|
|
681
|
+
##### Inherited from
|
|
682
|
+
|
|
683
|
+
[`LinearBase`](LinearBase.md).[`find`](LinearBase.md#find)
|
|
684
|
+
|
|
685
|
+
***
|
|
686
|
+
|
|
687
|
+
### findIndex()
|
|
688
|
+
|
|
689
|
+
```ts
|
|
690
|
+
findIndex(predicate, thisArg?): number;
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L151)
|
|
694
|
+
|
|
695
|
+
Find the first index matching a predicate.
|
|
696
|
+
|
|
697
|
+
#### Parameters
|
|
698
|
+
|
|
699
|
+
##### predicate
|
|
700
|
+
|
|
701
|
+
`ElementCallback`\<`E`, `R`, `boolean`\>
|
|
702
|
+
|
|
703
|
+
`(element, index, self) => boolean`.
|
|
704
|
+
|
|
705
|
+
##### thisArg?
|
|
706
|
+
|
|
707
|
+
`unknown`
|
|
708
|
+
|
|
709
|
+
Optional `this` for callback.
|
|
710
|
+
|
|
711
|
+
#### Returns
|
|
712
|
+
|
|
713
|
+
`number`
|
|
714
|
+
|
|
715
|
+
Index or `-1`.
|
|
716
|
+
|
|
717
|
+
#### Remarks
|
|
718
|
+
|
|
719
|
+
Time O(n), Space O(1)
|
|
720
|
+
|
|
721
|
+
#### Inherited from
|
|
722
|
+
|
|
723
|
+
[`LinearBase`](LinearBase.md).[`findIndex`](LinearBase.md#findindex)
|
|
724
|
+
|
|
725
|
+
***
|
|
726
|
+
|
|
727
|
+
### forEach()
|
|
728
|
+
|
|
729
|
+
```ts
|
|
730
|
+
forEach(callbackfn, thisArg?): void;
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
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)
|
|
734
|
+
|
|
735
|
+
Invokes a callback for each element in iteration order.
|
|
736
|
+
|
|
737
|
+
#### Parameters
|
|
738
|
+
|
|
739
|
+
##### callbackfn
|
|
740
|
+
|
|
741
|
+
`ElementCallback`\<`E`, `R`, `void`\>
|
|
742
|
+
|
|
743
|
+
Function invoked per element with signature `(value, index, self)`.
|
|
744
|
+
|
|
745
|
+
##### thisArg?
|
|
746
|
+
|
|
747
|
+
`unknown`
|
|
748
|
+
|
|
749
|
+
Optional `this` binding for the callback.
|
|
750
|
+
|
|
751
|
+
#### Returns
|
|
752
|
+
|
|
753
|
+
`void`
|
|
754
|
+
|
|
755
|
+
`void`.
|
|
756
|
+
|
|
757
|
+
#### Remarks
|
|
758
|
+
|
|
759
|
+
Time O(n), Space O(1).
|
|
760
|
+
|
|
761
|
+
#### Inherited from
|
|
762
|
+
|
|
763
|
+
[`LinearBase`](LinearBase.md).[`forEach`](LinearBase.md#foreach)
|
|
764
|
+
|
|
765
|
+
***
|
|
766
|
+
|
|
767
|
+
### getNodeAt()
|
|
768
|
+
|
|
769
|
+
```ts
|
|
770
|
+
abstract getNodeAt(index): NODE | undefined;
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
Defined in: [data-structures/base/linear-base.ts:617](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L617)
|
|
774
|
+
|
|
775
|
+
Node at index (for random-access emulation).
|
|
776
|
+
|
|
777
|
+
#### Parameters
|
|
778
|
+
|
|
779
|
+
##### index
|
|
780
|
+
|
|
781
|
+
`number`
|
|
782
|
+
|
|
783
|
+
Position (0-based).
|
|
784
|
+
|
|
785
|
+
#### Returns
|
|
786
|
+
|
|
787
|
+
`NODE` \| `undefined`
|
|
788
|
+
|
|
789
|
+
Node or `undefined`.
|
|
790
|
+
|
|
791
|
+
#### Remarks
|
|
792
|
+
|
|
793
|
+
Time O(n), Space O(1)
|
|
794
|
+
|
|
795
|
+
***
|
|
796
|
+
|
|
797
|
+
### has()
|
|
798
|
+
|
|
799
|
+
```ts
|
|
800
|
+
has(element): boolean;
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
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)
|
|
804
|
+
|
|
805
|
+
Checks whether a strictly-equal element exists in the structure.
|
|
806
|
+
|
|
807
|
+
#### Parameters
|
|
808
|
+
|
|
809
|
+
##### element
|
|
810
|
+
|
|
811
|
+
`E`
|
|
812
|
+
|
|
813
|
+
The element to test with `===` equality.
|
|
814
|
+
|
|
815
|
+
#### Returns
|
|
816
|
+
|
|
817
|
+
`boolean`
|
|
818
|
+
|
|
819
|
+
`true` if an equal element is found; otherwise `false`.
|
|
820
|
+
|
|
821
|
+
#### Remarks
|
|
822
|
+
|
|
823
|
+
Time O(n) in the worst case. Space O(1).
|
|
824
|
+
|
|
825
|
+
#### Inherited from
|
|
826
|
+
|
|
827
|
+
[`LinearBase`](LinearBase.md).[`has`](LinearBase.md#has)
|
|
828
|
+
|
|
829
|
+
***
|
|
830
|
+
|
|
831
|
+
### indexOf()
|
|
832
|
+
|
|
833
|
+
```ts
|
|
834
|
+
indexOf(searchElement, fromIndex?): number;
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
Defined in: [data-structures/base/linear-base.ts:422](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L422)
|
|
838
|
+
|
|
839
|
+
Linked-list optimized `indexOf` (forwards scan).
|
|
840
|
+
|
|
841
|
+
#### Parameters
|
|
842
|
+
|
|
843
|
+
##### searchElement
|
|
844
|
+
|
|
845
|
+
`E`
|
|
846
|
+
|
|
847
|
+
Value to match.
|
|
848
|
+
|
|
849
|
+
##### fromIndex?
|
|
850
|
+
|
|
851
|
+
`number` = `0`
|
|
852
|
+
|
|
853
|
+
Start position.
|
|
854
|
+
|
|
855
|
+
#### Returns
|
|
856
|
+
|
|
857
|
+
`number`
|
|
858
|
+
|
|
859
|
+
Index or `-1`.
|
|
860
|
+
|
|
861
|
+
#### Remarks
|
|
862
|
+
|
|
863
|
+
Time O(n), Space O(1)
|
|
864
|
+
|
|
865
|
+
#### Overrides
|
|
866
|
+
|
|
867
|
+
[`LinearBase`](LinearBase.md).[`indexOf`](LinearBase.md#indexof)
|
|
868
|
+
|
|
869
|
+
***
|
|
870
|
+
|
|
871
|
+
### isEmpty()
|
|
872
|
+
|
|
873
|
+
```ts
|
|
874
|
+
abstract isEmpty(): boolean;
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
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)
|
|
878
|
+
|
|
879
|
+
Indicates whether the structure currently contains no elements.
|
|
880
|
+
|
|
881
|
+
#### Returns
|
|
882
|
+
|
|
883
|
+
`boolean`
|
|
884
|
+
|
|
885
|
+
`true` if empty; otherwise `false`.
|
|
886
|
+
|
|
887
|
+
#### Remarks
|
|
888
|
+
|
|
889
|
+
Expected Time O(1), Space O(1) for most implementations.
|
|
890
|
+
|
|
891
|
+
#### Inherited from
|
|
892
|
+
|
|
893
|
+
[`LinearBase`](LinearBase.md).[`isEmpty`](LinearBase.md#isempty)
|
|
894
|
+
|
|
895
|
+
***
|
|
896
|
+
|
|
897
|
+
### join()
|
|
898
|
+
|
|
899
|
+
```ts
|
|
900
|
+
join(separator?): string;
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L228)
|
|
904
|
+
|
|
905
|
+
Join all elements into a string.
|
|
906
|
+
|
|
907
|
+
#### Parameters
|
|
908
|
+
|
|
909
|
+
##### separator?
|
|
910
|
+
|
|
911
|
+
`string` = `','`
|
|
912
|
+
|
|
913
|
+
Separator string.
|
|
914
|
+
|
|
915
|
+
#### Returns
|
|
916
|
+
|
|
917
|
+
`string`
|
|
918
|
+
|
|
919
|
+
Concatenated string.
|
|
920
|
+
|
|
921
|
+
#### Remarks
|
|
922
|
+
|
|
923
|
+
Time O(n), Space O(n)
|
|
924
|
+
|
|
925
|
+
#### Inherited from
|
|
926
|
+
|
|
927
|
+
[`LinearBase`](LinearBase.md).[`join`](LinearBase.md#join)
|
|
928
|
+
|
|
929
|
+
***
|
|
930
|
+
|
|
931
|
+
### lastIndexOf()
|
|
932
|
+
|
|
933
|
+
```ts
|
|
934
|
+
lastIndexOf(searchElement, fromIndex?): number;
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
Defined in: [data-structures/base/linear-base.ts:448](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L448)
|
|
938
|
+
|
|
939
|
+
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
940
|
+
|
|
941
|
+
#### Parameters
|
|
942
|
+
|
|
943
|
+
##### searchElement
|
|
944
|
+
|
|
945
|
+
`E`
|
|
946
|
+
|
|
947
|
+
Value to match.
|
|
948
|
+
|
|
949
|
+
##### fromIndex?
|
|
950
|
+
|
|
951
|
+
`number` = `...`
|
|
952
|
+
|
|
953
|
+
Start position.
|
|
954
|
+
|
|
955
|
+
#### Returns
|
|
956
|
+
|
|
957
|
+
`number`
|
|
958
|
+
|
|
959
|
+
Index or `-1`.
|
|
960
|
+
|
|
961
|
+
#### Remarks
|
|
962
|
+
|
|
963
|
+
Time O(n), Space O(1)
|
|
964
|
+
|
|
965
|
+
#### Overrides
|
|
966
|
+
|
|
967
|
+
[`LinearBase`](LinearBase.md).[`lastIndexOf`](LinearBase.md#lastindexof)
|
|
968
|
+
|
|
969
|
+
***
|
|
970
|
+
|
|
971
|
+
### map()
|
|
972
|
+
|
|
973
|
+
```ts
|
|
974
|
+
abstract map<EM, RM>(
|
|
975
|
+
callback,
|
|
976
|
+
options?,
|
|
977
|
+
thisArg?): IterableElementBase<EM, RM>;
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
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)
|
|
981
|
+
|
|
982
|
+
Maps each element to a new element and returns a new iterable structure.
|
|
983
|
+
|
|
984
|
+
#### Type Parameters
|
|
985
|
+
|
|
986
|
+
##### EM
|
|
987
|
+
|
|
988
|
+
`EM`
|
|
989
|
+
|
|
990
|
+
The mapped element type.
|
|
991
|
+
|
|
992
|
+
##### RM
|
|
993
|
+
|
|
994
|
+
`RM`
|
|
995
|
+
|
|
996
|
+
The mapped raw element type used internally by the target structure.
|
|
997
|
+
|
|
998
|
+
#### Parameters
|
|
999
|
+
|
|
1000
|
+
##### callback
|
|
1001
|
+
|
|
1002
|
+
`ElementCallback`\<`E`, `R`, `EM`\>
|
|
1003
|
+
|
|
1004
|
+
Function with signature `(value, index, self) => mapped`.
|
|
1005
|
+
|
|
1006
|
+
##### options?
|
|
1007
|
+
|
|
1008
|
+
`IterableElementBaseOptions`\<`EM`, `RM`\>
|
|
1009
|
+
|
|
1010
|
+
Optional options for the returned structure, including its `toElementFn`.
|
|
1011
|
+
|
|
1012
|
+
##### thisArg?
|
|
1013
|
+
|
|
1014
|
+
`unknown`
|
|
1015
|
+
|
|
1016
|
+
Optional `this` binding for the callback.
|
|
1017
|
+
|
|
1018
|
+
#### Returns
|
|
1019
|
+
|
|
1020
|
+
[`IterableElementBase`](IterableElementBase.md)\<`EM`, `RM`\>
|
|
1021
|
+
|
|
1022
|
+
A new `IterableElementBase<EM, RM>` containing mapped elements.
|
|
1023
|
+
|
|
1024
|
+
#### Remarks
|
|
1025
|
+
|
|
1026
|
+
Time O(n), Space O(n).
|
|
1027
|
+
|
|
1028
|
+
#### Inherited from
|
|
1029
|
+
|
|
1030
|
+
[`LinearBase`](LinearBase.md).[`map`](LinearBase.md#map)
|
|
1031
|
+
|
|
1032
|
+
***
|
|
1033
|
+
|
|
1034
|
+
### mapSame()
|
|
1035
|
+
|
|
1036
|
+
```ts
|
|
1037
|
+
abstract mapSame(callback, thisArg?): this;
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
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)
|
|
1041
|
+
|
|
1042
|
+
Maps each element to the same element type and returns the same concrete structure type.
|
|
1043
|
+
|
|
1044
|
+
#### Parameters
|
|
1045
|
+
|
|
1046
|
+
##### callback
|
|
1047
|
+
|
|
1048
|
+
`ElementCallback`\<`E`, `R`, `E`\>
|
|
1049
|
+
|
|
1050
|
+
Function with signature `(value, index, self) => mappedValue`.
|
|
1051
|
+
|
|
1052
|
+
##### thisArg?
|
|
1053
|
+
|
|
1054
|
+
`unknown`
|
|
1055
|
+
|
|
1056
|
+
Optional `this` binding for the callback.
|
|
1057
|
+
|
|
1058
|
+
#### Returns
|
|
1059
|
+
|
|
1060
|
+
`this`
|
|
1061
|
+
|
|
1062
|
+
A new instance of the same concrete type with mapped elements.
|
|
1063
|
+
|
|
1064
|
+
#### Remarks
|
|
1065
|
+
|
|
1066
|
+
Time O(n), Space O(n).
|
|
1067
|
+
|
|
1068
|
+
#### Inherited from
|
|
1069
|
+
|
|
1070
|
+
[`LinearBase`](LinearBase.md).[`mapSame`](LinearBase.md#mapsame)
|
|
1071
|
+
|
|
1072
|
+
***
|
|
1073
|
+
|
|
1074
|
+
### print()
|
|
1075
|
+
|
|
1076
|
+
```ts
|
|
1077
|
+
print(): void;
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
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)
|
|
1081
|
+
|
|
1082
|
+
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1083
|
+
|
|
1084
|
+
#### Returns
|
|
1085
|
+
|
|
1086
|
+
`void`
|
|
1087
|
+
|
|
1088
|
+
`void`.
|
|
1089
|
+
|
|
1090
|
+
#### Remarks
|
|
1091
|
+
|
|
1092
|
+
Time O(n) due to materialization, Space O(n) for the intermediate representation.
|
|
1093
|
+
|
|
1094
|
+
#### Inherited from
|
|
1095
|
+
|
|
1096
|
+
[`LinearBase`](LinearBase.md).[`print`](LinearBase.md#print)
|
|
1097
|
+
|
|
1098
|
+
***
|
|
1099
|
+
|
|
1100
|
+
### push()
|
|
1101
|
+
|
|
1102
|
+
```ts
|
|
1103
|
+
abstract push(elementOrNode): boolean;
|
|
1104
|
+
```
|
|
1105
|
+
|
|
1106
|
+
Defined in: [data-structures/base/linear-base.ts:336](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L336)
|
|
1107
|
+
|
|
1108
|
+
Append one element or node to the tail.
|
|
1109
|
+
|
|
1110
|
+
#### Parameters
|
|
1111
|
+
|
|
1112
|
+
##### elementOrNode
|
|
1113
|
+
|
|
1114
|
+
`E` \| `NODE`
|
|
1115
|
+
|
|
1116
|
+
Element or node.
|
|
1117
|
+
|
|
1118
|
+
#### Returns
|
|
1119
|
+
|
|
1120
|
+
`boolean`
|
|
1121
|
+
|
|
1122
|
+
`true` if appended.
|
|
1123
|
+
|
|
1124
|
+
#### Remarks
|
|
1125
|
+
|
|
1126
|
+
Time O(1) amortized typical, Space O(1)
|
|
1127
|
+
|
|
1128
|
+
#### Inherited from
|
|
1129
|
+
|
|
1130
|
+
[`LinearBase`](LinearBase.md).[`push`](LinearBase.md#push)
|
|
1131
|
+
|
|
1132
|
+
***
|
|
1133
|
+
|
|
1134
|
+
### pushMany()
|
|
1135
|
+
|
|
1136
|
+
```ts
|
|
1137
|
+
abstract pushMany(elements): boolean[];
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
Defined in: [data-structures/base/linear-base.ts:344](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L344)
|
|
1141
|
+
|
|
1142
|
+
Append many elements/nodes at once.
|
|
1143
|
+
|
|
1144
|
+
#### Parameters
|
|
1145
|
+
|
|
1146
|
+
##### elements
|
|
1147
|
+
|
|
1148
|
+
\| `Iterable`\<`E`, `any`, `any`\>
|
|
1149
|
+
\| `Iterable`\<`R`, `any`, `any`\>
|
|
1150
|
+
\| `Iterable`\<`NODE`, `any`, `any`\>
|
|
1151
|
+
|
|
1152
|
+
Iterable of elements or nodes.
|
|
1153
|
+
|
|
1154
|
+
#### Returns
|
|
1155
|
+
|
|
1156
|
+
`boolean`[]
|
|
1157
|
+
|
|
1158
|
+
Array of booleans indicating append success.
|
|
1159
|
+
|
|
1160
|
+
#### Remarks
|
|
1161
|
+
|
|
1162
|
+
Time O(n), Space O(1)
|
|
1163
|
+
|
|
1164
|
+
#### Inherited from
|
|
1165
|
+
|
|
1166
|
+
[`LinearBase`](LinearBase.md).[`pushMany`](LinearBase.md#pushmany)
|
|
1167
|
+
|
|
1168
|
+
***
|
|
1169
|
+
|
|
1170
|
+
### reduce()
|
|
1171
|
+
|
|
1172
|
+
Reduces all elements to a single accumulated value.
|
|
1173
|
+
|
|
1174
|
+
#### Param
|
|
1175
|
+
|
|
1176
|
+
Reducer of signature `(acc, value, index, self) => nextAcc`. The first element is used as the initial accumulator.
|
|
1177
|
+
|
|
1178
|
+
#### Param
|
|
1179
|
+
|
|
1180
|
+
Reducer of signature `(acc, value, index, self) => nextAcc`.
|
|
1181
|
+
|
|
1182
|
+
#### Param
|
|
1183
|
+
|
|
1184
|
+
The initial accumulator value of type `E`.
|
|
1185
|
+
|
|
1186
|
+
#### Template
|
|
1187
|
+
|
|
1188
|
+
The accumulator type when it differs from `E`.
|
|
1189
|
+
|
|
1190
|
+
#### Param
|
|
1191
|
+
|
|
1192
|
+
Reducer of signature `(acc: U, value, index, self) => U`.
|
|
1193
|
+
|
|
1194
|
+
#### Param
|
|
1195
|
+
|
|
1196
|
+
The initial accumulator value of type `U`.
|
|
1197
|
+
|
|
1198
|
+
#### Remarks
|
|
1199
|
+
|
|
1200
|
+
Time O(n), Space O(1). Throws if called on an empty structure without `initialValue`.
|
|
1201
|
+
|
|
1202
|
+
#### Call Signature
|
|
1203
|
+
|
|
1204
|
+
```ts
|
|
1205
|
+
reduce(callbackfn): E;
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
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)
|
|
1209
|
+
|
|
1210
|
+
##### Parameters
|
|
1211
|
+
|
|
1212
|
+
###### callbackfn
|
|
1213
|
+
|
|
1214
|
+
`ReduceElementCallback`\<`E`, `R`\>
|
|
1215
|
+
|
|
1216
|
+
##### Returns
|
|
1217
|
+
|
|
1218
|
+
`E`
|
|
1219
|
+
|
|
1220
|
+
##### Inherited from
|
|
1221
|
+
|
|
1222
|
+
[`LinearBase`](LinearBase.md).[`reduce`](LinearBase.md#reduce)
|
|
1223
|
+
|
|
1224
|
+
#### Call Signature
|
|
1225
|
+
|
|
1226
|
+
```ts
|
|
1227
|
+
reduce(callbackfn, initialValue): E;
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
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)
|
|
1231
|
+
|
|
1232
|
+
##### Parameters
|
|
1233
|
+
|
|
1234
|
+
###### callbackfn
|
|
1235
|
+
|
|
1236
|
+
`ReduceElementCallback`\<`E`, `R`\>
|
|
1237
|
+
|
|
1238
|
+
###### initialValue
|
|
1239
|
+
|
|
1240
|
+
`E`
|
|
1241
|
+
|
|
1242
|
+
##### Returns
|
|
1243
|
+
|
|
1244
|
+
`E`
|
|
1245
|
+
|
|
1246
|
+
##### Inherited from
|
|
1247
|
+
|
|
1248
|
+
[`LinearBase`](LinearBase.md).[`reduce`](LinearBase.md#reduce)
|
|
1249
|
+
|
|
1250
|
+
#### Call Signature
|
|
1251
|
+
|
|
1252
|
+
```ts
|
|
1253
|
+
reduce<U>(callbackfn, initialValue): U;
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
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)
|
|
1257
|
+
|
|
1258
|
+
##### Type Parameters
|
|
1259
|
+
|
|
1260
|
+
###### U
|
|
1261
|
+
|
|
1262
|
+
`U`
|
|
1263
|
+
|
|
1264
|
+
##### Parameters
|
|
1265
|
+
|
|
1266
|
+
###### callbackfn
|
|
1267
|
+
|
|
1268
|
+
`ReduceElementCallback`\<`E`, `R`, `U`\>
|
|
1269
|
+
|
|
1270
|
+
###### initialValue
|
|
1271
|
+
|
|
1272
|
+
`U`
|
|
1273
|
+
|
|
1274
|
+
##### Returns
|
|
1275
|
+
|
|
1276
|
+
`U`
|
|
1277
|
+
|
|
1278
|
+
##### Inherited from
|
|
1279
|
+
|
|
1280
|
+
[`LinearBase`](LinearBase.md).[`reduce`](LinearBase.md#reduce)
|
|
1281
|
+
|
|
1282
|
+
***
|
|
1283
|
+
|
|
1284
|
+
### reduceRight()
|
|
1285
|
+
|
|
1286
|
+
```ts
|
|
1287
|
+
reduceRight<U>(callbackfn, initialValue): U;
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
Defined in: [data-structures/base/linear-base.ts:574](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L574)
|
|
1291
|
+
|
|
1292
|
+
Right-to-left reduction using reverse iterator.
|
|
1293
|
+
|
|
1294
|
+
#### Type Parameters
|
|
1295
|
+
|
|
1296
|
+
##### U
|
|
1297
|
+
|
|
1298
|
+
`U`
|
|
1299
|
+
|
|
1300
|
+
#### Parameters
|
|
1301
|
+
|
|
1302
|
+
##### callbackfn
|
|
1303
|
+
|
|
1304
|
+
`ReduceLinearCallback`\<`E`, `U`\>
|
|
1305
|
+
|
|
1306
|
+
`(acc, element, index, self) => acc`.
|
|
1307
|
+
|
|
1308
|
+
##### initialValue
|
|
1309
|
+
|
|
1310
|
+
`U`
|
|
1311
|
+
|
|
1312
|
+
Initial accumulator.
|
|
1313
|
+
|
|
1314
|
+
#### Returns
|
|
1315
|
+
|
|
1316
|
+
`U`
|
|
1317
|
+
|
|
1318
|
+
Final accumulator.
|
|
1319
|
+
|
|
1320
|
+
#### Remarks
|
|
1321
|
+
|
|
1322
|
+
Time O(n), Space O(1)
|
|
1323
|
+
|
|
1324
|
+
#### Overrides
|
|
1325
|
+
|
|
1326
|
+
[`LinearBase`](LinearBase.md).[`reduceRight`](LinearBase.md#reduceright)
|
|
1327
|
+
|
|
1328
|
+
***
|
|
1329
|
+
|
|
1330
|
+
### reverse()
|
|
1331
|
+
|
|
1332
|
+
```ts
|
|
1333
|
+
abstract reverse(): this;
|
|
1334
|
+
```
|
|
1335
|
+
|
|
1336
|
+
Defined in: [data-structures/base/linear-base.ts:328](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L328)
|
|
1337
|
+
|
|
1338
|
+
Reverse the order of elements in-place (or equivalent).
|
|
1339
|
+
|
|
1340
|
+
#### Returns
|
|
1341
|
+
|
|
1342
|
+
`this`
|
|
1343
|
+
|
|
1344
|
+
This list.
|
|
1345
|
+
|
|
1346
|
+
#### Remarks
|
|
1347
|
+
|
|
1348
|
+
Time O(n), Space O(1)
|
|
1349
|
+
|
|
1350
|
+
#### Inherited from
|
|
1351
|
+
|
|
1352
|
+
[`LinearBase`](LinearBase.md).[`reverse`](LinearBase.md#reverse)
|
|
1353
|
+
|
|
1354
|
+
***
|
|
1355
|
+
|
|
1356
|
+
### setAt()
|
|
1357
|
+
|
|
1358
|
+
```ts
|
|
1359
|
+
abstract setAt(index, value): boolean;
|
|
1360
|
+
```
|
|
1361
|
+
|
|
1362
|
+
Defined in: [data-structures/base/linear-base.ts:314](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L314)
|
|
1363
|
+
|
|
1364
|
+
Set the value at an index.
|
|
1365
|
+
|
|
1366
|
+
#### Parameters
|
|
1367
|
+
|
|
1368
|
+
##### index
|
|
1369
|
+
|
|
1370
|
+
`number`
|
|
1371
|
+
|
|
1372
|
+
Position (0-based).
|
|
1373
|
+
|
|
1374
|
+
##### value
|
|
1375
|
+
|
|
1376
|
+
`E`
|
|
1377
|
+
|
|
1378
|
+
New value.
|
|
1379
|
+
|
|
1380
|
+
#### Returns
|
|
1381
|
+
|
|
1382
|
+
`boolean`
|
|
1383
|
+
|
|
1384
|
+
`true` if updated.
|
|
1385
|
+
|
|
1386
|
+
#### Remarks
|
|
1387
|
+
|
|
1388
|
+
Time O(1) typical, Space O(1)
|
|
1389
|
+
|
|
1390
|
+
#### Inherited from
|
|
1391
|
+
|
|
1392
|
+
[`LinearBase`](LinearBase.md).[`setAt`](LinearBase.md#setat)
|
|
1393
|
+
|
|
1394
|
+
***
|
|
1395
|
+
|
|
1396
|
+
### slice()
|
|
1397
|
+
|
|
1398
|
+
```ts
|
|
1399
|
+
slice(start?, end?): this;
|
|
1400
|
+
```
|
|
1401
|
+
|
|
1402
|
+
Defined in: [data-structures/base/linear-base.ts:494](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L494)
|
|
1403
|
+
|
|
1404
|
+
Slice via forward iteration (no random access required).
|
|
1405
|
+
|
|
1406
|
+
#### Parameters
|
|
1407
|
+
|
|
1408
|
+
##### start?
|
|
1409
|
+
|
|
1410
|
+
`number` = `0`
|
|
1411
|
+
|
|
1412
|
+
Inclusive start (supports negative index).
|
|
1413
|
+
|
|
1414
|
+
##### end?
|
|
1415
|
+
|
|
1416
|
+
`number` = `...`
|
|
1417
|
+
|
|
1418
|
+
Exclusive end (supports negative index).
|
|
1419
|
+
|
|
1420
|
+
#### Returns
|
|
1421
|
+
|
|
1422
|
+
`this`
|
|
1423
|
+
|
|
1424
|
+
New list (`this` type).
|
|
1425
|
+
|
|
1426
|
+
#### Remarks
|
|
1427
|
+
|
|
1428
|
+
Time O(n), Space O(n)
|
|
1429
|
+
|
|
1430
|
+
#### Overrides
|
|
1431
|
+
|
|
1432
|
+
[`LinearBase`](LinearBase.md).[`slice`](LinearBase.md#slice)
|
|
1433
|
+
|
|
1434
|
+
***
|
|
1435
|
+
|
|
1436
|
+
### some()
|
|
1437
|
+
|
|
1438
|
+
```ts
|
|
1439
|
+
some(predicate, thisArg?): boolean;
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
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)
|
|
1443
|
+
|
|
1444
|
+
Tests whether at least one element satisfies the predicate.
|
|
1445
|
+
|
|
1446
|
+
#### Parameters
|
|
1447
|
+
|
|
1448
|
+
##### predicate
|
|
1449
|
+
|
|
1450
|
+
`ElementCallback`\<`E`, `R`, `boolean`\>
|
|
1451
|
+
|
|
1452
|
+
Function invoked for each element with signature `(value, index, self)`.
|
|
1453
|
+
|
|
1454
|
+
##### thisArg?
|
|
1455
|
+
|
|
1456
|
+
`unknown`
|
|
1457
|
+
|
|
1458
|
+
Optional `this` binding for the predicate.
|
|
1459
|
+
|
|
1460
|
+
#### Returns
|
|
1461
|
+
|
|
1462
|
+
`boolean`
|
|
1463
|
+
|
|
1464
|
+
`true` if any element passes; otherwise `false`.
|
|
1465
|
+
|
|
1466
|
+
#### Remarks
|
|
1467
|
+
|
|
1468
|
+
Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
1469
|
+
|
|
1470
|
+
#### Inherited from
|
|
1471
|
+
|
|
1472
|
+
[`LinearBase`](LinearBase.md).[`some`](LinearBase.md#some)
|
|
1473
|
+
|
|
1474
|
+
***
|
|
1475
|
+
|
|
1476
|
+
### sort()
|
|
1477
|
+
|
|
1478
|
+
```ts
|
|
1479
|
+
sort(compareFn?): this;
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L185)
|
|
1483
|
+
|
|
1484
|
+
In-place stable order via array sort semantics.
|
|
1485
|
+
|
|
1486
|
+
#### Parameters
|
|
1487
|
+
|
|
1488
|
+
##### compareFn?
|
|
1489
|
+
|
|
1490
|
+
(`a`, `b`) => `number`
|
|
1491
|
+
|
|
1492
|
+
Comparator `(a, b) => number`.
|
|
1493
|
+
|
|
1494
|
+
#### Returns
|
|
1495
|
+
|
|
1496
|
+
`this`
|
|
1497
|
+
|
|
1498
|
+
This container.
|
|
1499
|
+
|
|
1500
|
+
#### Remarks
|
|
1501
|
+
|
|
1502
|
+
Time O(n log n), Space O(n) (materializes to array temporarily)
|
|
1503
|
+
|
|
1504
|
+
#### Inherited from
|
|
1505
|
+
|
|
1506
|
+
[`LinearBase`](LinearBase.md).[`sort`](LinearBase.md#sort)
|
|
1507
|
+
|
|
1508
|
+
***
|
|
1509
|
+
|
|
1510
|
+
### splice()
|
|
1511
|
+
|
|
1512
|
+
```ts
|
|
1513
|
+
splice(
|
|
1514
|
+
start,
|
|
1515
|
+
deleteCount?, ...
|
|
1516
|
+
items): this;
|
|
1517
|
+
```
|
|
1518
|
+
|
|
1519
|
+
Defined in: [data-structures/base/linear-base.ts:522](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L522)
|
|
1520
|
+
|
|
1521
|
+
Splice by walking node iterators from the start index.
|
|
1522
|
+
|
|
1523
|
+
#### Parameters
|
|
1524
|
+
|
|
1525
|
+
##### start
|
|
1526
|
+
|
|
1527
|
+
`number`
|
|
1528
|
+
|
|
1529
|
+
Start index.
|
|
1530
|
+
|
|
1531
|
+
##### deleteCount?
|
|
1532
|
+
|
|
1533
|
+
`number` = `0`
|
|
1534
|
+
|
|
1535
|
+
How many elements to remove.
|
|
1536
|
+
|
|
1537
|
+
##### items
|
|
1538
|
+
|
|
1539
|
+
...`E`[]
|
|
1540
|
+
|
|
1541
|
+
Elements to insert after the splice point.
|
|
1542
|
+
|
|
1543
|
+
#### Returns
|
|
1544
|
+
|
|
1545
|
+
`this`
|
|
1546
|
+
|
|
1547
|
+
Removed elements as a new list (`this` type).
|
|
1548
|
+
|
|
1549
|
+
#### Remarks
|
|
1550
|
+
|
|
1551
|
+
Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
1552
|
+
|
|
1553
|
+
#### Overrides
|
|
1554
|
+
|
|
1555
|
+
[`LinearBase`](LinearBase.md).[`splice`](LinearBase.md#splice)
|
|
1556
|
+
|
|
1557
|
+
***
|
|
1558
|
+
|
|
1559
|
+
### toArray()
|
|
1560
|
+
|
|
1561
|
+
```ts
|
|
1562
|
+
toArray(): E[];
|
|
1563
|
+
```
|
|
1564
|
+
|
|
1565
|
+
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)
|
|
1566
|
+
|
|
1567
|
+
Materializes the elements into a new array.
|
|
1568
|
+
|
|
1569
|
+
#### Returns
|
|
1570
|
+
|
|
1571
|
+
`E`[]
|
|
1572
|
+
|
|
1573
|
+
A shallow array copy of the iteration order.
|
|
1574
|
+
|
|
1575
|
+
#### Remarks
|
|
1576
|
+
|
|
1577
|
+
Time O(n), Space O(n).
|
|
1578
|
+
|
|
1579
|
+
#### Inherited from
|
|
1580
|
+
|
|
1581
|
+
[`LinearBase`](LinearBase.md).[`toArray`](LinearBase.md#toarray)
|
|
1582
|
+
|
|
1583
|
+
***
|
|
1584
|
+
|
|
1585
|
+
### toReversedArray()
|
|
1586
|
+
|
|
1587
|
+
```ts
|
|
1588
|
+
toReversedArray(): E[];
|
|
1589
|
+
```
|
|
1590
|
+
|
|
1591
|
+
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L237)
|
|
1592
|
+
|
|
1593
|
+
Snapshot elements into a reversed array.
|
|
1594
|
+
|
|
1595
|
+
#### Returns
|
|
1596
|
+
|
|
1597
|
+
`E`[]
|
|
1598
|
+
|
|
1599
|
+
New reversed array.
|
|
1600
|
+
|
|
1601
|
+
#### Remarks
|
|
1602
|
+
|
|
1603
|
+
Time O(n), Space O(n)
|
|
1604
|
+
|
|
1605
|
+
#### Inherited from
|
|
1606
|
+
|
|
1607
|
+
[`LinearBase`](LinearBase.md).[`toReversedArray`](LinearBase.md#toreversedarray)
|
|
1608
|
+
|
|
1609
|
+
***
|
|
1610
|
+
|
|
1611
|
+
### toVisual()
|
|
1612
|
+
|
|
1613
|
+
```ts
|
|
1614
|
+
toVisual(): E[];
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
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)
|
|
1618
|
+
|
|
1619
|
+
Returns a representation of the structure suitable for quick visualization.
|
|
1620
|
+
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
1621
|
+
|
|
1622
|
+
#### Returns
|
|
1623
|
+
|
|
1624
|
+
`E`[]
|
|
1625
|
+
|
|
1626
|
+
A visual representation (array by default).
|
|
1627
|
+
|
|
1628
|
+
#### Remarks
|
|
1629
|
+
|
|
1630
|
+
Time O(n), Space O(n).
|
|
1631
|
+
|
|
1632
|
+
#### Inherited from
|
|
1633
|
+
|
|
1634
|
+
[`LinearBase`](LinearBase.md).[`toVisual`](LinearBase.md#tovisual)
|
|
1635
|
+
|
|
1636
|
+
***
|
|
1637
|
+
|
|
1638
|
+
### values()
|
|
1639
|
+
|
|
1640
|
+
```ts
|
|
1641
|
+
values(): IterableIterator<E>;
|
|
1642
|
+
```
|
|
1643
|
+
|
|
1644
|
+
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)
|
|
1645
|
+
|
|
1646
|
+
Returns an iterator over the values (alias of the default iterator).
|
|
1647
|
+
|
|
1648
|
+
#### Returns
|
|
1649
|
+
|
|
1650
|
+
`IterableIterator`\<`E`\>
|
|
1651
|
+
|
|
1652
|
+
An `IterableIterator<E>` over all elements.
|
|
1653
|
+
|
|
1654
|
+
#### Remarks
|
|
1655
|
+
|
|
1656
|
+
Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
1657
|
+
|
|
1658
|
+
#### Inherited from
|
|
1659
|
+
|
|
1660
|
+
[`LinearBase`](LinearBase.md).[`values`](LinearBase.md#values)
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
---
|
|
1664
|
+
|
|
1665
|
+
## Protected Members
|
|
1666
|
+
|
|
1667
|
+
### \_toElementFn?
|
|
1668
|
+
|
|
1669
|
+
```ts
|
|
1670
|
+
protected optional _toElementFn?: (rawElement) => E;
|
|
1671
|
+
```
|
|
1672
|
+
|
|
1673
|
+
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)
|
|
1674
|
+
|
|
1675
|
+
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
1676
|
+
|
|
1677
|
+
#### Parameters
|
|
1678
|
+
|
|
1679
|
+
##### rawElement
|
|
1680
|
+
|
|
1681
|
+
`R`
|
|
1682
|
+
|
|
1683
|
+
#### Returns
|
|
1684
|
+
|
|
1685
|
+
`E`
|
|
1686
|
+
|
|
1687
|
+
#### Remarks
|
|
1688
|
+
|
|
1689
|
+
Time O(1), Space O(1).
|
|
1690
|
+
|
|
1691
|
+
#### Inherited from
|
|
1692
|
+
|
|
1693
|
+
[`LinearBase`](LinearBase.md).[`_toElementFn`](LinearBase.md#_toelementfn)
|
|
1694
|
+
|
|
1695
|
+
## Accessors
|
|
1696
|
+
|
|
1697
|
+
### \_createInstance()
|
|
1698
|
+
|
|
1699
|
+
```ts
|
|
1700
|
+
abstract protected _createInstance(options?): this;
|
|
1701
|
+
```
|
|
1702
|
+
|
|
1703
|
+
Defined in: [data-structures/base/linear-base.ts:385](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L385)
|
|
1704
|
+
|
|
1705
|
+
Create an empty list of the same species.
|
|
1706
|
+
|
|
1707
|
+
#### Parameters
|
|
1708
|
+
|
|
1709
|
+
##### options?
|
|
1710
|
+
|
|
1711
|
+
`LinearBaseOptions`\<`E`, `R`\>
|
|
1712
|
+
|
|
1713
|
+
Runtime options to carry.
|
|
1714
|
+
|
|
1715
|
+
#### Returns
|
|
1716
|
+
|
|
1717
|
+
`this`
|
|
1718
|
+
|
|
1719
|
+
Empty list (`this` type).
|
|
1720
|
+
|
|
1721
|
+
#### Remarks
|
|
1722
|
+
|
|
1723
|
+
Time O(1), Space O(1)
|
|
1724
|
+
|
|
1725
|
+
#### Inherited from
|
|
1726
|
+
|
|
1727
|
+
[`LinearBase`](LinearBase.md).[`_createInstance`](LinearBase.md#_createinstance)
|
|
1728
|
+
|
|
1729
|
+
***
|
|
1730
|
+
|
|
1731
|
+
### \_getIterator()
|
|
1732
|
+
|
|
1733
|
+
```ts
|
|
1734
|
+
abstract protected _getIterator(...args): IterableIterator<E>;
|
|
1735
|
+
```
|
|
1736
|
+
|
|
1737
|
+
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)
|
|
1738
|
+
|
|
1739
|
+
Internal iterator factory used by the default iterator.
|
|
1740
|
+
|
|
1741
|
+
#### Parameters
|
|
1742
|
+
|
|
1743
|
+
##### args
|
|
1744
|
+
|
|
1745
|
+
...`unknown`[]
|
|
1746
|
+
|
|
1747
|
+
Optional iterator arguments.
|
|
1748
|
+
|
|
1749
|
+
#### Returns
|
|
1750
|
+
|
|
1751
|
+
`IterableIterator`\<`E`\>
|
|
1752
|
+
|
|
1753
|
+
An iterator over elements.
|
|
1754
|
+
|
|
1755
|
+
#### Remarks
|
|
1756
|
+
|
|
1757
|
+
Implementations should yield in O(1) per element with O(1) extra space when possible.
|
|
1758
|
+
|
|
1759
|
+
#### Inherited from
|
|
1760
|
+
|
|
1761
|
+
[`LinearBase`](LinearBase.md).[`_getIterator`](LinearBase.md#_getiterator)
|
|
1762
|
+
|
|
1763
|
+
***
|
|
1764
|
+
|
|
1765
|
+
### \_getNodeIterator()
|
|
1766
|
+
|
|
1767
|
+
```ts
|
|
1768
|
+
abstract protected _getNodeIterator(...args): IterableIterator<NODE>;
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
Defined in: [data-structures/base/linear-base.ts:624](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L624)
|
|
1772
|
+
|
|
1773
|
+
Iterate linked nodes from head to tail.
|
|
1774
|
+
|
|
1775
|
+
#### Parameters
|
|
1776
|
+
|
|
1777
|
+
##### args
|
|
1778
|
+
|
|
1779
|
+
...`unknown`[]
|
|
1780
|
+
|
|
1781
|
+
#### Returns
|
|
1782
|
+
|
|
1783
|
+
`IterableIterator`\<`NODE`\>
|
|
1784
|
+
|
|
1785
|
+
Iterator over nodes.
|
|
1786
|
+
|
|
1787
|
+
#### Remarks
|
|
1788
|
+
|
|
1789
|
+
Time O(n), Space O(1)
|
|
1790
|
+
|
|
1791
|
+
***
|
|
1792
|
+
|
|
1793
|
+
### \_getPrevNode()
|
|
1794
|
+
|
|
1795
|
+
```ts
|
|
1796
|
+
abstract protected _getPrevNode(node): NODE | undefined;
|
|
1797
|
+
```
|
|
1798
|
+
|
|
1799
|
+
Defined in: [data-structures/base/linear-base.ts:632](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L632)
|
|
1800
|
+
|
|
1801
|
+
Get previous node of a given node.
|
|
1802
|
+
|
|
1803
|
+
#### Parameters
|
|
1804
|
+
|
|
1805
|
+
##### node
|
|
1806
|
+
|
|
1807
|
+
`NODE`
|
|
1808
|
+
|
|
1809
|
+
Current node.
|
|
1810
|
+
|
|
1811
|
+
#### Returns
|
|
1812
|
+
|
|
1813
|
+
`NODE` \| `undefined`
|
|
1814
|
+
|
|
1815
|
+
Previous node or `undefined`.
|
|
1816
|
+
|
|
1817
|
+
#### Remarks
|
|
1818
|
+
|
|
1819
|
+
Time O(1)~O(n) depending on list variant (singly vs doubly), Space O(1)
|
|
1820
|
+
|
|
1821
|
+
***
|
|
1822
|
+
|
|
1823
|
+
### \_getReverseIterator()
|
|
1824
|
+
|
|
1825
|
+
```ts
|
|
1826
|
+
abstract protected _getReverseIterator(...args): IterableIterator<E>;
|
|
1827
|
+
```
|
|
1828
|
+
|
|
1829
|
+
Defined in: [data-structures/base/linear-base.ts:392](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L392)
|
|
1830
|
+
|
|
1831
|
+
Reverse-direction iterator over elements.
|
|
1832
|
+
|
|
1833
|
+
#### Parameters
|
|
1834
|
+
|
|
1835
|
+
##### args
|
|
1836
|
+
|
|
1837
|
+
...`unknown`[]
|
|
1838
|
+
|
|
1839
|
+
#### Returns
|
|
1840
|
+
|
|
1841
|
+
`IterableIterator`\<`E`\>
|
|
1842
|
+
|
|
1843
|
+
Iterator of elements from tail to head.
|
|
1844
|
+
|
|
1845
|
+
#### Remarks
|
|
1846
|
+
|
|
1847
|
+
Time O(n), Space O(1)
|
|
1848
|
+
|
|
1849
|
+
#### Inherited from
|
|
1850
|
+
|
|
1851
|
+
[`LinearBase`](LinearBase.md).[`_getReverseIterator`](LinearBase.md#_getreverseiterator)
|
|
1852
|
+
|
|
1853
|
+
***
|