data-structure-typed 2.5.3 → 2.6.1
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/.github/workflows/ci.yml +7 -2
- package/.github/workflows/release-package.yml +9 -2
- package/.husky/pre-commit +3 -0
- package/CHANGELOG.md +1 -1
- package/MIGRATION.md +48 -0
- package/README.md +20 -2
- package/README_CN.md +20 -2
- package/SPECIFICATION.md +24 -0
- package/SPECIFICATION.zh-CN.md +24 -0
- package/dist/cjs/binary-tree.cjs +1897 -19
- package/dist/cjs/graph.cjs +174 -0
- package/dist/cjs/hash.cjs +33 -0
- package/dist/cjs/heap.cjs +71 -0
- package/dist/cjs/index.cjs +2383 -3
- package/dist/cjs/linked-list.cjs +224 -2
- package/dist/cjs/matrix.cjs +24 -0
- package/dist/cjs/priority-queue.cjs +71 -0
- package/dist/cjs/queue.cjs +221 -1
- package/dist/cjs/stack.cjs +59 -0
- package/dist/cjs/trie.cjs +62 -0
- package/dist/cjs-legacy/binary-tree.cjs +1897 -19
- package/dist/cjs-legacy/graph.cjs +174 -0
- package/dist/cjs-legacy/hash.cjs +33 -0
- package/dist/cjs-legacy/heap.cjs +71 -0
- package/dist/cjs-legacy/index.cjs +2383 -3
- package/dist/cjs-legacy/linked-list.cjs +224 -2
- package/dist/cjs-legacy/matrix.cjs +24 -0
- package/dist/cjs-legacy/priority-queue.cjs +71 -0
- package/dist/cjs-legacy/queue.cjs +221 -1
- package/dist/cjs-legacy/stack.cjs +59 -0
- package/dist/cjs-legacy/trie.cjs +62 -0
- package/dist/esm/binary-tree.mjs +1897 -19
- package/dist/esm/graph.mjs +174 -0
- package/dist/esm/hash.mjs +33 -0
- package/dist/esm/heap.mjs +71 -0
- package/dist/esm/index.mjs +2383 -3
- package/dist/esm/linked-list.mjs +224 -2
- package/dist/esm/matrix.mjs +24 -0
- package/dist/esm/priority-queue.mjs +71 -0
- package/dist/esm/queue.mjs +221 -1
- package/dist/esm/stack.mjs +59 -0
- package/dist/esm/trie.mjs +62 -0
- package/dist/esm-legacy/binary-tree.mjs +1897 -19
- package/dist/esm-legacy/graph.mjs +174 -0
- package/dist/esm-legacy/hash.mjs +33 -0
- package/dist/esm-legacy/heap.mjs +71 -0
- package/dist/esm-legacy/index.mjs +2383 -3
- package/dist/esm-legacy/linked-list.mjs +224 -2
- package/dist/esm-legacy/matrix.mjs +24 -0
- package/dist/esm-legacy/priority-queue.mjs +71 -0
- package/dist/esm-legacy/queue.mjs +221 -1
- package/dist/esm-legacy/stack.mjs +59 -0
- package/dist/esm-legacy/trie.mjs +62 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
- package/dist/types/data-structures/heap/heap.d.ts +42 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
- package/dist/types/data-structures/queue/deque.d.ts +90 -1
- package/dist/types/data-structures/queue/queue.d.ts +36 -0
- package/dist/types/data-structures/stack/stack.d.ts +30 -0
- package/dist/types/data-structures/trie/trie.d.ts +36 -0
- package/dist/umd/data-structure-typed.js +2383 -3
- package/dist/umd/data-structure-typed.min.js +3 -3
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +108 -108
- package/docs-site-docusaurus/docs/api/classes/BST.md +101 -101
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +66 -66
- package/docs-site-docusaurus/docs/api/classes/Deque.md +235 -51
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +21 -21
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +231 -67
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +14 -14
- package/docs-site-docusaurus/docs/api/classes/Heap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +83 -13
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +124 -20
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +140 -32
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +30 -26
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +159 -51
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +20 -20
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +117 -34
- package/docs-site-docusaurus/docs/api/classes/Queue.md +142 -34
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +117 -117
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +158 -50
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +21 -21
- package/docs-site-docusaurus/docs/api/classes/Stack.md +108 -26
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +75 -39
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +301 -39
- package/docs-site-docusaurus/docs/api/classes/Trie.md +110 -28
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +20 -20
- package/jest.integration.config.js +1 -2
- package/package.json +51 -50
- package/src/common/error.ts +15 -32
- package/src/common/index.ts +0 -3
- package/src/data-structures/base/iterable-element-base.ts +32 -3
- package/src/data-structures/base/linear-base.ts +13 -36
- package/src/data-structures/binary-tree/avl-tree.ts +31 -493
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -530
- package/src/data-structures/binary-tree/binary-tree.ts +326 -1236
- package/src/data-structures/binary-tree/bst.ts +158 -1010
- package/src/data-structures/binary-tree/red-black-tree.ts +451 -1233
- package/src/data-structures/binary-tree/segment-tree.ts +73 -333
- package/src/data-structures/binary-tree/tree-map.ts +462 -4749
- package/src/data-structures/binary-tree/tree-multi-map.ts +310 -4530
- package/src/data-structures/binary-tree/tree-multi-set.ts +300 -3652
- package/src/data-structures/binary-tree/tree-set.ts +437 -4443
- package/src/data-structures/graph/abstract-graph.ts +98 -167
- package/src/data-structures/graph/directed-graph.ts +137 -532
- package/src/data-structures/graph/map-graph.ts +0 -3
- package/src/data-structures/graph/undirected-graph.ts +132 -484
- package/src/data-structures/hash/hash-map.ts +154 -549
- package/src/data-structures/heap/heap.ts +200 -753
- package/src/data-structures/linked-list/doubly-linked-list.ts +153 -809
- package/src/data-structures/linked-list/singly-linked-list.ts +122 -749
- package/src/data-structures/linked-list/skip-linked-list.ts +211 -864
- package/src/data-structures/matrix/matrix.ts +179 -494
- package/src/data-structures/matrix/navigator.ts +0 -1
- package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
- package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
- package/src/data-structures/priority-queue/priority-queue.ts +1 -2
- package/src/data-structures/queue/deque.ts +241 -807
- package/src/data-structures/queue/queue.ts +102 -589
- package/src/data-structures/stack/stack.ts +76 -475
- package/src/data-structures/trie/trie.ts +98 -592
- package/src/types/common.ts +0 -10
- package/src/types/data-structures/binary-tree/bst.ts +0 -7
- package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
- package/src/types/data-structures/graph/abstract-graph.ts +0 -2
- package/src/types/data-structures/hash/hash-map.ts +0 -3
- package/src/types/data-structures/hash/index.ts +0 -1
- package/src/types/data-structures/matrix/navigator.ts +0 -2
- package/src/types/utils/utils.ts +0 -7
- package/src/types/utils/validate-type.ts +0 -7
- package/src/utils/number.ts +0 -2
- package/src/utils/utils.ts +0 -5
|
@@ -370,7 +370,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
370
370
|
addAfter(existingElementOrNode, newElementOrNode): boolean;
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
373
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:850](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L850)
|
|
374
374
|
|
|
375
375
|
Insert a new element/node after an existing one.
|
|
376
376
|
|
|
@@ -410,7 +410,7 @@ Time O(N), Space O(1)
|
|
|
410
410
|
addAt(index, newElementOrNode): boolean;
|
|
411
411
|
```
|
|
412
412
|
|
|
413
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
413
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:799](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L799)
|
|
414
414
|
|
|
415
415
|
Insert a new element/node at an index, shifting following nodes.
|
|
416
416
|
|
|
@@ -461,7 +461,7 @@ Time O(N), Space O(1)
|
|
|
461
461
|
addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
464
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:823](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L823)
|
|
465
465
|
|
|
466
466
|
Insert a new element/node before an existing one.
|
|
467
467
|
|
|
@@ -501,7 +501,7 @@ Time O(N), Space O(1)
|
|
|
501
501
|
at(index): E | undefined;
|
|
502
502
|
```
|
|
503
503
|
|
|
504
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
504
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:644](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L644)
|
|
505
505
|
|
|
506
506
|
Get the element at a given index.
|
|
507
507
|
|
|
@@ -546,7 +546,7 @@ Time O(N), Space O(1)
|
|
|
546
546
|
clear(): void;
|
|
547
547
|
```
|
|
548
548
|
|
|
549
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
549
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1117](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1117)
|
|
550
550
|
|
|
551
551
|
Remove all nodes and reset length.
|
|
552
552
|
|
|
@@ -583,7 +583,7 @@ Time O(N), Space O(1)
|
|
|
583
583
|
clone(): this;
|
|
584
584
|
```
|
|
585
585
|
|
|
586
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
586
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1435](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1435)
|
|
587
587
|
|
|
588
588
|
Deep clone this list (values are copied by reference).
|
|
589
589
|
|
|
@@ -621,7 +621,7 @@ Time O(N), Space O(N)
|
|
|
621
621
|
concat(...items): this;
|
|
622
622
|
```
|
|
623
623
|
|
|
624
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
624
|
+
Defined in: [data-structures/base/linear-base.ts:484](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L484)
|
|
625
625
|
|
|
626
626
|
Concatenate lists/elements preserving order.
|
|
627
627
|
|
|
@@ -657,7 +657,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
657
657
|
delete(elementOrNode?): boolean;
|
|
658
658
|
```
|
|
659
659
|
|
|
660
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
660
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:997](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L997)
|
|
661
661
|
|
|
662
662
|
Delete the first match by value/node.
|
|
663
663
|
|
|
@@ -702,7 +702,7 @@ Time O(N), Space O(1)
|
|
|
702
702
|
deleteAt(index): E | undefined;
|
|
703
703
|
```
|
|
704
704
|
|
|
705
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
705
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:932](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L932)
|
|
706
706
|
|
|
707
707
|
Delete the element at an index.
|
|
708
708
|
|
|
@@ -747,7 +747,7 @@ Time O(N), Space O(1)
|
|
|
747
747
|
deleteWhere(predicate): boolean;
|
|
748
748
|
```
|
|
749
749
|
|
|
750
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
750
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1357](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1357)
|
|
751
751
|
|
|
752
752
|
Delete the first element that satisfies a predicate.
|
|
753
753
|
|
|
@@ -771,6 +771,30 @@ Time O(N), Space O(1)
|
|
|
771
771
|
|
|
772
772
|
***
|
|
773
773
|
|
|
774
|
+
### entries()
|
|
775
|
+
|
|
776
|
+
```ts
|
|
777
|
+
entries(): IterableIterator<[number, E]>;
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
Defined in: [data-structures/base/iterable-element-base.ts:208](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L208)
|
|
781
|
+
|
|
782
|
+
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
783
|
+
|
|
784
|
+
#### Returns
|
|
785
|
+
|
|
786
|
+
`IterableIterator`\<\[`number`, `E`\]\>
|
|
787
|
+
|
|
788
|
+
#### Remarks
|
|
789
|
+
|
|
790
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
791
|
+
|
|
792
|
+
#### Inherited from
|
|
793
|
+
|
|
794
|
+
[`LinearLinkedBase`](LinearLinkedBase.md).[`entries`](LinearLinkedBase.md#entries)
|
|
795
|
+
|
|
796
|
+
***
|
|
797
|
+
|
|
774
798
|
### every()
|
|
775
799
|
|
|
776
800
|
```ts
|
|
@@ -866,7 +890,7 @@ Time O(n), Space O(1)
|
|
|
866
890
|
filter(callback, thisArg?): this;
|
|
867
891
|
```
|
|
868
892
|
|
|
869
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
893
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1496](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1496)
|
|
870
894
|
|
|
871
895
|
Filter values into a new list of the same class.
|
|
872
896
|
|
|
@@ -1041,6 +1065,80 @@ Time O(n), Space O(1)
|
|
|
1041
1065
|
|
|
1042
1066
|
***
|
|
1043
1067
|
|
|
1068
|
+
### findLast()
|
|
1069
|
+
|
|
1070
|
+
```ts
|
|
1071
|
+
findLast(elementNodeOrPredicate): E | undefined;
|
|
1072
|
+
```
|
|
1073
|
+
|
|
1074
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1258](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1258)
|
|
1075
|
+
|
|
1076
|
+
Find the first value matching a predicate scanning backward (tail → head).
|
|
1077
|
+
|
|
1078
|
+
#### Parameters
|
|
1079
|
+
|
|
1080
|
+
##### elementNodeOrPredicate
|
|
1081
|
+
|
|
1082
|
+
\| `E`
|
|
1083
|
+
\| [`DoublyLinkedListNode`](DoublyLinkedListNode.md)\<`E`\>
|
|
1084
|
+
\| ((`node`) => `boolean`)
|
|
1085
|
+
|
|
1086
|
+
Element, node, or predicate to match.
|
|
1087
|
+
|
|
1088
|
+
#### Returns
|
|
1089
|
+
|
|
1090
|
+
`E` \| `undefined`
|
|
1091
|
+
|
|
1092
|
+
Matching value or undefined.
|
|
1093
|
+
|
|
1094
|
+
*
|
|
1095
|
+
|
|
1096
|
+
#### Remarks
|
|
1097
|
+
|
|
1098
|
+
Time O(N), Space O(1)
|
|
1099
|
+
|
|
1100
|
+
#### Example
|
|
1101
|
+
|
|
1102
|
+
```ts
|
|
1103
|
+
// Find value scanning from tail
|
|
1104
|
+
const list = new DoublyLinkedList<number>([1, 2, 3, 4]);
|
|
1105
|
+
// findLast scans from tail to head, returns first match
|
|
1106
|
+
const found = list.findLast(node => node.value < 4);
|
|
1107
|
+
console.log(found); // 3;
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
***
|
|
1111
|
+
|
|
1112
|
+
### findLastIndex()
|
|
1113
|
+
|
|
1114
|
+
```ts
|
|
1115
|
+
findLastIndex(predicate): number;
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1276](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1276)
|
|
1119
|
+
|
|
1120
|
+
Find the index of the last value matching a predicate (scans tail → head).
|
|
1121
|
+
|
|
1122
|
+
#### Parameters
|
|
1123
|
+
|
|
1124
|
+
##### predicate
|
|
1125
|
+
|
|
1126
|
+
(`value`, `index`, `list`) => `boolean`
|
|
1127
|
+
|
|
1128
|
+
Function called with (value, index, list).
|
|
1129
|
+
|
|
1130
|
+
#### Returns
|
|
1131
|
+
|
|
1132
|
+
`number`
|
|
1133
|
+
|
|
1134
|
+
Matching index, or -1 if not found.
|
|
1135
|
+
|
|
1136
|
+
#### Remarks
|
|
1137
|
+
|
|
1138
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
1139
|
+
|
|
1140
|
+
***
|
|
1141
|
+
|
|
1044
1142
|
### forEach()
|
|
1045
1143
|
|
|
1046
1144
|
```ts
|
|
@@ -1081,15 +1179,13 @@ Time O(n), Space O(1).
|
|
|
1081
1179
|
|
|
1082
1180
|
***
|
|
1083
1181
|
|
|
1084
|
-
### getBackward()
|
|
1182
|
+
### ~~getBackward()~~
|
|
1085
1183
|
|
|
1086
1184
|
```ts
|
|
1087
1185
|
getBackward(elementNodeOrPredicate): E | undefined;
|
|
1088
1186
|
```
|
|
1089
1187
|
|
|
1090
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1091
|
-
|
|
1092
|
-
Find the first value matching a predicate scanning backward.
|
|
1188
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1238](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1238)
|
|
1093
1189
|
|
|
1094
1190
|
#### Parameters
|
|
1095
1191
|
|
|
@@ -1099,29 +1195,13 @@ Find the first value matching a predicate scanning backward.
|
|
|
1099
1195
|
\| [`DoublyLinkedListNode`](DoublyLinkedListNode.md)\<`E`\>
|
|
1100
1196
|
\| ((`node`) => `boolean`)
|
|
1101
1197
|
|
|
1102
|
-
Element, node, or predicate to match.
|
|
1103
|
-
|
|
1104
1198
|
#### Returns
|
|
1105
1199
|
|
|
1106
1200
|
`E` \| `undefined`
|
|
1107
1201
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
*
|
|
1111
|
-
|
|
1112
|
-
#### Remarks
|
|
1113
|
-
|
|
1114
|
-
Time O(N), Space O(1)
|
|
1115
|
-
|
|
1116
|
-
#### Example
|
|
1202
|
+
#### Deprecated
|
|
1117
1203
|
|
|
1118
|
-
|
|
1119
|
-
// Find value scanning from tail
|
|
1120
|
-
const list = new DoublyLinkedList<number>([1, 2, 3, 4]);
|
|
1121
|
-
// getBackward scans from tail to head, returns first match
|
|
1122
|
-
const found = list.getBackward(node => node.value < 4);
|
|
1123
|
-
console.log(found); // 3;
|
|
1124
|
-
```
|
|
1204
|
+
Use `findLast` instead. Will be removed in a future major version.
|
|
1125
1205
|
|
|
1126
1206
|
***
|
|
1127
1207
|
|
|
@@ -1131,7 +1211,7 @@ Time O(N), Space O(1)
|
|
|
1131
1211
|
getNode(elementNodeOrPredicate?): DoublyLinkedListNode<E> | undefined;
|
|
1132
1212
|
```
|
|
1133
1213
|
|
|
1134
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1214
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:715](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L715)
|
|
1135
1215
|
|
|
1136
1216
|
Find a node by value, reference, or predicate.
|
|
1137
1217
|
|
|
@@ -1163,7 +1243,7 @@ Time O(N), Space O(1)
|
|
|
1163
1243
|
getNodeAt(index): DoublyLinkedListNode<E> | undefined;
|
|
1164
1244
|
```
|
|
1165
1245
|
|
|
1166
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1246
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:701](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L701)
|
|
1167
1247
|
|
|
1168
1248
|
Get the node reference at a given index.
|
|
1169
1249
|
|
|
@@ -1235,13 +1315,47 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1235
1315
|
|
|
1236
1316
|
***
|
|
1237
1317
|
|
|
1318
|
+
### includes()
|
|
1319
|
+
|
|
1320
|
+
```ts
|
|
1321
|
+
includes(element): boolean;
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
Defined in: [data-structures/base/iterable-element-base.ts:200](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L200)
|
|
1325
|
+
|
|
1326
|
+
Check whether a value exists (Array-compatible alias for `has`).
|
|
1327
|
+
|
|
1328
|
+
#### Parameters
|
|
1329
|
+
|
|
1330
|
+
##### element
|
|
1331
|
+
|
|
1332
|
+
`E`
|
|
1333
|
+
|
|
1334
|
+
Element to search for (uses `===`).
|
|
1335
|
+
|
|
1336
|
+
#### Returns
|
|
1337
|
+
|
|
1338
|
+
`boolean`
|
|
1339
|
+
|
|
1340
|
+
`true` if found.
|
|
1341
|
+
|
|
1342
|
+
#### Remarks
|
|
1343
|
+
|
|
1344
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
1345
|
+
|
|
1346
|
+
#### Inherited from
|
|
1347
|
+
|
|
1348
|
+
[`LinearLinkedBase`](LinearLinkedBase.md).[`includes`](LinearLinkedBase.md#includes)
|
|
1349
|
+
|
|
1350
|
+
***
|
|
1351
|
+
|
|
1238
1352
|
### indexOf()
|
|
1239
1353
|
|
|
1240
1354
|
```ts
|
|
1241
1355
|
indexOf(searchElement, fromIndex?): number;
|
|
1242
1356
|
```
|
|
1243
1357
|
|
|
1244
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1358
|
+
Defined in: [data-structures/base/linear-base.ts:433](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L433)
|
|
1245
1359
|
|
|
1246
1360
|
Linked-list optimized `indexOf` (forwards scan).
|
|
1247
1361
|
|
|
@@ -1281,7 +1395,7 @@ Time O(n), Space O(1)
|
|
|
1281
1395
|
isEmpty(): boolean;
|
|
1282
1396
|
```
|
|
1283
1397
|
|
|
1284
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1398
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1062](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1062)
|
|
1285
1399
|
|
|
1286
1400
|
Check whether the list is empty.
|
|
1287
1401
|
|
|
@@ -1376,13 +1490,37 @@ Time O(n), Space O(n)
|
|
|
1376
1490
|
|
|
1377
1491
|
***
|
|
1378
1492
|
|
|
1493
|
+
### keys()
|
|
1494
|
+
|
|
1495
|
+
```ts
|
|
1496
|
+
keys(): IterableIterator<number>;
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
Defined in: [data-structures/base/iterable-element-base.ts:219](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L219)
|
|
1500
|
+
|
|
1501
|
+
Return an iterator of numeric indices (Array-compatible).
|
|
1502
|
+
|
|
1503
|
+
#### Returns
|
|
1504
|
+
|
|
1505
|
+
`IterableIterator`\<`number`\>
|
|
1506
|
+
|
|
1507
|
+
#### Remarks
|
|
1508
|
+
|
|
1509
|
+
Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
1510
|
+
|
|
1511
|
+
#### Inherited from
|
|
1512
|
+
|
|
1513
|
+
[`LinearLinkedBase`](LinearLinkedBase.md).[`keys`](LinearLinkedBase.md#keys)
|
|
1514
|
+
|
|
1515
|
+
***
|
|
1516
|
+
|
|
1379
1517
|
### lastIndexOf()
|
|
1380
1518
|
|
|
1381
1519
|
```ts
|
|
1382
1520
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1383
1521
|
```
|
|
1384
1522
|
|
|
1385
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1523
|
+
Defined in: [data-structures/base/linear-base.ts:459](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L459)
|
|
1386
1524
|
|
|
1387
1525
|
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
1388
1526
|
|
|
@@ -1425,7 +1563,7 @@ map<EM, RM>(
|
|
|
1425
1563
|
thisArg?): DoublyLinkedList<EM, RM>;
|
|
1426
1564
|
```
|
|
1427
1565
|
|
|
1428
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1566
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1588](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1588)
|
|
1429
1567
|
|
|
1430
1568
|
Map values into a new list (possibly different element type).
|
|
1431
1569
|
|
|
@@ -1501,7 +1639,7 @@ Time O(N), Space O(N)
|
|
|
1501
1639
|
mapSame(callback, thisArg?): this;
|
|
1502
1640
|
```
|
|
1503
1641
|
|
|
1504
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1642
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1511](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1511)
|
|
1505
1643
|
|
|
1506
1644
|
Map values into a new list of the same class.
|
|
1507
1645
|
|
|
@@ -1541,7 +1679,7 @@ Time O(N), Space O(N)
|
|
|
1541
1679
|
pop(): E | undefined;
|
|
1542
1680
|
```
|
|
1543
1681
|
|
|
1544
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1682
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:408](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L408)
|
|
1545
1683
|
|
|
1546
1684
|
Remove and return the tail element.
|
|
1547
1685
|
|
|
@@ -1584,7 +1722,7 @@ Time O(1), Space O(1)
|
|
|
1584
1722
|
print(): void;
|
|
1585
1723
|
```
|
|
1586
1724
|
|
|
1587
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1725
|
+
Defined in: [data-structures/base/iterable-element-base.ts:301](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L301)
|
|
1588
1726
|
|
|
1589
1727
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1590
1728
|
|
|
@@ -1610,7 +1748,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1610
1748
|
push(elementOrNode): boolean;
|
|
1611
1749
|
```
|
|
1612
1750
|
|
|
1613
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1751
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:330](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L330)
|
|
1614
1752
|
|
|
1615
1753
|
Append an element/node to the tail.
|
|
1616
1754
|
|
|
@@ -1665,7 +1803,7 @@ Time O(1), Space O(1)
|
|
|
1665
1803
|
pushMany(elements): boolean[];
|
|
1666
1804
|
```
|
|
1667
1805
|
|
|
1668
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1806
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:565](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L565)
|
|
1669
1807
|
|
|
1670
1808
|
Append a sequence of elements/nodes.
|
|
1671
1809
|
|
|
@@ -1733,7 +1871,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1733
1871
|
reduce(callbackfn): E;
|
|
1734
1872
|
```
|
|
1735
1873
|
|
|
1736
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1874
|
+
Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L226)
|
|
1737
1875
|
|
|
1738
1876
|
##### Parameters
|
|
1739
1877
|
|
|
@@ -1755,7 +1893,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1755
1893
|
reduce(callbackfn, initialValue): E;
|
|
1756
1894
|
```
|
|
1757
1895
|
|
|
1758
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1896
|
+
Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L227)
|
|
1759
1897
|
|
|
1760
1898
|
##### Parameters
|
|
1761
1899
|
|
|
@@ -1781,7 +1919,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1781
1919
|
reduce<U>(callbackfn, initialValue): U;
|
|
1782
1920
|
```
|
|
1783
1921
|
|
|
1784
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1922
|
+
Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L228)
|
|
1785
1923
|
|
|
1786
1924
|
##### Type Parameters
|
|
1787
1925
|
|
|
@@ -1815,7 +1953,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1815
1953
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1816
1954
|
```
|
|
1817
1955
|
|
|
1818
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1956
|
+
Defined in: [data-structures/base/linear-base.ts:585](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L585)
|
|
1819
1957
|
|
|
1820
1958
|
Right-to-left reduction using reverse iterator.
|
|
1821
1959
|
|
|
@@ -1861,7 +1999,7 @@ Time O(n), Space O(1)
|
|
|
1861
1999
|
reverse(): this;
|
|
1862
2000
|
```
|
|
1863
2001
|
|
|
1864
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2002
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1340](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1340)
|
|
1865
2003
|
|
|
1866
2004
|
Reverse the list in place.
|
|
1867
2005
|
|
|
@@ -1898,7 +2036,7 @@ Time O(N), Space O(1)
|
|
|
1898
2036
|
search(elementNodeOrPredicate): E | undefined;
|
|
1899
2037
|
```
|
|
1900
2038
|
|
|
1901
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2039
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1174](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1174)
|
|
1902
2040
|
|
|
1903
2041
|
Find the first value matching a predicate scanning forward.
|
|
1904
2042
|
|
|
@@ -1941,7 +2079,7 @@ Time O(N), Space O(1)
|
|
|
1941
2079
|
setAt(index, value): boolean;
|
|
1942
2080
|
```
|
|
1943
2081
|
|
|
1944
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2082
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:874](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L874)
|
|
1945
2083
|
|
|
1946
2084
|
Set the element value at an index.
|
|
1947
2085
|
|
|
@@ -1981,7 +2119,7 @@ Time O(N), Space O(1)
|
|
|
1981
2119
|
setEquality(equals): this;
|
|
1982
2120
|
```
|
|
1983
2121
|
|
|
1984
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2122
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1378](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1378)
|
|
1985
2123
|
|
|
1986
2124
|
Set the equality comparator used to compare values.
|
|
1987
2125
|
|
|
@@ -2011,7 +2149,7 @@ Time O(1), Space O(1)
|
|
|
2011
2149
|
shift(): E | undefined;
|
|
2012
2150
|
```
|
|
2013
2151
|
|
|
2014
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2152
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:475](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L475)
|
|
2015
2153
|
|
|
2016
2154
|
Remove and return the head element.
|
|
2017
2155
|
|
|
@@ -2044,7 +2182,7 @@ Time O(1), Space O(1)
|
|
|
2044
2182
|
slice(start?, end?): this;
|
|
2045
2183
|
```
|
|
2046
2184
|
|
|
2047
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2185
|
+
Defined in: [data-structures/base/linear-base.ts:505](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L505)
|
|
2048
2186
|
|
|
2049
2187
|
Slice via forward iteration (no random access required).
|
|
2050
2188
|
|
|
@@ -2161,7 +2299,7 @@ splice(
|
|
|
2161
2299
|
items): this;
|
|
2162
2300
|
```
|
|
2163
2301
|
|
|
2164
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2302
|
+
Defined in: [data-structures/base/linear-base.ts:533](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L533)
|
|
2165
2303
|
|
|
2166
2304
|
Splice by walking node iterators from the start index.
|
|
2167
2305
|
|
|
@@ -2207,7 +2345,7 @@ Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
|
2207
2345
|
toArray(): E[];
|
|
2208
2346
|
```
|
|
2209
2347
|
|
|
2210
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2348
|
+
Defined in: [data-structures/base/iterable-element-base.ts:278](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L278)
|
|
2211
2349
|
|
|
2212
2350
|
Materializes the elements into a new array.
|
|
2213
2351
|
|
|
@@ -2227,6 +2365,32 @@ Time O(n), Space O(n).
|
|
|
2227
2365
|
|
|
2228
2366
|
***
|
|
2229
2367
|
|
|
2368
|
+
### toReversed()
|
|
2369
|
+
|
|
2370
|
+
```ts
|
|
2371
|
+
toReversed(): this;
|
|
2372
|
+
```
|
|
2373
|
+
|
|
2374
|
+
Defined in: [data-structures/base/linear-base.ts:335](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L335)
|
|
2375
|
+
|
|
2376
|
+
Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
2377
|
+
|
|
2378
|
+
#### Returns
|
|
2379
|
+
|
|
2380
|
+
`this`
|
|
2381
|
+
|
|
2382
|
+
A new reversed instance.
|
|
2383
|
+
|
|
2384
|
+
#### Remarks
|
|
2385
|
+
|
|
2386
|
+
Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O(n), Space O(n).
|
|
2387
|
+
|
|
2388
|
+
#### Inherited from
|
|
2389
|
+
|
|
2390
|
+
[`LinearLinkedBase`](LinearLinkedBase.md).[`toReversed`](LinearLinkedBase.md#toreversed)
|
|
2391
|
+
|
|
2392
|
+
***
|
|
2393
|
+
|
|
2230
2394
|
### toReversedArray()
|
|
2231
2395
|
|
|
2232
2396
|
```ts
|
|
@@ -2259,7 +2423,7 @@ Time O(n), Space O(n)
|
|
|
2259
2423
|
toVisual(): E[];
|
|
2260
2424
|
```
|
|
2261
2425
|
|
|
2262
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2426
|
+
Defined in: [data-structures/base/iterable-element-base.ts:290](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L290)
|
|
2263
2427
|
|
|
2264
2428
|
Returns a representation of the structure suitable for quick visualization.
|
|
2265
2429
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2286,7 +2450,7 @@ Time O(n), Space O(n).
|
|
|
2286
2450
|
unshift(elementOrNode): boolean;
|
|
2287
2451
|
```
|
|
2288
2452
|
|
|
2289
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2453
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:543](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L543)
|
|
2290
2454
|
|
|
2291
2455
|
Prepend an element/node to the head.
|
|
2292
2456
|
|
|
@@ -2327,7 +2491,7 @@ Time O(1), Space O(1)
|
|
|
2327
2491
|
unshiftMany(elements): boolean[];
|
|
2328
2492
|
```
|
|
2329
2493
|
|
|
2330
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2494
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:581](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L581)
|
|
2331
2495
|
|
|
2332
2496
|
Prepend a sequence of elements/nodes.
|
|
2333
2497
|
|
|
@@ -2464,7 +2628,7 @@ Time O(1), Space O(1).
|
|
|
2464
2628
|
protected _createInstance(options?): this;
|
|
2465
2629
|
```
|
|
2466
2630
|
|
|
2467
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2631
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1650](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1650)
|
|
2468
2632
|
|
|
2469
2633
|
(Protected) Create an empty instance of the same concrete class.
|
|
2470
2634
|
|
|
@@ -2498,7 +2662,7 @@ Time O(1), Space O(1)
|
|
|
2498
2662
|
protected _createLike<EM, RM>(elements?, options?): DoublyLinkedList<EM, RM>;
|
|
2499
2663
|
```
|
|
2500
2664
|
|
|
2501
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2665
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1668](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1668)
|
|
2502
2666
|
|
|
2503
2667
|
(Protected) Create a like-kind instance and seed it from an iterable.
|
|
2504
2668
|
|
|
@@ -2546,7 +2710,7 @@ Time O(N), Space O(N)
|
|
|
2546
2710
|
protected _ensureNode(elementOrNode): DoublyLinkedListNode<E>;
|
|
2547
2711
|
```
|
|
2548
2712
|
|
|
2549
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2713
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1606](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1606)
|
|
2550
2714
|
|
|
2551
2715
|
(Protected) Create or return a node for the given input (node or raw element).
|
|
2552
2716
|
|
|
@@ -2576,7 +2740,7 @@ Time O(1), Space O(1)
|
|
|
2576
2740
|
protected _ensurePredicate(elementNodeOrPredicate): (node) => boolean;
|
|
2577
2741
|
```
|
|
2578
2742
|
|
|
2579
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2743
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1618](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1618)
|
|
2580
2744
|
|
|
2581
2745
|
(Protected) Normalize input into a predicate over nodes.
|
|
2582
2746
|
|
|
@@ -2608,7 +2772,7 @@ Time O(1), Space O(1)
|
|
|
2608
2772
|
protected _getIterator(): IterableIterator<E>;
|
|
2609
2773
|
```
|
|
2610
2774
|
|
|
2611
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2775
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1679](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1679)
|
|
2612
2776
|
|
|
2613
2777
|
Internal iterator factory used by the default iterator.
|
|
2614
2778
|
|
|
@@ -2634,7 +2798,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
2634
2798
|
protected _getNodeIterator(): IterableIterator<DoublyLinkedListNode<E>>;
|
|
2635
2799
|
```
|
|
2636
2800
|
|
|
2637
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2801
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1695](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1695)
|
|
2638
2802
|
|
|
2639
2803
|
Iterate linked nodes from head to tail.
|
|
2640
2804
|
|
|
@@ -2660,7 +2824,7 @@ Time O(n), Space O(1)
|
|
|
2660
2824
|
protected _getPrevNode(node): DoublyLinkedListNode<E> | undefined;
|
|
2661
2825
|
```
|
|
2662
2826
|
|
|
2663
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2827
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1639](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1639)
|
|
2664
2828
|
|
|
2665
2829
|
(Protected) Get the previous node of a given node.
|
|
2666
2830
|
|
|
@@ -2694,7 +2858,7 @@ Time O(1), Space O(1)
|
|
|
2694
2858
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2695
2859
|
```
|
|
2696
2860
|
|
|
2697
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2861
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:1687](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L1687)
|
|
2698
2862
|
|
|
2699
2863
|
Reverse-direction iterator over elements.
|
|
2700
2864
|
|