data-structure-typed 2.5.2 → 2.6.0
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/.husky/pre-commit +3 -0
- package/CHANGELOG.md +3 -1
- package/MIGRATION.md +217 -0
- package/README.md +80 -8
- package/README_CN.md +569 -143
- package/SPECIFICATION.md +44 -14
- package/SPECIFICATION.zh-CN.md +44 -14
- package/dist/cjs/binary-tree.cjs +5841 -1678
- package/dist/cjs/graph.cjs +422 -14
- package/dist/cjs/hash.cjs +95 -7
- package/dist/cjs/heap.cjs +174 -16
- package/dist/cjs/index.cjs +7751 -2449
- package/dist/cjs/linked-list.cjs +443 -2
- package/dist/cjs/matrix.cjs +56 -0
- package/dist/cjs/priority-queue.cjs +172 -14
- package/dist/cjs/queue.cjs +435 -0
- package/dist/cjs/stack.cjs +103 -4
- package/dist/cjs/trie.cjs +106 -0
- package/dist/cjs-legacy/binary-tree.cjs +5933 -1772
- package/dist/cjs-legacy/graph.cjs +422 -14
- package/dist/cjs-legacy/hash.cjs +95 -7
- package/dist/cjs-legacy/heap.cjs +174 -16
- package/dist/cjs-legacy/index.cjs +8154 -2854
- package/dist/cjs-legacy/linked-list.cjs +443 -2
- package/dist/cjs-legacy/matrix.cjs +56 -0
- package/dist/cjs-legacy/priority-queue.cjs +172 -14
- package/dist/cjs-legacy/queue.cjs +435 -0
- package/dist/cjs-legacy/stack.cjs +103 -4
- package/dist/cjs-legacy/trie.cjs +106 -0
- package/dist/esm/binary-tree.mjs +5841 -1678
- package/dist/esm/graph.mjs +422 -14
- package/dist/esm/hash.mjs +95 -7
- package/dist/esm/heap.mjs +174 -16
- package/dist/esm/index.mjs +7751 -2449
- package/dist/esm/linked-list.mjs +443 -2
- package/dist/esm/matrix.mjs +56 -0
- package/dist/esm/priority-queue.mjs +172 -14
- package/dist/esm/queue.mjs +435 -0
- package/dist/esm/stack.mjs +103 -4
- package/dist/esm/trie.mjs +106 -0
- package/dist/esm-legacy/binary-tree.mjs +5933 -1772
- package/dist/esm-legacy/graph.mjs +422 -14
- package/dist/esm-legacy/hash.mjs +95 -7
- package/dist/esm-legacy/heap.mjs +174 -16
- package/dist/esm-legacy/index.mjs +8154 -2854
- package/dist/esm-legacy/linked-list.mjs +443 -2
- package/dist/esm-legacy/matrix.mjs +56 -0
- package/dist/esm-legacy/priority-queue.mjs +172 -14
- package/dist/esm-legacy/queue.mjs +435 -0
- package/dist/esm-legacy/stack.mjs +103 -4
- package/dist/esm-legacy/trie.mjs +106 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +191 -15
- package/dist/types/data-structures/binary-tree/bst.d.ts +171 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1061 -167
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1232 -355
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +916 -194
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1078 -141
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +150 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +171 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/umd/data-structure-typed.js +7784 -2484
- package/dist/umd/data-structure-typed.min.js +4 -4
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +188 -200
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +62 -62
- package/docs-site-docusaurus/docs/api/classes/BST.md +183 -195
- 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 +143 -155
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +99 -85
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +100 -70
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +12 -12
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/Heap.md +96 -85
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +48 -48
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +52 -52
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +46 -42
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +73 -73
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +104 -89
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +103 -88
- package/docs-site-docusaurus/docs/api/classes/Queue.md +111 -59
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +200 -212
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +75 -75
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +37 -37
- package/docs-site-docusaurus/docs/api/classes/Stack.md +42 -42
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +107 -36
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +106 -35
- package/docs-site-docusaurus/docs/api/classes/Trie.md +43 -43
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +72 -72
- package/docs-site-docusaurus/docs/guide/architecture.md +75 -7
- package/docs-site-docusaurus/docs/guide/concepts.md +53 -34
- package/docs-site-docusaurus/docs/guide/faq.md +53 -0
- package/docs-site-docusaurus/docs/guide/guides.md +8 -9
- package/docs-site-docusaurus/docs/guide/integrations.md +74 -177
- package/docs-site-docusaurus/docs/guide/overview.md +131 -17
- package/docs-site-docusaurus/src/pages/index.tsx +4 -0
- package/docs-site-docusaurus/typedoc.json +1 -0
- package/jest.integration.config.js +1 -2
- package/package.json +10 -7
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +88 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +98 -0
- package/src/data-structures/binary-tree/binary-tree.ts +242 -81
- package/src/data-structures/binary-tree/bst.ts +173 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +139 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +948 -36
- package/src/data-structures/binary-tree/tree-multi-map.ts +893 -13
- package/src/data-structures/binary-tree/tree-multi-set.ts +761 -33
- package/src/data-structures/binary-tree/tree-set.ts +1260 -251
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +100 -12
- package/src/data-structures/heap/heap.ts +149 -19
- package/src/data-structures/linked-list/doubly-linked-list.ts +178 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +126 -0
- package/src/data-structures/matrix/matrix.ts +56 -0
- package/src/data-structures/queue/deque.ts +187 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +84 -0
- package/src/interfaces/binary-tree.ts +1 -9
- package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +0 -12984
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +0 -3
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +0 -4505
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +0 -9731
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +0 -347
|
@@ -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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/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/main/src/data-structures/queue/deque.ts#L132)
|
|
297
297
|
|
|
298
298
|
Get the current bucket size.
|
|
299
299
|
|
|
@@ -317,13 +317,9 @@ 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:332](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L332)
|
|
321
321
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
##### Remarks
|
|
325
|
-
|
|
326
|
-
Time O(1), Space O(1)
|
|
322
|
+
Deque peek at both ends
|
|
327
323
|
|
|
328
324
|
##### Example
|
|
329
325
|
|
|
@@ -347,10 +343,6 @@ Time O(1), Space O(1)
|
|
|
347
343
|
|
|
348
344
|
`E` \| `undefined`
|
|
349
345
|
|
|
350
|
-
First element or undefined.
|
|
351
|
-
|
|
352
|
-
*
|
|
353
|
-
|
|
354
346
|
***
|
|
355
347
|
|
|
356
348
|
### firstInBucket
|
|
@@ -361,7 +353,7 @@ First element or undefined.
|
|
|
361
353
|
get firstInBucket(): number;
|
|
362
354
|
```
|
|
363
355
|
|
|
364
|
-
Defined in: [data-structures/queue/deque.ts:184](https://github.com/zrwusa/data-structure-typed/blob/
|
|
356
|
+
Defined in: [data-structures/queue/deque.ts:184](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L184)
|
|
365
357
|
|
|
366
358
|
Get the index inside the first bucket.
|
|
367
359
|
|
|
@@ -385,7 +377,7 @@ Zero-based index within the first bucket.
|
|
|
385
377
|
get last(): E | undefined;
|
|
386
378
|
```
|
|
387
379
|
|
|
388
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
380
|
+
Defined in: [data-structures/queue/deque.ts:387](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L387)
|
|
389
381
|
|
|
390
382
|
Get the last element without removing it.
|
|
391
383
|
|
|
@@ -420,7 +412,7 @@ Last element or undefined.
|
|
|
420
412
|
get lastInBucket(): number;
|
|
421
413
|
```
|
|
422
414
|
|
|
423
|
-
Defined in: [data-structures/queue/deque.ts:208](https://github.com/zrwusa/data-structure-typed/blob/
|
|
415
|
+
Defined in: [data-structures/queue/deque.ts:208](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L208)
|
|
424
416
|
|
|
425
417
|
Get the index inside the last bucket.
|
|
426
418
|
|
|
@@ -444,7 +436,7 @@ Zero-based index within the last bucket.
|
|
|
444
436
|
get length(): number;
|
|
445
437
|
```
|
|
446
438
|
|
|
447
|
-
Defined in: [data-structures/queue/deque.ts:244](https://github.com/zrwusa/data-structure-typed/blob/
|
|
439
|
+
Defined in: [data-structures/queue/deque.ts:244](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L244)
|
|
448
440
|
|
|
449
441
|
Get the number of elements in the deque.
|
|
450
442
|
|
|
@@ -472,7 +464,7 @@ Current length.
|
|
|
472
464
|
get maxLen(): number;
|
|
473
465
|
```
|
|
474
466
|
|
|
475
|
-
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/
|
|
467
|
+
Defined in: [data-structures/base/linear-base.ts:100](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L100)
|
|
476
468
|
|
|
477
469
|
Upper bound for length (if positive), or `-1` when unbounded.
|
|
478
470
|
|
|
@@ -500,7 +492,7 @@ Maximum allowed length.
|
|
|
500
492
|
get toElementFn(): ((rawElement) => E) | undefined;
|
|
501
493
|
```
|
|
502
494
|
|
|
503
|
-
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/
|
|
495
|
+
Defined in: [data-structures/base/iterable-element-base.ts:48](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L48)
|
|
504
496
|
|
|
505
497
|
Exposes the current `toElementFn`, if configured.
|
|
506
498
|
|
|
@@ -526,7 +518,7 @@ The converter function or `undefined` when not set.
|
|
|
526
518
|
iterator: IterableIterator<E>;
|
|
527
519
|
```
|
|
528
520
|
|
|
529
|
-
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/
|
|
521
|
+
Defined in: [data-structures/base/iterable-element-base.ts:61](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L61)
|
|
530
522
|
|
|
531
523
|
Returns an iterator over the structure's elements.
|
|
532
524
|
|
|
@@ -563,7 +555,7 @@ addAt(
|
|
|
563
555
|
num?): boolean;
|
|
564
556
|
```
|
|
565
557
|
|
|
566
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
558
|
+
Defined in: [data-structures/queue/deque.ts:937](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L937)
|
|
567
559
|
|
|
568
560
|
Insert repeated copies of an element at a position.
|
|
569
561
|
|
|
@@ -609,7 +601,7 @@ Time O(N), Space O(1)
|
|
|
609
601
|
at(pos): E | undefined;
|
|
610
602
|
```
|
|
611
603
|
|
|
612
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
604
|
+
Defined in: [data-structures/queue/deque.ts:907](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L907)
|
|
613
605
|
|
|
614
606
|
Get the element at a given position.
|
|
615
607
|
|
|
@@ -654,7 +646,7 @@ Time O(1), Space O(1)
|
|
|
654
646
|
clear(): void;
|
|
655
647
|
```
|
|
656
648
|
|
|
657
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
649
|
+
Defined in: [data-structures/queue/deque.ts:852](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L852)
|
|
658
650
|
|
|
659
651
|
Remove all elements and reset structure.
|
|
660
652
|
|
|
@@ -691,7 +683,7 @@ Time O(1), Space O(1)
|
|
|
691
683
|
clone(): this;
|
|
692
684
|
```
|
|
693
685
|
|
|
694
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
686
|
+
Defined in: [data-structures/queue/deque.ts:1435](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1435)
|
|
695
687
|
|
|
696
688
|
Deep clone this deque, preserving options.
|
|
697
689
|
|
|
@@ -730,7 +722,7 @@ Time O(N), Space O(N)
|
|
|
730
722
|
compact(): boolean;
|
|
731
723
|
```
|
|
732
724
|
|
|
733
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
725
|
+
Defined in: [data-structures/queue/deque.ts:1357](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1357)
|
|
734
726
|
|
|
735
727
|
Compact the deque by removing unused buckets.
|
|
736
728
|
|
|
@@ -765,7 +757,7 @@ Time O(N), Space O(1)
|
|
|
765
757
|
concat(...items): this;
|
|
766
758
|
```
|
|
767
759
|
|
|
768
|
-
Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/
|
|
760
|
+
Defined in: [data-structures/base/linear-base.ts:165](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L165)
|
|
769
761
|
|
|
770
762
|
Concatenate elements and/or containers.
|
|
771
763
|
|
|
@@ -799,7 +791,7 @@ Time O(sum(length)), Space O(sum(length))
|
|
|
799
791
|
cut(pos, isCutSelf?): Deque<E>;
|
|
800
792
|
```
|
|
801
793
|
|
|
802
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
794
|
+
Defined in: [data-structures/queue/deque.ts:965](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L965)
|
|
803
795
|
|
|
804
796
|
Cut the deque to keep items up to index; optionally mutate in-place.
|
|
805
797
|
|
|
@@ -835,7 +827,7 @@ Time O(N), Space O(1)
|
|
|
835
827
|
cutRest(pos, isCutSelf?): Deque<E>;
|
|
836
828
|
```
|
|
837
829
|
|
|
838
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
830
|
+
Defined in: [data-structures/queue/deque.ts:1032](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1032)
|
|
839
831
|
|
|
840
832
|
Cut the deque to keep items from index onward; optionally mutate in-place.
|
|
841
833
|
|
|
@@ -871,7 +863,7 @@ Time O(N), Space O(1)
|
|
|
871
863
|
delete(element): boolean;
|
|
872
864
|
```
|
|
873
865
|
|
|
874
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
866
|
+
Defined in: [data-structures/queue/deque.ts:1135](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1135)
|
|
875
867
|
|
|
876
868
|
Delete the first occurrence of a value.
|
|
877
869
|
|
|
@@ -916,7 +908,7 @@ Time O(N), Space O(1)
|
|
|
916
908
|
deleteAt(pos): E | undefined;
|
|
917
909
|
```
|
|
918
910
|
|
|
919
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
911
|
+
Defined in: [data-structures/queue/deque.ts:1061](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1061)
|
|
920
912
|
|
|
921
913
|
Delete the element at a given position.
|
|
922
914
|
|
|
@@ -950,7 +942,7 @@ Time O(N), Space O(1)
|
|
|
950
942
|
deleteWhere(predicate): boolean;
|
|
951
943
|
```
|
|
952
944
|
|
|
953
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
945
|
+
Defined in: [data-structures/queue/deque.ts:1159](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1159)
|
|
954
946
|
|
|
955
947
|
Delete the first element matching a predicate.
|
|
956
948
|
|
|
@@ -980,7 +972,7 @@ Time O(N), Space O(1)
|
|
|
980
972
|
every(predicate, thisArg?): boolean;
|
|
981
973
|
```
|
|
982
974
|
|
|
983
|
-
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/
|
|
975
|
+
Defined in: [data-structures/base/iterable-element-base.ts:87](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L87)
|
|
984
976
|
|
|
985
977
|
Tests whether all elements satisfy the predicate.
|
|
986
978
|
|
|
@@ -1023,7 +1015,7 @@ fill(
|
|
|
1023
1015
|
end?): this;
|
|
1024
1016
|
```
|
|
1025
1017
|
|
|
1026
|
-
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1018
|
+
Defined in: [data-structures/base/linear-base.ts:292](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L292)
|
|
1027
1019
|
|
|
1028
1020
|
Fill a range with a value.
|
|
1029
1021
|
|
|
@@ -1069,7 +1061,7 @@ Time O(n), Space O(1)
|
|
|
1069
1061
|
filter(predicate, thisArg?): this;
|
|
1070
1062
|
```
|
|
1071
1063
|
|
|
1072
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1064
|
+
Defined in: [data-structures/queue/deque.ts:1493](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1493)
|
|
1073
1065
|
|
|
1074
1066
|
Filter elements into a new deque of the same class.
|
|
1075
1067
|
|
|
@@ -1122,7 +1114,7 @@ Time O(N), Space O(N)
|
|
|
1122
1114
|
find<S>(predicate, thisArg?): S | undefined;
|
|
1123
1115
|
```
|
|
1124
1116
|
|
|
1125
|
-
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1117
|
+
Defined in: [data-structures/base/iterable-element-base.ts:163](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L163)
|
|
1126
1118
|
|
|
1127
1119
|
Finds the first element that satisfies the predicate and returns it.
|
|
1128
1120
|
|
|
@@ -1168,7 +1160,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1168
1160
|
find(predicate, thisArg?): E | undefined;
|
|
1169
1161
|
```
|
|
1170
1162
|
|
|
1171
|
-
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1163
|
+
Defined in: [data-structures/base/iterable-element-base.ts:164](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L164)
|
|
1172
1164
|
|
|
1173
1165
|
Finds the first element that satisfies the predicate and returns it.
|
|
1174
1166
|
|
|
@@ -1210,7 +1202,7 @@ Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
|
1210
1202
|
findIndex(predicate, thisArg?): number;
|
|
1211
1203
|
```
|
|
1212
1204
|
|
|
1213
|
-
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1205
|
+
Defined in: [data-structures/base/linear-base.ts:151](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L151)
|
|
1214
1206
|
|
|
1215
1207
|
Find the first index matching a predicate.
|
|
1216
1208
|
|
|
@@ -1250,7 +1242,7 @@ Time O(n), Space O(1)
|
|
|
1250
1242
|
forEach(callbackfn, thisArg?): void;
|
|
1251
1243
|
```
|
|
1252
1244
|
|
|
1253
|
-
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1245
|
+
Defined in: [data-structures/base/iterable-element-base.ts:133](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L133)
|
|
1254
1246
|
|
|
1255
1247
|
Invokes a callback for each element in iteration order.
|
|
1256
1248
|
|
|
@@ -1290,7 +1282,7 @@ Time O(n), Space O(1).
|
|
|
1290
1282
|
has(element): boolean;
|
|
1291
1283
|
```
|
|
1292
1284
|
|
|
1293
|
-
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1285
|
+
Defined in: [data-structures/base/iterable-element-base.ts:189](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L189)
|
|
1294
1286
|
|
|
1295
1287
|
Checks whether a strictly-equal element exists in the structure.
|
|
1296
1288
|
|
|
@@ -1324,7 +1316,7 @@ Time O(n) in the worst case. Space O(1).
|
|
|
1324
1316
|
indexOf(searchElement, fromIndex?): number;
|
|
1325
1317
|
```
|
|
1326
1318
|
|
|
1327
|
-
Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1319
|
+
Defined in: [data-structures/base/linear-base.ts:111](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L111)
|
|
1328
1320
|
|
|
1329
1321
|
First index of a value from the left.
|
|
1330
1322
|
|
|
@@ -1364,7 +1356,7 @@ Time O(n), Space O(1)
|
|
|
1364
1356
|
isEmpty(): boolean;
|
|
1365
1357
|
```
|
|
1366
1358
|
|
|
1367
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1359
|
+
Defined in: [data-structures/queue/deque.ts:800](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L800)
|
|
1368
1360
|
|
|
1369
1361
|
Check whether the deque is empty.
|
|
1370
1362
|
|
|
@@ -1400,7 +1392,7 @@ Time O(1), Space O(1)
|
|
|
1400
1392
|
join(separator?): string;
|
|
1401
1393
|
```
|
|
1402
1394
|
|
|
1403
|
-
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1395
|
+
Defined in: [data-structures/base/linear-base.ts:228](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L228)
|
|
1404
1396
|
|
|
1405
1397
|
Join all elements into a string.
|
|
1406
1398
|
|
|
@@ -1434,7 +1426,7 @@ Time O(n), Space O(n)
|
|
|
1434
1426
|
lastIndexOf(searchElement, fromIndex?): number;
|
|
1435
1427
|
```
|
|
1436
1428
|
|
|
1437
|
-
Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1429
|
+
Defined in: [data-structures/base/linear-base.ts:131](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L131)
|
|
1438
1430
|
|
|
1439
1431
|
Last index of a value from the right.
|
|
1440
1432
|
|
|
@@ -1477,7 +1469,7 @@ map<EM, RM>(
|
|
|
1477
1469
|
thisArg?): Deque<EM, RM>;
|
|
1478
1470
|
```
|
|
1479
1471
|
|
|
1480
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1472
|
+
Defined in: [data-structures/queue/deque.ts:1575](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1575)
|
|
1481
1473
|
|
|
1482
1474
|
Map elements into a new deque (possibly different element type).
|
|
1483
1475
|
|
|
@@ -1544,7 +1536,7 @@ Time O(N), Space O(N)
|
|
|
1544
1536
|
mapSame(callback, thisArg?): this;
|
|
1545
1537
|
```
|
|
1546
1538
|
|
|
1547
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1539
|
+
Defined in: [data-structures/queue/deque.ts:1512](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1512)
|
|
1548
1540
|
|
|
1549
1541
|
Map elements into a new deque of the same element type.
|
|
1550
1542
|
|
|
@@ -1578,13 +1570,35 @@ Time O(N), Space O(N)
|
|
|
1578
1570
|
|
|
1579
1571
|
***
|
|
1580
1572
|
|
|
1573
|
+
### peek()
|
|
1574
|
+
|
|
1575
|
+
```ts
|
|
1576
|
+
peek(): E | undefined;
|
|
1577
|
+
```
|
|
1578
|
+
|
|
1579
|
+
Defined in: [data-structures/queue/deque.ts:311](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L311)
|
|
1580
|
+
|
|
1581
|
+
Peek at the front element without removing it (alias for `first`).
|
|
1582
|
+
|
|
1583
|
+
#### Returns
|
|
1584
|
+
|
|
1585
|
+
`E` \| `undefined`
|
|
1586
|
+
|
|
1587
|
+
Front element or undefined.
|
|
1588
|
+
|
|
1589
|
+
#### Remarks
|
|
1590
|
+
|
|
1591
|
+
Time O(1), Space O(1)
|
|
1592
|
+
|
|
1593
|
+
***
|
|
1594
|
+
|
|
1581
1595
|
### pop()
|
|
1582
1596
|
|
|
1583
1597
|
```ts
|
|
1584
1598
|
pop(): E | undefined;
|
|
1585
1599
|
```
|
|
1586
1600
|
|
|
1587
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1601
|
+
Defined in: [data-structures/queue/deque.ts:547](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L547)
|
|
1588
1602
|
|
|
1589
1603
|
Remove and return the last element.
|
|
1590
1604
|
|
|
@@ -1617,7 +1631,7 @@ Time O(1), Space O(1)
|
|
|
1617
1631
|
print(): void;
|
|
1618
1632
|
```
|
|
1619
1633
|
|
|
1620
|
-
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1634
|
+
Defined in: [data-structures/base/iterable-element-base.ts:269](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L269)
|
|
1621
1635
|
|
|
1622
1636
|
Prints `toVisual()` to the console. Intended for quick debugging.
|
|
1623
1637
|
|
|
@@ -1643,7 +1657,7 @@ Time O(n) due to materialization, Space O(n) for the intermediate representation
|
|
|
1643
1657
|
push(element): boolean;
|
|
1644
1658
|
```
|
|
1645
1659
|
|
|
1646
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1660
|
+
Defined in: [data-structures/queue/deque.ts:478](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L478)
|
|
1647
1661
|
|
|
1648
1662
|
Append one element at the back.
|
|
1649
1663
|
|
|
@@ -1701,7 +1715,7 @@ Time O(1) amortized, Space O(1)
|
|
|
1701
1715
|
pushMany(elements): boolean[];
|
|
1702
1716
|
```
|
|
1703
1717
|
|
|
1704
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1718
|
+
Defined in: [data-structures/queue/deque.ts:722](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L722)
|
|
1705
1719
|
|
|
1706
1720
|
Append a sequence of elements.
|
|
1707
1721
|
|
|
@@ -1767,7 +1781,7 @@ Time O(n), Space O(1). Throws if called on an empty structure without `initialVa
|
|
|
1767
1781
|
reduce(callbackfn): E;
|
|
1768
1782
|
```
|
|
1769
1783
|
|
|
1770
|
-
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1784
|
+
Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L194)
|
|
1771
1785
|
|
|
1772
1786
|
##### Parameters
|
|
1773
1787
|
|
|
@@ -1789,7 +1803,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:194](https://github.c
|
|
|
1789
1803
|
reduce(callbackfn, initialValue): E;
|
|
1790
1804
|
```
|
|
1791
1805
|
|
|
1792
|
-
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1806
|
+
Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L195)
|
|
1793
1807
|
|
|
1794
1808
|
##### Parameters
|
|
1795
1809
|
|
|
@@ -1815,7 +1829,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:195](https://github.c
|
|
|
1815
1829
|
reduce<U>(callbackfn, initialValue): U;
|
|
1816
1830
|
```
|
|
1817
1831
|
|
|
1818
|
-
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1832
|
+
Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L196)
|
|
1819
1833
|
|
|
1820
1834
|
##### Type Parameters
|
|
1821
1835
|
|
|
@@ -1849,7 +1863,7 @@ Defined in: [data-structures/base/iterable-element-base.ts:196](https://github.c
|
|
|
1849
1863
|
reduceRight<U>(callbackfn, initialValue): U;
|
|
1850
1864
|
```
|
|
1851
1865
|
|
|
1852
|
-
Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/
|
|
1866
|
+
Defined in: [data-structures/base/linear-base.ts:256](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L256)
|
|
1853
1867
|
|
|
1854
1868
|
Right-to-left reduction over elements.
|
|
1855
1869
|
|
|
@@ -1895,7 +1909,7 @@ Time O(n), Space O(1)
|
|
|
1895
1909
|
reverse(): this;
|
|
1896
1910
|
```
|
|
1897
1911
|
|
|
1898
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1912
|
+
Defined in: [data-structures/queue/deque.ts:1245](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1245)
|
|
1899
1913
|
|
|
1900
1914
|
Reverse the deque by reversing buckets and pointers.
|
|
1901
1915
|
|
|
@@ -1945,7 +1959,7 @@ Time O(N), Space O(N)
|
|
|
1945
1959
|
setAt(pos, element): boolean;
|
|
1946
1960
|
```
|
|
1947
1961
|
|
|
1948
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
1962
|
+
Defined in: [data-structures/queue/deque.ts:921](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L921)
|
|
1949
1963
|
|
|
1950
1964
|
Replace the element at a given position.
|
|
1951
1965
|
|
|
@@ -1985,7 +1999,7 @@ Time O(1), Space O(1)
|
|
|
1985
1999
|
setEquality(equals): this;
|
|
1986
2000
|
```
|
|
1987
2001
|
|
|
1988
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2002
|
+
Defined in: [data-structures/queue/deque.ts:1177](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1177)
|
|
1989
2003
|
|
|
1990
2004
|
Set the equality comparator used by delete operations.
|
|
1991
2005
|
|
|
@@ -2015,7 +2029,7 @@ Time O(1), Space O(1)
|
|
|
2015
2029
|
shift(): E | undefined;
|
|
2016
2030
|
```
|
|
2017
2031
|
|
|
2018
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2032
|
+
Defined in: [data-structures/queue/deque.ts:616](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L616)
|
|
2019
2033
|
|
|
2020
2034
|
Remove and return the first element.
|
|
2021
2035
|
|
|
@@ -2048,7 +2062,7 @@ Time O(1) amortized, Space O(1)
|
|
|
2048
2062
|
slice(start?, end?): this;
|
|
2049
2063
|
```
|
|
2050
2064
|
|
|
2051
|
-
Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2065
|
+
Defined in: [data-structures/base/linear-base.ts:273](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L273)
|
|
2052
2066
|
|
|
2053
2067
|
Create a shallow copy of a subrange.
|
|
2054
2068
|
|
|
@@ -2088,7 +2102,7 @@ Time O(n), Space O(n)
|
|
|
2088
2102
|
some(predicate, thisArg?): boolean;
|
|
2089
2103
|
```
|
|
2090
2104
|
|
|
2091
|
-
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2105
|
+
Defined in: [data-structures/base/iterable-element-base.ts:110](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L110)
|
|
2092
2106
|
|
|
2093
2107
|
Tests whether at least one element satisfies the predicate.
|
|
2094
2108
|
|
|
@@ -2128,7 +2142,7 @@ Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
|
2128
2142
|
sort(compareFn?): this;
|
|
2129
2143
|
```
|
|
2130
2144
|
|
|
2131
|
-
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2145
|
+
Defined in: [data-structures/base/linear-base.ts:185](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L185)
|
|
2132
2146
|
|
|
2133
2147
|
In-place stable order via array sort semantics.
|
|
2134
2148
|
|
|
@@ -2165,7 +2179,7 @@ splice(
|
|
|
2165
2179
|
items?): this;
|
|
2166
2180
|
```
|
|
2167
2181
|
|
|
2168
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2182
|
+
Defined in: [data-structures/queue/deque.ts:997](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L997)
|
|
2169
2183
|
|
|
2170
2184
|
Remove and/or insert elements at a position (array-like behavior).
|
|
2171
2185
|
|
|
@@ -2211,7 +2225,7 @@ Time O(N + M), Space O(M)
|
|
|
2211
2225
|
toArray(): E[];
|
|
2212
2226
|
```
|
|
2213
2227
|
|
|
2214
|
-
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2228
|
+
Defined in: [data-structures/base/iterable-element-base.ts:246](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L246)
|
|
2215
2229
|
|
|
2216
2230
|
Materializes the elements into a new array.
|
|
2217
2231
|
|
|
@@ -2237,7 +2251,7 @@ Time O(n), Space O(n).
|
|
|
2237
2251
|
toReversedArray(): E[];
|
|
2238
2252
|
```
|
|
2239
2253
|
|
|
2240
|
-
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2254
|
+
Defined in: [data-structures/base/linear-base.ts:237](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/linear-base.ts#L237)
|
|
2241
2255
|
|
|
2242
2256
|
Snapshot elements into a reversed array.
|
|
2243
2257
|
|
|
@@ -2263,7 +2277,7 @@ Time O(n), Space O(n)
|
|
|
2263
2277
|
toVisual(): E[];
|
|
2264
2278
|
```
|
|
2265
2279
|
|
|
2266
|
-
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2280
|
+
Defined in: [data-structures/base/iterable-element-base.ts:258](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L258)
|
|
2267
2281
|
|
|
2268
2282
|
Returns a representation of the structure suitable for quick visualization.
|
|
2269
2283
|
Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
@@ -2290,7 +2304,7 @@ Time O(n), Space O(n).
|
|
|
2290
2304
|
unique(): this;
|
|
2291
2305
|
```
|
|
2292
2306
|
|
|
2293
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2307
|
+
Defined in: [data-structures/queue/deque.ts:1263](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1263)
|
|
2294
2308
|
|
|
2295
2309
|
Deduplicate consecutive equal elements in-place.
|
|
2296
2310
|
|
|
@@ -2312,7 +2326,7 @@ Time O(N), Space O(1)
|
|
|
2312
2326
|
unshift(element): boolean;
|
|
2313
2327
|
```
|
|
2314
2328
|
|
|
2315
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2329
|
+
Defined in: [data-structures/queue/deque.ts:696](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L696)
|
|
2316
2330
|
|
|
2317
2331
|
Prepend one element at the front.
|
|
2318
2332
|
|
|
@@ -2363,7 +2377,7 @@ Time O(1) amortized, Space O(1)
|
|
|
2363
2377
|
unshiftMany(elements?): boolean[];
|
|
2364
2378
|
```
|
|
2365
2379
|
|
|
2366
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2380
|
+
Defined in: [data-structures/queue/deque.ts:741](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L741)
|
|
2367
2381
|
|
|
2368
2382
|
Prepend a sequence of elements.
|
|
2369
2383
|
|
|
@@ -2393,7 +2407,7 @@ Time O(N), Space O(1)
|
|
|
2393
2407
|
values(): IterableIterator<E>;
|
|
2394
2408
|
```
|
|
2395
2409
|
|
|
2396
|
-
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2410
|
+
Defined in: [data-structures/base/iterable-element-base.ts:72](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L72)
|
|
2397
2411
|
|
|
2398
2412
|
Returns an iterator over the values (alias of the default iterator).
|
|
2399
2413
|
|
|
@@ -2422,7 +2436,7 @@ static fromArray<E, R>(
|
|
|
2422
2436
|
options?): any;
|
|
2423
2437
|
```
|
|
2424
2438
|
|
|
2425
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2439
|
+
Defined in: [data-structures/queue/deque.ts:403](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L403)
|
|
2426
2440
|
|
|
2427
2441
|
Create a Deque from an array of elements.
|
|
2428
2442
|
|
|
@@ -2477,7 +2491,7 @@ Time O(N), Space O(N)
|
|
|
2477
2491
|
protected _compactCounter: number = 0;
|
|
2478
2492
|
```
|
|
2479
2493
|
|
|
2480
|
-
Defined in: [data-structures/queue/deque.ts:162](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2494
|
+
Defined in: [data-structures/queue/deque.ts:162](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L162)
|
|
2481
2495
|
|
|
2482
2496
|
Counter for shift/pop operations since last compaction check.
|
|
2483
2497
|
Only checks ratio every `_bucketSize` operations to minimize overhead.
|
|
@@ -2490,7 +2504,7 @@ Only checks ratio every `_bucketSize` operations to minimize overhead.
|
|
|
2490
2504
|
protected optional _toElementFn?: (rawElement) => E;
|
|
2491
2505
|
```
|
|
2492
2506
|
|
|
2493
|
-
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/
|
|
2507
|
+
Defined in: [data-structures/base/iterable-element-base.ts:39](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/base/iterable-element-base.ts#L39)
|
|
2494
2508
|
|
|
2495
2509
|
The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
2496
2510
|
|
|
@@ -2520,7 +2534,7 @@ Time O(1), Space O(1).
|
|
|
2520
2534
|
protected _autoCompact(): void;
|
|
2521
2535
|
```
|
|
2522
2536
|
|
|
2523
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2537
|
+
Defined in: [data-structures/queue/deque.ts:1291](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1291)
|
|
2524
2538
|
|
|
2525
2539
|
(Protected) Trigger auto-compaction if space utilization drops below threshold.
|
|
2526
2540
|
Only checks every `_bucketSize` operations to minimize hot-path overhead.
|
|
@@ -2538,7 +2552,7 @@ Uses element-based ratio: `elements / (bucketCount * bucketSize)`.
|
|
|
2538
2552
|
protected _createInstance(options?): this;
|
|
2539
2553
|
```
|
|
2540
2554
|
|
|
2541
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2555
|
+
Defined in: [data-structures/queue/deque.ts:1690](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1690)
|
|
2542
2556
|
|
|
2543
2557
|
(Protected) Create an empty instance of the same concrete class.
|
|
2544
2558
|
|
|
@@ -2572,7 +2586,7 @@ Time O(1), Space O(1)
|
|
|
2572
2586
|
protected _createLike<T, RR>(elements?, options?): Deque<T, RR>;
|
|
2573
2587
|
```
|
|
2574
2588
|
|
|
2575
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2589
|
+
Defined in: [data-structures/queue/deque.ts:1708](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1708)
|
|
2576
2590
|
|
|
2577
2591
|
(Protected) Create a like-kind deque seeded by elements.
|
|
2578
2592
|
|
|
@@ -2618,7 +2632,7 @@ Time O(N), Space O(N)
|
|
|
2618
2632
|
protected _getBucketAndPosition(pos): object;
|
|
2619
2633
|
```
|
|
2620
2634
|
|
|
2621
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2635
|
+
Defined in: [data-structures/queue/deque.ts:1664](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1664)
|
|
2622
2636
|
|
|
2623
2637
|
(Protected) Translate a logical position to bucket/offset.
|
|
2624
2638
|
|
|
@@ -2660,7 +2674,7 @@ Time O(1), Space O(1)
|
|
|
2660
2674
|
protected _getIterator(): IterableIterator<E>;
|
|
2661
2675
|
```
|
|
2662
2676
|
|
|
2663
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2677
|
+
Defined in: [data-structures/queue/deque.ts:1621](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1621)
|
|
2664
2678
|
|
|
2665
2679
|
(Protected) Iterate elements from front to back.
|
|
2666
2680
|
|
|
@@ -2686,7 +2700,7 @@ Time O(N), Space O(1)
|
|
|
2686
2700
|
protected _getReverseIterator(): IterableIterator<E>;
|
|
2687
2701
|
```
|
|
2688
2702
|
|
|
2689
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2703
|
+
Defined in: [data-structures/queue/deque.ts:1725](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1725)
|
|
2690
2704
|
|
|
2691
2705
|
(Protected) Iterate elements from back to front.
|
|
2692
2706
|
|
|
@@ -2712,7 +2726,7 @@ Time O(N), Space O(1)
|
|
|
2712
2726
|
protected _reallocate(needBucketNum?): void;
|
|
2713
2727
|
```
|
|
2714
2728
|
|
|
2715
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2729
|
+
Defined in: [data-structures/queue/deque.ts:1635](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1635)
|
|
2716
2730
|
|
|
2717
2731
|
(Protected) Reallocate buckets to make room near the ends.
|
|
2718
2732
|
|
|
@@ -2742,7 +2756,7 @@ Time O(N), Space O(N)
|
|
|
2742
2756
|
protected _setBucketSize(size): void;
|
|
2743
2757
|
```
|
|
2744
2758
|
|
|
2745
|
-
Defined in: [data-structures/queue/deque.ts:
|
|
2759
|
+
Defined in: [data-structures/queue/deque.ts:1601](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/queue/deque.ts#L1601)
|
|
2746
2760
|
|
|
2747
2761
|
(Protected) Set the internal bucket size.
|
|
2748
2762
|
|