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: Deque\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
9
|
+
Defined in: [data-structures/queue/deque.ts:84](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L84)
|
|
10
10
|
|
|
11
11
|
Deque implemented with circular buckets allowing O(1) amortized push/pop at both ends.
|
|
12
12
|
|
|
@@ -103,7 +103,7 @@ Time O(1), Space O(1)
|
|
|
103
103
|
new Deque<E, R>(elements?, options?): Deque<E, R>;
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
106
|
+
Defined in: [data-structures/queue/deque.ts:98](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L98)
|
|
107
107
|
|
|
108
108
|
Create a Deque and optionally bulk-insert elements.
|
|
109
109
|
|
|
@@ -145,7 +145,7 @@ Time O(N), Space O(N)
|
|
|
145
145
|
get autoCompactRatio(): number;
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
148
|
+
Defined in: [data-structures/queue/deque.ts:148](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L148)
|
|
149
149
|
|
|
150
150
|
Get the auto-compaction ratio.
|
|
151
151
|
When `elements / (bucketCount * bucketSize)` drops below this ratio after
|
|
@@ -167,7 +167,7 @@ Current ratio threshold. 0 means auto-compact is disabled.
|
|
|
167
167
|
set autoCompactRatio(value): void;
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
170
|
+
Defined in: [data-structures/queue/deque.ts:157](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L157)
|
|
171
171
|
|
|
172
172
|
Set the auto-compaction ratio.
|
|
173
173
|
|
|
@@ -197,7 +197,7 @@ Ratio in [0,1]. 0 disables auto-compact.
|
|
|
197
197
|
get bucketCount(): number;
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
200
|
+
Defined in: [data-structures/queue/deque.ts:212](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L212)
|
|
201
201
|
|
|
202
202
|
Get the number of buckets allocated.
|
|
203
203
|
|
|
@@ -221,7 +221,7 @@ Bucket count.
|
|
|
221
221
|
get bucketFirst(): number;
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
224
|
+
Defined in: [data-structures/queue/deque.ts:168](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L168)
|
|
225
225
|
|
|
226
226
|
Get the index of the first bucket in use.
|
|
227
227
|
|
|
@@ -245,7 +245,7 @@ Zero-based bucket index.
|
|
|
245
245
|
get bucketLast(): number;
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
248
|
+
Defined in: [data-structures/queue/deque.ts:190](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L190)
|
|
249
249
|
|
|
250
250
|
Get the index of the last bucket in use.
|
|
251
251
|
|
|
@@ -269,7 +269,7 @@ Zero-based bucket index.
|
|
|
269
269
|
get buckets(): E[][];
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
272
|
+
Defined in: [data-structures/queue/deque.ts:223](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L223)
|
|
273
273
|
|
|
274
274
|
Get the internal buckets array.
|
|
275
275
|
|
|
@@ -293,7 +293,7 @@ Array of buckets storing values.
|
|
|
293
293
|
get bucketSize(): number;
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
296
|
+
Defined in: [data-structures/queue/deque.ts:135](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L135)
|
|
297
297
|
|
|
298
298
|
Get the current bucket size.
|
|
299
299
|
|
|
@@ -317,12 +317,10 @@ Bucket capacity per bucket.
|
|
|
317
317
|
get first(): E | undefined;
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
320
|
+
Defined in: [data-structures/queue/deque.ts:255](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L255)
|
|
321
321
|
|
|
322
322
|
Deque peek at both ends
|
|
323
323
|
|
|
324
|
-
*
|
|
325
|
-
|
|
326
324
|
##### Example
|
|
327
325
|
|
|
328
326
|
```ts
|
|
@@ -355,7 +353,7 @@ Deque peek at both ends
|
|
|
355
353
|
get firstInBucket(): number;
|
|
356
354
|
```
|
|
357
355
|
|
|
358
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
356
|
+
Defined in: [data-structures/queue/deque.ts:179](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L179)
|
|
359
357
|
|
|
360
358
|
Get the index inside the first bucket.
|
|
361
359
|
|
|
@@ -379,7 +377,7 @@ Zero-based index within the first bucket.
|
|
|
379
377
|
get last(): E | undefined;
|
|
380
378
|
```
|
|
381
379
|
|
|
382
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
380
|
+
Defined in: [data-structures/queue/deque.ts:270](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L270)
|
|
383
381
|
|
|
384
382
|
Get the last element without removing it.
|
|
385
383
|
|
|
@@ -402,8 +400,6 @@ Time O(1), Space O(1)
|
|
|
402
400
|
|
|
403
401
|
Last element or undefined.
|
|
404
402
|
|
|
405
|
-
*
|
|
406
|
-
|
|
407
403
|
***
|
|
408
404
|
|
|
409
405
|
### lastInBucket
|
|
@@ -414,7 +410,7 @@ Last element or undefined.
|
|
|
414
410
|
get lastInBucket(): number;
|
|
415
411
|
```
|
|
416
412
|
|
|
417
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
413
|
+
Defined in: [data-structures/queue/deque.ts:201](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L201)
|
|
418
414
|
|
|
419
415
|
Get the index inside the last bucket.
|
|
420
416
|
|
|
@@ -438,7 +434,7 @@ Zero-based index within the last bucket.
|
|
|
438
434
|
get length(): number;
|
|
439
435
|
```
|
|
440
436
|
|
|
441
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
437
|
+
Defined in: [data-structures/queue/deque.ts:234](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L234)
|
|
442
438
|
|
|
443
439
|
Get the number of elements in the deque.
|
|
444
440
|
|
|
@@ -557,7 +553,7 @@ addAt(
|
|
|
557
553
|
num?): boolean;
|
|
558
554
|
```
|
|
559
555
|
|
|
560
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
556
|
+
Defined in: [data-structures/queue/deque.ts:570](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L570)
|
|
561
557
|
|
|
562
558
|
Insert repeated copies of an element at a position.
|
|
563
559
|
|
|
@@ -603,7 +599,7 @@ Time O(N), Space O(1)
|
|
|
603
599
|
at(pos): E | undefined;
|
|
604
600
|
```
|
|
605
601
|
|
|
606
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
602
|
+
Defined in: [data-structures/queue/deque.ts:542](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L542)
|
|
607
603
|
|
|
608
604
|
Get the element at a given position.
|
|
609
605
|
|
|
@@ -621,8 +617,6 @@ Zero-based position from the front.
|
|
|
621
617
|
|
|
622
618
|
Element or undefined.
|
|
623
619
|
|
|
624
|
-
*
|
|
625
|
-
|
|
626
620
|
#### Remarks
|
|
627
621
|
|
|
628
622
|
Time O(1), Space O(1)
|
|
@@ -648,7 +642,7 @@ Time O(1), Space O(1)
|
|
|
648
642
|
clear(): void;
|
|
649
643
|
```
|
|
650
644
|
|
|
651
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
645
|
+
Defined in: [data-structures/queue/deque.ts:524](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L524)
|
|
652
646
|
|
|
653
647
|
Remove all elements and reset structure.
|
|
654
648
|
|
|
@@ -658,8 +652,6 @@ Remove all elements and reset structure.
|
|
|
658
652
|
|
|
659
653
|
void
|
|
660
654
|
|
|
661
|
-
*
|
|
662
|
-
|
|
663
655
|
#### Remarks
|
|
664
656
|
|
|
665
657
|
Time O(1), Space O(1)
|
|
@@ -685,7 +677,7 @@ Time O(1), Space O(1)
|
|
|
685
677
|
clone(): this;
|
|
686
678
|
```
|
|
687
679
|
|
|
688
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
680
|
+
Defined in: [data-structures/queue/deque.ts:934](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L934)
|
|
689
681
|
|
|
690
682
|
Deep clone this deque, preserving options.
|
|
691
683
|
|
|
@@ -695,8 +687,6 @@ Deep clone this deque, preserving options.
|
|
|
695
687
|
|
|
696
688
|
A new deque with the same content and options.
|
|
697
689
|
|
|
698
|
-
*
|
|
699
|
-
|
|
700
690
|
#### Remarks
|
|
701
691
|
|
|
702
692
|
Time O(N), Space O(N)
|
|
@@ -724,7 +714,7 @@ Time O(N), Space O(N)
|
|
|
724
714
|
compact(): boolean;
|
|
725
715
|
```
|
|
726
716
|
|
|
727
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
717
|
+
Defined in: [data-structures/queue/deque.ts:894](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L894)
|
|
728
718
|
|
|
729
719
|
Compact the deque by removing unused buckets.
|
|
730
720
|
|
|
@@ -734,8 +724,6 @@ Compact the deque by removing unused buckets.
|
|
|
734
724
|
|
|
735
725
|
True if compaction was performed (bucket count reduced).
|
|
736
726
|
|
|
737
|
-
*
|
|
738
|
-
|
|
739
727
|
#### Remarks
|
|
740
728
|
|
|
741
729
|
Time O(N), Space O(1)
|
|
@@ -759,7 +747,7 @@ Time O(N), Space O(1)
|
|
|
759
747
|
concat(...items): this;
|
|
760
748
|
```
|
|
761
749
|
|
|
762
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
750
|
+
Defined in: [data-structures/base/linear-base.ts:161](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L161)
|
|
763
751
|
|
|
764
752
|
Concatenate elements and/or containers.
|
|
765
753
|
|
|
@@ -793,7 +781,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
793
781
|
cut(pos, isCutSelf?): Deque<E>;
|
|
794
782
|
```
|
|
795
783
|
|
|
796
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
784
|
+
Defined in: [data-structures/queue/deque.ts:597](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L597)
|
|
797
785
|
|
|
798
786
|
Cut the deque to keep items up to index; optionally mutate in-place.
|
|
799
787
|
|
|
@@ -829,7 +817,7 @@ Time O(N), Space O(1)
|
|
|
829
817
|
cutRest(pos, isCutSelf?): Deque<E>;
|
|
830
818
|
```
|
|
831
819
|
|
|
832
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
820
|
+
Defined in: [data-structures/queue/deque.ts:655](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L655)
|
|
833
821
|
|
|
834
822
|
Cut the deque to keep items from index onward; optionally mutate in-place.
|
|
835
823
|
|
|
@@ -865,7 +853,7 @@ Time O(N), Space O(1)
|
|
|
865
853
|
delete(element): boolean;
|
|
866
854
|
```
|
|
867
855
|
|
|
868
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
856
|
+
Defined in: [data-structures/queue/deque.ts:717](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L717)
|
|
869
857
|
|
|
870
858
|
Delete the first occurrence of a value.
|
|
871
859
|
|
|
@@ -883,8 +871,6 @@ Element to remove (using the configured equality).
|
|
|
883
871
|
|
|
884
872
|
True if an element was removed.
|
|
885
873
|
|
|
886
|
-
*
|
|
887
|
-
|
|
888
874
|
#### Remarks
|
|
889
875
|
|
|
890
876
|
Time O(N), Space O(1)
|
|
@@ -910,7 +896,7 @@ Time O(N), Space O(1)
|
|
|
910
896
|
deleteAt(pos): E | undefined;
|
|
911
897
|
```
|
|
912
898
|
|
|
913
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
899
|
+
Defined in: [data-structures/queue/deque.ts:683](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L683)
|
|
914
900
|
|
|
915
901
|
Delete the element at a given position.
|
|
916
902
|
|
|
@@ -944,7 +930,7 @@ Time O(N), Space O(1)
|
|
|
944
930
|
deleteWhere(predicate): boolean;
|
|
945
931
|
```
|
|
946
932
|
|
|
947
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
933
|
+
Defined in: [data-structures/queue/deque.ts:740](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L740)
|
|
948
934
|
|
|
949
935
|
Delete the first element matching a predicate.
|
|
950
936
|
|
|
@@ -974,7 +960,7 @@ Time O(N), Space O(1)
|
|
|
974
960
|
entries(): IterableIterator<[number, E]>;
|
|
975
961
|
```
|
|
976
962
|
|
|
977
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
963
|
+
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)
|
|
978
964
|
|
|
979
965
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
980
966
|
|
|
@@ -1041,7 +1027,7 @@ fill(
|
|
|
1041
1027
|
end?): this;
|
|
1042
1028
|
```
|
|
1043
1029
|
|
|
1044
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1030
|
+
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)
|
|
1045
1031
|
|
|
1046
1032
|
Fill a range with a value.
|
|
1047
1033
|
|
|
@@ -1087,7 +1073,7 @@ Time O(n), Space O(1)
|
|
|
1087
1073
|
filter(predicate, thisArg?): this;
|
|
1088
1074
|
```
|
|
1089
1075
|
|
|
1090
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1076
|
+
Defined in: [data-structures/queue/deque.ts:954](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L954)
|
|
1091
1077
|
|
|
1092
1078
|
Filter elements into a new deque of the same class.
|
|
1093
1079
|
|
|
@@ -1111,8 +1097,6 @@ Value for `this` inside the predicate.
|
|
|
1111
1097
|
|
|
1112
1098
|
A new deque with kept elements.
|
|
1113
1099
|
|
|
1114
|
-
*
|
|
1115
|
-
|
|
1116
1100
|
#### Remarks
|
|
1117
1101
|
|
|
1118
1102
|
Time O(N), Space O(N)
|
|
@@ -1228,7 +1212,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1228
1212
|
findIndex(predicate, thisArg?): number;
|
|
1229
1213
|
```
|
|
1230
1214
|
|
|
1231
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1215
|
+
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)
|
|
1232
1216
|
|
|
1233
1217
|
Find the first index matching a predicate.
|
|
1234
1218
|
|
|
@@ -1268,7 +1252,7 @@ Time O(n), Space O(1)
|
|
|
1268
1252
|
findLast(predicate): E | undefined;
|
|
1269
1253
|
```
|
|
1270
1254
|
|
|
1271
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1255
|
+
Defined in: [data-structures/queue/deque.ts:796](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L796)
|
|
1272
1256
|
|
|
1273
1257
|
Find the last value matching a predicate (scans back-to-front).
|
|
1274
1258
|
|
|
@@ -1285,7 +1269,6 @@ Function called with (value, index, deque).
|
|
|
1285
1269
|
`E` \| `undefined`
|
|
1286
1270
|
|
|
1287
1271
|
Matching value or undefined.
|
|
1288
|
-
*
|
|
1289
1272
|
|
|
1290
1273
|
#### Remarks
|
|
1291
1274
|
|
|
@@ -1308,7 +1291,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
|
1308
1291
|
findLastIndex(predicate): number;
|
|
1309
1292
|
```
|
|
1310
1293
|
|
|
1311
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1294
|
+
Defined in: [data-structures/queue/deque.ts:815](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L815)
|
|
1312
1295
|
|
|
1313
1296
|
Find the index of the last value matching a predicate (scans back-to-front).
|
|
1314
1297
|
|
|
@@ -1325,7 +1308,6 @@ Function called with (value, index, deque).
|
|
|
1325
1308
|
`number`
|
|
1326
1309
|
|
|
1327
1310
|
Matching index, or -1 if not found.
|
|
1328
|
-
*
|
|
1329
1311
|
|
|
1330
1312
|
#### Remarks
|
|
1331
1313
|
|
|
@@ -1388,7 +1370,7 @@ Time O(n), Space O(1).
|
|
|
1388
1370
|
has(element): boolean;
|
|
1389
1371
|
```
|
|
1390
1372
|
|
|
1391
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1373
|
+
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)
|
|
1392
1374
|
|
|
1393
1375
|
Checks whether a strictly-equal element exists in the structure.
|
|
1394
1376
|
|
|
@@ -1422,7 +1404,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1422
1404
|
includes(element): boolean;
|
|
1423
1405
|
```
|
|
1424
1406
|
|
|
1425
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1407
|
+
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)
|
|
1426
1408
|
|
|
1427
1409
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
1428
1410
|
|
|
@@ -1496,7 +1478,7 @@ Time O(n), Space O(1)
|
|
|
1496
1478
|
isEmpty(): boolean;
|
|
1497
1479
|
```
|
|
1498
1480
|
|
|
1499
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1481
|
+
Defined in: [data-structures/queue/deque.ts:510](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L510)
|
|
1500
1482
|
|
|
1501
1483
|
Check whether the deque is empty.
|
|
1502
1484
|
|
|
@@ -1506,8 +1488,6 @@ Check whether the deque is empty.
|
|
|
1506
1488
|
|
|
1507
1489
|
True if length is 0.
|
|
1508
1490
|
|
|
1509
|
-
*
|
|
1510
|
-
|
|
1511
1491
|
#### Remarks
|
|
1512
1492
|
|
|
1513
1493
|
Time O(1), Space O(1)
|
|
@@ -1532,7 +1512,7 @@ Time O(1), Space O(1)
|
|
|
1532
1512
|
join(separator?): string;
|
|
1533
1513
|
```
|
|
1534
1514
|
|
|
1535
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1515
|
+
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)
|
|
1536
1516
|
|
|
1537
1517
|
Join all elements into a string.
|
|
1538
1518
|
|
|
@@ -1566,7 +1546,7 @@ Time O(n), Space O(n)
|
|
|
1566
1546
|
keys(): IterableIterator<number>;
|
|
1567
1547
|
```
|
|
1568
1548
|
|
|
1569
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1549
|
+
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)
|
|
1570
1550
|
|
|
1571
1551
|
Return an iterator of numeric indices (Array-compatible).
|
|
1572
1552
|
|
|
@@ -1590,7 +1570,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per st
|
|
|
1590
1570
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1591
1571
|
```
|
|
1592
1572
|
|
|
1593
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1573
|
+
Defined in: [data-structures/base/linear-base.ts:129](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L129)
|
|
1594
1574
|
|
|
1595
1575
|
Last index of a value from the right.
|
|
1596
1576
|
|
|
@@ -1633,7 +1613,7 @@ map<EM, RM>(
|
|
|
1633
1613
|
thisArg?): Deque<EM, RM>;
|
|
1634
1614
|
```
|
|
1635
1615
|
|
|
1636
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1616
|
+
Defined in: [data-structures/queue/deque.ts:998](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L998)
|
|
1637
1617
|
|
|
1638
1618
|
Map elements into a new deque (possibly different element type).
|
|
1639
1619
|
|
|
@@ -1673,8 +1653,6 @@ Value for `this` inside the callback.
|
|
|
1673
1653
|
|
|
1674
1654
|
A new Deque with mapped elements.
|
|
1675
1655
|
|
|
1676
|
-
*
|
|
1677
|
-
|
|
1678
1656
|
#### Remarks
|
|
1679
1657
|
|
|
1680
1658
|
Time O(N), Space O(N)
|
|
@@ -1700,7 +1678,7 @@ Time O(N), Space O(N)
|
|
|
1700
1678
|
mapSame(callback, thisArg?): this;
|
|
1701
1679
|
```
|
|
1702
1680
|
|
|
1703
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1681
|
+
Defined in: [data-structures/queue/deque.ts:972](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L972)
|
|
1704
1682
|
|
|
1705
1683
|
Map elements into a new deque of the same element type.
|
|
1706
1684
|
|
|
@@ -1740,7 +1718,7 @@ Time O(N), Space O(N)
|
|
|
1740
1718
|
peek(): E | undefined;
|
|
1741
1719
|
```
|
|
1742
1720
|
|
|
1743
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1721
|
+
Defined in: [data-structures/queue/deque.ts:320](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L320)
|
|
1744
1722
|
|
|
1745
1723
|
Peek at the front element without removing it (alias for `first`).
|
|
1746
1724
|
|
|
@@ -1762,7 +1740,7 @@ Time O(1), Space O(1)
|
|
|
1762
1740
|
pop(): E | undefined;
|
|
1763
1741
|
```
|
|
1764
1742
|
|
|
1765
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1743
|
+
Defined in: [data-structures/queue/deque.ts:377](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L377)
|
|
1766
1744
|
|
|
1767
1745
|
Remove and return the last element.
|
|
1768
1746
|
|
|
@@ -1772,8 +1750,6 @@ Remove and return the last element.
|
|
|
1772
1750
|
|
|
1773
1751
|
Removed element or undefined.
|
|
1774
1752
|
|
|
1775
|
-
*
|
|
1776
|
-
|
|
1777
1753
|
#### Remarks
|
|
1778
1754
|
|
|
1779
1755
|
Time O(1), Space O(1)
|
|
@@ -1795,7 +1771,7 @@ Time O(1), Space O(1)
|
|
|
1795
1771
|
print(): void;
|
|
1796
1772
|
```
|
|
1797
1773
|
|
|
1798
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1774
|
+
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)
|
|
1799
1775
|
|
|
1800
1776
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1801
1777
|
|
|
@@ -1821,7 +1797,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1821
1797
|
push(element): boolean;
|
|
1822
1798
|
```
|
|
1823
1799
|
|
|
1824
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1800
|
+
Defined in: [data-structures/queue/deque.ts:348](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L348)
|
|
1825
1801
|
|
|
1826
1802
|
Append one element at the back.
|
|
1827
1803
|
|
|
@@ -1839,8 +1815,6 @@ Element to append.
|
|
|
1839
1815
|
|
|
1840
1816
|
True when appended.
|
|
1841
1817
|
|
|
1842
|
-
*
|
|
1843
|
-
|
|
1844
1818
|
#### Remarks
|
|
1845
1819
|
|
|
1846
1820
|
Time O(1) amortized, Space O(1)
|
|
@@ -1879,7 +1853,7 @@ Time O(1) amortized, Space O(1)
|
|
|
1879
1853
|
pushMany(elements): boolean[];
|
|
1880
1854
|
```
|
|
1881
1855
|
|
|
1882
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1856
|
+
Defined in: [data-structures/queue/deque.ts:471](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L471)
|
|
1883
1857
|
|
|
1884
1858
|
Append a sequence of elements.
|
|
1885
1859
|
|
|
@@ -1945,7 +1919,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1945
1919
|
reduce(callbackfn): E;
|
|
1946
1920
|
```
|
|
1947
1921
|
|
|
1948
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1922
|
+
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)
|
|
1949
1923
|
|
|
1950
1924
|
##### Parameters
|
|
1951
1925
|
|
|
@@ -1967,7 +1941,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1967
1941
|
reduce(callbackfn, initialValue): E;
|
|
1968
1942
|
```
|
|
1969
1943
|
|
|
1970
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1944
|
+
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)
|
|
1971
1945
|
|
|
1972
1946
|
##### Parameters
|
|
1973
1947
|
|
|
@@ -1993,7 +1967,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1993
1967
|
reduce<U>(callbackfn, initialValue): U;
|
|
1994
1968
|
```
|
|
1995
1969
|
|
|
1996
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1970
|
+
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)
|
|
1997
1971
|
|
|
1998
1972
|
##### Type Parameters
|
|
1999
1973
|
|
|
@@ -2027,7 +2001,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
2027
2001
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
2028
2002
|
```
|
|
2029
2003
|
|
|
2030
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2004
|
+
Defined in: [data-structures/base/linear-base.ts:245](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L245)
|
|
2031
2005
|
|
|
2032
2006
|
Right-to-left reduction over elements.
|
|
2033
2007
|
|
|
@@ -2073,12 +2047,10 @@ Time O(n), Space O(1)
|
|
|
2073
2047
|
reverse(): this;
|
|
2074
2048
|
```
|
|
2075
2049
|
|
|
2076
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2050
|
+
Defined in: [data-structures/queue/deque.ts:843](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L843)
|
|
2077
2051
|
|
|
2078
2052
|
Deque for...of iteration and reverse
|
|
2079
2053
|
|
|
2080
|
-
*
|
|
2081
|
-
|
|
2082
2054
|
#### Returns
|
|
2083
2055
|
|
|
2084
2056
|
`this`
|
|
@@ -2117,7 +2089,7 @@ Deque for...of iteration and reverse
|
|
|
2117
2089
|
setAt(pos, element): boolean;
|
|
2118
2090
|
```
|
|
2119
2091
|
|
|
2120
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2092
|
+
Defined in: [data-structures/queue/deque.ts:555](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L555)
|
|
2121
2093
|
|
|
2122
2094
|
Replace the element at a given position.
|
|
2123
2095
|
|
|
@@ -2157,7 +2129,7 @@ Time O(1), Space O(1)
|
|
|
2157
2129
|
setEquality(equals): this;
|
|
2158
2130
|
```
|
|
2159
2131
|
|
|
2160
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2132
|
+
Defined in: [data-structures/queue/deque.ts:757](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L757)
|
|
2161
2133
|
|
|
2162
2134
|
Set the equality comparator used by delete operations.
|
|
2163
2135
|
|
|
@@ -2187,7 +2159,7 @@ Time O(1), Space O(1)
|
|
|
2187
2159
|
shift(): E | undefined;
|
|
2188
2160
|
```
|
|
2189
2161
|
|
|
2190
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2162
|
+
Defined in: [data-structures/queue/deque.ts:406](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L406)
|
|
2191
2163
|
|
|
2192
2164
|
Remove and return the first element.
|
|
2193
2165
|
|
|
@@ -2197,8 +2169,6 @@ Remove and return the first element.
|
|
|
2197
2169
|
|
|
2198
2170
|
Removed element or undefined.
|
|
2199
2171
|
|
|
2200
|
-
*
|
|
2201
|
-
|
|
2202
2172
|
#### Remarks
|
|
2203
2173
|
|
|
2204
2174
|
Time O(1) amortized, Space O(1)
|
|
@@ -2220,7 +2190,7 @@ Time O(1) amortized, Space O(1)
|
|
|
2220
2190
|
slice(start?, end?): this;
|
|
2221
2191
|
```
|
|
2222
2192
|
|
|
2223
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2193
|
+
Defined in: [data-structures/base/linear-base.ts:261](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L261)
|
|
2224
2194
|
|
|
2225
2195
|
Create a shallow copy of a subrange.
|
|
2226
2196
|
|
|
@@ -2300,7 +2270,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2300
2270
|
sort(compareFn?): this;
|
|
2301
2271
|
```
|
|
2302
2272
|
|
|
2303
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2273
|
+
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)
|
|
2304
2274
|
|
|
2305
2275
|
In-place stable order via array sort semantics.
|
|
2306
2276
|
|
|
@@ -2337,7 +2307,7 @@ splice(
|
|
|
2337
2307
|
items?): this;
|
|
2338
2308
|
```
|
|
2339
2309
|
|
|
2340
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2310
|
+
Defined in: [data-structures/queue/deque.ts:627](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L627)
|
|
2341
2311
|
|
|
2342
2312
|
Remove and/or insert elements at a position (array-like behavior).
|
|
2343
2313
|
|
|
@@ -2383,7 +2353,7 @@ Time O(N + M), Space O(M)
|
|
|
2383
2353
|
toArray(): E[];
|
|
2384
2354
|
```
|
|
2385
2355
|
|
|
2386
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2356
|
+
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)
|
|
2387
2357
|
|
|
2388
2358
|
Materializes the elements into a new array.
|
|
2389
2359
|
|
|
@@ -2409,7 +2379,7 @@ Time O(n), Space O(n).
|
|
|
2409
2379
|
toReversed(): this;
|
|
2410
2380
|
```
|
|
2411
2381
|
|
|
2412
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2382
|
+
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)
|
|
2413
2383
|
|
|
2414
2384
|
Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
2415
2385
|
|
|
@@ -2435,7 +2405,7 @@ Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O
|
|
|
2435
2405
|
toReversedArray(): E[];
|
|
2436
2406
|
```
|
|
2437
2407
|
|
|
2438
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2408
|
+
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)
|
|
2439
2409
|
|
|
2440
2410
|
Snapshot elements into a reversed array.
|
|
2441
2411
|
|
|
@@ -2461,7 +2431,7 @@ Time O(n), Space O(n)
|
|
|
2461
2431
|
toVisual(): E[];
|
|
2462
2432
|
```
|
|
2463
2433
|
|
|
2464
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2434
|
+
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)
|
|
2465
2435
|
|
|
2466
2436
|
Returns a representation of the structure suitable for quick visualization.
|
|
2467
2437
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2488,7 +2458,7 @@ Time O(n), Space O(n).
|
|
|
2488
2458
|
unique(): this;
|
|
2489
2459
|
```
|
|
2490
2460
|
|
|
2491
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2461
|
+
Defined in: [data-structures/queue/deque.ts:860](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L860)
|
|
2492
2462
|
|
|
2493
2463
|
Deduplicate consecutive equal elements in-place.
|
|
2494
2464
|
|
|
@@ -2510,7 +2480,7 @@ Time O(N), Space O(1)
|
|
|
2510
2480
|
unshift(element): boolean;
|
|
2511
2481
|
```
|
|
2512
2482
|
|
|
2513
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2483
|
+
Defined in: [data-structures/queue/deque.ts:446](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L446)
|
|
2514
2484
|
|
|
2515
2485
|
Prepend one element at the front.
|
|
2516
2486
|
|
|
@@ -2528,8 +2498,6 @@ Element to prepend.
|
|
|
2528
2498
|
|
|
2529
2499
|
True when prepended.
|
|
2530
2500
|
|
|
2531
|
-
*
|
|
2532
|
-
|
|
2533
2501
|
#### Remarks
|
|
2534
2502
|
|
|
2535
2503
|
Time O(1) amortized, Space O(1)
|
|
@@ -2561,7 +2529,7 @@ Time O(1) amortized, Space O(1)
|
|
|
2561
2529
|
unshiftMany(elements?): boolean[];
|
|
2562
2530
|
```
|
|
2563
2531
|
|
|
2564
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2532
|
+
Defined in: [data-structures/queue/deque.ts:489](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L489)
|
|
2565
2533
|
|
|
2566
2534
|
Prepend a sequence of elements.
|
|
2567
2535
|
|
|
@@ -2620,7 +2588,7 @@ static fromArray<E, R>(
|
|
|
2620
2588
|
options?): any;
|
|
2621
2589
|
```
|
|
2622
2590
|
|
|
2623
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2591
|
+
Defined in: [data-structures/queue/deque.ts:285](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L285)
|
|
2624
2592
|
|
|
2625
2593
|
Create a Deque from an array of elements.
|
|
2626
2594
|
|
|
@@ -2675,7 +2643,7 @@ Time O(N), Space O(N)
|
|
|
2675
2643
|
protected _compactCounter: number = 0;
|
|
2676
2644
|
```
|
|
2677
2645
|
|
|
2678
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2646
|
+
Defined in: [data-structures/queue/deque.ts:89](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L89)
|
|
2679
2647
|
|
|
2680
2648
|
Counter for shift/pop operations since last compaction check.
|
|
2681
2649
|
Only checks ratio every `_bucketSize` operations to minimize overhead.
|
|
@@ -2718,7 +2686,7 @@ Time O(1), Space O(1).
|
|
|
2718
2686
|
protected _autoCompact(): void;
|
|
2719
2687
|
```
|
|
2720
2688
|
|
|
2721
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2689
|
+
Defined in: [data-structures/queue/deque.ts:1029](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1029)
|
|
2722
2690
|
|
|
2723
2691
|
(Protected) Trigger auto-compaction if space utilization drops below threshold.
|
|
2724
2692
|
Only checks every `_bucketSize` operations to minimize hot-path overhead.
|
|
@@ -2736,7 +2704,7 @@ Uses element-based ratio: `elements / (bucketCount * bucketSize)`.
|
|
|
2736
2704
|
protected _createInstance(options?): this;
|
|
2737
2705
|
```
|
|
2738
2706
|
|
|
2739
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2707
|
+
Defined in: [data-structures/queue/deque.ts:1126](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1126)
|
|
2740
2708
|
|
|
2741
2709
|
(Protected) Create an empty instance of the same concrete class.
|
|
2742
2710
|
|
|
@@ -2770,7 +2738,7 @@ Time O(1), Space O(1)
|
|
|
2770
2738
|
protected _createLike<T, RR>(elements?, options?): Deque<T, RR>;
|
|
2771
2739
|
```
|
|
2772
2740
|
|
|
2773
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2741
|
+
Defined in: [data-structures/queue/deque.ts:1143](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1143)
|
|
2774
2742
|
|
|
2775
2743
|
(Protected) Create a like-kind deque seeded by elements.
|
|
2776
2744
|
|
|
@@ -2816,7 +2784,7 @@ Time O(N), Space O(N)
|
|
|
2816
2784
|
protected _getBucketAndPosition(pos): object;
|
|
2817
2785
|
```
|
|
2818
2786
|
|
|
2819
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2787
|
+
Defined in: [data-structures/queue/deque.ts:1105](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1105)
|
|
2820
2788
|
|
|
2821
2789
|
(Protected) Translate a logical position to bucket/offset.
|
|
2822
2790
|
|
|
@@ -2858,7 +2826,7 @@ Time O(1), Space O(1)
|
|
|
2858
2826
|
protected _getIterator(): IterableIterator<E>;
|
|
2859
2827
|
```
|
|
2860
2828
|
|
|
2861
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2829
|
+
Defined in: [data-structures/queue/deque.ts:1064](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1064)
|
|
2862
2830
|
|
|
2863
2831
|
(Protected) Iterate elements from front to back.
|
|
2864
2832
|
|
|
@@ -2884,7 +2852,7 @@ Time O(N), Space O(1)
|
|
|
2884
2852
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2885
2853
|
```
|
|
2886
2854
|
|
|
2887
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2855
|
+
Defined in: [data-structures/queue/deque.ts:1159](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1159)
|
|
2888
2856
|
|
|
2889
2857
|
(Protected) Iterate elements from back to front.
|
|
2890
2858
|
|
|
@@ -2910,7 +2878,7 @@ Time O(N), Space O(1)
|
|
|
2910
2878
|
protected _reallocate(needBucketNum?): void;
|
|
2911
2879
|
```
|
|
2912
2880
|
|
|
2913
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2881
|
+
Defined in: [data-structures/queue/deque.ts:1077](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1077)
|
|
2914
2882
|
|
|
2915
2883
|
(Protected) Reallocate buckets to make room near the ends.
|
|
2916
2884
|
|
|
@@ -2940,7 +2908,7 @@ Time O(N), Space O(N)
|
|
|
2940
2908
|
protected _setBucketSize(size): void;
|
|
2941
2909
|
```
|
|
2942
2910
|
|
|
2943
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2911
|
+
Defined in: [data-structures/queue/deque.ts:1046](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1046)
|
|
2944
2912
|
|
|
2945
2913
|
(Protected) Set the internal bucket size.
|
|
2946
2914
|
|