data-structure-typed 2.6.1 → 2.6.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/CHANGELOG.md +9 -1
- package/dist/cjs/binary-tree.cjs +2927 -23688
- package/dist/cjs/graph.cjs +845 -2634
- package/dist/cjs/hash.cjs +185 -616
- package/dist/cjs/heap.cjs +266 -818
- package/dist/cjs/index.cjs +5116 -31358
- package/dist/cjs/linked-list.cjs +644 -2615
- package/dist/cjs/matrix.cjs +220 -535
- package/dist/cjs/priority-queue.cjs +266 -818
- package/dist/cjs/queue.cjs +637 -2343
- package/dist/cjs/stack.cjs +124 -530
- package/dist/cjs/trie.cjs +145 -592
- package/dist/cjs-legacy/binary-tree.cjs +4352 -25113
- package/dist/cjs-legacy/graph.cjs +847 -2636
- package/dist/cjs-legacy/hash.cjs +181 -612
- package/dist/cjs-legacy/heap.cjs +266 -818
- package/dist/cjs-legacy/index.cjs +6657 -32899
- package/dist/cjs-legacy/linked-list.cjs +640 -2611
- package/dist/cjs-legacy/matrix.cjs +220 -535
- package/dist/cjs-legacy/priority-queue.cjs +266 -818
- package/dist/cjs-legacy/queue.cjs +634 -2340
- package/dist/cjs-legacy/stack.cjs +124 -530
- package/dist/cjs-legacy/trie.cjs +145 -592
- package/dist/esm/binary-tree.mjs +2927 -23688
- package/dist/esm/graph.mjs +845 -2634
- package/dist/esm/hash.mjs +185 -616
- package/dist/esm/heap.mjs +266 -818
- package/dist/esm/index.mjs +5116 -31358
- package/dist/esm/linked-list.mjs +644 -2615
- package/dist/esm/matrix.mjs +220 -535
- package/dist/esm/priority-queue.mjs +266 -818
- package/dist/esm/queue.mjs +637 -2343
- package/dist/esm/stack.mjs +124 -530
- package/dist/esm/trie.mjs +145 -592
- package/dist/esm-legacy/binary-tree.mjs +4352 -25113
- package/dist/esm-legacy/graph.mjs +847 -2636
- package/dist/esm-legacy/hash.mjs +181 -612
- package/dist/esm-legacy/heap.mjs +266 -818
- package/dist/esm-legacy/index.mjs +6657 -32899
- package/dist/esm-legacy/linked-list.mjs +640 -2611
- package/dist/esm-legacy/matrix.mjs +220 -535
- package/dist/esm-legacy/priority-queue.mjs +266 -818
- package/dist/esm-legacy/queue.mjs +634 -2340
- package/dist/esm-legacy/stack.mjs +124 -530
- package/dist/esm-legacy/trie.mjs +145 -592
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +29 -500
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +38 -563
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +230 -1212
- package/dist/types/data-structures/binary-tree/bst.d.ts +124 -1063
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +99 -854
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +62 -314
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +366 -5057
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +277 -4885
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +253 -3929
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +261 -4782
- package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -44
- package/dist/types/data-structures/graph/directed-graph.d.ts +130 -527
- package/dist/types/data-structures/graph/undirected-graph.d.ts +125 -482
- package/dist/types/data-structures/hash/hash-map.d.ts +132 -562
- package/dist/types/data-structures/heap/heap.d.ts +194 -746
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +120 -809
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -733
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +193 -863
- package/dist/types/data-structures/matrix/matrix.d.ts +159 -474
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -6
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +6 -11
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/types/data-structures/queue/deque.d.ts +196 -804
- package/dist/types/data-structures/queue/queue.d.ts +99 -585
- package/dist/types/data-structures/stack/stack.d.ts +75 -481
- package/dist/types/data-structures/trie/trie.d.ts +98 -584
- package/dist/umd/data-structure-typed.js +6580 -32822
- package/dist/umd/data-structure-typed.min.js +3 -3
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +162 -215
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/BST.md +155 -208
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +7 -7
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -29
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +104 -158
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +72 -104
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +60 -80
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +67 -101
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +6 -6
- 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 +52 -48
- package/docs-site-docusaurus/docs/api/classes/Heap.md +40 -68
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +17 -17
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +68 -96
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +60 -80
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +57 -52
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +38 -66
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +41 -74
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +38 -66
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +46 -79
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +40 -68
- package/docs-site-docusaurus/docs/api/classes/Queue.md +54 -78
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +171 -225
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -22
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +68 -98
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +4 -4
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +98 -75
- package/docs-site-docusaurus/docs/api/classes/Stack.md +33 -53
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +104 -129
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +57 -124
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +45 -116
- package/docs-site-docusaurus/docs/api/classes/Trie.md +37 -61
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +59 -77
- package/package.json +1 -1
- package/src/data-structures/binary-tree/tree-multi-set.ts +15 -11
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: DoublyLinkedList\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
9
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:144](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L144)
|
|
10
10
|
|
|
11
11
|
Doubly linked list with O(1) push/pop/unshift/shift and linear scans.
|
|
12
12
|
|
|
@@ -112,7 +112,7 @@ Caution: Although our linked list classes provide methods such as at, setAt, add
|
|
|
112
112
|
new DoublyLinkedList<E, R>(elements?, options?): DoublyLinkedList<E, R>;
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
115
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:152](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L152)
|
|
116
116
|
|
|
117
117
|
Create a DoublyLinkedList and optionally bulk-insert elements.
|
|
118
118
|
|
|
@@ -158,7 +158,7 @@ LinearLinkedBase<E, R, DoublyLinkedListNode<E>>.constructor
|
|
|
158
158
|
get first(): E | undefined;
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
161
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:204](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L204)
|
|
162
162
|
|
|
163
163
|
Get the first element value.
|
|
164
164
|
|
|
@@ -182,7 +182,7 @@ First element or undefined.
|
|
|
182
182
|
get head(): DoublyLinkedListNode<E> | undefined;
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
185
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:173](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L173)
|
|
186
186
|
|
|
187
187
|
Get the head node.
|
|
188
188
|
|
|
@@ -206,7 +206,7 @@ Head node or undefined.
|
|
|
206
206
|
get last(): E | undefined;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
209
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:213](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L213)
|
|
210
210
|
|
|
211
211
|
Get the last element value.
|
|
212
212
|
|
|
@@ -230,7 +230,7 @@ Last element or undefined.
|
|
|
230
230
|
get length(): number;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
233
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L195)
|
|
234
234
|
|
|
235
235
|
Get the number of elements.
|
|
236
236
|
|
|
@@ -286,7 +286,7 @@ Maximum allowed length.
|
|
|
286
286
|
get tail(): DoublyLinkedListNode<E> | undefined;
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
289
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:184](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L184)
|
|
290
290
|
|
|
291
291
|
Get the tail node.
|
|
292
292
|
|
|
@@ -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:526](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L526)
|
|
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:479](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L479)
|
|
414
414
|
|
|
415
415
|
Insert a new element/node at an index, shifting following nodes.
|
|
416
416
|
|
|
@@ -434,8 +434,6 @@ Element or node to insert.
|
|
|
434
434
|
|
|
435
435
|
True if inserted.
|
|
436
436
|
|
|
437
|
-
*
|
|
438
|
-
|
|
439
437
|
#### Remarks
|
|
440
438
|
|
|
441
439
|
Time O(N), Space O(1)
|
|
@@ -461,7 +459,7 @@ Time O(N), Space O(1)
|
|
|
461
459
|
addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
462
460
|
```
|
|
463
461
|
|
|
464
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
462
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:501](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L501)
|
|
465
463
|
|
|
466
464
|
Insert a new element/node before an existing one.
|
|
467
465
|
|
|
@@ -501,7 +499,7 @@ Time O(N), Space O(1)
|
|
|
501
499
|
at(index): E | undefined;
|
|
502
500
|
```
|
|
503
501
|
|
|
504
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
502
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:409](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L409)
|
|
505
503
|
|
|
506
504
|
Get the element at a given index.
|
|
507
505
|
|
|
@@ -519,8 +517,6 @@ Zero-based index.
|
|
|
519
517
|
|
|
520
518
|
Element or undefined.
|
|
521
519
|
|
|
522
|
-
*
|
|
523
|
-
|
|
524
520
|
#### Remarks
|
|
525
521
|
|
|
526
522
|
Time O(N), Space O(1)
|
|
@@ -546,7 +542,7 @@ Time O(N), Space O(1)
|
|
|
546
542
|
clear(): void;
|
|
547
543
|
```
|
|
548
544
|
|
|
549
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
545
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:627](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L627)
|
|
550
546
|
|
|
551
547
|
Remove all nodes and reset length.
|
|
552
548
|
|
|
@@ -556,8 +552,6 @@ Remove all nodes and reset length.
|
|
|
556
552
|
|
|
557
553
|
void
|
|
558
554
|
|
|
559
|
-
*
|
|
560
|
-
|
|
561
555
|
#### Remarks
|
|
562
556
|
|
|
563
557
|
Time O(N), Space O(1)
|
|
@@ -583,7 +577,7 @@ Time O(N), Space O(1)
|
|
|
583
577
|
clone(): this;
|
|
584
578
|
```
|
|
585
579
|
|
|
586
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
580
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:781](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L781)
|
|
587
581
|
|
|
588
582
|
Deep clone this list (values are copied by reference).
|
|
589
583
|
|
|
@@ -593,8 +587,6 @@ Deep clone this list (values are copied by reference).
|
|
|
593
587
|
|
|
594
588
|
A new list with the same element sequence.
|
|
595
589
|
|
|
596
|
-
*
|
|
597
|
-
|
|
598
590
|
#### Remarks
|
|
599
591
|
|
|
600
592
|
Time O(N), Space O(N)
|
|
@@ -621,7 +613,7 @@ Time O(N), Space O(N)
|
|
|
621
613
|
concat(...items): this;
|
|
622
614
|
```
|
|
623
615
|
|
|
624
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
616
|
+
Defined in: [data-structures/base/linear-base.ts:462](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L462)
|
|
625
617
|
|
|
626
618
|
Concatenate lists/elements preserving order.
|
|
627
619
|
|
|
@@ -657,7 +649,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
657
649
|
delete(elementOrNode?): boolean;
|
|
658
650
|
```
|
|
659
651
|
|
|
660
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
652
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:590](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L590)
|
|
661
653
|
|
|
662
654
|
Delete the first match by value/node.
|
|
663
655
|
|
|
@@ -675,8 +667,6 @@ Element or node to remove.
|
|
|
675
667
|
|
|
676
668
|
True if removed.
|
|
677
669
|
|
|
678
|
-
*
|
|
679
|
-
|
|
680
670
|
#### Remarks
|
|
681
671
|
|
|
682
672
|
Time O(N), Space O(1)
|
|
@@ -702,7 +692,7 @@ Time O(N), Space O(1)
|
|
|
702
692
|
deleteAt(index): E | undefined;
|
|
703
693
|
```
|
|
704
694
|
|
|
705
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
695
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:566](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L566)
|
|
706
696
|
|
|
707
697
|
Delete the element at an index.
|
|
708
698
|
|
|
@@ -720,8 +710,6 @@ Zero-based index.
|
|
|
720
710
|
|
|
721
711
|
Removed element or undefined.
|
|
722
712
|
|
|
723
|
-
*
|
|
724
|
-
|
|
725
713
|
#### Remarks
|
|
726
714
|
|
|
727
715
|
Time O(N), Space O(1)
|
|
@@ -747,7 +735,7 @@ Time O(N), Space O(1)
|
|
|
747
735
|
deleteWhere(predicate): boolean;
|
|
748
736
|
```
|
|
749
737
|
|
|
750
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
738
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:745](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L745)
|
|
751
739
|
|
|
752
740
|
Delete the first element that satisfies a predicate.
|
|
753
741
|
|
|
@@ -777,7 +765,7 @@ Time O(N), Space O(1)
|
|
|
777
765
|
entries(): IterableIterator<[number, E]>;
|
|
778
766
|
```
|
|
779
767
|
|
|
780
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
768
|
+
Defined in: [data-structures/base/iterable-element-base.ts:207](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L207)
|
|
781
769
|
|
|
782
770
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
783
771
|
|
|
@@ -844,7 +832,7 @@ fill(
|
|
|
844
832
|
end?): this;
|
|
845
833
|
```
|
|
846
834
|
|
|
847
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
835
|
+
Defined in: [data-structures/base/linear-base.ts:279](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L279)
|
|
848
836
|
|
|
849
837
|
Fill a range with a value.
|
|
850
838
|
|
|
@@ -890,7 +878,7 @@ Time O(n), Space O(1)
|
|
|
890
878
|
filter(callback, thisArg?): this;
|
|
891
879
|
```
|
|
892
880
|
|
|
893
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
881
|
+
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)
|
|
894
882
|
|
|
895
883
|
Filter values into a new list of the same class.
|
|
896
884
|
|
|
@@ -914,8 +902,6 @@ Value for `this` inside the callback.
|
|
|
914
902
|
|
|
915
903
|
A new list with kept values.
|
|
916
904
|
|
|
917
|
-
*
|
|
918
|
-
|
|
919
905
|
#### Remarks
|
|
920
906
|
|
|
921
907
|
Time O(N), Space O(N)
|
|
@@ -1031,7 +1017,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1031
1017
|
findIndex(predicate, thisArg?): number;
|
|
1032
1018
|
```
|
|
1033
1019
|
|
|
1034
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1020
|
+
Defined in: [data-structures/base/linear-base.ts:147](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L147)
|
|
1035
1021
|
|
|
1036
1022
|
Find the first index matching a predicate.
|
|
1037
1023
|
|
|
@@ -1071,7 +1057,7 @@ Time O(n), Space O(1)
|
|
|
1071
1057
|
findLast(elementNodeOrPredicate): E | undefined;
|
|
1072
1058
|
```
|
|
1073
1059
|
|
|
1074
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1060
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:689](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L689)
|
|
1075
1061
|
|
|
1076
1062
|
Find the first value matching a predicate scanning backward (tail → head).
|
|
1077
1063
|
|
|
@@ -1091,8 +1077,6 @@ Element, node, or predicate to match.
|
|
|
1091
1077
|
|
|
1092
1078
|
Matching value or undefined.
|
|
1093
1079
|
|
|
1094
|
-
*
|
|
1095
|
-
|
|
1096
1080
|
#### Remarks
|
|
1097
1081
|
|
|
1098
1082
|
Time O(N), Space O(1)
|
|
@@ -1115,7 +1099,7 @@ Time O(N), Space O(1)
|
|
|
1115
1099
|
findLastIndex(predicate): number;
|
|
1116
1100
|
```
|
|
1117
1101
|
|
|
1118
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1102
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:707](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L707)
|
|
1119
1103
|
|
|
1120
1104
|
Find the index of the last value matching a predicate (scans tail → head).
|
|
1121
1105
|
|
|
@@ -1185,7 +1169,7 @@ Time O(n), Space O(1).
|
|
|
1185
1169
|
getBackward(elementNodeOrPredicate): E | undefined;
|
|
1186
1170
|
```
|
|
1187
1171
|
|
|
1188
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1172
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:671](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L671)
|
|
1189
1173
|
|
|
1190
1174
|
#### Parameters
|
|
1191
1175
|
|
|
@@ -1211,7 +1195,7 @@ Use `findLast` instead. Will be removed in a future major version.
|
|
|
1211
1195
|
getNode(elementNodeOrPredicate?): DoublyLinkedListNode<E> | undefined;
|
|
1212
1196
|
```
|
|
1213
1197
|
|
|
1214
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1198
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:439](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L439)
|
|
1215
1199
|
|
|
1216
1200
|
Find a node by value, reference, or predicate.
|
|
1217
1201
|
|
|
@@ -1243,7 +1227,7 @@ Time O(N), Space O(1)
|
|
|
1243
1227
|
getNodeAt(index): DoublyLinkedListNode<E> | undefined;
|
|
1244
1228
|
```
|
|
1245
1229
|
|
|
1246
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1230
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:426](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L426)
|
|
1247
1231
|
|
|
1248
1232
|
Get the node reference at a given index.
|
|
1249
1233
|
|
|
@@ -1261,8 +1245,6 @@ Zero-based index.
|
|
|
1261
1245
|
|
|
1262
1246
|
Node or undefined.
|
|
1263
1247
|
|
|
1264
|
-
*
|
|
1265
|
-
|
|
1266
1248
|
#### Remarks
|
|
1267
1249
|
|
|
1268
1250
|
Time O(N), Space O(1)
|
|
@@ -1287,7 +1269,7 @@ Time O(N), Space O(1)
|
|
|
1287
1269
|
has(element): boolean;
|
|
1288
1270
|
```
|
|
1289
1271
|
|
|
1290
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1272
|
+
Defined in: [data-structures/base/iterable-element-base.ts:188](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L188)
|
|
1291
1273
|
|
|
1292
1274
|
Checks whether a strictly-equal element exists in the structure.
|
|
1293
1275
|
|
|
@@ -1321,7 +1303,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1321
1303
|
includes(element): boolean;
|
|
1322
1304
|
```
|
|
1323
1305
|
|
|
1324
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1306
|
+
Defined in: [data-structures/base/iterable-element-base.ts:199](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L199)
|
|
1325
1307
|
|
|
1326
1308
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
1327
1309
|
|
|
@@ -1355,7 +1337,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
|
1355
1337
|
indexOf(searchElement, fromIndex?): number;
|
|
1356
1338
|
```
|
|
1357
1339
|
|
|
1358
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1340
|
+
Defined in: [data-structures/base/linear-base.ts:417](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L417)
|
|
1359
1341
|
|
|
1360
1342
|
Linked-list optimized `indexOf` (forwards scan).
|
|
1361
1343
|
|
|
@@ -1395,7 +1377,7 @@ Time O(n), Space O(1)
|
|
|
1395
1377
|
isEmpty(): boolean;
|
|
1396
1378
|
```
|
|
1397
1379
|
|
|
1398
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1380
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:613](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L613)
|
|
1399
1381
|
|
|
1400
1382
|
Check whether the list is empty.
|
|
1401
1383
|
|
|
@@ -1405,8 +1387,6 @@ Check whether the list is empty.
|
|
|
1405
1387
|
|
|
1406
1388
|
True if length is 0.
|
|
1407
1389
|
|
|
1408
|
-
*
|
|
1409
|
-
|
|
1410
1390
|
#### Remarks
|
|
1411
1391
|
|
|
1412
1392
|
Time O(1), Space O(1)
|
|
@@ -1430,7 +1410,7 @@ Time O(1), Space O(1)
|
|
|
1430
1410
|
isNode(elementNodeOrPredicate): elementNodeOrPredicate is DoublyLinkedListNode<E>;
|
|
1431
1411
|
```
|
|
1432
1412
|
|
|
1433
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1413
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:242](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L242)
|
|
1434
1414
|
|
|
1435
1415
|
Type guard: check whether the input is a DoublyLinkedListNode.
|
|
1436
1416
|
|
|
@@ -1462,7 +1442,7 @@ Time O(1), Space O(1)
|
|
|
1462
1442
|
join(separator?): string;
|
|
1463
1443
|
```
|
|
1464
1444
|
|
|
1465
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1445
|
+
Defined in: [data-structures/base/linear-base.ts:218](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L218)
|
|
1466
1446
|
|
|
1467
1447
|
Join all elements into a string.
|
|
1468
1448
|
|
|
@@ -1496,7 +1476,7 @@ Time O(n), Space O(n)
|
|
|
1496
1476
|
keys(): IterableIterator<number>;
|
|
1497
1477
|
```
|
|
1498
1478
|
|
|
1499
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1479
|
+
Defined in: [data-structures/base/iterable-element-base.ts:218](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L218)
|
|
1500
1480
|
|
|
1501
1481
|
Return an iterator of numeric indices (Array-compatible).
|
|
1502
1482
|
|
|
@@ -1520,7 +1500,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per st
|
|
|
1520
1500
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1521
1501
|
```
|
|
1522
1502
|
|
|
1523
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1503
|
+
Defined in: [data-structures/base/linear-base.ts:440](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L440)
|
|
1524
1504
|
|
|
1525
1505
|
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
1526
1506
|
|
|
@@ -1563,7 +1543,7 @@ map<EM, RM>(
|
|
|
1563
1543
|
thisArg?): DoublyLinkedList<EM, RM>;
|
|
1564
1544
|
```
|
|
1565
1545
|
|
|
1566
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1546
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:847](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L847)
|
|
1567
1547
|
|
|
1568
1548
|
Map values into a new list (possibly different element type).
|
|
1569
1549
|
|
|
@@ -1603,8 +1583,6 @@ Value for `this` inside the callback.
|
|
|
1603
1583
|
|
|
1604
1584
|
A new DoublyLinkedList with mapped values.
|
|
1605
1585
|
|
|
1606
|
-
*
|
|
1607
|
-
|
|
1608
1586
|
#### Remarks
|
|
1609
1587
|
|
|
1610
1588
|
Time O(N), Space O(N)
|
|
@@ -1639,7 +1617,7 @@ Time O(N), Space O(N)
|
|
|
1639
1617
|
mapSame(callback, thisArg?): this;
|
|
1640
1618
|
```
|
|
1641
1619
|
|
|
1642
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1620
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:813](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L813)
|
|
1643
1621
|
|
|
1644
1622
|
Map values into a new list of the same class.
|
|
1645
1623
|
|
|
@@ -1679,7 +1657,7 @@ Time O(N), Space O(N)
|
|
|
1679
1657
|
pop(): E | undefined;
|
|
1680
1658
|
```
|
|
1681
1659
|
|
|
1682
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1660
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:304](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L304)
|
|
1683
1661
|
|
|
1684
1662
|
Remove and return the tail element.
|
|
1685
1663
|
|
|
@@ -1689,8 +1667,6 @@ Remove and return the tail element.
|
|
|
1689
1667
|
|
|
1690
1668
|
Removed element or undefined.
|
|
1691
1669
|
|
|
1692
|
-
*
|
|
1693
|
-
|
|
1694
1670
|
#### Remarks
|
|
1695
1671
|
|
|
1696
1672
|
Time O(1), Space O(1)
|
|
@@ -1722,7 +1698,7 @@ Time O(1), Space O(1)
|
|
|
1722
1698
|
print(): void;
|
|
1723
1699
|
```
|
|
1724
1700
|
|
|
1725
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1701
|
+
Defined in: [data-structures/base/iterable-element-base.ts:298](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L298)
|
|
1726
1702
|
|
|
1727
1703
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1728
1704
|
|
|
@@ -1748,7 +1724,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1748
1724
|
push(elementOrNode): boolean;
|
|
1749
1725
|
```
|
|
1750
1726
|
|
|
1751
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1727
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:269](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L269)
|
|
1752
1728
|
|
|
1753
1729
|
Append an element/node to the tail.
|
|
1754
1730
|
|
|
@@ -1766,8 +1742,6 @@ Element or node to append.
|
|
|
1766
1742
|
|
|
1767
1743
|
True when appended.
|
|
1768
1744
|
|
|
1769
|
-
*
|
|
1770
|
-
|
|
1771
1745
|
#### Remarks
|
|
1772
1746
|
|
|
1773
1747
|
Time O(1), Space O(1)
|
|
@@ -1803,7 +1777,7 @@ Time O(1), Space O(1)
|
|
|
1803
1777
|
pushMany(elements): boolean[];
|
|
1804
1778
|
```
|
|
1805
1779
|
|
|
1806
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1780
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:374](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L374)
|
|
1807
1781
|
|
|
1808
1782
|
Append a sequence of elements/nodes.
|
|
1809
1783
|
|
|
@@ -1871,7 +1845,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1871
1845
|
reduce(callbackfn): E;
|
|
1872
1846
|
```
|
|
1873
1847
|
|
|
1874
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1848
|
+
Defined in: [data-structures/base/iterable-element-base.ts:225](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L225)
|
|
1875
1849
|
|
|
1876
1850
|
##### Parameters
|
|
1877
1851
|
|
|
@@ -1893,7 +1867,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1893
1867
|
reduce(callbackfn, initialValue): E;
|
|
1894
1868
|
```
|
|
1895
1869
|
|
|
1896
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1870
|
+
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)
|
|
1897
1871
|
|
|
1898
1872
|
##### Parameters
|
|
1899
1873
|
|
|
@@ -1919,7 +1893,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1919
1893
|
reduce<U>(callbackfn, initialValue): U;
|
|
1920
1894
|
```
|
|
1921
1895
|
|
|
1922
|
-
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)
|
|
1923
1897
|
|
|
1924
1898
|
##### Type Parameters
|
|
1925
1899
|
|
|
@@ -1953,7 +1927,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
1953
1927
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1954
1928
|
```
|
|
1955
1929
|
|
|
1956
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1930
|
+
Defined in: [data-structures/base/linear-base.ts:552](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L552)
|
|
1957
1931
|
|
|
1958
1932
|
Right-to-left reduction using reverse iterator.
|
|
1959
1933
|
|
|
@@ -1999,7 +1973,7 @@ Time O(n), Space O(1)
|
|
|
1999
1973
|
reverse(): this;
|
|
2000
1974
|
```
|
|
2001
1975
|
|
|
2002
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
1976
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:728](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L728)
|
|
2003
1977
|
|
|
2004
1978
|
Reverse the list in place.
|
|
2005
1979
|
|
|
@@ -2009,8 +1983,6 @@ Reverse the list in place.
|
|
|
2009
1983
|
|
|
2010
1984
|
This list.
|
|
2011
1985
|
|
|
2012
|
-
*
|
|
2013
|
-
|
|
2014
1986
|
#### Remarks
|
|
2015
1987
|
|
|
2016
1988
|
Time O(N), Space O(1)
|
|
@@ -2036,7 +2008,7 @@ Time O(N), Space O(1)
|
|
|
2036
2008
|
search(elementNodeOrPredicate): E | undefined;
|
|
2037
2009
|
```
|
|
2038
2010
|
|
|
2039
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2011
|
+
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)
|
|
2040
2012
|
|
|
2041
2013
|
Find the first value matching a predicate scanning forward.
|
|
2042
2014
|
|
|
@@ -2056,8 +2028,6 @@ Element, node, or predicate to match.
|
|
|
2056
2028
|
|
|
2057
2029
|
Matched value or undefined.
|
|
2058
2030
|
|
|
2059
|
-
*
|
|
2060
|
-
|
|
2061
2031
|
#### Remarks
|
|
2062
2032
|
|
|
2063
2033
|
Time O(N), Space O(1)
|
|
@@ -2079,7 +2049,7 @@ Time O(N), Space O(1)
|
|
|
2079
2049
|
setAt(index, value): boolean;
|
|
2080
2050
|
```
|
|
2081
2051
|
|
|
2082
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2052
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:548](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L548)
|
|
2083
2053
|
|
|
2084
2054
|
Set the element value at an index.
|
|
2085
2055
|
|
|
@@ -2119,7 +2089,7 @@ Time O(N), Space O(1)
|
|
|
2119
2089
|
setEquality(equals): this;
|
|
2120
2090
|
```
|
|
2121
2091
|
|
|
2122
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2092
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:765](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L765)
|
|
2123
2093
|
|
|
2124
2094
|
Set the equality comparator used to compare values.
|
|
2125
2095
|
|
|
@@ -2149,7 +2119,7 @@ Time O(1), Space O(1)
|
|
|
2149
2119
|
shift(): E | undefined;
|
|
2150
2120
|
```
|
|
2151
2121
|
|
|
2152
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2122
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:328](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L328)
|
|
2153
2123
|
|
|
2154
2124
|
Remove and return the head element.
|
|
2155
2125
|
|
|
@@ -2159,8 +2129,6 @@ Remove and return the head element.
|
|
|
2159
2129
|
|
|
2160
2130
|
Removed element or undefined.
|
|
2161
2131
|
|
|
2162
|
-
*
|
|
2163
|
-
|
|
2164
2132
|
#### Remarks
|
|
2165
2133
|
|
|
2166
2134
|
Time O(1), Space O(1)
|
|
@@ -2182,7 +2150,7 @@ Time O(1), Space O(1)
|
|
|
2182
2150
|
slice(start?, end?): this;
|
|
2183
2151
|
```
|
|
2184
2152
|
|
|
2185
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2153
|
+
Defined in: [data-structures/base/linear-base.ts:481](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L481)
|
|
2186
2154
|
|
|
2187
2155
|
Slice via forward iteration (no random access required).
|
|
2188
2156
|
|
|
@@ -2262,7 +2230,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2262
2230
|
sort(compareFn?): this;
|
|
2263
2231
|
```
|
|
2264
2232
|
|
|
2265
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2233
|
+
Defined in: [data-structures/base/linear-base.ts:179](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L179)
|
|
2266
2234
|
|
|
2267
2235
|
In-place stable order via array sort semantics.
|
|
2268
2236
|
|
|
@@ -2299,7 +2267,7 @@ splice(
|
|
|
2299
2267
|
items): this;
|
|
2300
2268
|
```
|
|
2301
2269
|
|
|
2302
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2270
|
+
Defined in: [data-structures/base/linear-base.ts:507](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L507)
|
|
2303
2271
|
|
|
2304
2272
|
Splice by walking node iterators from the start index.
|
|
2305
2273
|
|
|
@@ -2345,7 +2313,7 @@ Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
|
2345
2313
|
toArray(): E[];
|
|
2346
2314
|
```
|
|
2347
2315
|
|
|
2348
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2316
|
+
Defined in: [data-structures/base/iterable-element-base.ts:275](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L275)
|
|
2349
2317
|
|
|
2350
2318
|
Materializes the elements into a new array.
|
|
2351
2319
|
|
|
@@ -2371,7 +2339,7 @@ Time O(n), Space O(n).
|
|
|
2371
2339
|
toReversed(): this;
|
|
2372
2340
|
```
|
|
2373
2341
|
|
|
2374
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2342
|
+
Defined in: [data-structures/base/linear-base.ts:319](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L319)
|
|
2375
2343
|
|
|
2376
2344
|
Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
2377
2345
|
|
|
@@ -2397,7 +2365,7 @@ Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O
|
|
|
2397
2365
|
toReversedArray(): E[];
|
|
2398
2366
|
```
|
|
2399
2367
|
|
|
2400
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2368
|
+
Defined in: [data-structures/base/linear-base.ts:227](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L227)
|
|
2401
2369
|
|
|
2402
2370
|
Snapshot elements into a reversed array.
|
|
2403
2371
|
|
|
@@ -2423,7 +2391,7 @@ Time O(n), Space O(n)
|
|
|
2423
2391
|
toVisual(): E[];
|
|
2424
2392
|
```
|
|
2425
2393
|
|
|
2426
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2394
|
+
Defined in: [data-structures/base/iterable-element-base.ts:287](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L287)
|
|
2427
2395
|
|
|
2428
2396
|
Returns a representation of the structure suitable for quick visualization.
|
|
2429
2397
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2450,7 +2418,7 @@ Time O(n), Space O(n).
|
|
|
2450
2418
|
unshift(elementOrNode): boolean;
|
|
2451
2419
|
```
|
|
2452
2420
|
|
|
2453
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2421
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:353](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L353)
|
|
2454
2422
|
|
|
2455
2423
|
Prepend an element/node to the head.
|
|
2456
2424
|
|
|
@@ -2468,8 +2436,6 @@ Element or node to prepend.
|
|
|
2468
2436
|
|
|
2469
2437
|
True when prepended.
|
|
2470
2438
|
|
|
2471
|
-
*
|
|
2472
|
-
|
|
2473
2439
|
#### Remarks
|
|
2474
2440
|
|
|
2475
2441
|
Time O(1), Space O(1)
|
|
@@ -2491,7 +2457,7 @@ Time O(1), Space O(1)
|
|
|
2491
2457
|
unshiftMany(elements): boolean[];
|
|
2492
2458
|
```
|
|
2493
2459
|
|
|
2494
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2460
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:389](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L389)
|
|
2495
2461
|
|
|
2496
2462
|
Prepend a sequence of elements/nodes.
|
|
2497
2463
|
|
|
@@ -2549,7 +2515,7 @@ Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
|
2549
2515
|
static fromArray<E, R>(this, data): any;
|
|
2550
2516
|
```
|
|
2551
2517
|
|
|
2552
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2518
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:226](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L226)
|
|
2553
2519
|
|
|
2554
2520
|
Create a new list from an array of elements.
|
|
2555
2521
|
|
|
@@ -2628,7 +2594,7 @@ Time O(1), Space O(1).
|
|
|
2628
2594
|
protected _createInstance(options?): this;
|
|
2629
2595
|
```
|
|
2630
2596
|
|
|
2631
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2597
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:907](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L907)
|
|
2632
2598
|
|
|
2633
2599
|
(Protected) Create an empty instance of the same concrete class.
|
|
2634
2600
|
|
|
@@ -2662,7 +2628,7 @@ Time O(1), Space O(1)
|
|
|
2662
2628
|
protected _createLike<EM, RM>(elements?, options?): DoublyLinkedList<EM, RM>;
|
|
2663
2629
|
```
|
|
2664
2630
|
|
|
2665
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2631
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:924](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L924)
|
|
2666
2632
|
|
|
2667
2633
|
(Protected) Create a like-kind instance and seed it from an iterable.
|
|
2668
2634
|
|
|
@@ -2710,7 +2676,7 @@ Time O(N), Space O(N)
|
|
|
2710
2676
|
protected _ensureNode(elementOrNode): DoublyLinkedListNode<E>;
|
|
2711
2677
|
```
|
|
2712
2678
|
|
|
2713
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2679
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:866](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L866)
|
|
2714
2680
|
|
|
2715
2681
|
(Protected) Create or return a node for the given input (node or raw element).
|
|
2716
2682
|
|
|
@@ -2740,7 +2706,7 @@ Time O(1), Space O(1)
|
|
|
2740
2706
|
protected _ensurePredicate(elementNodeOrPredicate): (node) => boolean;
|
|
2741
2707
|
```
|
|
2742
2708
|
|
|
2743
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2709
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:877](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L877)
|
|
2744
2710
|
|
|
2745
2711
|
(Protected) Normalize input into a predicate over nodes.
|
|
2746
2712
|
|
|
@@ -2772,7 +2738,7 @@ Time O(1), Space O(1)
|
|
|
2772
2738
|
protected _getIterator(): IterableIterator<E>;
|
|
2773
2739
|
```
|
|
2774
2740
|
|
|
2775
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2741
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:935](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L935)
|
|
2776
2742
|
|
|
2777
2743
|
Internal iterator factory used by the default iterator.
|
|
2778
2744
|
|
|
@@ -2798,7 +2764,7 @@ Implementations should yield in O(1) per element with O(1) extra space when poss
|
|
|
2798
2764
|
protected _getNodeIterator(): IterableIterator<DoublyLinkedListNode<E>>;
|
|
2799
2765
|
```
|
|
2800
2766
|
|
|
2801
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2767
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:951](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L951)
|
|
2802
2768
|
|
|
2803
2769
|
Iterate linked nodes from head to tail.
|
|
2804
2770
|
|
|
@@ -2824,7 +2790,7 @@ Time O(n), Space O(1)
|
|
|
2824
2790
|
protected _getPrevNode(node): DoublyLinkedListNode<E> | undefined;
|
|
2825
2791
|
```
|
|
2826
2792
|
|
|
2827
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2793
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:897](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L897)
|
|
2828
2794
|
|
|
2829
2795
|
(Protected) Get the previous node of a given node.
|
|
2830
2796
|
|
|
@@ -2858,7 +2824,7 @@ Time O(1), Space O(1)
|
|
|
2858
2824
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2859
2825
|
```
|
|
2860
2826
|
|
|
2861
|
-
Defined in: [data-structures/linked-list/doubly-linked-list.ts:
|
|
2827
|
+
Defined in: [data-structures/linked-list/doubly-linked-list.ts:943](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/doubly-linked-list.ts#L943)
|
|
2862
2828
|
|
|
2863
2829
|
Reverse-direction iterator over elements.
|
|
2864
2830
|
|