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: LinkedListQueue\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
9
|
+
Defined in: [data-structures/queue/queue.ts:624](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L624)
|
|
10
10
|
|
|
11
11
|
Queue implemented over a singly linked list; preserves head/tail operations with linear scans for queries.
|
|
12
12
|
|
|
@@ -42,7 +42,7 @@ examples will be generated by unit test
|
|
|
42
42
|
new LinkedListQueue<E, R>(elements?, options?): LinkedListQueue<E, R>;
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
45
|
+
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)
|
|
46
46
|
|
|
47
47
|
Create a SinglyLinkedList and optionally bulk-insert elements.
|
|
48
48
|
|
|
@@ -86,7 +86,7 @@ Time O(N), Space O(N)
|
|
|
86
86
|
get first(): E | undefined;
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
89
|
+
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)
|
|
90
90
|
|
|
91
91
|
Get the first element value.
|
|
92
92
|
|
|
@@ -114,7 +114,7 @@ First element or undefined.
|
|
|
114
114
|
get head(): SinglyLinkedListNode<E> | undefined;
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
117
|
+
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)
|
|
118
118
|
|
|
119
119
|
Get the head node.
|
|
120
120
|
|
|
@@ -142,7 +142,7 @@ Head node or undefined.
|
|
|
142
142
|
get last(): E | undefined;
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
145
|
+
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)
|
|
146
146
|
|
|
147
147
|
Get the last element value.
|
|
148
148
|
|
|
@@ -170,7 +170,7 @@ Last element or undefined.
|
|
|
170
170
|
get length(): number;
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
173
|
+
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)
|
|
174
174
|
|
|
175
175
|
Get the number of elements.
|
|
176
176
|
|
|
@@ -226,7 +226,7 @@ Maximum allowed length.
|
|
|
226
226
|
get tail(): SinglyLinkedListNode<E> | undefined;
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
229
|
+
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)
|
|
230
230
|
|
|
231
231
|
Get the tail node.
|
|
232
232
|
|
|
@@ -314,7 +314,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
314
314
|
addAfter(existingElementOrNode, newElementOrNode): boolean;
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
317
|
+
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)
|
|
318
318
|
|
|
319
319
|
Insert a new element/node after an existing one.
|
|
320
320
|
|
|
@@ -354,7 +354,7 @@ Time O(N), Space O(1)
|
|
|
354
354
|
addAt(index, newElementOrNode): boolean;
|
|
355
355
|
```
|
|
356
356
|
|
|
357
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
357
|
+
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)
|
|
358
358
|
|
|
359
359
|
Insert a new element/node at an index, shifting following nodes.
|
|
360
360
|
|
|
@@ -378,8 +378,6 @@ Element or node to insert.
|
|
|
378
378
|
|
|
379
379
|
True if inserted.
|
|
380
380
|
|
|
381
|
-
*
|
|
382
|
-
|
|
383
381
|
#### Remarks
|
|
384
382
|
|
|
385
383
|
Time O(N), Space O(1)
|
|
@@ -405,7 +403,7 @@ Time O(N), Space O(1)
|
|
|
405
403
|
addBefore(existingElementOrNode, newElementOrNode): boolean;
|
|
406
404
|
```
|
|
407
405
|
|
|
408
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
406
|
+
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)
|
|
409
407
|
|
|
410
408
|
Insert a new element/node before an existing one.
|
|
411
409
|
|
|
@@ -445,7 +443,7 @@ Time O(N), Space O(1)
|
|
|
445
443
|
at(index): E | undefined;
|
|
446
444
|
```
|
|
447
445
|
|
|
448
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
446
|
+
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)
|
|
449
447
|
|
|
450
448
|
Get the element at a given index.
|
|
451
449
|
|
|
@@ -463,8 +461,6 @@ Zero-based index.
|
|
|
463
461
|
|
|
464
462
|
Element or undefined.
|
|
465
463
|
|
|
466
|
-
*
|
|
467
|
-
|
|
468
464
|
#### Remarks
|
|
469
465
|
|
|
470
466
|
Time O(N), Space O(1)
|
|
@@ -491,7 +487,7 @@ Time O(N), Space O(1)
|
|
|
491
487
|
clear(): void;
|
|
492
488
|
```
|
|
493
489
|
|
|
494
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
490
|
+
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)
|
|
495
491
|
|
|
496
492
|
Remove all nodes and reset length.
|
|
497
493
|
|
|
@@ -501,8 +497,6 @@ Remove all nodes and reset length.
|
|
|
501
497
|
|
|
502
498
|
void
|
|
503
499
|
|
|
504
|
-
*
|
|
505
|
-
|
|
506
500
|
#### Remarks
|
|
507
501
|
|
|
508
502
|
Time O(N), Space O(1)
|
|
@@ -528,7 +522,7 @@ Time O(N), Space O(1)
|
|
|
528
522
|
clone(): this;
|
|
529
523
|
```
|
|
530
524
|
|
|
531
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
525
|
+
Defined in: [data-structures/queue/queue.ts:630](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L630)
|
|
532
526
|
|
|
533
527
|
Deep clone this linked-list-based queue.
|
|
534
528
|
|
|
@@ -554,7 +548,7 @@ Time O(N), Space O(N)
|
|
|
554
548
|
concat(...items): this;
|
|
555
549
|
```
|
|
556
550
|
|
|
557
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
551
|
+
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)
|
|
558
552
|
|
|
559
553
|
Concatenate lists/elements preserving order.
|
|
560
554
|
|
|
@@ -590,7 +584,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
590
584
|
countOccurrences(elementOrNode): number;
|
|
591
585
|
```
|
|
592
586
|
|
|
593
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
587
|
+
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)
|
|
594
588
|
|
|
595
589
|
Count how many nodes match a value/node/predicate.
|
|
596
590
|
|
|
@@ -626,7 +620,7 @@ Time O(N), Space O(1)
|
|
|
626
620
|
delete(elementOrNode?): boolean;
|
|
627
621
|
```
|
|
628
622
|
|
|
629
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
623
|
+
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)
|
|
630
624
|
|
|
631
625
|
Delete the first match by value/node.
|
|
632
626
|
|
|
@@ -644,8 +638,6 @@ Element or node to remove; if omitted/undefined, nothing happens.
|
|
|
644
638
|
|
|
645
639
|
True if removed.
|
|
646
640
|
|
|
647
|
-
*
|
|
648
|
-
|
|
649
641
|
#### Remarks
|
|
650
642
|
|
|
651
643
|
Time O(N), Space O(1)
|
|
@@ -671,7 +663,7 @@ Time O(N), Space O(1)
|
|
|
671
663
|
deleteAt(index): E | undefined;
|
|
672
664
|
```
|
|
673
665
|
|
|
674
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
666
|
+
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)
|
|
675
667
|
|
|
676
668
|
Delete the element at an index.
|
|
677
669
|
|
|
@@ -689,8 +681,6 @@ Zero-based index.
|
|
|
689
681
|
|
|
690
682
|
Removed element or undefined.
|
|
691
683
|
|
|
692
|
-
*
|
|
693
|
-
|
|
694
684
|
#### Remarks
|
|
695
685
|
|
|
696
686
|
Time O(N), Space O(1)
|
|
@@ -716,7 +706,7 @@ Time O(N), Space O(1)
|
|
|
716
706
|
deleteWhere(predicate): boolean;
|
|
717
707
|
```
|
|
718
708
|
|
|
719
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
709
|
+
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)
|
|
720
710
|
|
|
721
711
|
Delete the first node whose value matches a predicate.
|
|
722
712
|
|
|
@@ -750,7 +740,7 @@ Time O(N), Space O(1)
|
|
|
750
740
|
entries(): IterableIterator<[number, E]>;
|
|
751
741
|
```
|
|
752
742
|
|
|
753
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
743
|
+
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)
|
|
754
744
|
|
|
755
745
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
756
746
|
|
|
@@ -817,7 +807,7 @@ fill(
|
|
|
817
807
|
end?): this;
|
|
818
808
|
```
|
|
819
809
|
|
|
820
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
810
|
+
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)
|
|
821
811
|
|
|
822
812
|
Fill a range with a value.
|
|
823
813
|
|
|
@@ -863,7 +853,7 @@ Time O(n), Space O(1)
|
|
|
863
853
|
filter(callback, thisArg?): this;
|
|
864
854
|
```
|
|
865
855
|
|
|
866
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
856
|
+
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)
|
|
867
857
|
|
|
868
858
|
Filter values into a new list of the same class.
|
|
869
859
|
|
|
@@ -887,8 +877,6 @@ Value for `this` inside the callback.
|
|
|
887
877
|
|
|
888
878
|
A new list with kept values.
|
|
889
879
|
|
|
890
|
-
*
|
|
891
|
-
|
|
892
880
|
#### Remarks
|
|
893
881
|
|
|
894
882
|
Time O(N), Space O(N)
|
|
@@ -1014,7 +1002,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1014
1002
|
findIndex(predicate, thisArg?): number;
|
|
1015
1003
|
```
|
|
1016
1004
|
|
|
1017
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1005
|
+
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)
|
|
1018
1006
|
|
|
1019
1007
|
Find the first index matching a predicate.
|
|
1020
1008
|
|
|
@@ -1094,7 +1082,7 @@ Time O(n), Space O(1).
|
|
|
1094
1082
|
getNode(elementNodeOrPredicate?): SinglyLinkedListNode<E> | undefined;
|
|
1095
1083
|
```
|
|
1096
1084
|
|
|
1097
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1085
|
+
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)
|
|
1098
1086
|
|
|
1099
1087
|
Find a node by value, reference, or predicate.
|
|
1100
1088
|
|
|
@@ -1130,7 +1118,7 @@ Time O(N), Space O(1)
|
|
|
1130
1118
|
getNodeAt(index): SinglyLinkedListNode<E> | undefined;
|
|
1131
1119
|
```
|
|
1132
1120
|
|
|
1133
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1121
|
+
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)
|
|
1134
1122
|
|
|
1135
1123
|
Get the node reference at a given index.
|
|
1136
1124
|
|
|
@@ -1148,8 +1136,6 @@ Zero-based index.
|
|
|
1148
1136
|
|
|
1149
1137
|
Node or undefined.
|
|
1150
1138
|
|
|
1151
|
-
*
|
|
1152
|
-
|
|
1153
1139
|
#### Remarks
|
|
1154
1140
|
|
|
1155
1141
|
Time O(N), Space O(1)
|
|
@@ -1174,7 +1160,7 @@ Time O(N), Space O(1)
|
|
|
1174
1160
|
has(element): boolean;
|
|
1175
1161
|
```
|
|
1176
1162
|
|
|
1177
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1163
|
+
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)
|
|
1178
1164
|
|
|
1179
1165
|
Checks whether a strictly-equal element exists in the structure.
|
|
1180
1166
|
|
|
@@ -1208,7 +1194,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1208
1194
|
includes(element): boolean;
|
|
1209
1195
|
```
|
|
1210
1196
|
|
|
1211
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1197
|
+
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)
|
|
1212
1198
|
|
|
1213
1199
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
1214
1200
|
|
|
@@ -1242,7 +1228,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
|
1242
1228
|
indexOf(searchElement, fromIndex?): number;
|
|
1243
1229
|
```
|
|
1244
1230
|
|
|
1245
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1231
|
+
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)
|
|
1246
1232
|
|
|
1247
1233
|
Linked-list optimized `indexOf` (forwards scan).
|
|
1248
1234
|
|
|
@@ -1282,7 +1268,7 @@ Time O(n), Space O(1)
|
|
|
1282
1268
|
isEmpty(): boolean;
|
|
1283
1269
|
```
|
|
1284
1270
|
|
|
1285
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1271
|
+
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)
|
|
1286
1272
|
|
|
1287
1273
|
Check whether the list is empty.
|
|
1288
1274
|
|
|
@@ -1292,8 +1278,6 @@ Check whether the list is empty.
|
|
|
1292
1278
|
|
|
1293
1279
|
True if length is 0.
|
|
1294
1280
|
|
|
1295
|
-
*
|
|
1296
|
-
|
|
1297
1281
|
#### Remarks
|
|
1298
1282
|
|
|
1299
1283
|
Time O(1), Space O(1)
|
|
@@ -1317,7 +1301,7 @@ Time O(1), Space O(1)
|
|
|
1317
1301
|
isNode(elementNodeOrPredicate): elementNodeOrPredicate is SinglyLinkedListNode<E>;
|
|
1318
1302
|
```
|
|
1319
1303
|
|
|
1320
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1304
|
+
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)
|
|
1321
1305
|
|
|
1322
1306
|
Type guard: check whether the input is a SinglyLinkedListNode.
|
|
1323
1307
|
|
|
@@ -1353,7 +1337,7 @@ Time O(1), Space O(1)
|
|
|
1353
1337
|
join(separator?): string;
|
|
1354
1338
|
```
|
|
1355
1339
|
|
|
1356
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1340
|
+
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)
|
|
1357
1341
|
|
|
1358
1342
|
Join all elements into a string.
|
|
1359
1343
|
|
|
@@ -1387,7 +1371,7 @@ Time O(n), Space O(n)
|
|
|
1387
1371
|
keys(): IterableIterator<number>;
|
|
1388
1372
|
```
|
|
1389
1373
|
|
|
1390
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1374
|
+
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)
|
|
1391
1375
|
|
|
1392
1376
|
Return an iterator of numeric indices (Array-compatible).
|
|
1393
1377
|
|
|
@@ -1411,7 +1395,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per st
|
|
|
1411
1395
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1412
1396
|
```
|
|
1413
1397
|
|
|
1414
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1398
|
+
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)
|
|
1415
1399
|
|
|
1416
1400
|
Linked-list optimized `lastIndexOf` (reverse scan).
|
|
1417
1401
|
|
|
@@ -1454,7 +1438,7 @@ map<EM, RM>(
|
|
|
1454
1438
|
thisArg?): SinglyLinkedList<EM, RM>;
|
|
1455
1439
|
```
|
|
1456
1440
|
|
|
1457
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1441
|
+
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)
|
|
1458
1442
|
|
|
1459
1443
|
Map values into a new list (possibly different element type).
|
|
1460
1444
|
|
|
@@ -1494,8 +1478,6 @@ Value for `this` inside the callback.
|
|
|
1494
1478
|
|
|
1495
1479
|
A new SinglyLinkedList with mapped values.
|
|
1496
1480
|
|
|
1497
|
-
*
|
|
1498
|
-
|
|
1499
1481
|
#### Remarks
|
|
1500
1482
|
|
|
1501
1483
|
Time O(N), Space O(N)
|
|
@@ -1521,7 +1503,7 @@ Time O(N), Space O(N)
|
|
|
1521
1503
|
mapSame(callback, thisArg?): this;
|
|
1522
1504
|
```
|
|
1523
1505
|
|
|
1524
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1506
|
+
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)
|
|
1525
1507
|
|
|
1526
1508
|
Map values into a new list of the same class.
|
|
1527
1509
|
|
|
@@ -1561,7 +1543,7 @@ Time O(N), Space O(N)
|
|
|
1561
1543
|
pop(): E | undefined;
|
|
1562
1544
|
```
|
|
1563
1545
|
|
|
1564
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1546
|
+
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)
|
|
1565
1547
|
|
|
1566
1548
|
Remove and return the tail element.
|
|
1567
1549
|
|
|
@@ -1571,8 +1553,6 @@ Remove and return the tail element.
|
|
|
1571
1553
|
|
|
1572
1554
|
Removed element or undefined.
|
|
1573
1555
|
|
|
1574
|
-
*
|
|
1575
|
-
|
|
1576
1556
|
#### Remarks
|
|
1577
1557
|
|
|
1578
1558
|
Time O(N), Space O(1)
|
|
@@ -1608,7 +1588,7 @@ Time O(N), Space O(1)
|
|
|
1608
1588
|
print(): void;
|
|
1609
1589
|
```
|
|
1610
1590
|
|
|
1611
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1591
|
+
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)
|
|
1612
1592
|
|
|
1613
1593
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1614
1594
|
|
|
@@ -1634,7 +1614,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1634
1614
|
push(elementOrNode): boolean;
|
|
1635
1615
|
```
|
|
1636
1616
|
|
|
1637
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1617
|
+
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)
|
|
1638
1618
|
|
|
1639
1619
|
Append an element/node to the tail.
|
|
1640
1620
|
|
|
@@ -1652,8 +1632,6 @@ Element or node to append.
|
|
|
1652
1632
|
|
|
1653
1633
|
True when appended.
|
|
1654
1634
|
|
|
1655
|
-
*
|
|
1656
|
-
|
|
1657
1635
|
#### Remarks
|
|
1658
1636
|
|
|
1659
1637
|
Time O(1), Space O(1)
|
|
@@ -1689,7 +1667,7 @@ Time O(1), Space O(1)
|
|
|
1689
1667
|
pushMany(elements): boolean[];
|
|
1690
1668
|
```
|
|
1691
1669
|
|
|
1692
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1670
|
+
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)
|
|
1693
1671
|
|
|
1694
1672
|
Append a sequence of elements/nodes.
|
|
1695
1673
|
|
|
@@ -1757,7 +1735,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1757
1735
|
reduce(callbackfn): E;
|
|
1758
1736
|
```
|
|
1759
1737
|
|
|
1760
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1738
|
+
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)
|
|
1761
1739
|
|
|
1762
1740
|
##### Parameters
|
|
1763
1741
|
|
|
@@ -1779,7 +1757,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1779
1757
|
reduce(callbackfn, initialValue): E;
|
|
1780
1758
|
```
|
|
1781
1759
|
|
|
1782
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1760
|
+
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)
|
|
1783
1761
|
|
|
1784
1762
|
##### Parameters
|
|
1785
1763
|
|
|
@@ -1805,7 +1783,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1805
1783
|
reduce<U>(callbackfn, initialValue): U;
|
|
1806
1784
|
```
|
|
1807
1785
|
|
|
1808
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1786
|
+
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)
|
|
1809
1787
|
|
|
1810
1788
|
##### Type Parameters
|
|
1811
1789
|
|
|
@@ -1839,7 +1817,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
1839
1817
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1840
1818
|
```
|
|
1841
1819
|
|
|
1842
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1820
|
+
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)
|
|
1843
1821
|
|
|
1844
1822
|
Right-to-left reduction using reverse iterator.
|
|
1845
1823
|
|
|
@@ -1885,7 +1863,7 @@ Time O(n), Space O(1)
|
|
|
1885
1863
|
reverse(): this;
|
|
1886
1864
|
```
|
|
1887
1865
|
|
|
1888
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1866
|
+
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)
|
|
1889
1867
|
|
|
1890
1868
|
Reverse the list in place.
|
|
1891
1869
|
|
|
@@ -1895,8 +1873,6 @@ Reverse the list in place.
|
|
|
1895
1873
|
|
|
1896
1874
|
This list.
|
|
1897
1875
|
|
|
1898
|
-
*
|
|
1899
|
-
|
|
1900
1876
|
#### Remarks
|
|
1901
1877
|
|
|
1902
1878
|
Time O(N), Space O(1)
|
|
@@ -1922,7 +1898,7 @@ Time O(N), Space O(1)
|
|
|
1922
1898
|
search(elementNodeOrPredicate): E | undefined;
|
|
1923
1899
|
```
|
|
1924
1900
|
|
|
1925
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1901
|
+
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)
|
|
1926
1902
|
|
|
1927
1903
|
Find the first value matching a predicate (by node).
|
|
1928
1904
|
|
|
@@ -1958,7 +1934,7 @@ Time O(N), Space O(1)
|
|
|
1958
1934
|
setAt(index, value): boolean;
|
|
1959
1935
|
```
|
|
1960
1936
|
|
|
1961
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1937
|
+
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)
|
|
1962
1938
|
|
|
1963
1939
|
Set the element value at an index.
|
|
1964
1940
|
|
|
@@ -1998,7 +1974,7 @@ Time O(N), Space O(1)
|
|
|
1998
1974
|
setEquality(equals): this;
|
|
1999
1975
|
```
|
|
2000
1976
|
|
|
2001
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
1977
|
+
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)
|
|
2002
1978
|
|
|
2003
1979
|
Set the equality comparator used to compare values.
|
|
2004
1980
|
|
|
@@ -2032,7 +2008,7 @@ Time O(1), Space O(1)
|
|
|
2032
2008
|
shift(): E | undefined;
|
|
2033
2009
|
```
|
|
2034
2010
|
|
|
2035
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2011
|
+
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)
|
|
2036
2012
|
|
|
2037
2013
|
Remove and return the head element.
|
|
2038
2014
|
|
|
@@ -2042,8 +2018,6 @@ Remove and return the head element.
|
|
|
2042
2018
|
|
|
2043
2019
|
Removed element or undefined.
|
|
2044
2020
|
|
|
2045
|
-
*
|
|
2046
|
-
|
|
2047
2021
|
#### Remarks
|
|
2048
2022
|
|
|
2049
2023
|
Time O(1), Space O(1)
|
|
@@ -2069,7 +2043,7 @@ Time O(1), Space O(1)
|
|
|
2069
2043
|
slice(start?, end?): this;
|
|
2070
2044
|
```
|
|
2071
2045
|
|
|
2072
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2046
|
+
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)
|
|
2073
2047
|
|
|
2074
2048
|
Slice via forward iteration (no random access required).
|
|
2075
2049
|
|
|
@@ -2149,7 +2123,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2149
2123
|
sort(compareFn?): this;
|
|
2150
2124
|
```
|
|
2151
2125
|
|
|
2152
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2126
|
+
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)
|
|
2153
2127
|
|
|
2154
2128
|
In-place stable order via array sort semantics.
|
|
2155
2129
|
|
|
@@ -2186,7 +2160,7 @@ splice(
|
|
|
2186
2160
|
items?): this;
|
|
2187
2161
|
```
|
|
2188
2162
|
|
|
2189
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2163
|
+
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)
|
|
2190
2164
|
|
|
2191
2165
|
Remove and/or insert elements at a position (array-like behavior).
|
|
2192
2166
|
|
|
@@ -2232,7 +2206,7 @@ Time O(N + M), Space O(M)
|
|
|
2232
2206
|
toArray(): E[];
|
|
2233
2207
|
```
|
|
2234
2208
|
|
|
2235
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2209
|
+
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)
|
|
2236
2210
|
|
|
2237
2211
|
Materializes the elements into a new array.
|
|
2238
2212
|
|
|
@@ -2258,7 +2232,7 @@ Time O(n), Space O(n).
|
|
|
2258
2232
|
toReversed(): this;
|
|
2259
2233
|
```
|
|
2260
2234
|
|
|
2261
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2235
|
+
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)
|
|
2262
2236
|
|
|
2263
2237
|
Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
2264
2238
|
|
|
@@ -2284,7 +2258,7 @@ Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O
|
|
|
2284
2258
|
toReversedArray(): E[];
|
|
2285
2259
|
```
|
|
2286
2260
|
|
|
2287
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2261
|
+
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)
|
|
2288
2262
|
|
|
2289
2263
|
Snapshot elements into a reversed array.
|
|
2290
2264
|
|
|
@@ -2310,7 +2284,7 @@ Time O(n), Space O(n)
|
|
|
2310
2284
|
toVisual(): E[];
|
|
2311
2285
|
```
|
|
2312
2286
|
|
|
2313
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2287
|
+
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)
|
|
2314
2288
|
|
|
2315
2289
|
Returns a representation of the structure suitable for quick visualization.
|
|
2316
2290
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2337,7 +2311,7 @@ Time O(n), Space O(n).
|
|
|
2337
2311
|
unshift(elementOrNode): boolean;
|
|
2338
2312
|
```
|
|
2339
2313
|
|
|
2340
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2314
|
+
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)
|
|
2341
2315
|
|
|
2342
2316
|
Prepend an element/node to the head.
|
|
2343
2317
|
|
|
@@ -2355,8 +2329,6 @@ Element or node to prepend.
|
|
|
2355
2329
|
|
|
2356
2330
|
True when prepended.
|
|
2357
2331
|
|
|
2358
|
-
*
|
|
2359
|
-
|
|
2360
2332
|
#### Remarks
|
|
2361
2333
|
|
|
2362
2334
|
Time O(1), Space O(1)
|
|
@@ -2397,7 +2369,7 @@ Time O(1), Space O(1)
|
|
|
2397
2369
|
unshiftMany(elements): boolean[];
|
|
2398
2370
|
```
|
|
2399
2371
|
|
|
2400
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2372
|
+
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)
|
|
2401
2373
|
|
|
2402
2374
|
Prepend a sequence of elements/nodes.
|
|
2403
2375
|
|
|
@@ -2462,7 +2434,7 @@ static from<E, R, S>(
|
|
|
2462
2434
|
options?): S;
|
|
2463
2435
|
```
|
|
2464
2436
|
|
|
2465
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2437
|
+
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)
|
|
2466
2438
|
|
|
2467
2439
|
Create a new list from an iterable of elements.
|
|
2468
2440
|
|
|
@@ -2555,7 +2527,7 @@ Time O(1), Space O(1).
|
|
|
2555
2527
|
protected _createInstance(options?): this;
|
|
2556
2528
|
```
|
|
2557
2529
|
|
|
2558
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2530
|
+
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)
|
|
2559
2531
|
|
|
2560
2532
|
(Protected) Create an empty instance of the same concrete class.
|
|
2561
2533
|
|
|
@@ -2589,7 +2561,7 @@ Time O(1), Space O(1)
|
|
|
2589
2561
|
protected _createLike<EM, RM>(elements?, options?): SinglyLinkedList<EM, RM>;
|
|
2590
2562
|
```
|
|
2591
2563
|
|
|
2592
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2564
|
+
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)
|
|
2593
2565
|
|
|
2594
2566
|
(Protected) Create a like-kind instance and seed it from an iterable.
|
|
2595
2567
|
|
|
@@ -2641,7 +2613,7 @@ Time O(N), Space O(N)
|
|
|
2641
2613
|
protected _ensureNode(elementOrNode): SinglyLinkedListNode<E>;
|
|
2642
2614
|
```
|
|
2643
2615
|
|
|
2644
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2616
|
+
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)
|
|
2645
2617
|
|
|
2646
2618
|
(Protected) Normalize input into a node instance.
|
|
2647
2619
|
|
|
@@ -2675,7 +2647,7 @@ Time O(1), Space O(1)
|
|
|
2675
2647
|
protected _ensurePredicate(elementNodeOrPredicate): (node) => boolean;
|
|
2676
2648
|
```
|
|
2677
2649
|
|
|
2678
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2650
|
+
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)
|
|
2679
2651
|
|
|
2680
2652
|
(Protected) Normalize input into a node predicate.
|
|
2681
2653
|
|
|
@@ -2711,7 +2683,7 @@ Time O(1), Space O(1)
|
|
|
2711
2683
|
protected _getIterator(): IterableIterator<E>;
|
|
2712
2684
|
```
|
|
2713
2685
|
|
|
2714
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2686
|
+
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)
|
|
2715
2687
|
|
|
2716
2688
|
(Protected) Iterate values from head to tail.
|
|
2717
2689
|
|
|
@@ -2737,7 +2709,7 @@ Time O(N), Space O(1)
|
|
|
2737
2709
|
protected _getNodeIterator(): IterableIterator<SinglyLinkedListNode<E>>;
|
|
2738
2710
|
```
|
|
2739
2711
|
|
|
2740
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2712
|
+
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)
|
|
2741
2713
|
|
|
2742
2714
|
(Protected) Iterate nodes from head to tail.
|
|
2743
2715
|
|
|
@@ -2763,7 +2735,7 @@ Time O(N), Space O(1)
|
|
|
2763
2735
|
protected _getPrevNode(node): SinglyLinkedListNode<E> | undefined;
|
|
2764
2736
|
```
|
|
2765
2737
|
|
|
2766
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2738
|
+
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)
|
|
2767
2739
|
|
|
2768
2740
|
(Protected) Get the previous node of a given node.
|
|
2769
2741
|
|
|
@@ -2797,7 +2769,7 @@ Time O(N), Space O(1)
|
|
|
2797
2769
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2798
2770
|
```
|
|
2799
2771
|
|
|
2800
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2772
|
+
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)
|
|
2801
2773
|
|
|
2802
2774
|
(Protected) Iterate values from tail to head.
|
|
2803
2775
|
|
|
@@ -2823,7 +2795,7 @@ Time O(N), Space O(N)
|
|
|
2823
2795
|
protected _isPredicate(elementNodeOrPredicate): elementNodeOrPredicate is (node: SinglyLinkedListNode<E>) => boolean;
|
|
2824
2796
|
```
|
|
2825
2797
|
|
|
2826
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2798
|
+
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)
|
|
2827
2799
|
|
|
2828
2800
|
(Protected) Check if input is a node predicate function.
|
|
2829
2801
|
|
|
@@ -2859,7 +2831,7 @@ Time O(1), Space O(1)
|
|
|
2859
2831
|
protected _spawnLike<EM, RM>(options?): SinglyLinkedList<EM, RM>;
|
|
2860
2832
|
```
|
|
2861
2833
|
|
|
2862
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2834
|
+
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)
|
|
2863
2835
|
|
|
2864
2836
|
(Protected) Spawn an empty like-kind list instance.
|
|
2865
2837
|
|
|
@@ -2903,7 +2875,7 @@ Time O(1), Space O(1)
|
|
|
2903
2875
|
protected createNode(value): SinglyLinkedListNode<E>;
|
|
2904
2876
|
```
|
|
2905
2877
|
|
|
2906
|
-
Defined in: [data-structures/linked-list/singly-linked-list.ts:
|
|
2878
|
+
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)
|
|
2907
2879
|
|
|
2908
2880
|
(Protected) Create a node from a value.
|
|
2909
2881
|
|