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: Queue\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
9
|
+
Defined in: [data-structures/queue/queue.ts:90](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L90)
|
|
10
10
|
|
|
11
11
|
Array-backed queue with amortized O(1) enqueue/dequeue via an offset pointer and optional auto-compaction.
|
|
12
12
|
|
|
@@ -115,7 +115,7 @@ Time O(1), Space O(1)
|
|
|
115
115
|
new Queue<E, R>(elements?, options?): Queue<E, R>;
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
118
|
+
Defined in: [data-structures/queue/queue.ts:98](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L98)
|
|
119
119
|
|
|
120
120
|
Create a Queue and optionally bulk-insert elements.
|
|
121
121
|
|
|
@@ -157,7 +157,7 @@ Time O(N), Space O(N)
|
|
|
157
157
|
get autoCompactRatio(): number;
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
160
|
+
Defined in: [data-structures/queue/queue.ts:136](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L136)
|
|
161
161
|
|
|
162
162
|
Get the compaction threshold (offset/size).
|
|
163
163
|
|
|
@@ -177,7 +177,7 @@ Auto-compaction ratio in (0,1].
|
|
|
177
177
|
set autoCompactRatio(value): void;
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
180
|
+
Defined in: [data-structures/queue/queue.ts:146](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L146)
|
|
181
181
|
|
|
182
182
|
Set the compaction threshold.
|
|
183
183
|
|
|
@@ -209,7 +209,7 @@ void
|
|
|
209
209
|
get elements(): E[];
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
212
|
+
Defined in: [data-structures/queue/queue.ts:114](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L114)
|
|
213
213
|
|
|
214
214
|
Get the underlying array buffer.
|
|
215
215
|
|
|
@@ -233,7 +233,7 @@ Backing array of elements.
|
|
|
233
233
|
get first(): E | undefined;
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
236
|
+
Defined in: [data-structures/queue/queue.ts:176](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L176)
|
|
237
237
|
|
|
238
238
|
Get the first element (front) without removing it.
|
|
239
239
|
|
|
@@ -256,8 +256,6 @@ Time O(1), Space O(1)
|
|
|
256
256
|
|
|
257
257
|
Front element or undefined.
|
|
258
258
|
|
|
259
|
-
*
|
|
260
|
-
|
|
261
259
|
***
|
|
262
260
|
|
|
263
261
|
### last
|
|
@@ -268,7 +266,7 @@ Front element or undefined.
|
|
|
268
266
|
get last(): E | undefined;
|
|
269
267
|
```
|
|
270
268
|
|
|
271
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
269
|
+
Defined in: [data-structures/queue/queue.ts:185](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L185)
|
|
272
270
|
|
|
273
271
|
Get the last element (back) without removing it.
|
|
274
272
|
|
|
@@ -292,7 +290,7 @@ Back element or undefined.
|
|
|
292
290
|
get length(): number;
|
|
293
291
|
```
|
|
294
292
|
|
|
295
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
293
|
+
Defined in: [data-structures/queue/queue.ts:162](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L162)
|
|
296
294
|
|
|
297
295
|
Get the number of elements currently in the queue.
|
|
298
296
|
|
|
@@ -317,8 +315,6 @@ Time O(1), Space O(1)
|
|
|
317
315
|
|
|
318
316
|
Current length.
|
|
319
317
|
|
|
320
|
-
*
|
|
321
|
-
|
|
322
318
|
#### Overrides
|
|
323
319
|
|
|
324
320
|
[`LinearBase`](LinearBase.md).[`length`](LinearBase.md#length)
|
|
@@ -361,7 +357,7 @@ Maximum allowed length.
|
|
|
361
357
|
get offset(): number;
|
|
362
358
|
```
|
|
363
359
|
|
|
364
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
360
|
+
Defined in: [data-structures/queue/queue.ts:125](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L125)
|
|
365
361
|
|
|
366
362
|
Get the current start offset into the array.
|
|
367
363
|
|
|
@@ -445,7 +441,7 @@ Producing the iterator is O(1); consuming the entire iterator is Time O(n) with
|
|
|
445
441
|
addAt(index, newElement): boolean;
|
|
446
442
|
```
|
|
447
443
|
|
|
448
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
444
|
+
Defined in: [data-structures/queue/queue.ts:357](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L357)
|
|
449
445
|
|
|
450
446
|
Insert a new element at a given index.
|
|
451
447
|
|
|
@@ -485,7 +481,7 @@ Time O(N), Space O(1)
|
|
|
485
481
|
at(index): E | undefined;
|
|
486
482
|
```
|
|
487
483
|
|
|
488
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
484
|
+
Defined in: [data-structures/queue/queue.ts:332](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L332)
|
|
489
485
|
|
|
490
486
|
Get the element at a given logical index.
|
|
491
487
|
|
|
@@ -503,8 +499,6 @@ Zero-based index from the front.
|
|
|
503
499
|
|
|
504
500
|
Element or undefined.
|
|
505
501
|
|
|
506
|
-
*
|
|
507
|
-
|
|
508
502
|
#### Remarks
|
|
509
503
|
|
|
510
504
|
Time O(1), Space O(1)
|
|
@@ -530,7 +524,7 @@ Time O(1), Space O(1)
|
|
|
530
524
|
clear(): void;
|
|
531
525
|
```
|
|
532
526
|
|
|
533
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
527
|
+
Defined in: [data-structures/queue/queue.ts:413](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L413)
|
|
534
528
|
|
|
535
529
|
Remove all elements and reset offset.
|
|
536
530
|
|
|
@@ -540,8 +534,6 @@ Remove all elements and reset offset.
|
|
|
540
534
|
|
|
541
535
|
void
|
|
542
536
|
|
|
543
|
-
*
|
|
544
|
-
|
|
545
537
|
#### Remarks
|
|
546
538
|
|
|
547
539
|
Time O(1), Space O(1)
|
|
@@ -567,7 +559,7 @@ Time O(1), Space O(1)
|
|
|
567
559
|
clone(): this;
|
|
568
560
|
```
|
|
569
561
|
|
|
570
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
562
|
+
Defined in: [data-structures/queue/queue.ts:468](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L468)
|
|
571
563
|
|
|
572
564
|
Deep clone this queue and its parameters.
|
|
573
565
|
|
|
@@ -577,8 +569,6 @@ Deep clone this queue and its parameters.
|
|
|
577
569
|
|
|
578
570
|
A new queue with the same content and options.
|
|
579
571
|
|
|
580
|
-
*
|
|
581
|
-
|
|
582
572
|
#### Remarks
|
|
583
573
|
|
|
584
574
|
Time O(N), Space O(N)
|
|
@@ -606,7 +596,7 @@ Time O(N), Space O(N)
|
|
|
606
596
|
compact(): boolean;
|
|
607
597
|
```
|
|
608
598
|
|
|
609
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
599
|
+
Defined in: [data-structures/queue/queue.ts:430](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L430)
|
|
610
600
|
|
|
611
601
|
Compact storage by discarding consumed head elements.
|
|
612
602
|
|
|
@@ -616,8 +606,6 @@ Compact storage by discarding consumed head elements.
|
|
|
616
606
|
|
|
617
607
|
True when compaction performed.
|
|
618
608
|
|
|
619
|
-
*
|
|
620
|
-
|
|
621
609
|
#### Remarks
|
|
622
610
|
|
|
623
611
|
Time O(N), Space O(N)
|
|
@@ -641,7 +629,7 @@ Time O(N), Space O(N)
|
|
|
641
629
|
concat(...items): this;
|
|
642
630
|
```
|
|
643
631
|
|
|
644
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
632
|
+
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)
|
|
645
633
|
|
|
646
634
|
Concatenate elements and/or containers.
|
|
647
635
|
|
|
@@ -675,7 +663,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
675
663
|
delete(element): boolean;
|
|
676
664
|
```
|
|
677
665
|
|
|
678
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
666
|
+
Defined in: [data-structures/queue/queue.ts:311](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L311)
|
|
679
667
|
|
|
680
668
|
Delete the first occurrence of a specific element.
|
|
681
669
|
|
|
@@ -693,8 +681,6 @@ Element to remove (strict equality via Object.is).
|
|
|
693
681
|
|
|
694
682
|
True if an element was removed.
|
|
695
683
|
|
|
696
|
-
*
|
|
697
|
-
|
|
698
684
|
#### Remarks
|
|
699
685
|
|
|
700
686
|
Time O(N), Space O(1)
|
|
@@ -720,7 +706,7 @@ Time O(N), Space O(1)
|
|
|
720
706
|
deleteAt(index): E | undefined;
|
|
721
707
|
```
|
|
722
708
|
|
|
723
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
709
|
+
Defined in: [data-structures/queue/queue.ts:343](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L343)
|
|
724
710
|
|
|
725
711
|
Delete the element at a given index.
|
|
726
712
|
|
|
@@ -754,7 +740,7 @@ Time O(N), Space O(1)
|
|
|
754
740
|
deleteWhere(predicate): boolean;
|
|
755
741
|
```
|
|
756
742
|
|
|
757
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
743
|
+
Defined in: [data-structures/queue/queue.ts:382](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L382)
|
|
758
744
|
|
|
759
745
|
Delete the first element that satisfies a predicate.
|
|
760
746
|
|
|
@@ -784,7 +770,7 @@ Time O(N), Space O(N)
|
|
|
784
770
|
entries(): IterableIterator<[number, E]>;
|
|
785
771
|
```
|
|
786
772
|
|
|
787
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
773
|
+
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)
|
|
788
774
|
|
|
789
775
|
Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
790
776
|
|
|
@@ -851,7 +837,7 @@ fill(
|
|
|
851
837
|
end?): this;
|
|
852
838
|
```
|
|
853
839
|
|
|
854
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
840
|
+
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)
|
|
855
841
|
|
|
856
842
|
Fill a range with a value.
|
|
857
843
|
|
|
@@ -897,7 +883,7 @@ Time O(n), Space O(1)
|
|
|
897
883
|
filter(predicate, thisArg?): this;
|
|
898
884
|
```
|
|
899
885
|
|
|
900
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
886
|
+
Defined in: [data-structures/queue/queue.ts:487](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L487)
|
|
901
887
|
|
|
902
888
|
Filter elements into a new queue of the same class.
|
|
903
889
|
|
|
@@ -921,8 +907,6 @@ Value for `this` inside the predicate.
|
|
|
921
907
|
|
|
922
908
|
A new queue with kept elements.
|
|
923
909
|
|
|
924
|
-
*
|
|
925
|
-
|
|
926
910
|
#### Remarks
|
|
927
911
|
|
|
928
912
|
Time O(N), Space O(N)
|
|
@@ -1038,7 +1022,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1038
1022
|
findIndex(predicate, thisArg?): number;
|
|
1039
1023
|
```
|
|
1040
1024
|
|
|
1041
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1025
|
+
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)
|
|
1042
1026
|
|
|
1043
1027
|
Find the first index matching a predicate.
|
|
1044
1028
|
|
|
@@ -1118,7 +1102,7 @@ Time O(n), Space O(1).
|
|
|
1118
1102
|
has(element): boolean;
|
|
1119
1103
|
```
|
|
1120
1104
|
|
|
1121
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1105
|
+
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)
|
|
1122
1106
|
|
|
1123
1107
|
Checks whether a strictly-equal element exists in the structure.
|
|
1124
1108
|
|
|
@@ -1152,7 +1136,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1152
1136
|
includes(element): boolean;
|
|
1153
1137
|
```
|
|
1154
1138
|
|
|
1155
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1139
|
+
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)
|
|
1156
1140
|
|
|
1157
1141
|
Check whether a value exists (Array-compatible alias for `has`).
|
|
1158
1142
|
|
|
@@ -1226,7 +1210,7 @@ Time O(n), Space O(1)
|
|
|
1226
1210
|
isEmpty(): boolean;
|
|
1227
1211
|
```
|
|
1228
1212
|
|
|
1229
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1213
|
+
Defined in: [data-structures/queue/queue.ts:232](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L232)
|
|
1230
1214
|
|
|
1231
1215
|
Check whether the queue is empty.
|
|
1232
1216
|
|
|
@@ -1236,8 +1220,6 @@ Check whether the queue is empty.
|
|
|
1236
1220
|
|
|
1237
1221
|
True if length is 0.
|
|
1238
1222
|
|
|
1239
|
-
*
|
|
1240
|
-
|
|
1241
1223
|
#### Remarks
|
|
1242
1224
|
|
|
1243
1225
|
Time O(1), Space O(1)
|
|
@@ -1276,7 +1258,7 @@ Time O(1), Space O(1)
|
|
|
1276
1258
|
join(separator?): string;
|
|
1277
1259
|
```
|
|
1278
1260
|
|
|
1279
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1261
|
+
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)
|
|
1280
1262
|
|
|
1281
1263
|
Join all elements into a string.
|
|
1282
1264
|
|
|
@@ -1310,7 +1292,7 @@ Time O(n), Space O(n)
|
|
|
1310
1292
|
keys(): IterableIterator<number>;
|
|
1311
1293
|
```
|
|
1312
1294
|
|
|
1313
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1295
|
+
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)
|
|
1314
1296
|
|
|
1315
1297
|
Return an iterator of numeric indices (Array-compatible).
|
|
1316
1298
|
|
|
@@ -1334,7 +1316,7 @@ Provided for familiarity when migrating from Array. Time O(n), Space O(1) per st
|
|
|
1334
1316
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1335
1317
|
```
|
|
1336
1318
|
|
|
1337
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1319
|
+
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)
|
|
1338
1320
|
|
|
1339
1321
|
Last index of a value from the right.
|
|
1340
1322
|
|
|
@@ -1377,7 +1359,7 @@ map<EM, RM>(
|
|
|
1377
1359
|
thisArg?): Queue<EM, RM>;
|
|
1378
1360
|
```
|
|
1379
1361
|
|
|
1380
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1362
|
+
Defined in: [data-structures/queue/queue.ts:513](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L513)
|
|
1381
1363
|
|
|
1382
1364
|
Map each element to a new element in a possibly different-typed queue.
|
|
1383
1365
|
|
|
@@ -1417,8 +1399,6 @@ Value for `this` inside the callback.
|
|
|
1417
1399
|
|
|
1418
1400
|
A new Queue with mapped elements.
|
|
1419
1401
|
|
|
1420
|
-
*
|
|
1421
|
-
|
|
1422
1402
|
#### Remarks
|
|
1423
1403
|
|
|
1424
1404
|
Time O(N), Space O(N)
|
|
@@ -1444,7 +1424,7 @@ Time O(N), Space O(N)
|
|
|
1444
1424
|
mapSame(callback, thisArg?): this;
|
|
1445
1425
|
```
|
|
1446
1426
|
|
|
1447
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1427
|
+
Defined in: [data-structures/queue/queue.ts:535](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L535)
|
|
1448
1428
|
|
|
1449
1429
|
Map each element to a new value of the same type.
|
|
1450
1430
|
|
|
@@ -1484,7 +1464,7 @@ Time O(N), Space O(N)
|
|
|
1484
1464
|
peek(): E | undefined;
|
|
1485
1465
|
```
|
|
1486
1466
|
|
|
1487
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1467
|
+
Defined in: [data-structures/queue/queue.ts:205](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L205)
|
|
1488
1468
|
|
|
1489
1469
|
Peek at the front element without removing it (alias for `first`).
|
|
1490
1470
|
|
|
@@ -1506,7 +1486,7 @@ Time O(1), Space O(1)
|
|
|
1506
1486
|
print(): void;
|
|
1507
1487
|
```
|
|
1508
1488
|
|
|
1509
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1489
|
+
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)
|
|
1510
1490
|
|
|
1511
1491
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1512
1492
|
|
|
@@ -1532,7 +1512,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1532
1512
|
push(element): boolean;
|
|
1533
1513
|
```
|
|
1534
1514
|
|
|
1535
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1515
|
+
Defined in: [data-structures/queue/queue.ts:252](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L252)
|
|
1536
1516
|
|
|
1537
1517
|
Enqueue one element at the back.
|
|
1538
1518
|
|
|
@@ -1550,8 +1530,6 @@ Element to enqueue.
|
|
|
1550
1530
|
|
|
1551
1531
|
True on success.
|
|
1552
1532
|
|
|
1553
|
-
*
|
|
1554
|
-
|
|
1555
1533
|
#### Remarks
|
|
1556
1534
|
|
|
1557
1535
|
Time O(1), Space O(1)
|
|
@@ -1582,7 +1560,7 @@ Time O(1), Space O(1)
|
|
|
1582
1560
|
pushMany(elements): boolean[];
|
|
1583
1561
|
```
|
|
1584
1562
|
|
|
1585
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1563
|
+
Defined in: [data-structures/queue/queue.ts:264](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L264)
|
|
1586
1564
|
|
|
1587
1565
|
Enqueue many elements from an iterable.
|
|
1588
1566
|
|
|
@@ -1648,7 +1626,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1648
1626
|
reduce(callbackfn): E;
|
|
1649
1627
|
```
|
|
1650
1628
|
|
|
1651
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1629
|
+
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)
|
|
1652
1630
|
|
|
1653
1631
|
##### Parameters
|
|
1654
1632
|
|
|
@@ -1670,7 +1648,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:226](https://github.c
|
|
|
1670
1648
|
reduce(callbackfn, initialValue): E;
|
|
1671
1649
|
```
|
|
1672
1650
|
|
|
1673
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1651
|
+
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)
|
|
1674
1652
|
|
|
1675
1653
|
##### Parameters
|
|
1676
1654
|
|
|
@@ -1696,7 +1674,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:227](https://github.c
|
|
|
1696
1674
|
reduce<U>(callbackfn, initialValue): U;
|
|
1697
1675
|
```
|
|
1698
1676
|
|
|
1699
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1677
|
+
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)
|
|
1700
1678
|
|
|
1701
1679
|
##### Type Parameters
|
|
1702
1680
|
|
|
@@ -1730,7 +1708,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:228](https://github.c
|
|
|
1730
1708
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1731
1709
|
```
|
|
1732
1710
|
|
|
1733
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1711
|
+
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)
|
|
1734
1712
|
|
|
1735
1713
|
Right-to-left reduction over elements.
|
|
1736
1714
|
|
|
@@ -1776,7 +1754,7 @@ Time O(n), Space O(1)
|
|
|
1776
1754
|
reverse(): this;
|
|
1777
1755
|
```
|
|
1778
1756
|
|
|
1779
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1757
|
+
Defined in: [data-structures/queue/queue.ts:397](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L397)
|
|
1780
1758
|
|
|
1781
1759
|
Reverse the queue in-place by compacting then reversing.
|
|
1782
1760
|
|
|
@@ -1802,7 +1780,7 @@ Time O(N), Space O(N)
|
|
|
1802
1780
|
setAt(index, newElement): boolean;
|
|
1803
1781
|
```
|
|
1804
1782
|
|
|
1805
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1783
|
+
Defined in: [data-structures/queue/queue.ts:370](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L370)
|
|
1806
1784
|
|
|
1807
1785
|
Replace the element at a given index.
|
|
1808
1786
|
|
|
@@ -1842,7 +1820,7 @@ Time O(1), Space O(1)
|
|
|
1842
1820
|
shift(): E | undefined;
|
|
1843
1821
|
```
|
|
1844
1822
|
|
|
1845
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1823
|
+
Defined in: [data-structures/queue/queue.ts:292](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L292)
|
|
1846
1824
|
|
|
1847
1825
|
Dequeue one element from the front (amortized via offset).
|
|
1848
1826
|
|
|
@@ -1852,8 +1830,6 @@ Dequeue one element from the front (amortized via offset).
|
|
|
1852
1830
|
|
|
1853
1831
|
Removed element or undefined.
|
|
1854
1832
|
|
|
1855
|
-
*
|
|
1856
|
-
|
|
1857
1833
|
#### Remarks
|
|
1858
1834
|
|
|
1859
1835
|
Time O(1) amortized, Space O(1)
|
|
@@ -1884,7 +1860,7 @@ Time O(1) amortized, Space O(1)
|
|
|
1884
1860
|
slice(start?, end?): this;
|
|
1885
1861
|
```
|
|
1886
1862
|
|
|
1887
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1863
|
+
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)
|
|
1888
1864
|
|
|
1889
1865
|
Create a shallow copy of a subrange.
|
|
1890
1866
|
|
|
@@ -1964,7 +1940,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
1964
1940
|
sort(compareFn?): this;
|
|
1965
1941
|
```
|
|
1966
1942
|
|
|
1967
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
1943
|
+
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)
|
|
1968
1944
|
|
|
1969
1945
|
In-place stable order via array sort semantics.
|
|
1970
1946
|
|
|
@@ -2001,7 +1977,7 @@ splice(
|
|
|
2001
1977
|
items?): this;
|
|
2002
1978
|
```
|
|
2003
1979
|
|
|
2004
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
1980
|
+
Defined in: [data-structures/queue/queue.ts:444](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L444)
|
|
2005
1981
|
|
|
2006
1982
|
Remove and/or insert elements at a position (array-like).
|
|
2007
1983
|
|
|
@@ -2047,7 +2023,7 @@ Time O(N + M), Space O(M)
|
|
|
2047
2023
|
toArray(): E[];
|
|
2048
2024
|
```
|
|
2049
2025
|
|
|
2050
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2026
|
+
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)
|
|
2051
2027
|
|
|
2052
2028
|
Materializes the elements into a new array.
|
|
2053
2029
|
|
|
@@ -2073,7 +2049,7 @@ Time O(n), Space O(n).
|
|
|
2073
2049
|
toReversed(): this;
|
|
2074
2050
|
```
|
|
2075
2051
|
|
|
2076
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2052
|
+
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)
|
|
2077
2053
|
|
|
2078
2054
|
Return a new instance of the same type with elements in reverse order (non-mutating).
|
|
2079
2055
|
|
|
@@ -2099,7 +2075,7 @@ Provided for familiarity when migrating from Array (ES2023 `toReversed`). Time O
|
|
|
2099
2075
|
toReversedArray(): E[];
|
|
2100
2076
|
```
|
|
2101
2077
|
|
|
2102
|
-
Defined in: [data-structures/base/linear-base.ts:
|
|
2078
|
+
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)
|
|
2103
2079
|
|
|
2104
2080
|
Snapshot elements into a reversed array.
|
|
2105
2081
|
|
|
@@ -2125,7 +2101,7 @@ Time O(n), Space O(n)
|
|
|
2125
2101
|
toVisual(): E[];
|
|
2126
2102
|
```
|
|
2127
2103
|
|
|
2128
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2104
|
+
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)
|
|
2129
2105
|
|
|
2130
2106
|
Returns a representation of the structure suitable for quick visualization.
|
|
2131
2107
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2178,7 +2154,7 @@ Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
|
2178
2154
|
static fromArray<E>(elements): Queue<E>;
|
|
2179
2155
|
```
|
|
2180
2156
|
|
|
2181
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
2157
|
+
Defined in: [data-structures/queue/queue.ts:196](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L196)
|
|
2182
2158
|
|
|
2183
2159
|
Create a queue from an array of elements.
|
|
2184
2160
|
|
|
@@ -2247,7 +2223,7 @@ Time O(1), Space O(1).
|
|
|
2247
2223
|
protected _createInstance(options?): this;
|
|
2248
2224
|
```
|
|
2249
2225
|
|
|
2250
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
2226
|
+
Defined in: [data-structures/queue/queue.ts:591](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L591)
|
|
2251
2227
|
|
|
2252
2228
|
(Protected) Create an empty instance of the same concrete class.
|
|
2253
2229
|
|
|
@@ -2281,7 +2257,7 @@ Time O(1), Space O(1)
|
|
|
2281
2257
|
protected _createLike<EM, RM>(elements?, options?): Queue<EM, RM>;
|
|
2282
2258
|
```
|
|
2283
2259
|
|
|
2284
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
2260
|
+
Defined in: [data-structures/queue/queue.ts:605](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L605)
|
|
2285
2261
|
|
|
2286
2262
|
(Protected) Create a like-kind queue and seed it from an iterable.
|
|
2287
2263
|
|
|
@@ -2327,7 +2303,7 @@ Time O(N), Space O(N)
|
|
|
2327
2303
|
protected _getIterator(): IterableIterator<E>;
|
|
2328
2304
|
```
|
|
2329
2305
|
|
|
2330
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
2306
|
+
Defined in: [data-structures/queue/queue.ts:569](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L569)
|
|
2331
2307
|
|
|
2332
2308
|
(Protected) Iterate elements from front to back.
|
|
2333
2309
|
|
|
@@ -2353,7 +2329,7 @@ Time O(N), Space O(1)
|
|
|
2353
2329
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2354
2330
|
```
|
|
2355
2331
|
|
|
2356
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
2332
|
+
Defined in: [data-structures/queue/queue.ts:578](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L578)
|
|
2357
2333
|
|
|
2358
2334
|
(Protected) Iterate elements from back to front.
|
|
2359
2335
|
|
|
@@ -2379,7 +2355,7 @@ Time O(N), Space O(1)
|
|
|
2379
2355
|
protected _setAutoCompactRatio(value): void;
|
|
2380
2356
|
```
|
|
2381
2357
|
|
|
2382
|
-
Defined in: [data-structures/queue/queue.ts:
|
|
2358
|
+
Defined in: [data-structures/queue/queue.ts:560](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/queue.ts#L560)
|
|
2383
2359
|
|
|
2384
2360
|
(Protected) Set the internal auto-compaction ratio.
|
|
2385
2361
|
|