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: SinglyLinkedList\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
9
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:190](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L190)
|
|
10
10
|
|
|
11
11
|
Singly linked list with O(1) push/pop-like ends operations and linear scans.
|
|
12
12
|
|
|
@@ -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:
|
|
187
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:198](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L198)
|
|
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:
|
|
233
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:244](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L244)
|
|
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:
|
|
257
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:213](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L213)
|
|
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:
|
|
281
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:253](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L253)
|
|
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:
|
|
305
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:235](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L235)
|
|
306
306
|
|
|
307
307
|
Get the number of elements.
|
|
308
308
|
|
|
@@ -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:
|
|
361
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:224](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L224)
|
|
362
362
|
|
|
363
363
|
Get the tail node.
|
|
364
364
|
|
|
@@ -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:702](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L702)
|
|
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:568](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L568)
|
|
486
486
|
|
|
487
487
|
Insert a new element/node at an index, shifting following nodes.
|
|
488
488
|
|
|
@@ -506,8 +506,6 @@ Element or node to insert.
|
|
|
506
506
|
|
|
507
507
|
True if inserted.
|
|
508
508
|
|
|
509
|
-
*
|
|
510
|
-
|
|
511
509
|
#### Remarks
|
|
512
510
|
|
|
513
511
|
Time O(N), Space O(1)
|
|
@@ -533,7 +531,7 @@ Time O(N), Space O(1)
|
|
|
533
531
|
addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
534
532
|
```
|
|
535
533
|
|
|
536
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
534
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:674](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L674)
|
|
537
535
|
|
|
538
536
|
Insert a new element/node before an existing one.
|
|
539
537
|
|
|
@@ -573,7 +571,7 @@ Time O(N), Space O(1)
|
|
|
573
571
|
at(index): E | undefined;
|
|
574
572
|
```
|
|
575
573
|
|
|
576
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
574
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:470](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L470)
|
|
577
575
|
|
|
578
576
|
Get the element at a given index.
|
|
579
577
|
|
|
@@ -591,8 +589,6 @@ Zero-based index.
|
|
|
591
589
|
|
|
592
590
|
Element or undefined.
|
|
593
591
|
|
|
594
|
-
*
|
|
595
|
-
|
|
596
592
|
#### Remarks
|
|
597
593
|
|
|
598
594
|
Time O(N), Space O(1)
|
|
@@ -619,7 +615,7 @@ Time O(N), Space O(1)
|
|
|
619
615
|
clear(): void;
|
|
620
616
|
```
|
|
621
617
|
|
|
622
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
618
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:616](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L616)
|
|
623
619
|
|
|
624
620
|
Remove all nodes and reset length.
|
|
625
621
|
|
|
@@ -629,8 +625,6 @@ Remove all nodes and reset length.
|
|
|
629
625
|
|
|
630
626
|
void
|
|
631
627
|
|
|
632
|
-
*
|
|
633
|
-
|
|
634
628
|
#### Remarks
|
|
635
629
|
|
|
636
630
|
Time O(N), Space O(1)
|
|
@@ -656,7 +650,7 @@ Time O(N), Space O(1)
|
|
|
656
650
|
clone(): this;
|
|
657
651
|
```
|
|
658
652
|
|
|
659
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
653
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:830](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L830)
|
|
660
654
|
|
|
661
655
|
Deep clone this list (values are copied by reference).
|
|
662
656
|
|
|
@@ -666,8 +660,6 @@ Deep clone this list (values are copied by reference).
|
|
|
666
660
|
|
|
667
661
|
A new list with the same element sequence.
|
|
668
662
|
|
|
669
|
-
*
|
|
670
|
-
|
|
671
663
|
#### Remarks
|
|
672
664
|
|
|
673
665
|
Time O(N), Space O(N)
|
|
@@ -695,7 +687,7 @@ Time O(N), Space O(N)
|
|
|
695
687
|
concat(...items): this;
|
|
696
688
|
```
|
|
697
689
|
|
|
698
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
690
|
+
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)
|
|
699
691
|
|
|
700
692
|
Concatenate lists/elements preserving order.
|
|
701
693
|
|
|
@@ -731,7 +723,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
731
723
|
countOccurrences(elementOrNode): number;
|
|
732
724
|
```
|
|
733
725
|
|
|
734
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
726
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:768](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L768)
|
|
735
727
|
|
|
736
728
|
Count how many nodes match a value/node/predicate.
|
|
737
729
|
|
|
@@ -763,7 +755,7 @@ Time O(N), Space O(1)
|
|
|
763
755
|
delete(elementOrNode?): boolean;
|
|
764
756
|
```
|
|
765
757
|
|
|
766
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
758
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:540](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L540)
|
|
767
759
|
|
|
768
760
|
Delete the first match by value/node.
|
|
769
761
|
|
|
@@ -781,8 +773,6 @@ Element or node to remove; if omitted/undefined, nothing happens.
|
|
|
781
773
|
|
|
782
774
|
True if removed.
|
|
783
775
|
|
|
784
|
-
*
|
|
785
|
-
|
|
786
776
|
#### Remarks
|
|
787
777
|
|
|
788
778
|
Time O(N), Space O(1)
|
|
@@ -808,7 +798,7 @@ Time O(N), Space O(1)
|
|
|
808
798
|
deleteAt(index): E | undefined;
|
|
809
799
|
```
|
|
810
800
|
|
|
811
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
801
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:517](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L517)
|
|
812
802
|
|
|
813
803
|
Delete the element at an index.
|
|
814
804
|
|
|
@@ -826,8 +816,6 @@ Zero-based index.
|
|
|
826
816
|
|
|
827
817
|
Removed element or undefined.
|
|
828
818
|
|
|
829
|
-
*
|
|
830
|
-
|
|
831
819
|
#### Remarks
|
|
832
820
|
|
|
833
821
|
Time O(N), Space O(1)
|
|
@@ -853,7 +841,7 @@ Time O(N), Space O(1)
|
|
|
853
841
|
deleteWhere(predicate): boolean;
|
|
854
842
|
```
|
|
855
843
|
|
|
856
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
844
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:796](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L796)
|
|
857
845
|
|
|
858
846
|
Delete the first node whose value matches a predicate.
|
|
859
847
|
|
|
@@ -883,7 +871,7 @@ Time O(N), Space O(1)
|
|
|
883
871
|
entries(): IterableIterator<[number, E]>;
|
|
884
872
|
```
|
|
885
873
|
|
|
886
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
874
|
+
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)
|
|
887
875
|
|
|
888
876
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
889
877
|
|
|
@@ -950,7 +938,7 @@ fill(
|
|
|
950
938
|
end?): this;
|
|
951
939
|
```
|
|
952
940
|
|
|
953
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
941
|
+
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)
|
|
954
942
|
|
|
955
943
|
Fill a range with a value.
|
|
956
944
|
|
|
@@ -996,7 +984,7 @@ Time O(n), Space O(1)
|
|
|
996
984
|
filter(callback, thisArg?): this;
|
|
997
985
|
```
|
|
998
986
|
|
|
999
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
987
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:858](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L858)
|
|
1000
988
|
|
|
1001
989
|
Filter values into a new list of the same class.
|
|
1002
990
|
|
|
@@ -1020,8 +1008,6 @@ Value for `this` inside the callback.
|
|
|
1020
1008
|
|
|
1021
1009
|
A new list with kept values.
|
|
1022
1010
|
|
|
1023
|
-
*
|
|
1024
|
-
|
|
1025
1011
|
#### Remarks
|
|
1026
1012
|
|
|
1027
1013
|
Time O(N), Space O(N)
|
|
@@ -1147,7 +1133,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1147
1133
|
findIndex(predicate, thisArg?): number;
|
|
1148
1134
|
```
|
|
1149
1135
|
|
|
1150
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1136
|
+
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)
|
|
1151
1137
|
|
|
1152
1138
|
Find the first index matching a predicate.
|
|
1153
1139
|
|
|
@@ -1227,7 +1213,7 @@ Time O(n), Space O(1).
|
|
|
1227
1213
|
getNode(elementNodeOrPredicate?): SinglyLinkedListNode<E> | undefined;
|
|
1228
1214
|
```
|
|
1229
1215
|
|
|
1230
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1216
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:653](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L653)
|
|
1231
1217
|
|
|
1232
1218
|
Find a node by value, reference, or predicate.
|
|
1233
1219
|
|
|
@@ -1259,7 +1245,7 @@ Time O(N), Space O(1)
|
|
|
1259
1245
|
getNodeAt(index): SinglyLinkedListNode<E> | undefined;
|
|
1260
1246
|
```
|
|
1261
1247
|
|
|
1262
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1248
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:499](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L499)
|
|
1263
1249
|
|
|
1264
1250
|
Get the node reference at a given index.
|
|
1265
1251
|
|
|
@@ -1277,8 +1263,6 @@ Zero-based index.
|
|
|
1277
1263
|
|
|
1278
1264
|
Node or undefined.
|
|
1279
1265
|
|
|
1280
|
-
*
|
|
1281
|
-
|
|
1282
1266
|
#### Remarks
|
|
1283
1267
|
|
|
1284
1268
|
Time O(N), Space O(1)
|
|
@@ -1303,7 +1287,7 @@ Time O(N), Space O(1)
|
|
|
1303
1287
|
has(element): boolean;
|
|
1304
1288
|
```
|
|
1305
1289
|
|
|
1306
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1290
|
+
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)
|
|
1307
1291
|
|
|
1308
1292
|
Checks whether a strictly-equal element exists in the structure.
|
|
1309
1293
|
|
|
@@ -1337,7 +1321,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1337
1321
|
includes(element): boolean;
|
|
1338
1322
|
```
|
|
1339
1323
|
|
|
1340
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1324
|
+
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)
|
|
1341
1325
|
|
|
1342
1326
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
1343
1327
|
|
|
@@ -1371,7 +1355,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
|
1371
1355
|
indexOf(searchElement, fromIndex?): number;
|
|
1372
1356
|
```
|
|
1373
1357
|
|
|
1374
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1358
|
+
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)
|
|
1375
1359
|
|
|
1376
1360
|
Linked-list optimized `indexOf` (forwards scan).
|
|
1377
1361
|
|
|
@@ -1411,7 +1395,7 @@ Time O(n), Space O(1)
|
|
|
1411
1395
|
isEmpty(): boolean;
|
|
1412
1396
|
```
|
|
1413
1397
|
|
|
1414
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1398
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:602](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L602)
|
|
1415
1399
|
|
|
1416
1400
|
Check whether the list is empty.
|
|
1417
1401
|
|
|
@@ -1421,8 +1405,6 @@ Check whether the list is empty.
|
|
|
1421
1405
|
|
|
1422
1406
|
True if length is 0.
|
|
1423
1407
|
|
|
1424
|
-
*
|
|
1425
|
-
|
|
1426
1408
|
#### Remarks
|
|
1427
1409
|
|
|
1428
1410
|
Time O(1), Space O(1)
|
|
@@ -1446,7 +1428,7 @@ Time O(1), Space O(1)
|
|
|
1446
1428
|
isNode(elementNodeOrPredicate): elementNodeOrPredicate is SinglyLinkedListNode<E>;
|
|
1447
1429
|
```
|
|
1448
1430
|
|
|
1449
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1431
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:483](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L483)
|
|
1450
1432
|
|
|
1451
1433
|
Type guard: check whether the input is a SinglyLinkedListNode.
|
|
1452
1434
|
|
|
@@ -1478,7 +1460,7 @@ Time O(1), Space O(1)
|
|
|
1478
1460
|
join(separator?): string;
|
|
1479
1461
|
```
|
|
1480
1462
|
|
|
1481
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1463
|
+
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)
|
|
1482
1464
|
|
|
1483
1465
|
Join all elements into a string.
|
|
1484
1466
|
|
|
@@ -1512,7 +1494,7 @@ Time O(n), Space O(n)
|
|
|
1512
1494
|
keys(): IterableIterator<number>;
|
|
1513
1495
|
```
|
|
1514
1496
|
|
|
1515
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1497
|
+
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)
|
|
1516
1498
|
|
|
1517
1499
|
Return an iterator of numeric indices (Array-compatible).
|
|
1518
1500
|
|
|
@@ -1536,7 +1518,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per st
|
|
|
1536
1518
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1537
1519
|
```
|
|
1538
1520
|
|
|
1539
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1521
|
+
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)
|
|
1540
1522
|
|
|
1541
1523
|
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
1542
1524
|
|
|
@@ -1579,7 +1561,7 @@ map<EM, RM>(
|
|
|
1579
1561
|
thisArg?): SinglyLinkedList<EM, RM>;
|
|
1580
1562
|
```
|
|
1581
1563
|
|
|
1582
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1564
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:897](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L897)
|
|
1583
1565
|
|
|
1584
1566
|
Map values into a new list (possibly different element type).
|
|
1585
1567
|
|
|
@@ -1619,8 +1601,6 @@ Value for `this` inside the callback.
|
|
|
1619
1601
|
|
|
1620
1602
|
A new SinglyLinkedList with mapped values.
|
|
1621
1603
|
|
|
1622
|
-
*
|
|
1623
|
-
|
|
1624
1604
|
#### Remarks
|
|
1625
1605
|
|
|
1626
1606
|
Time O(N), Space O(N)
|
|
@@ -1646,7 +1626,7 @@ Time O(N), Space O(N)
|
|
|
1646
1626
|
mapSame(callback, thisArg?): this;
|
|
1647
1627
|
```
|
|
1648
1628
|
|
|
1649
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1629
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:872](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L872)
|
|
1650
1630
|
|
|
1651
1631
|
Map values into a new list of the same class.
|
|
1652
1632
|
|
|
@@ -1686,7 +1666,7 @@ Time O(N), Space O(N)
|
|
|
1686
1666
|
pop(): E | undefined;
|
|
1687
1667
|
```
|
|
1688
1668
|
|
|
1689
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1669
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:335](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L335)
|
|
1690
1670
|
|
|
1691
1671
|
Remove and return the tail element.
|
|
1692
1672
|
|
|
@@ -1696,8 +1676,6 @@ Remove and return the tail element.
|
|
|
1696
1676
|
|
|
1697
1677
|
Removed element or undefined.
|
|
1698
1678
|
|
|
1699
|
-
*
|
|
1700
|
-
|
|
1701
1679
|
#### Remarks
|
|
1702
1680
|
|
|
1703
1681
|
Time O(N), Space O(1)
|
|
@@ -1729,7 +1707,7 @@ Time O(N), Space O(1)
|
|
|
1729
1707
|
print(): void;
|
|
1730
1708
|
```
|
|
1731
1709
|
|
|
1732
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1710
|
+
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)
|
|
1733
1711
|
|
|
1734
1712
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1735
1713
|
|
|
@@ -1755,7 +1733,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1755
1733
|
push(elementOrNode): boolean;
|
|
1756
1734
|
```
|
|
1757
1735
|
|
|
1758
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1736
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:302](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L302)
|
|
1759
1737
|
|
|
1760
1738
|
Append an element/node to the tail.
|
|
1761
1739
|
|
|
@@ -1773,8 +1751,6 @@ Element or node to append.
|
|
|
1773
1751
|
|
|
1774
1752
|
True when appended.
|
|
1775
1753
|
|
|
1776
|
-
*
|
|
1777
|
-
|
|
1778
1754
|
#### Remarks
|
|
1779
1755
|
|
|
1780
1756
|
Time O(1), Space O(1)
|
|
@@ -1810,7 +1786,7 @@ Time O(1), Space O(1)
|
|
|
1810
1786
|
pushMany(elements): boolean[];
|
|
1811
1787
|
```
|
|
1812
1788
|
|
|
1813
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1789
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:416](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L416)
|
|
1814
1790
|
|
|
1815
1791
|
Append a sequence of elements/nodes.
|
|
1816
1792
|
|
|
@@ -1878,7 +1854,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1878
1854
|
reduce(callbackfn): E;
|
|
1879
1855
|
```
|
|
1880
1856
|
|
|
1881
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1857
|
+
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)
|
|
1882
1858
|
|
|
1883
1859
|
##### Parameters
|
|
1884
1860
|
|
|
@@ -1900,7 +1876,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1900
1876
|
reduce(callbackfn, initialValue): E;
|
|
1901
1877
|
```
|
|
1902
1878
|
|
|
1903
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1879
|
+
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)
|
|
1904
1880
|
|
|
1905
1881
|
##### Parameters
|
|
1906
1882
|
|
|
@@ -1926,7 +1902,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1926
1902
|
reduce<U>(callbackfn, initialValue): U;
|
|
1927
1903
|
```
|
|
1928
1904
|
|
|
1929
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1905
|
+
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)
|
|
1930
1906
|
|
|
1931
1907
|
##### Type Parameters
|
|
1932
1908
|
|
|
@@ -1960,7 +1936,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
1960
1936
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1961
1937
|
```
|
|
1962
1938
|
|
|
1963
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1939
|
+
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)
|
|
1964
1940
|
|
|
1965
1941
|
Right-to-left reduction using reverse iterator.
|
|
1966
1942
|
|
|
@@ -2006,7 +1982,7 @@ Time O(n), Space O(1)
|
|
|
2006
1982
|
reverse(): this;
|
|
2007
1983
|
```
|
|
2008
1984
|
|
|
2009
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1985
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:632](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L632)
|
|
2010
1986
|
|
|
2011
1987
|
Reverse the list in place.
|
|
2012
1988
|
|
|
@@ -2016,8 +1992,6 @@ Reverse the list in place.
|
|
|
2016
1992
|
|
|
2017
1993
|
This list.
|
|
2018
1994
|
|
|
2019
|
-
*
|
|
2020
|
-
|
|
2021
1995
|
#### Remarks
|
|
2022
1996
|
|
|
2023
1997
|
Time O(N), Space O(1)
|
|
@@ -2043,7 +2017,7 @@ Time O(N), Space O(1)
|
|
|
2043
2017
|
search(elementNodeOrPredicate): E | undefined;
|
|
2044
2018
|
```
|
|
2045
2019
|
|
|
2046
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2020
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:446](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L446)
|
|
2047
2021
|
|
|
2048
2022
|
Find the first value matching a predicate (by node).
|
|
2049
2023
|
|
|
@@ -2075,7 +2049,7 @@ Time O(N), Space O(1)
|
|
|
2075
2049
|
setAt(index, value): boolean;
|
|
2076
2050
|
```
|
|
2077
2051
|
|
|
2078
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2052
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:587](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L587)
|
|
2079
2053
|
|
|
2080
2054
|
Set the element value at an index.
|
|
2081
2055
|
|
|
@@ -2115,7 +2089,7 @@ Time O(N), Space O(1)
|
|
|
2115
2089
|
setEquality(equals): this;
|
|
2116
2090
|
```
|
|
2117
2091
|
|
|
2118
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2092
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:785](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L785)
|
|
2119
2093
|
|
|
2120
2094
|
Set the equality comparator used to compare values.
|
|
2121
2095
|
|
|
@@ -2145,7 +2119,7 @@ Time O(1), Space O(1)
|
|
|
2145
2119
|
shift(): E | undefined;
|
|
2146
2120
|
```
|
|
2147
2121
|
|
|
2148
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2122
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:363](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L363)
|
|
2149
2123
|
|
|
2150
2124
|
Remove and return the head element.
|
|
2151
2125
|
|
|
@@ -2155,8 +2129,6 @@ Remove and return the head element.
|
|
|
2155
2129
|
|
|
2156
2130
|
Removed element or undefined.
|
|
2157
2131
|
|
|
2158
|
-
*
|
|
2159
|
-
|
|
2160
2132
|
#### Remarks
|
|
2161
2133
|
|
|
2162
2134
|
Time O(1), Space O(1)
|
|
@@ -2178,7 +2150,7 @@ Time O(1), Space O(1)
|
|
|
2178
2150
|
slice(start?, end?): this;
|
|
2179
2151
|
```
|
|
2180
2152
|
|
|
2181
|
-
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)
|
|
2182
2154
|
|
|
2183
2155
|
Slice via forward iteration (no random access required).
|
|
2184
2156
|
|
|
@@ -2258,7 +2230,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2258
2230
|
sort(compareFn?): this;
|
|
2259
2231
|
```
|
|
2260
2232
|
|
|
2261
|
-
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)
|
|
2262
2234
|
|
|
2263
2235
|
In-place stable order via array sort semantics.
|
|
2264
2236
|
|
|
@@ -2295,7 +2267,7 @@ splice(
|
|
|
2295
2267
|
items?): this;
|
|
2296
2268
|
```
|
|
2297
2269
|
|
|
2298
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2270
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:721](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L721)
|
|
2299
2271
|
|
|
2300
2272
|
Remove and/or insert elements at a position (array-like behavior).
|
|
2301
2273
|
|
|
@@ -2341,7 +2313,7 @@ Time O(N + M), Space O(M)
|
|
|
2341
2313
|
toArray(): E[];
|
|
2342
2314
|
```
|
|
2343
2315
|
|
|
2344
|
-
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)
|
|
2345
2317
|
|
|
2346
2318
|
Materializes the elements into a new array.
|
|
2347
2319
|
|
|
@@ -2367,7 +2339,7 @@ Time O(n), Space O(n).
|
|
|
2367
2339
|
toReversed(): this;
|
|
2368
2340
|
```
|
|
2369
2341
|
|
|
2370
|
-
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)
|
|
2371
2343
|
|
|
2372
2344
|
Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
2373
2345
|
|
|
@@ -2393,7 +2365,7 @@ Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O
|
|
|
2393
2365
|
toReversedArray(): E[];
|
|
2394
2366
|
```
|
|
2395
2367
|
|
|
2396
|
-
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)
|
|
2397
2369
|
|
|
2398
2370
|
Snapshot elements into a reversed array.
|
|
2399
2371
|
|
|
@@ -2419,7 +2391,7 @@ Time O(n), Space O(n)
|
|
|
2419
2391
|
toVisual(): E[];
|
|
2420
2392
|
```
|
|
2421
2393
|
|
|
2422
|
-
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)
|
|
2423
2395
|
|
|
2424
2396
|
Returns a representation of the structure suitable for quick visualization.
|
|
2425
2397
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2446,7 +2418,7 @@ Time O(n), Space O(n).
|
|
|
2446
2418
|
unshift(elementOrNode): boolean;
|
|
2447
2419
|
```
|
|
2448
2420
|
|
|
2449
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2421
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:398](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L398)
|
|
2450
2422
|
|
|
2451
2423
|
Prepend an element/node to the head.
|
|
2452
2424
|
|
|
@@ -2464,8 +2436,6 @@ Element or node to prepend.
|
|
|
2464
2436
|
|
|
2465
2437
|
True when prepended.
|
|
2466
2438
|
|
|
2467
|
-
*
|
|
2468
|
-
|
|
2469
2439
|
#### Remarks
|
|
2470
2440
|
|
|
2471
2441
|
Time O(1), Space O(1)
|
|
@@ -2502,7 +2472,7 @@ Time O(1), Space O(1)
|
|
|
2502
2472
|
unshiftMany(elements): boolean[];
|
|
2503
2473
|
```
|
|
2504
2474
|
|
|
2505
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2475
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:431](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L431)
|
|
2506
2476
|
|
|
2507
2477
|
Prepend a sequence of elements/nodes.
|
|
2508
2478
|
|
|
@@ -2563,7 +2533,7 @@ static from<E, R, S>(
|
|
|
2563
2533
|
options?): S;
|
|
2564
2534
|
```
|
|
2565
2535
|
|
|
2566
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2536
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:268](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L268)
|
|
2567
2537
|
|
|
2568
2538
|
Create a new list from an iterable of elements.
|
|
2569
2539
|
|
|
@@ -2652,7 +2622,7 @@ Time O(1), Space O(1).
|
|
|
2652
2622
|
protected _createInstance(options?): this;
|
|
2653
2623
|
```
|
|
2654
2624
|
|
|
2655
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2625
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1013](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1013)
|
|
2656
2626
|
|
|
2657
2627
|
(Protected) Create an empty instance of the same concrete class.
|
|
2658
2628
|
|
|
@@ -2686,7 +2656,7 @@ Time O(1), Space O(1)
|
|
|
2686
2656
|
protected _createLike<EM, RM>(elements?, options?): SinglyLinkedList<EM, RM>;
|
|
2687
2657
|
```
|
|
2688
2658
|
|
|
2689
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2659
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1030](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1030)
|
|
2690
2660
|
|
|
2691
2661
|
(Protected) Create a like-kind instance and seed it from an iterable.
|
|
2692
2662
|
|
|
@@ -2734,7 +2704,7 @@ Time O(N), Space O(N)
|
|
|
2734
2704
|
protected _ensureNode(elementOrNode): SinglyLinkedListNode<E>;
|
|
2735
2705
|
```
|
|
2736
2706
|
|
|
2737
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2707
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:938](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L938)
|
|
2738
2708
|
|
|
2739
2709
|
(Protected) Normalize input into a node instance.
|
|
2740
2710
|
|
|
@@ -2764,7 +2734,7 @@ Time O(1), Space O(1)
|
|
|
2764
2734
|
protected _ensurePredicate(elementNodeOrPredicate): (node) => boolean;
|
|
2765
2735
|
```
|
|
2766
2736
|
|
|
2767
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2737
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:949](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L949)
|
|
2768
2738
|
|
|
2769
2739
|
(Protected) Normalize input into a node predicate.
|
|
2770
2740
|
|
|
@@ -2796,7 +2766,7 @@ Time O(1), Space O(1)
|
|
|
2796
2766
|
protected _getIterator(): IterableIterator<E>;
|
|
2797
2767
|
```
|
|
2798
2768
|
|
|
2799
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2769
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:976](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L976)
|
|
2800
2770
|
|
|
2801
2771
|
(Protected) Iterate values from head to tail.
|
|
2802
2772
|
|
|
@@ -2822,7 +2792,7 @@ Time O(N), Space O(1)
|
|
|
2822
2792
|
protected _getNodeIterator(): IterableIterator<SinglyLinkedListNode<E>>;
|
|
2823
2793
|
```
|
|
2824
2794
|
|
|
2825
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2795
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:999](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L999)
|
|
2826
2796
|
|
|
2827
2797
|
(Protected) Iterate nodes from head to tail.
|
|
2828
2798
|
|
|
@@ -2848,7 +2818,7 @@ Time O(N), Space O(1)
|
|
|
2848
2818
|
protected _getPrevNode(node): SinglyLinkedListNode<E> | undefined;
|
|
2849
2819
|
```
|
|
2850
2820
|
|
|
2851
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2821
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:964](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L964)
|
|
2852
2822
|
|
|
2853
2823
|
(Protected) Get the previous node of a given node.
|
|
2854
2824
|
|
|
@@ -2882,7 +2852,7 @@ Time O(N), Space O(1)
|
|
|
2882
2852
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2883
2853
|
```
|
|
2884
2854
|
|
|
2885
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2855
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:989](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L989)
|
|
2886
2856
|
|
|
2887
2857
|
(Protected) Iterate values from tail to head.
|
|
2888
2858
|
|
|
@@ -2908,7 +2878,7 @@ Time O(N), Space O(N)
|
|
|
2908
2878
|
protected _isPredicate(elementNodeOrPredicate): elementNodeOrPredicate is (node: SinglyLinkedListNode<E>) => boolean;
|
|
2909
2879
|
```
|
|
2910
2880
|
|
|
2911
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2881
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:926](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L926)
|
|
2912
2882
|
|
|
2913
2883
|
(Protected) Check if input is a node predicate function.
|
|
2914
2884
|
|
|
@@ -2940,7 +2910,7 @@ Time O(1), Space O(1)
|
|
|
2940
2910
|
protected _spawnLike<EM, RM>(options?): SinglyLinkedList<EM, RM>;
|
|
2941
2911
|
```
|
|
2942
2912
|
|
|
2943
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2913
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:1049](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L1049)
|
|
2944
2914
|
|
|
2945
2915
|
(Protected) Spawn an empty like-kind list instance.
|
|
2946
2916
|
|
|
@@ -2980,7 +2950,7 @@ Time O(1), Space O(1)
|
|
|
2980
2950
|
protected createNode(value): SinglyLinkedListNode<E>;
|
|
2981
2951
|
```
|
|
2982
2952
|
|
|
2983
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2953
|
+
Defined in: [data-structures/linked-list/singly-linked-list.ts:916](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/linked-list/singly-linked-list.ts#L916)
|
|
2984
2954
|
|
|
2985
2955
|
(Protected) Create a node from a value.
|
|
2986
2956
|
|