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: SinglyLinkedList\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:194](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:194](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L194)
|
|
10
10
|
|
|
11
11
|
Singly linked list with O(1) push/pop-like ends operations and linear scans.
|
|
12
12
|
|
|
@@ -170,7 +170,7 @@ Time O(1), Space O(1)
|
|
|
170
170
|
|
|
171
171
|
`R` = `any`
|
|
172
172
|
|
|
173
|
-
1. Node Structure: Each node contains
|
|
173
|
+
1. Node Structure: Each node contains two parts: a data field and a pointer (or reference) to the next node. This structure allows forward-only traversal of the linked list.
|
|
174
174
|
2. Bidirectional Traversal: Unlike doubly linked lists, singly linked lists can be easily traversed forwards but not backwards.
|
|
175
175
|
3. No Centralized Index: Unlike arrays, elements in a linked list are not stored contiguously, so there is no centralized index. Accessing elements in a linked list typically requires traversing from the head or tail node.
|
|
176
176
|
4. High Efficiency in Insertion and Deletion: Adding or removing elements in a linked list does not require moving other elements, making these operations more efficient than in arrays.
|
|
@@ -184,7 +184,7 @@ Caution: Although our linked list classes provide methods such as at, setAt, add
|
|
|
184
184
|
new SinglyLinkedList<E, R>(elements?, options?): SinglyLinkedList<E, R>;
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:205](https://github.com/zrwusa/data-structure-typed/blob/
|
|
187
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:205](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L205)
|
|
188
188
|
|
|
189
189
|
Create a SinglyLinkedList and optionally bulk-insert elements.
|
|
190
190
|
|
|
@@ -230,7 +230,7 @@ LinearLinkedBase<E, R, SinglyLinkedListNode<E>>.constructor
|
|
|
230
230
|
get first(): E | undefined;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:255](https://github.com/zrwusa/data-structure-typed/blob/
|
|
233
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:255](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L255)
|
|
234
234
|
|
|
235
235
|
Get the first element value.
|
|
236
236
|
|
|
@@ -254,7 +254,7 @@ First element or undefined.
|
|
|
254
254
|
get head(): SinglyLinkedListNode<E> | undefined;
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:221](https://github.com/zrwusa/data-structure-typed/blob/
|
|
257
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:221](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L221)
|
|
258
258
|
|
|
259
259
|
Get the head node.
|
|
260
260
|
|
|
@@ -278,7 +278,7 @@ Head node or undefined.
|
|
|
278
278
|
get last(): E | undefined;
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:265](https://github.com/zrwusa/data-structure-typed/blob/
|
|
281
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:265](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L265)
|
|
282
282
|
|
|
283
283
|
Get the last element value.
|
|
284
284
|
|
|
@@ -302,7 +302,7 @@ Last element or undefined.
|
|
|
302
302
|
get length(): number;
|
|
303
303
|
```
|
|
304
304
|
|
|
305
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:245](https://github.com/zrwusa/data-structure-typed/blob/
|
|
305
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:245](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L245)
|
|
306
306
|
|
|
307
307
|
Get the number of elements.
|
|
308
308
|
|
|
@@ -330,7 +330,7 @@ Current length.
|
|
|
330
330
|
get maxLen(): number;
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
-
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/
|
|
333
|
+
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)
|
|
334
334
|
|
|
335
335
|
Upper bound for length (if positive), or `-1` when unbounded.
|
|
336
336
|
|
|
@@ -358,7 +358,7 @@ Maximum allowed length.
|
|
|
358
358
|
get tail(): SinglyLinkedListNode<E> | undefined;
|
|
359
359
|
```
|
|
360
360
|
|
|
361
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:233](https://github.com/zrwusa/data-structure-typed/blob/
|
|
361
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:233](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L233)
|
|
362
362
|
|
|
363
363
|
Get the tail node.
|
|
364
364
|
|
|
@@ -382,7 +382,7 @@ Tail node or undefined.
|
|
|
382
382
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
383
383
|
```
|
|
384
384
|
|
|
385
|
-
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/
|
|
385
|
+
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)
|
|
386
386
|
|
|
387
387
|
Exposes the current `toElementFn`, if configured.
|
|
388
388
|
|
|
@@ -408,7 +408,7 @@ The converter function or `undefined` when not set.
|
|
|
408
408
|
iterator: IterableIterator<E>;
|
|
409
409
|
```
|
|
410
410
|
|
|
411
|
-
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/
|
|
411
|
+
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)
|
|
412
412
|
|
|
413
413
|
Returns an iterator over the structure's elements.
|
|
414
414
|
|
|
@@ -442,7 +442,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
442
442
|
addAfter(existingElementOrNode, newElementOrNode): boolean;
|
|
443
443
|
```
|
|
444
444
|
|
|
445
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
445
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1189](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1189)
|
|
446
446
|
|
|
447
447
|
Insert a new element/node after an existing one.
|
|
448
448
|
|
|
@@ -482,7 +482,7 @@ Time O(N), Space O(1)
|
|
|
482
482
|
addAt(index, newElementOrNode): boolean;
|
|
483
483
|
```
|
|
484
484
|
|
|
485
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
485
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:934](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L934)
|
|
486
486
|
|
|
487
487
|
Insert a new element/node at an index, shifting following nodes.
|
|
488
488
|
|
|
@@ -533,7 +533,7 @@ Time O(N), Space O(1)
|
|
|
533
533
|
addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
534
534
|
```
|
|
535
535
|
|
|
536
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
536
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1159](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1159)
|
|
537
537
|
|
|
538
538
|
Insert a new element/node before an existing one.
|
|
539
539
|
|
|
@@ -573,7 +573,7 @@ Time O(N), Space O(1)
|
|
|
573
573
|
at(index): E | undefined;
|
|
574
574
|
```
|
|
575
575
|
|
|
576
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
576
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:686](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L686)
|
|
577
577
|
|
|
578
578
|
Get the element at a given index.
|
|
579
579
|
|
|
@@ -619,7 +619,7 @@ Time O(N), Space O(1)
|
|
|
619
619
|
clear(): void;
|
|
620
620
|
```
|
|
621
621
|
|
|
622
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
622
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1059](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1059)
|
|
623
623
|
|
|
624
624
|
Remove all nodes and reset length.
|
|
625
625
|
|
|
@@ -656,7 +656,7 @@ Time O(N), Space O(1)
|
|
|
656
656
|
clone(): this;
|
|
657
657
|
```
|
|
658
658
|
|
|
659
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
659
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1367](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1367)
|
|
660
660
|
|
|
661
661
|
Deep clone this list (values are copied by reference).
|
|
662
662
|
|
|
@@ -695,7 +695,7 @@ Time O(N), Space O(N)
|
|
|
695
695
|
concat(...items): this;
|
|
696
696
|
```
|
|
697
697
|
|
|
698
|
-
Defined in: [data-structures/base/linear-base.ts:473](https://github.com/zrwusa/data-structure-typed/blob/
|
|
698
|
+
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)
|
|
699
699
|
|
|
700
700
|
Concatenate lists/elements preserving order.
|
|
701
701
|
|
|
@@ -731,7 +731,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
731
731
|
countOccurrences(elementOrNode): number;
|
|
732
732
|
```
|
|
733
733
|
|
|
734
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
734
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1265](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1265)
|
|
735
735
|
|
|
736
736
|
Count how many nodes match a value/node/predicate.
|
|
737
737
|
|
|
@@ -763,7 +763,7 @@ Time O(N), Space O(1)
|
|
|
763
763
|
delete(elementOrNode?): boolean;
|
|
764
764
|
```
|
|
765
765
|
|
|
766
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
766
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:868](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L868)
|
|
767
767
|
|
|
768
768
|
Delete the first match by value/node.
|
|
769
769
|
|
|
@@ -808,7 +808,7 @@ Time O(N), Space O(1)
|
|
|
808
808
|
deleteAt(index): E | undefined;
|
|
809
809
|
```
|
|
810
810
|
|
|
811
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
811
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:808](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L808)
|
|
812
812
|
|
|
813
813
|
Delete the element at an index.
|
|
814
814
|
|
|
@@ -853,7 +853,7 @@ Time O(N), Space O(1)
|
|
|
853
853
|
deleteWhere(predicate): boolean;
|
|
854
854
|
```
|
|
855
855
|
|
|
856
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
856
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1295](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1295)
|
|
857
857
|
|
|
858
858
|
Delete the first node whose value matches a predicate.
|
|
859
859
|
|
|
@@ -883,7 +883,7 @@ Time O(N), Space O(1)
|
|
|
883
883
|
every(predicate, thisArg?): boolean;
|
|
884
884
|
```
|
|
885
885
|
|
|
886
|
-
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/
|
|
886
|
+
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)
|
|
887
887
|
|
|
888
888
|
Tests whether all elements satisfy the predicate.
|
|
889
889
|
|
|
@@ -926,7 +926,7 @@ fill(
|
|
|
926
926
|
end?): this;
|
|
927
927
|
```
|
|
928
928
|
|
|
929
|
-
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/
|
|
929
|
+
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)
|
|
930
930
|
|
|
931
931
|
Fill a range with a value.
|
|
932
932
|
|
|
@@ -972,7 +972,7 @@ Time O(n), Space O(1)
|
|
|
972
972
|
filter(callback, thisArg?): this;
|
|
973
973
|
```
|
|
974
974
|
|
|
975
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
975
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1435](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1435)
|
|
976
976
|
|
|
977
977
|
Filter values into a new list of the same class.
|
|
978
978
|
|
|
@@ -1035,7 +1035,7 @@ Time O(N), Space O(N)
|
|
|
1035
1035
|
find<S>(predicate, thisArg?): S | undefined;
|
|
1036
1036
|
```
|
|
1037
1037
|
|
|
1038
|
-
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1038
|
+
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)
|
|
1039
1039
|
|
|
1040
1040
|
Finds the first element that satisfies the predicate and returns it.
|
|
1041
1041
|
|
|
@@ -1081,7 +1081,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1081
1081
|
find(predicate, thisArg?): E | undefined;
|
|
1082
1082
|
```
|
|
1083
1083
|
|
|
1084
|
-
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1084
|
+
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)
|
|
1085
1085
|
|
|
1086
1086
|
Finds the first element that satisfies the predicate and returns it.
|
|
1087
1087
|
|
|
@@ -1123,7 +1123,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1123
1123
|
findIndex(predicate, thisArg?): number;
|
|
1124
1124
|
```
|
|
1125
1125
|
|
|
1126
|
-
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1126
|
+
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)
|
|
1127
1127
|
|
|
1128
1128
|
Find the first index matching a predicate.
|
|
1129
1129
|
|
|
@@ -1163,7 +1163,7 @@ Time O(n), Space O(1)
|
|
|
1163
1163
|
forEach(callbackfn, thisArg?): void;
|
|
1164
1164
|
```
|
|
1165
1165
|
|
|
1166
|
-
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1166
|
+
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)
|
|
1167
1167
|
|
|
1168
1168
|
Invokes a callback for each element in iteration order.
|
|
1169
1169
|
|
|
@@ -1203,7 +1203,7 @@ Time O(n), Space O(1).
|
|
|
1203
1203
|
getNode(elementNodeOrPredicate?): SinglyLinkedListNode<E> | undefined;
|
|
1204
1204
|
```
|
|
1205
1205
|
|
|
1206
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1206
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1137](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1137)
|
|
1207
1207
|
|
|
1208
1208
|
Find a node by value, reference, or predicate.
|
|
1209
1209
|
|
|
@@ -1235,7 +1235,7 @@ Time O(N), Space O(1)
|
|
|
1235
1235
|
getNodeAt(index): SinglyLinkedListNode<E> | undefined;
|
|
1236
1236
|
```
|
|
1237
1237
|
|
|
1238
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1238
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:753](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L753)
|
|
1239
1239
|
|
|
1240
1240
|
Get the node reference at a given index.
|
|
1241
1241
|
|
|
@@ -1279,7 +1279,7 @@ Time O(N), Space O(1)
|
|
|
1279
1279
|
has(element): boolean;
|
|
1280
1280
|
```
|
|
1281
1281
|
|
|
1282
|
-
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1282
|
+
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)
|
|
1283
1283
|
|
|
1284
1284
|
Checks whether a strictly-equal element exists in the structure.
|
|
1285
1285
|
|
|
@@ -1313,7 +1313,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1313
1313
|
indexOf(searchElement, fromIndex?): number;
|
|
1314
1314
|
```
|
|
1315
1315
|
|
|
1316
|
-
Defined in: [data-structures/base/linear-base.ts:422](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1316
|
+
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)
|
|
1317
1317
|
|
|
1318
1318
|
Linked-list optimized `indexOf` (forwards scan).
|
|
1319
1319
|
|
|
@@ -1353,7 +1353,7 @@ Time O(n), Space O(1)
|
|
|
1353
1353
|
isEmpty(): boolean;
|
|
1354
1354
|
```
|
|
1355
1355
|
|
|
1356
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1356
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1007](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1007)
|
|
1357
1357
|
|
|
1358
1358
|
Check whether the list is empty.
|
|
1359
1359
|
|
|
@@ -1388,7 +1388,7 @@ Time O(1), Space O(1)
|
|
|
1388
1388
|
isNode(elementNodeOrPredicate): elementNodeOrPredicate is SinglyLinkedListNode<E>;
|
|
1389
1389
|
```
|
|
1390
1390
|
|
|
1391
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1391
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:700](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L700)
|
|
1392
1392
|
|
|
1393
1393
|
Type guard: check whether the input is a SinglyLinkedListNode.
|
|
1394
1394
|
|
|
@@ -1420,7 +1420,7 @@ Time O(1), Space O(1)
|
|
|
1420
1420
|
join(separator?): string;
|
|
1421
1421
|
```
|
|
1422
1422
|
|
|
1423
|
-
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1423
|
+
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)
|
|
1424
1424
|
|
|
1425
1425
|
Join all elements into a string.
|
|
1426
1426
|
|
|
@@ -1454,7 +1454,7 @@ Time O(n), Space O(n)
|
|
|
1454
1454
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1455
1455
|
```
|
|
1456
1456
|
|
|
1457
|
-
Defined in: [data-structures/base/linear-base.ts:448](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1457
|
+
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)
|
|
1458
1458
|
|
|
1459
1459
|
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
1460
1460
|
|
|
@@ -1497,7 +1497,7 @@ map<EM, RM>(
|
|
|
1497
1497
|
thisArg?): SinglyLinkedList<EM, RM>;
|
|
1498
1498
|
```
|
|
1499
1499
|
|
|
1500
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1500
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1515](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1515)
|
|
1501
1501
|
|
|
1502
1502
|
Map values into a new list (possibly different element type).
|
|
1503
1503
|
|
|
@@ -1564,7 +1564,7 @@ Time O(N), Space O(N)
|
|
|
1564
1564
|
mapSame(callback, thisArg?): this;
|
|
1565
1565
|
```
|
|
1566
1566
|
|
|
1567
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1567
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1450](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1450)
|
|
1568
1568
|
|
|
1569
1569
|
Map values into a new list of the same class.
|
|
1570
1570
|
|
|
@@ -1604,7 +1604,7 @@ Time O(N), Space O(N)
|
|
|
1604
1604
|
pop(): E | undefined;
|
|
1605
1605
|
```
|
|
1606
1606
|
|
|
1607
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1607
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:428](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L428)
|
|
1608
1608
|
|
|
1609
1609
|
Remove and return the tail element.
|
|
1610
1610
|
|
|
@@ -1647,7 +1647,7 @@ Time O(N), Space O(1)
|
|
|
1647
1647
|
print(): void;
|
|
1648
1648
|
```
|
|
1649
1649
|
|
|
1650
|
-
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1650
|
+
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)
|
|
1651
1651
|
|
|
1652
1652
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1653
1653
|
|
|
@@ -1673,7 +1673,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1673
1673
|
push(elementOrNode): boolean;
|
|
1674
1674
|
```
|
|
1675
1675
|
|
|
1676
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1676
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:355](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L355)
|
|
1677
1677
|
|
|
1678
1678
|
Append an element/node to the tail.
|
|
1679
1679
|
|
|
@@ -1728,7 +1728,7 @@ Time O(1), Space O(1)
|
|
|
1728
1728
|
pushMany(elements): boolean[];
|
|
1729
1729
|
```
|
|
1730
1730
|
|
|
1731
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1731
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:590](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L590)
|
|
1732
1732
|
|
|
1733
1733
|
Append a sequence of elements/nodes.
|
|
1734
1734
|
|
|
@@ -1796,7 +1796,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1796
1796
|
reduce(callbackfn): E;
|
|
1797
1797
|
```
|
|
1798
1798
|
|
|
1799
|
-
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1799
|
+
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)
|
|
1800
1800
|
|
|
1801
1801
|
##### Parameters
|
|
1802
1802
|
|
|
@@ -1818,7 +1818,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1818
1818
|
reduce(callbackfn, initialValue): E;
|
|
1819
1819
|
```
|
|
1820
1820
|
|
|
1821
|
-
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1821
|
+
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)
|
|
1822
1822
|
|
|
1823
1823
|
##### Parameters
|
|
1824
1824
|
|
|
@@ -1844,7 +1844,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1844
1844
|
reduce<U>(callbackfn, initialValue): U;
|
|
1845
1845
|
```
|
|
1846
1846
|
|
|
1847
|
-
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1847
|
+
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)
|
|
1848
1848
|
|
|
1849
1849
|
##### Type Parameters
|
|
1850
1850
|
|
|
@@ -1878,7 +1878,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1878
1878
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1879
1879
|
```
|
|
1880
1880
|
|
|
1881
|
-
Defined in: [data-structures/base/linear-base.ts:574](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1881
|
+
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)
|
|
1882
1882
|
|
|
1883
1883
|
Right-to-left reduction using reverse iterator.
|
|
1884
1884
|
|
|
@@ -1924,7 +1924,7 @@ Time O(n), Space O(1)
|
|
|
1924
1924
|
reverse(): this;
|
|
1925
1925
|
```
|
|
1926
1926
|
|
|
1927
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1927
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1115](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1115)
|
|
1928
1928
|
|
|
1929
1929
|
Reverse the list in place.
|
|
1930
1930
|
|
|
@@ -1961,7 +1961,7 @@ Time O(N), Space O(1)
|
|
|
1961
1961
|
search(elementNodeOrPredicate): E | undefined;
|
|
1962
1962
|
```
|
|
1963
1963
|
|
|
1964
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1964
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:622](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L622)
|
|
1965
1965
|
|
|
1966
1966
|
Find the first value matching a predicate (by node).
|
|
1967
1967
|
|
|
@@ -1993,7 +1993,7 @@ Time O(N), Space O(1)
|
|
|
1993
1993
|
setAt(index, value): boolean;
|
|
1994
1994
|
```
|
|
1995
1995
|
|
|
1996
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1996
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:954](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L954)
|
|
1997
1997
|
|
|
1998
1998
|
Set the element value at an index.
|
|
1999
1999
|
|
|
@@ -2033,7 +2033,7 @@ Time O(N), Space O(1)
|
|
|
2033
2033
|
setEquality(equals): this;
|
|
2034
2034
|
```
|
|
2035
2035
|
|
|
2036
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2036
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1283](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1283)
|
|
2037
2037
|
|
|
2038
2038
|
Set the equality comparator used to compare values.
|
|
2039
2039
|
|
|
@@ -2063,7 +2063,7 @@ Time O(1), Space O(1)
|
|
|
2063
2063
|
shift(): E | undefined;
|
|
2064
2064
|
```
|
|
2065
2065
|
|
|
2066
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2066
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:496](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L496)
|
|
2067
2067
|
|
|
2068
2068
|
Remove and return the head element.
|
|
2069
2069
|
|
|
@@ -2096,7 +2096,7 @@ Time O(1), Space O(1)
|
|
|
2096
2096
|
slice(start?, end?): this;
|
|
2097
2097
|
```
|
|
2098
2098
|
|
|
2099
|
-
Defined in: [data-structures/base/linear-base.ts:494](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2099
|
+
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)
|
|
2100
2100
|
|
|
2101
2101
|
Slice via forward iteration (no random access required).
|
|
2102
2102
|
|
|
@@ -2136,7 +2136,7 @@ Time O(n), Space O(n)
|
|
|
2136
2136
|
some(predicate, thisArg?): boolean;
|
|
2137
2137
|
```
|
|
2138
2138
|
|
|
2139
|
-
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2139
|
+
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)
|
|
2140
2140
|
|
|
2141
2141
|
Tests whether at least one element satisfies the predicate.
|
|
2142
2142
|
|
|
@@ -2176,7 +2176,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2176
2176
|
sort(compareFn?): this;
|
|
2177
2177
|
```
|
|
2178
2178
|
|
|
2179
|
-
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2179
|
+
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)
|
|
2180
2180
|
|
|
2181
2181
|
In-place stable order via array sort semantics.
|
|
2182
2182
|
|
|
@@ -2213,7 +2213,7 @@ splice(
|
|
|
2213
2213
|
items?): this;
|
|
2214
2214
|
```
|
|
2215
2215
|
|
|
2216
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2216
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1209](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1209)
|
|
2217
2217
|
|
|
2218
2218
|
Remove and/or insert elements at a position (array-like behavior).
|
|
2219
2219
|
|
|
@@ -2259,7 +2259,7 @@ Time O(N + M), Space O(M)
|
|
|
2259
2259
|
toArray(): E[];
|
|
2260
2260
|
```
|
|
2261
2261
|
|
|
2262
|
-
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2262
|
+
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)
|
|
2263
2263
|
|
|
2264
2264
|
Materializes the elements into a new array.
|
|
2265
2265
|
|
|
@@ -2285,7 +2285,7 @@ Time O(n), Space O(n).
|
|
|
2285
2285
|
toReversedArray(): E[];
|
|
2286
2286
|
```
|
|
2287
2287
|
|
|
2288
|
-
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2288
|
+
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)
|
|
2289
2289
|
|
|
2290
2290
|
Snapshot elements into a reversed array.
|
|
2291
2291
|
|
|
@@ -2311,7 +2311,7 @@ Time O(n), Space O(n)
|
|
|
2311
2311
|
toVisual(): E[];
|
|
2312
2312
|
```
|
|
2313
2313
|
|
|
2314
|
-
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2314
|
+
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)
|
|
2315
2315
|
|
|
2316
2316
|
Returns a representation of the structure suitable for quick visualization.
|
|
2317
2317
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2338,7 +2338,7 @@ Time O(n), Space O(n).
|
|
|
2338
2338
|
unshift(elementOrNode): boolean;
|
|
2339
2339
|
```
|
|
2340
2340
|
|
|
2341
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2341
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:571](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L571)
|
|
2342
2342
|
|
|
2343
2343
|
Prepend an element/node to the head.
|
|
2344
2344
|
|
|
@@ -2394,7 +2394,7 @@ Time O(1), Space O(1)
|
|
|
2394
2394
|
unshiftMany(elements): boolean[];
|
|
2395
2395
|
```
|
|
2396
2396
|
|
|
2397
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2397
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:606](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L606)
|
|
2398
2398
|
|
|
2399
2399
|
Prepend a sequence of elements/nodes.
|
|
2400
2400
|
|
|
@@ -2426,7 +2426,7 @@ Time O(N), Space O(1)
|
|
|
2426
2426
|
values(): IterableIterator<E>;
|
|
2427
2427
|
```
|
|
2428
2428
|
|
|
2429
|
-
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2429
|
+
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)
|
|
2430
2430
|
|
|
2431
2431
|
Returns an iterator over the values (alias of the default iterator).
|
|
2432
2432
|
|
|
@@ -2455,7 +2455,7 @@ static from<E, R, S>(
|
|
|
2455
2455
|
options?): S;
|
|
2456
2456
|
```
|
|
2457
2457
|
|
|
2458
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:281](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2458
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:281](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L281)
|
|
2459
2459
|
|
|
2460
2460
|
Create a new list from an iterable of elements.
|
|
2461
2461
|
|
|
@@ -2514,7 +2514,7 @@ Time O(N), Space O(N)
|
|
|
2514
2514
|
protected optional _toElementFn?: (rawElement) => E;
|
|
2515
2515
|
```
|
|
2516
2516
|
|
|
2517
|
-
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2517
|
+
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)
|
|
2518
2518
|
|
|
2519
2519
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
2520
2520
|
|
|
@@ -2544,7 +2544,7 @@ Time O(1), Space O(1).
|
|
|
2544
2544
|
protected _createInstance(options?): this;
|
|
2545
2545
|
```
|
|
2546
2546
|
|
|
2547
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2547
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1638](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1638)
|
|
2548
2548
|
|
|
2549
2549
|
(Protected) Create an empty instance of the same concrete class.
|
|
2550
2550
|
|
|
@@ -2578,7 +2578,7 @@ Time O(1), Space O(1)
|
|
|
2578
2578
|
protected _createLike<EM, RM>(elements?, options?): SinglyLinkedList<EM, RM>;
|
|
2579
2579
|
```
|
|
2580
2580
|
|
|
2581
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2581
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1656](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1656)
|
|
2582
2582
|
|
|
2583
2583
|
(Protected) Create a like-kind instance and seed it from an iterable.
|
|
2584
2584
|
|
|
@@ -2626,7 +2626,7 @@ Time O(N), Space O(N)
|
|
|
2626
2626
|
protected _ensureNode(elementOrNode): SinglyLinkedListNode<E>;
|
|
2627
2627
|
```
|
|
2628
2628
|
|
|
2629
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2629
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1557](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1557)
|
|
2630
2630
|
|
|
2631
2631
|
(Protected) Normalize input into a node instance.
|
|
2632
2632
|
|
|
@@ -2656,7 +2656,7 @@ Time O(1), Space O(1)
|
|
|
2656
2656
|
protected _ensurePredicate(elementNodeOrPredicate): (node) => boolean;
|
|
2657
2657
|
```
|
|
2658
2658
|
|
|
2659
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2659
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1569](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1569)
|
|
2660
2660
|
|
|
2661
2661
|
(Protected) Normalize input into a node predicate.
|
|
2662
2662
|
|
|
@@ -2688,7 +2688,7 @@ Time O(1), Space O(1)
|
|
|
2688
2688
|
protected _getIterator(): IterableIterator<E>;
|
|
2689
2689
|
```
|
|
2690
2690
|
|
|
2691
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2691
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1598](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1598)
|
|
2692
2692
|
|
|
2693
2693
|
(Protected) Iterate values from head to tail.
|
|
2694
2694
|
|
|
@@ -2714,7 +2714,7 @@ Time O(N), Space O(1)
|
|
|
2714
2714
|
protected _getNodeIterator(): IterableIterator<SinglyLinkedListNode<E>>;
|
|
2715
2715
|
```
|
|
2716
2716
|
|
|
2717
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2717
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1623](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1623)
|
|
2718
2718
|
|
|
2719
2719
|
(Protected) Iterate nodes from head to tail.
|
|
2720
2720
|
|
|
@@ -2740,7 +2740,7 @@ Time O(N), Space O(1)
|
|
|
2740
2740
|
protected _getPrevNode(node): SinglyLinkedListNode<E> | undefined;
|
|
2741
2741
|
```
|
|
2742
2742
|
|
|
2743
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2743
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1585](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1585)
|
|
2744
2744
|
|
|
2745
2745
|
(Protected) Get the previous node of a given node.
|
|
2746
2746
|
|
|
@@ -2774,7 +2774,7 @@ Time O(N), Space O(1)
|
|
|
2774
2774
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2775
2775
|
```
|
|
2776
2776
|
|
|
2777
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2777
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1612](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1612)
|
|
2778
2778
|
|
|
2779
2779
|
(Protected) Iterate values from tail to head.
|
|
2780
2780
|
|
|
@@ -2800,7 +2800,7 @@ Time O(N), Space O(N)
|
|
|
2800
2800
|
protected _isPredicate(elementNodeOrPredicate): elementNodeOrPredicate is (node: SinglyLinkedListNode<E>) => boolean;
|
|
2801
2801
|
```
|
|
2802
2802
|
|
|
2803
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2803
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1544](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1544)
|
|
2804
2804
|
|
|
2805
2805
|
(Protected) Check if input is a node predicate function.
|
|
2806
2806
|
|
|
@@ -2832,7 +2832,7 @@ Time O(1), Space O(1)
|
|
|
2832
2832
|
protected _spawnLike<EM, RM>(options?): SinglyLinkedList<EM, RM>;
|
|
2833
2833
|
```
|
|
2834
2834
|
|
|
2835
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2835
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1676](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1676)
|
|
2836
2836
|
|
|
2837
2837
|
(Protected) Spawn an empty like-kind list instance.
|
|
2838
2838
|
|
|
@@ -2872,7 +2872,7 @@ Time O(1), Space O(1)
|
|
|
2872
2872
|
protected createNode(value): SinglyLinkedListNode<E>;
|
|
2873
2873
|
```
|
|
2874
2874
|
|
|
2875
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2875
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1533](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1533)
|
|
2876
2876
|
|
|
2877
2877
|
(Protected) Create a node from a value.
|
|
2878
2878
|
|