data-structure-typed 2.5.1 → 2.5.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 +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- 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 +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: Deque\<E, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/queue/deque.ts:85](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/queue/deque.ts:85](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L85)
|
|
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:96](https://github.com/zrwusa/data-structure-typed/blob/
|
|
106
|
+
Defined in: [data-structures/queue/deque.ts:96](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L96)
|
|
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:145](https://github.com/zrwusa/data-structure-typed/blob/
|
|
148
|
+
Defined in: [data-structures/queue/deque.ts:145](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L145)
|
|
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:154](https://github.com/zrwusa/data-structure-typed/blob/
|
|
170
|
+
Defined in: [data-structures/queue/deque.ts:154](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L154)
|
|
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:220](https://github.com/zrwusa/data-structure-typed/blob/
|
|
200
|
+
Defined in: [data-structures/queue/deque.ts:220](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L220)
|
|
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:172](https://github.com/zrwusa/data-structure-typed/blob/
|
|
224
|
+
Defined in: [data-structures/queue/deque.ts:172](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L172)
|
|
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:196](https://github.com/zrwusa/data-structure-typed/blob/
|
|
248
|
+
Defined in: [data-structures/queue/deque.ts:196](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L196)
|
|
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:232](https://github.com/zrwusa/data-structure-typed/blob/
|
|
272
|
+
Defined in: [data-structures/queue/deque.ts:232](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L232)
|
|
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:132](https://github.com/zrwusa/data-structure-typed/blob/
|
|
296
|
+
Defined in: [data-structures/queue/deque.ts:132](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L132)
|
|
297
297
|
|
|
298
298
|
Get the current bucket size.
|
|
299
299
|
|
|
@@ -317,7 +317,7 @@ 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:303](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L303)
|
|
321
321
|
|
|
322
322
|
Get the first element without removing it.
|
|
323
323
|
|
|
@@ -361,7 +361,7 @@ First element or undefined.
|
|
|
361
361
|
get firstInBucket(): number;
|
|
362
362
|
```
|
|
363
363
|
|
|
364
|
-
Defined in: [data-structures/queue/deque.ts:184](https://github.com/zrwusa/data-structure-typed/blob/
|
|
364
|
+
Defined in: [data-structures/queue/deque.ts:184](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L184)
|
|
365
365
|
|
|
366
366
|
Get the index inside the first bucket.
|
|
367
367
|
|
|
@@ -385,7 +385,7 @@ Zero-based index within the first bucket.
|
|
|
385
385
|
get last(): E | undefined;
|
|
386
386
|
```
|
|
387
387
|
|
|
388
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
388
|
+
Defined in: [data-structures/queue/deque.ts:354](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L354)
|
|
389
389
|
|
|
390
390
|
Get the last element without removing it.
|
|
391
391
|
|
|
@@ -420,7 +420,7 @@ Last element or undefined.
|
|
|
420
420
|
get lastInBucket(): number;
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
Defined in: [data-structures/queue/deque.ts:208](https://github.com/zrwusa/data-structure-typed/blob/
|
|
423
|
+
Defined in: [data-structures/queue/deque.ts:208](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L208)
|
|
424
424
|
|
|
425
425
|
Get the index inside the last bucket.
|
|
426
426
|
|
|
@@ -444,7 +444,7 @@ Zero-based index within the last bucket.
|
|
|
444
444
|
get length(): number;
|
|
445
445
|
```
|
|
446
446
|
|
|
447
|
-
Defined in: [data-structures/queue/deque.ts:244](https://github.com/zrwusa/data-structure-typed/blob/
|
|
447
|
+
Defined in: [data-structures/queue/deque.ts:244](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L244)
|
|
448
448
|
|
|
449
449
|
Get the number of elements in the deque.
|
|
450
450
|
|
|
@@ -472,7 +472,7 @@ Current length.
|
|
|
472
472
|
get maxLen(): number;
|
|
473
473
|
```
|
|
474
474
|
|
|
475
|
-
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/
|
|
475
|
+
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L100)
|
|
476
476
|
|
|
477
477
|
Upper bound for length (if positive), or `-1` when unbounded.
|
|
478
478
|
|
|
@@ -500,7 +500,7 @@ Maximum allowed length.
|
|
|
500
500
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
501
501
|
```
|
|
502
502
|
|
|
503
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
503
|
+
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L48)
|
|
504
504
|
|
|
505
505
|
Exposes the current `toElementFn`, if configured.
|
|
506
506
|
|
|
@@ -526,7 +526,7 @@ The converter function or `undefined` when not set.
|
|
|
526
526
|
iterator: IterableIterator<E>;
|
|
527
527
|
```
|
|
528
528
|
|
|
529
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
529
|
+
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L61)
|
|
530
530
|
|
|
531
531
|
Returns an iterator over the structure's elements.
|
|
532
532
|
|
|
@@ -563,7 +563,7 @@ addAt(
|
|
|
563
563
|
num?): boolean;
|
|
564
564
|
```
|
|
565
565
|
|
|
566
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
566
|
+
Defined in: [data-structures/queue/deque.ts:876](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L876)
|
|
567
567
|
|
|
568
568
|
Insert repeated copies of an element at a position.
|
|
569
569
|
|
|
@@ -609,7 +609,7 @@ Time O(N), Space O(1)
|
|
|
609
609
|
at(pos): E | undefined;
|
|
610
610
|
```
|
|
611
611
|
|
|
612
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
612
|
+
Defined in: [data-structures/queue/deque.ts:846](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L846)
|
|
613
613
|
|
|
614
614
|
Get the element at a given position.
|
|
615
615
|
|
|
@@ -654,7 +654,7 @@ Time O(1), Space O(1)
|
|
|
654
654
|
clear(): void;
|
|
655
655
|
```
|
|
656
656
|
|
|
657
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
657
|
+
Defined in: [data-structures/queue/deque.ts:795](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L795)
|
|
658
658
|
|
|
659
659
|
Remove all elements and reset structure.
|
|
660
660
|
|
|
@@ -691,7 +691,7 @@ Time O(1), Space O(1)
|
|
|
691
691
|
clone(): this;
|
|
692
692
|
```
|
|
693
693
|
|
|
694
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
694
|
+
Defined in: [data-structures/queue/deque.ts:1358](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1358)
|
|
695
695
|
|
|
696
696
|
Deep clone this deque, preserving options.
|
|
697
697
|
|
|
@@ -730,7 +730,7 @@ Time O(N), Space O(N)
|
|
|
730
730
|
compact(): boolean;
|
|
731
731
|
```
|
|
732
732
|
|
|
733
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
733
|
+
Defined in: [data-structures/queue/deque.ts:1284](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1284)
|
|
734
734
|
|
|
735
735
|
Compact the deque by removing unused buckets.
|
|
736
736
|
|
|
@@ -765,7 +765,7 @@ Time O(N), Space O(1)
|
|
|
765
765
|
concat(...items): this;
|
|
766
766
|
```
|
|
767
767
|
|
|
768
|
-
Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/
|
|
768
|
+
Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L165)
|
|
769
769
|
|
|
770
770
|
Concatenate elements and/or containers.
|
|
771
771
|
|
|
@@ -799,7 +799,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
799
799
|
cut(pos, isCutSelf?): Deque<E>;
|
|
800
800
|
```
|
|
801
801
|
|
|
802
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
802
|
+
Defined in: [data-structures/queue/deque.ts:904](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L904)
|
|
803
803
|
|
|
804
804
|
Cut the deque to keep items up to index; optionally mutate in-place.
|
|
805
805
|
|
|
@@ -835,7 +835,7 @@ Time O(N), Space O(1)
|
|
|
835
835
|
cutRest(pos, isCutSelf?): Deque<E>;
|
|
836
836
|
```
|
|
837
837
|
|
|
838
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
838
|
+
Defined in: [data-structures/queue/deque.ts:971](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L971)
|
|
839
839
|
|
|
840
840
|
Cut the deque to keep items from index onward; optionally mutate in-place.
|
|
841
841
|
|
|
@@ -871,7 +871,7 @@ Time O(N), Space O(1)
|
|
|
871
871
|
delete(element): boolean;
|
|
872
872
|
```
|
|
873
873
|
|
|
874
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
874
|
+
Defined in: [data-structures/queue/deque.ts:1070](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1070)
|
|
875
875
|
|
|
876
876
|
Delete the first occurrence of a value.
|
|
877
877
|
|
|
@@ -916,7 +916,7 @@ Time O(N), Space O(1)
|
|
|
916
916
|
deleteAt(pos): E | undefined;
|
|
917
917
|
```
|
|
918
918
|
|
|
919
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
919
|
+
Defined in: [data-structures/queue/deque.ts:1000](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1000)
|
|
920
920
|
|
|
921
921
|
Delete the element at a given position.
|
|
922
922
|
|
|
@@ -950,7 +950,7 @@ Time O(N), Space O(1)
|
|
|
950
950
|
deleteWhere(predicate): boolean;
|
|
951
951
|
```
|
|
952
952
|
|
|
953
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
953
|
+
Defined in: [data-structures/queue/deque.ts:1094](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1094)
|
|
954
954
|
|
|
955
955
|
Delete the first element matching a predicate.
|
|
956
956
|
|
|
@@ -980,7 +980,7 @@ Time O(N), Space O(1)
|
|
|
980
980
|
every(predicate, thisArg?): boolean;
|
|
981
981
|
```
|
|
982
982
|
|
|
983
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
983
|
+
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L87)
|
|
984
984
|
|
|
985
985
|
Tests whether all elements satisfy the predicate.
|
|
986
986
|
|
|
@@ -1023,7 +1023,7 @@ fill(
|
|
|
1023
1023
|
end?): this;
|
|
1024
1024
|
```
|
|
1025
1025
|
|
|
1026
|
-
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1026
|
+
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L292)
|
|
1027
1027
|
|
|
1028
1028
|
Fill a range with a value.
|
|
1029
1029
|
|
|
@@ -1069,7 +1069,7 @@ Time O(n), Space O(1)
|
|
|
1069
1069
|
filter(predicate, thisArg?): this;
|
|
1070
1070
|
```
|
|
1071
1071
|
|
|
1072
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1072
|
+
Defined in: [data-structures/queue/deque.ts:1412](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1412)
|
|
1073
1073
|
|
|
1074
1074
|
Filter elements into a new deque of the same class.
|
|
1075
1075
|
|
|
@@ -1083,7 +1083,7 @@ Predicate (value, index, deque) → boolean to keep element.
|
|
|
1083
1083
|
|
|
1084
1084
|
##### thisArg?
|
|
1085
1085
|
|
|
1086
|
-
`
|
|
1086
|
+
`unknown`
|
|
1087
1087
|
|
|
1088
1088
|
Value for `this` inside the predicate.
|
|
1089
1089
|
|
|
@@ -1122,7 +1122,7 @@ Time O(N), Space O(N)
|
|
|
1122
1122
|
find<S>(predicate, thisArg?): S | undefined;
|
|
1123
1123
|
```
|
|
1124
1124
|
|
|
1125
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1125
|
+
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L163)
|
|
1126
1126
|
|
|
1127
1127
|
Finds the first element that satisfies the predicate and returns it.
|
|
1128
1128
|
|
|
@@ -1168,7 +1168,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1168
1168
|
find(predicate, thisArg?): E | undefined;
|
|
1169
1169
|
```
|
|
1170
1170
|
|
|
1171
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1171
|
+
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L164)
|
|
1172
1172
|
|
|
1173
1173
|
Finds the first element that satisfies the predicate and returns it.
|
|
1174
1174
|
|
|
@@ -1210,7 +1210,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1210
1210
|
findIndex(predicate, thisArg?): number;
|
|
1211
1211
|
```
|
|
1212
1212
|
|
|
1213
|
-
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1213
|
+
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L151)
|
|
1214
1214
|
|
|
1215
1215
|
Find the first index matching a predicate.
|
|
1216
1216
|
|
|
@@ -1224,7 +1224,7 @@ Find the first index matching a predicate.
|
|
|
1224
1224
|
|
|
1225
1225
|
##### thisArg?
|
|
1226
1226
|
|
|
1227
|
-
`
|
|
1227
|
+
`unknown`
|
|
1228
1228
|
|
|
1229
1229
|
Optional `this` for callback.
|
|
1230
1230
|
|
|
@@ -1250,7 +1250,7 @@ Time O(n), Space O(1)
|
|
|
1250
1250
|
forEach(callbackfn, thisArg?): void;
|
|
1251
1251
|
```
|
|
1252
1252
|
|
|
1253
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1253
|
+
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L133)
|
|
1254
1254
|
|
|
1255
1255
|
Invokes a callback for each element in iteration order.
|
|
1256
1256
|
|
|
@@ -1290,7 +1290,7 @@ Time O(n), Space O(1).
|
|
|
1290
1290
|
has(element): boolean;
|
|
1291
1291
|
```
|
|
1292
1292
|
|
|
1293
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1293
|
+
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L189)
|
|
1294
1294
|
|
|
1295
1295
|
Checks whether a strictly-equal element exists in the structure.
|
|
1296
1296
|
|
|
@@ -1324,7 +1324,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1324
1324
|
indexOf(searchElement, fromIndex?): number;
|
|
1325
1325
|
```
|
|
1326
1326
|
|
|
1327
|
-
Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1327
|
+
Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L111)
|
|
1328
1328
|
|
|
1329
1329
|
First index of a value from the left.
|
|
1330
1330
|
|
|
@@ -1364,7 +1364,7 @@ Time O(n), Space O(1)
|
|
|
1364
1364
|
isEmpty(): boolean;
|
|
1365
1365
|
```
|
|
1366
1366
|
|
|
1367
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1367
|
+
Defined in: [data-structures/queue/deque.ts:747](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L747)
|
|
1368
1368
|
|
|
1369
1369
|
Check whether the deque is empty.
|
|
1370
1370
|
|
|
@@ -1400,7 +1400,7 @@ Time O(1), Space O(1)
|
|
|
1400
1400
|
join(separator?): string;
|
|
1401
1401
|
```
|
|
1402
1402
|
|
|
1403
|
-
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1403
|
+
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L228)
|
|
1404
1404
|
|
|
1405
1405
|
Join all elements into a string.
|
|
1406
1406
|
|
|
@@ -1434,7 +1434,7 @@ Time O(n), Space O(n)
|
|
|
1434
1434
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1435
1435
|
```
|
|
1436
1436
|
|
|
1437
|
-
Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1437
|
+
Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L131)
|
|
1438
1438
|
|
|
1439
1439
|
Last index of a value from the right.
|
|
1440
1440
|
|
|
@@ -1477,7 +1477,7 @@ map<EM, RM>(
|
|
|
1477
1477
|
thisArg?): Deque<EM, RM>;
|
|
1478
1478
|
```
|
|
1479
1479
|
|
|
1480
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1480
|
+
Defined in: [data-structures/queue/deque.ts:1490](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1490)
|
|
1481
1481
|
|
|
1482
1482
|
Map elements into a new deque (possibly different element type).
|
|
1483
1483
|
|
|
@@ -1507,7 +1507,7 @@ Options for the output deque (e.g., bucketSize, toElementFn, maxLen).
|
|
|
1507
1507
|
|
|
1508
1508
|
##### thisArg?
|
|
1509
1509
|
|
|
1510
|
-
`
|
|
1510
|
+
`unknown`
|
|
1511
1511
|
|
|
1512
1512
|
Value for `this` inside the callback.
|
|
1513
1513
|
|
|
@@ -1544,7 +1544,7 @@ Time O(N), Space O(N)
|
|
|
1544
1544
|
mapSame(callback, thisArg?): this;
|
|
1545
1545
|
```
|
|
1546
1546
|
|
|
1547
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1547
|
+
Defined in: [data-structures/queue/deque.ts:1431](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1431)
|
|
1548
1548
|
|
|
1549
1549
|
Map elements into a new deque of the same element type.
|
|
1550
1550
|
|
|
@@ -1558,7 +1558,7 @@ Mapping function (value, index, deque) → newValue.
|
|
|
1558
1558
|
|
|
1559
1559
|
##### thisArg?
|
|
1560
1560
|
|
|
1561
|
-
`
|
|
1561
|
+
`unknown`
|
|
1562
1562
|
|
|
1563
1563
|
Value for `this` inside the callback.
|
|
1564
1564
|
|
|
@@ -1584,7 +1584,7 @@ Time O(N), Space O(N)
|
|
|
1584
1584
|
pop(): E | undefined;
|
|
1585
1585
|
```
|
|
1586
1586
|
|
|
1587
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1587
|
+
Defined in: [data-structures/queue/deque.ts:506](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L506)
|
|
1588
1588
|
|
|
1589
1589
|
Remove and return the last element.
|
|
1590
1590
|
|
|
@@ -1617,7 +1617,7 @@ Time O(1), Space O(1)
|
|
|
1617
1617
|
print(): void;
|
|
1618
1618
|
```
|
|
1619
1619
|
|
|
1620
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1620
|
+
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L269)
|
|
1621
1621
|
|
|
1622
1622
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1623
1623
|
|
|
@@ -1643,7 +1643,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1643
1643
|
push(element): boolean;
|
|
1644
1644
|
```
|
|
1645
1645
|
|
|
1646
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1646
|
+
Defined in: [data-structures/queue/deque.ts:441](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L441)
|
|
1647
1647
|
|
|
1648
1648
|
Append one element at the back.
|
|
1649
1649
|
|
|
@@ -1701,7 +1701,7 @@ Time O(1) amortized, Space O(1)
|
|
|
1701
1701
|
pushMany(elements): boolean[];
|
|
1702
1702
|
```
|
|
1703
1703
|
|
|
1704
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1704
|
+
Defined in: [data-structures/queue/deque.ts:673](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L673)
|
|
1705
1705
|
|
|
1706
1706
|
Append a sequence of elements.
|
|
1707
1707
|
|
|
@@ -1767,7 +1767,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1767
1767
|
reduce(callbackfn): E;
|
|
1768
1768
|
```
|
|
1769
1769
|
|
|
1770
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1770
|
+
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L194)
|
|
1771
1771
|
|
|
1772
1772
|
##### Parameters
|
|
1773
1773
|
|
|
@@ -1789,7 +1789,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:193](https://github.c
|
|
|
1789
1789
|
reduce(callbackfn, initialValue): E;
|
|
1790
1790
|
```
|
|
1791
1791
|
|
|
1792
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1792
|
+
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L195)
|
|
1793
1793
|
|
|
1794
1794
|
##### Parameters
|
|
1795
1795
|
|
|
@@ -1815,7 +1815,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1815
1815
|
reduce<U>(callbackfn, initialValue): U;
|
|
1816
1816
|
```
|
|
1817
1817
|
|
|
1818
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
1818
|
+
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L196)
|
|
1819
1819
|
|
|
1820
1820
|
##### Type Parameters
|
|
1821
1821
|
|
|
@@ -1849,7 +1849,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1849
1849
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1850
1850
|
```
|
|
1851
1851
|
|
|
1852
|
-
Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1852
|
+
Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L256)
|
|
1853
1853
|
|
|
1854
1854
|
Right-to-left reduction over elements.
|
|
1855
1855
|
|
|
@@ -1895,7 +1895,7 @@ Time O(n), Space O(1)
|
|
|
1895
1895
|
reverse(): this;
|
|
1896
1896
|
```
|
|
1897
1897
|
|
|
1898
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1898
|
+
Defined in: [data-structures/queue/deque.ts:1176](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1176)
|
|
1899
1899
|
|
|
1900
1900
|
Reverse the deque by reversing buckets and pointers.
|
|
1901
1901
|
|
|
@@ -1945,7 +1945,7 @@ Time O(N), Space O(N)
|
|
|
1945
1945
|
setAt(pos, element): boolean;
|
|
1946
1946
|
```
|
|
1947
1947
|
|
|
1948
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1948
|
+
Defined in: [data-structures/queue/deque.ts:860](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L860)
|
|
1949
1949
|
|
|
1950
1950
|
Replace the element at a given position.
|
|
1951
1951
|
|
|
@@ -1985,7 +1985,7 @@ Time O(1), Space O(1)
|
|
|
1985
1985
|
setEquality(equals): this;
|
|
1986
1986
|
```
|
|
1987
1987
|
|
|
1988
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1988
|
+
Defined in: [data-structures/queue/deque.ts:1112](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1112)
|
|
1989
1989
|
|
|
1990
1990
|
Set the equality comparator used by delete operations.
|
|
1991
1991
|
|
|
@@ -2015,7 +2015,7 @@ Time O(1), Space O(1)
|
|
|
2015
2015
|
shift(): E | undefined;
|
|
2016
2016
|
```
|
|
2017
2017
|
|
|
2018
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2018
|
+
Defined in: [data-structures/queue/deque.ts:571](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L571)
|
|
2019
2019
|
|
|
2020
2020
|
Remove and return the first element.
|
|
2021
2021
|
|
|
@@ -2048,7 +2048,7 @@ Time O(1) amortized, Space O(1)
|
|
|
2048
2048
|
slice(start?, end?): this;
|
|
2049
2049
|
```
|
|
2050
2050
|
|
|
2051
|
-
Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2051
|
+
Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L273)
|
|
2052
2052
|
|
|
2053
2053
|
Create a shallow copy of a subrange.
|
|
2054
2054
|
|
|
@@ -2088,7 +2088,7 @@ Time O(n), Space O(n)
|
|
|
2088
2088
|
some(predicate, thisArg?): boolean;
|
|
2089
2089
|
```
|
|
2090
2090
|
|
|
2091
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2091
|
+
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L110)
|
|
2092
2092
|
|
|
2093
2093
|
Tests whether at least one element satisfies the predicate.
|
|
2094
2094
|
|
|
@@ -2128,7 +2128,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2128
2128
|
sort(compareFn?): this;
|
|
2129
2129
|
```
|
|
2130
2130
|
|
|
2131
|
-
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2131
|
+
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L185)
|
|
2132
2132
|
|
|
2133
2133
|
In-place stable order via array sort semantics.
|
|
2134
2134
|
|
|
@@ -2165,7 +2165,7 @@ splice(
|
|
|
2165
2165
|
items?): this;
|
|
2166
2166
|
```
|
|
2167
2167
|
|
|
2168
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2168
|
+
Defined in: [data-structures/queue/deque.ts:936](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L936)
|
|
2169
2169
|
|
|
2170
2170
|
Remove and/or insert elements at a position (array-like behavior).
|
|
2171
2171
|
|
|
@@ -2211,7 +2211,7 @@ Time O(N + M), Space O(M)
|
|
|
2211
2211
|
toArray(): E[];
|
|
2212
2212
|
```
|
|
2213
2213
|
|
|
2214
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2214
|
+
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L246)
|
|
2215
2215
|
|
|
2216
2216
|
Materializes the elements into a new array.
|
|
2217
2217
|
|
|
@@ -2237,7 +2237,7 @@ Time O(n), Space O(n).
|
|
|
2237
2237
|
toReversedArray(): E[];
|
|
2238
2238
|
```
|
|
2239
2239
|
|
|
2240
|
-
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2240
|
+
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/linear-base.ts#L237)
|
|
2241
2241
|
|
|
2242
2242
|
Snapshot elements into a reversed array.
|
|
2243
2243
|
|
|
@@ -2263,7 +2263,7 @@ Time O(n), Space O(n)
|
|
|
2263
2263
|
toVisual(): E[];
|
|
2264
2264
|
```
|
|
2265
2265
|
|
|
2266
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2266
|
+
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L258)
|
|
2267
2267
|
|
|
2268
2268
|
Returns a representation of the structure suitable for quick visualization.
|
|
2269
2269
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2290,7 +2290,7 @@ Time O(n), Space O(n).
|
|
|
2290
2290
|
unique(): this;
|
|
2291
2291
|
```
|
|
2292
2292
|
|
|
2293
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2293
|
+
Defined in: [data-structures/queue/deque.ts:1194](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1194)
|
|
2294
2294
|
|
|
2295
2295
|
Deduplicate consecutive equal elements in-place.
|
|
2296
2296
|
|
|
@@ -2312,7 +2312,7 @@ Time O(N), Space O(1)
|
|
|
2312
2312
|
unshift(element): boolean;
|
|
2313
2313
|
```
|
|
2314
2314
|
|
|
2315
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2315
|
+
Defined in: [data-structures/queue/deque.ts:647](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L647)
|
|
2316
2316
|
|
|
2317
2317
|
Prepend one element at the front.
|
|
2318
2318
|
|
|
@@ -2363,7 +2363,7 @@ Time O(1) amortized, Space O(1)
|
|
|
2363
2363
|
unshiftMany(elements?): boolean[];
|
|
2364
2364
|
```
|
|
2365
2365
|
|
|
2366
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2366
|
+
Defined in: [data-structures/queue/deque.ts:692](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L692)
|
|
2367
2367
|
|
|
2368
2368
|
Prepend a sequence of elements.
|
|
2369
2369
|
|
|
@@ -2393,7 +2393,7 @@ Time O(N), Space O(1)
|
|
|
2393
2393
|
values(): IterableIterator<E>;
|
|
2394
2394
|
```
|
|
2395
2395
|
|
|
2396
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2396
|
+
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L72)
|
|
2397
2397
|
|
|
2398
2398
|
Returns an iterator over the values (alias of the default iterator).
|
|
2399
2399
|
|
|
@@ -2422,7 +2422,7 @@ static fromArray<E, R>(
|
|
|
2422
2422
|
options?): any;
|
|
2423
2423
|
```
|
|
2424
2424
|
|
|
2425
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2425
|
+
Defined in: [data-structures/queue/deque.ts:370](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L370)
|
|
2426
2426
|
|
|
2427
2427
|
Create a Deque from an array of elements.
|
|
2428
2428
|
|
|
@@ -2477,7 +2477,7 @@ Time O(N), Space O(N)
|
|
|
2477
2477
|
protected _compactCounter: number = 0;
|
|
2478
2478
|
```
|
|
2479
2479
|
|
|
2480
|
-
Defined in: [data-structures/queue/deque.ts:162](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2480
|
+
Defined in: [data-structures/queue/deque.ts:162](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L162)
|
|
2481
2481
|
|
|
2482
2482
|
Counter for shift/pop operations since last compaction check.
|
|
2483
2483
|
Only checks ratio every `_bucketSize` operations to minimize overhead.
|
|
@@ -2490,7 +2490,7 @@ Only checks ratio every `_bucketSize` operations to minimize overhead.
|
|
|
2490
2490
|
protected optional _toElementFn?: (rawElement) => E;
|
|
2491
2491
|
```
|
|
2492
2492
|
|
|
2493
|
-
Defined in: [data-structures/base/iterable-element-base.ts:
|
|
2493
|
+
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/base/iterable-element-base.ts#L39)
|
|
2494
2494
|
|
|
2495
2495
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
2496
2496
|
|
|
@@ -2520,7 +2520,7 @@ Time O(1), Space O(1).
|
|
|
2520
2520
|
protected _autoCompact(): void;
|
|
2521
2521
|
```
|
|
2522
2522
|
|
|
2523
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2523
|
+
Defined in: [data-structures/queue/deque.ts:1222](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1222)
|
|
2524
2524
|
|
|
2525
2525
|
(Protected) Trigger auto-compaction if space utilization drops below threshold.
|
|
2526
2526
|
Only checks every `_bucketSize` operations to minimize hot-path overhead.
|
|
@@ -2538,7 +2538,7 @@ Uses element-based ratio: `elements / (bucketCount * bucketSize)`.
|
|
|
2538
2538
|
protected _createInstance(options?): this;
|
|
2539
2539
|
```
|
|
2540
2540
|
|
|
2541
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2541
|
+
Defined in: [data-structures/queue/deque.ts:1605](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1605)
|
|
2542
2542
|
|
|
2543
2543
|
(Protected) Create an empty instance of the same concrete class.
|
|
2544
2544
|
|
|
@@ -2569,10 +2569,10 @@ Time O(1), Space O(1)
|
|
|
2569
2569
|
### \_createLike()
|
|
2570
2570
|
|
|
2571
2571
|
```ts
|
|
2572
|
-
protected _createLike<T, RR>(elements?, options?):
|
|
2572
|
+
protected _createLike<T, RR>(elements?, options?): Deque<T, RR>;
|
|
2573
2573
|
```
|
|
2574
2574
|
|
|
2575
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2575
|
+
Defined in: [data-structures/queue/deque.ts:1623](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1623)
|
|
2576
2576
|
|
|
2577
2577
|
(Protected) Create a like-kind deque seeded by elements.
|
|
2578
2578
|
|
|
@@ -2602,7 +2602,7 @@ Options forwarded to the constructor.
|
|
|
2602
2602
|
|
|
2603
2603
|
#### Returns
|
|
2604
2604
|
|
|
2605
|
-
`
|
|
2605
|
+
`Deque`\<`T`, `RR`\>
|
|
2606
2606
|
|
|
2607
2607
|
A like-kind Deque instance.
|
|
2608
2608
|
|
|
@@ -2618,7 +2618,7 @@ Time O(N), Space O(N)
|
|
|
2618
2618
|
protected _getBucketAndPosition(pos): object;
|
|
2619
2619
|
```
|
|
2620
2620
|
|
|
2621
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2621
|
+
Defined in: [data-structures/queue/deque.ts:1579](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1579)
|
|
2622
2622
|
|
|
2623
2623
|
(Protected) Translate a logical position to bucket/offset.
|
|
2624
2624
|
|
|
@@ -2660,7 +2660,7 @@ Time O(1), Space O(1)
|
|
|
2660
2660
|
protected _getIterator(): IterableIterator<E>;
|
|
2661
2661
|
```
|
|
2662
2662
|
|
|
2663
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2663
|
+
Defined in: [data-structures/queue/deque.ts:1536](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1536)
|
|
2664
2664
|
|
|
2665
2665
|
(Protected) Iterate elements from front to back.
|
|
2666
2666
|
|
|
@@ -2686,7 +2686,7 @@ Time O(N), Space O(1)
|
|
|
2686
2686
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2687
2687
|
```
|
|
2688
2688
|
|
|
2689
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2689
|
+
Defined in: [data-structures/queue/deque.ts:1640](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1640)
|
|
2690
2690
|
|
|
2691
2691
|
(Protected) Iterate elements from back to front.
|
|
2692
2692
|
|
|
@@ -2712,7 +2712,7 @@ Time O(N), Space O(1)
|
|
|
2712
2712
|
protected _reallocate(needBucketNum?): void;
|
|
2713
2713
|
```
|
|
2714
2714
|
|
|
2715
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2715
|
+
Defined in: [data-structures/queue/deque.ts:1550](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1550)
|
|
2716
2716
|
|
|
2717
2717
|
(Protected) Reallocate buckets to make room near the ends.
|
|
2718
2718
|
|
|
@@ -2742,7 +2742,7 @@ Time O(N), Space O(N)
|
|
|
2742
2742
|
protected _setBucketSize(size): void;
|
|
2743
2743
|
```
|
|
2744
2744
|
|
|
2745
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2745
|
+
Defined in: [data-structures/queue/deque.ts:1516](https://github.com/zrwusa/data-structure-typed/blob/8292cb978daf85ebe846186c7c7572aece04fb7b/src/data-structures/queue/deque.ts#L1516)
|
|
2746
2746
|
|
|
2747
2747
|
(Protected) Set the internal bucket size.
|
|
2748
2748
|
|