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: TreeMultiMap\<K, V, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:28](https://github.com/zrwusa/data-structure-typed/blob/
|
|
9
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:28](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L28)
|
|
10
10
|
|
|
11
11
|
TreeMultiMap (ordered MultiMap) — key → bucket (Array of values).
|
|
12
12
|
|
|
@@ -51,7 +51,7 @@ Semantics (RFC):
|
|
|
51
51
|
new TreeMultiMap<K, V, R>(keysNodesEntriesOrRaws?, options?): TreeMultiMap<K, V, R>;
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:45](https://github.com/zrwusa/data-structure-typed/blob/
|
|
54
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:45](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L45)
|
|
55
55
|
|
|
56
56
|
Creates a new TreeMultiMap.
|
|
57
57
|
|
|
@@ -103,7 +103,7 @@ const mmap = new TreeMultiMap(players, { toEntryFn: p => [p.score, p.items] });
|
|
|
103
103
|
get comparator(): Comparator<K>;
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
106
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:5021](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L5021)
|
|
107
107
|
|
|
108
108
|
Expose comparator for advanced usage/testing (read-only).
|
|
109
109
|
|
|
@@ -125,7 +125,7 @@ Time O(1), Space O(1)
|
|
|
125
125
|
get size(): number;
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:109](https://github.com/zrwusa/data-structure-typed/blob/
|
|
128
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:109](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L109)
|
|
129
129
|
|
|
130
130
|
Number of distinct keys.
|
|
131
131
|
|
|
@@ -147,7 +147,7 @@ Time O(1), Space O(1)
|
|
|
147
147
|
get totalSize(): number;
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
150
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:580](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L580)
|
|
151
151
|
|
|
152
152
|
Total number of values across all buckets (Σ bucket.length).
|
|
153
153
|
|
|
@@ -180,7 +180,7 @@ Time O(n), Space O(1)
|
|
|
180
180
|
iterator: Iterator<[K, V[]]>;
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
183
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1897](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1897)
|
|
184
184
|
|
|
185
185
|
Iterates over all entries as [key, bucket] pairs.
|
|
186
186
|
|
|
@@ -206,7 +206,7 @@ Iterable.[iterator]
|
|
|
206
206
|
add(key, value): boolean;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
209
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1239](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1239)
|
|
210
210
|
|
|
211
211
|
Append a single value.
|
|
212
212
|
|
|
@@ -249,7 +249,7 @@ Time O(log n), Space O(1)
|
|
|
249
249
|
ceiling(key): [K, V[]] | undefined;
|
|
250
250
|
```
|
|
251
251
|
|
|
252
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
252
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2896](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2896)
|
|
253
253
|
|
|
254
254
|
Returns the entry with the smallest key >= given key.
|
|
255
255
|
|
|
@@ -288,7 +288,7 @@ Time O(log n), Space O(1)
|
|
|
288
288
|
clear(): void;
|
|
289
289
|
```
|
|
290
290
|
|
|
291
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
291
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:490](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L490)
|
|
292
292
|
|
|
293
293
|
Removes all entries from the map.
|
|
294
294
|
|
|
@@ -320,7 +320,7 @@ Time O(1), Space O(1)
|
|
|
320
320
|
clone(): TreeMultiMap<K, V, R>;
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
323
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:5013](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L5013)
|
|
324
324
|
|
|
325
325
|
Deep copy
|
|
326
326
|
|
|
@@ -349,7 +349,7 @@ Deep copy
|
|
|
349
349
|
count(key): number;
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
352
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:534](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L534)
|
|
353
353
|
|
|
354
354
|
Bucket length for a key (missing => 0).
|
|
355
355
|
|
|
@@ -387,7 +387,7 @@ Time O(log n), Space O(1)
|
|
|
387
387
|
delete(key): boolean;
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
390
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1733](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1733)
|
|
391
391
|
|
|
392
392
|
Deletes a key and its entire bucket.
|
|
393
393
|
|
|
@@ -429,7 +429,7 @@ deleteValue(
|
|
|
429
429
|
eq?): boolean;
|
|
430
430
|
```
|
|
431
431
|
|
|
432
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
432
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1825](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1825)
|
|
433
433
|
|
|
434
434
|
Delete a single occurrence of a value from a key's bucket.
|
|
435
435
|
|
|
@@ -479,7 +479,7 @@ deleteValues(
|
|
|
479
479
|
eq?): number;
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
482
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1877](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1877)
|
|
483
483
|
|
|
484
484
|
Delete all occurrences of a value from a key's bucket.
|
|
485
485
|
|
|
@@ -527,7 +527,7 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
527
527
|
entriesOf(key): IterableIterator<[K, V]>;
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
530
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2330](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2330)
|
|
531
531
|
|
|
532
532
|
Iterates over all entries for a specific key.
|
|
533
533
|
|
|
@@ -565,7 +565,7 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
565
565
|
filter(predicate): TreeMultiMap<K, V, R>;
|
|
566
566
|
```
|
|
567
567
|
|
|
568
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
568
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4003](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4003)
|
|
569
569
|
|
|
570
570
|
Creates a new map with entries that pass the predicate.
|
|
571
571
|
|
|
@@ -605,7 +605,7 @@ Time O(n), Space O(n)
|
|
|
605
605
|
first(): [K, V[]] | undefined;
|
|
606
606
|
```
|
|
607
607
|
|
|
608
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
608
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2511](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2511)
|
|
609
609
|
|
|
610
610
|
Returns the entry with the smallest key.
|
|
611
611
|
|
|
@@ -637,7 +637,7 @@ Time O(log n), Space O(1)
|
|
|
637
637
|
flatEntries(): IterableIterator<[K, V]>;
|
|
638
638
|
```
|
|
639
639
|
|
|
640
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
640
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2423](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2423)
|
|
641
641
|
|
|
642
642
|
Iterates over all [key, value] pairs (flattened from buckets).
|
|
643
643
|
|
|
@@ -670,7 +670,7 @@ Time O(T), Space O(1) where T is totalSize
|
|
|
670
670
|
floor(key): [K, V[]] | undefined;
|
|
671
671
|
```
|
|
672
672
|
|
|
673
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
673
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:3096](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L3096)
|
|
674
674
|
|
|
675
675
|
Returns the entry with the largest key <= given key.
|
|
676
676
|
|
|
@@ -709,7 +709,7 @@ Time O(log n), Space O(1)
|
|
|
709
709
|
forEach(callback): void;
|
|
710
710
|
```
|
|
711
711
|
|
|
712
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
712
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:3807](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L3807)
|
|
713
713
|
|
|
714
714
|
Executes a callback for each entry.
|
|
715
715
|
|
|
@@ -749,7 +749,7 @@ Time O(n), Space O(1)
|
|
|
749
749
|
get(key): V[] | undefined;
|
|
750
750
|
```
|
|
751
751
|
|
|
752
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
752
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1051](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1051)
|
|
753
753
|
|
|
754
754
|
Live bucket reference (do not auto-delete key if bucket becomes empty via mutation).
|
|
755
755
|
|
|
@@ -787,7 +787,7 @@ Time O(log n), Space O(1)
|
|
|
787
787
|
getByRank(k): [K, V[]] | undefined;
|
|
788
788
|
```
|
|
789
789
|
|
|
790
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
790
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4923](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4923)
|
|
791
791
|
|
|
792
792
|
Creates a shallow clone of this map.
|
|
793
793
|
|
|
@@ -825,7 +825,7 @@ Time O(n log n), Space O(n)
|
|
|
825
825
|
getRank(key): number;
|
|
826
826
|
```
|
|
827
827
|
|
|
828
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
828
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4942](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4942)
|
|
829
829
|
|
|
830
830
|
Get the rank of a key in sorted order
|
|
831
831
|
|
|
@@ -861,7 +861,7 @@ Get the rank of a key in sorted order
|
|
|
861
861
|
has(key): boolean;
|
|
862
862
|
```
|
|
863
863
|
|
|
864
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
864
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:816](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L816)
|
|
865
865
|
|
|
866
866
|
Whether the map contains the given key.
|
|
867
867
|
|
|
@@ -902,7 +902,7 @@ hasEntry(
|
|
|
902
902
|
eq?): boolean;
|
|
903
903
|
```
|
|
904
904
|
|
|
905
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
905
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1778](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1778)
|
|
906
906
|
|
|
907
907
|
Check if a specific value exists in a key's bucket.
|
|
908
908
|
|
|
@@ -948,7 +948,7 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
948
948
|
higher(key): [K, V[]] | undefined;
|
|
949
949
|
```
|
|
950
950
|
|
|
951
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
951
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:3256](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L3256)
|
|
952
952
|
|
|
953
953
|
Returns the entry with the smallest key > given key.
|
|
954
954
|
|
|
@@ -986,7 +986,7 @@ Time O(log n), Space O(1)
|
|
|
986
986
|
isEmpty(): boolean;
|
|
987
987
|
```
|
|
988
988
|
|
|
989
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
989
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:298](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L298)
|
|
990
990
|
|
|
991
991
|
Whether the map is empty.
|
|
992
992
|
|
|
@@ -1015,7 +1015,7 @@ Time O(1), Space O(1)
|
|
|
1015
1015
|
keys(): IterableIterator<K>;
|
|
1016
1016
|
```
|
|
1017
1017
|
|
|
1018
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1018
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2092](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2092)
|
|
1019
1019
|
|
|
1020
1020
|
Iterates over all keys.
|
|
1021
1021
|
|
|
@@ -1047,7 +1047,7 @@ Time O(n), Space O(1)
|
|
|
1047
1047
|
last(): [K, V[]] | undefined;
|
|
1048
1048
|
```
|
|
1049
1049
|
|
|
1050
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1050
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2598](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2598)
|
|
1051
1051
|
|
|
1052
1052
|
Returns the entry with the largest key.
|
|
1053
1053
|
|
|
@@ -1079,7 +1079,7 @@ Time O(log n), Space O(1)
|
|
|
1079
1079
|
lower(key): [K, V[]] | undefined;
|
|
1080
1080
|
```
|
|
1081
1081
|
|
|
1082
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1082
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:3416](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L3416)
|
|
1083
1083
|
|
|
1084
1084
|
Returns the entry with the largest key < given key.
|
|
1085
1085
|
|
|
@@ -1117,7 +1117,7 @@ Time O(log n), Space O(1)
|
|
|
1117
1117
|
map<V2>(mapper): TreeMultiMap<K, V2, R>;
|
|
1118
1118
|
```
|
|
1119
1119
|
|
|
1120
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1120
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4199](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4199)
|
|
1121
1121
|
|
|
1122
1122
|
Creates a new map by transforming each entry.
|
|
1123
1123
|
|
|
@@ -1161,7 +1161,7 @@ Time O(n log n), Space O(n)
|
|
|
1161
1161
|
pollFirst(): [K, V[]] | undefined;
|
|
1162
1162
|
```
|
|
1163
1163
|
|
|
1164
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1164
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2648](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2648)
|
|
1165
1165
|
|
|
1166
1166
|
Removes and returns the entry with the smallest key.
|
|
1167
1167
|
|
|
@@ -1195,7 +1195,7 @@ Time O(log n), Space O(1)
|
|
|
1195
1195
|
pollLast(): [K, V[]] | undefined;
|
|
1196
1196
|
```
|
|
1197
1197
|
|
|
1198
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1198
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2697](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2697)
|
|
1199
1199
|
|
|
1200
1200
|
Removes and returns the entry with the largest key.
|
|
1201
1201
|
|
|
@@ -1228,7 +1228,7 @@ Time O(log n), Space O(1)
|
|
|
1228
1228
|
print(): void;
|
|
1229
1229
|
```
|
|
1230
1230
|
|
|
1231
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1231
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:3613](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L3613)
|
|
1232
1232
|
|
|
1233
1233
|
Prints the internal tree structure (for debugging).
|
|
1234
1234
|
|
|
@@ -1259,7 +1259,7 @@ Time O(n), Space O(n)
|
|
|
1259
1259
|
rangeByRank(start, end): [K, V[]][];
|
|
1260
1260
|
```
|
|
1261
1261
|
|
|
1262
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1262
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4972](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4972)
|
|
1263
1263
|
|
|
1264
1264
|
Get elements by rank range
|
|
1265
1265
|
|
|
@@ -1282,7 +1282,7 @@ Get elements by rank range
|
|
|
1282
1282
|
#### Example
|
|
1283
1283
|
|
|
1284
1284
|
```ts
|
|
1285
|
-
// Pagination
|
|
1285
|
+
// Pagination by position in tree order
|
|
1286
1286
|
const tree = new TreeMultiMap<number>(
|
|
1287
1287
|
[10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
1288
1288
|
{ enableOrderStatistic: true }
|
|
@@ -1305,7 +1305,7 @@ Get elements by rank range
|
|
|
1305
1305
|
rangeSearch<C>(range, callback?): ReturnType<C>[];
|
|
1306
1306
|
```
|
|
1307
1307
|
|
|
1308
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1308
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4748](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4748)
|
|
1309
1309
|
|
|
1310
1310
|
Searches for entries within a key range.
|
|
1311
1311
|
|
|
@@ -1355,7 +1355,7 @@ Time O(log n + k), Space O(k) where k is result size
|
|
|
1355
1355
|
reduce<U>(callback, initialValue): U;
|
|
1356
1356
|
```
|
|
1357
1357
|
|
|
1358
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1358
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4398](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4398)
|
|
1359
1359
|
|
|
1360
1360
|
Reduces all entries to a single value.
|
|
1361
1361
|
|
|
@@ -1406,7 +1406,7 @@ Time O(n), Space O(1)
|
|
|
1406
1406
|
set(entry, value?): boolean;
|
|
1407
1407
|
```
|
|
1408
1408
|
|
|
1409
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1409
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1477](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1477)
|
|
1410
1410
|
|
|
1411
1411
|
Alias for compatibility with existing TreeMultiMap semantics.
|
|
1412
1412
|
|
|
@@ -1449,7 +1449,7 @@ Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
|
1449
1449
|
set(key, value): boolean;
|
|
1450
1450
|
```
|
|
1451
1451
|
|
|
1452
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1452
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:1478](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L1478)
|
|
1453
1453
|
|
|
1454
1454
|
Alias for compatibility with existing TreeMultiMap semantics.
|
|
1455
1455
|
|
|
@@ -1491,7 +1491,7 @@ Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
|
1491
1491
|
setMany(keysNodesEntriesOrRaws): boolean[];
|
|
1492
1492
|
```
|
|
1493
1493
|
|
|
1494
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1494
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:4585](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L4585)
|
|
1495
1495
|
|
|
1496
1496
|
Sets multiple entries at once.
|
|
1497
1497
|
|
|
@@ -1528,7 +1528,7 @@ Time O(m log n), Space O(m) where m is input size
|
|
|
1528
1528
|
values(): IterableIterator<V[]>;
|
|
1529
1529
|
```
|
|
1530
1530
|
|
|
1531
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1531
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2284](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2284)
|
|
1532
1532
|
|
|
1533
1533
|
Iterates over all buckets.
|
|
1534
1534
|
|
|
@@ -1560,7 +1560,7 @@ Time O(n), Space O(1)
|
|
|
1560
1560
|
valuesOf(key): IterableIterator<V>;
|
|
1561
1561
|
```
|
|
1562
1562
|
|
|
1563
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1563
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:2376](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L2376)
|
|
1564
1564
|
|
|
1565
1565
|
Iterates over all values for a specific key.
|
|
1566
1566
|
|