data-structure-typed 2.6.1 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/cjs/binary-tree.cjs +2927 -23688
- package/dist/cjs/graph.cjs +845 -2634
- package/dist/cjs/hash.cjs +185 -616
- package/dist/cjs/heap.cjs +266 -818
- package/dist/cjs/index.cjs +5116 -31358
- package/dist/cjs/linked-list.cjs +644 -2615
- package/dist/cjs/matrix.cjs +220 -535
- package/dist/cjs/priority-queue.cjs +266 -818
- package/dist/cjs/queue.cjs +637 -2343
- package/dist/cjs/stack.cjs +124 -530
- package/dist/cjs/trie.cjs +145 -592
- package/dist/cjs-legacy/binary-tree.cjs +4352 -25113
- package/dist/cjs-legacy/graph.cjs +847 -2636
- package/dist/cjs-legacy/hash.cjs +181 -612
- package/dist/cjs-legacy/heap.cjs +266 -818
- package/dist/cjs-legacy/index.cjs +6657 -32899
- package/dist/cjs-legacy/linked-list.cjs +640 -2611
- package/dist/cjs-legacy/matrix.cjs +220 -535
- package/dist/cjs-legacy/priority-queue.cjs +266 -818
- package/dist/cjs-legacy/queue.cjs +634 -2340
- package/dist/cjs-legacy/stack.cjs +124 -530
- package/dist/cjs-legacy/trie.cjs +145 -592
- package/dist/esm/binary-tree.mjs +2927 -23688
- package/dist/esm/graph.mjs +845 -2634
- package/dist/esm/hash.mjs +185 -616
- package/dist/esm/heap.mjs +266 -818
- package/dist/esm/index.mjs +5116 -31358
- package/dist/esm/linked-list.mjs +644 -2615
- package/dist/esm/matrix.mjs +220 -535
- package/dist/esm/priority-queue.mjs +266 -818
- package/dist/esm/queue.mjs +637 -2343
- package/dist/esm/stack.mjs +124 -530
- package/dist/esm/trie.mjs +145 -592
- package/dist/esm-legacy/binary-tree.mjs +4352 -25113
- package/dist/esm-legacy/graph.mjs +847 -2636
- package/dist/esm-legacy/hash.mjs +181 -612
- package/dist/esm-legacy/heap.mjs +266 -818
- package/dist/esm-legacy/index.mjs +6657 -32899
- package/dist/esm-legacy/linked-list.mjs +640 -2611
- package/dist/esm-legacy/matrix.mjs +220 -535
- package/dist/esm-legacy/priority-queue.mjs +266 -818
- package/dist/esm-legacy/queue.mjs +634 -2340
- package/dist/esm-legacy/stack.mjs +124 -530
- package/dist/esm-legacy/trie.mjs +145 -592
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +29 -500
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +38 -563
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +230 -1212
- package/dist/types/data-structures/binary-tree/bst.d.ts +124 -1063
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +99 -854
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +62 -314
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +366 -5057
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +277 -4885
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +253 -3929
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +261 -4782
- package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -44
- package/dist/types/data-structures/graph/directed-graph.d.ts +130 -527
- package/dist/types/data-structures/graph/undirected-graph.d.ts +125 -482
- package/dist/types/data-structures/hash/hash-map.d.ts +132 -562
- package/dist/types/data-structures/heap/heap.d.ts +194 -746
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +120 -809
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -733
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +193 -863
- package/dist/types/data-structures/matrix/matrix.d.ts +159 -474
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -6
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +6 -11
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/types/data-structures/queue/deque.d.ts +196 -804
- package/dist/types/data-structures/queue/queue.d.ts +99 -585
- package/dist/types/data-structures/stack/stack.d.ts +75 -481
- package/dist/types/data-structures/trie/trie.d.ts +98 -584
- package/dist/umd/data-structure-typed.js +6580 -32822
- package/dist/umd/data-structure-typed.min.js +3 -3
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +162 -215
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/BST.md +155 -208
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +7 -7
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -29
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +104 -158
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +72 -104
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +60 -80
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +67 -101
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +52 -48
- package/docs-site-docusaurus/docs/api/classes/Heap.md +40 -68
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +17 -17
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +38 -38
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +68 -96
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +60 -80
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +57 -52
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +38 -66
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +41 -74
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +38 -66
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +46 -79
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +40 -68
- package/docs-site-docusaurus/docs/api/classes/Queue.md +54 -78
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +171 -225
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -22
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +68 -98
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +4 -4
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +98 -75
- package/docs-site-docusaurus/docs/api/classes/Stack.md +33 -53
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +104 -129
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +57 -124
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +45 -116
- package/docs-site-docusaurus/docs/api/classes/Trie.md +37 -61
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +59 -77
- package/package.json +1 -1
- package/src/data-structures/binary-tree/tree-multi-set.ts +15 -11
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: TreeMultiMap\<K, V, R\>
|
|
8
8
|
|
|
9
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
9
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:27](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L27)
|
|
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:
|
|
54
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:44](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L44)
|
|
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:115](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L115)
|
|
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:
|
|
128
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:90](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L90)
|
|
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:105](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L105)
|
|
151
151
|
|
|
152
152
|
Total number of values across all buckets (Σ bucket.length).
|
|
153
153
|
|
|
@@ -155,8 +155,6 @@ Total number of values across all buckets (Σ bucket.length).
|
|
|
155
155
|
|
|
156
156
|
Time O(n), Space O(1)
|
|
157
157
|
|
|
158
|
-
*
|
|
159
|
-
|
|
160
158
|
##### Example
|
|
161
159
|
|
|
162
160
|
```ts
|
|
@@ -180,7 +178,7 @@ Time O(n), Space O(1)
|
|
|
180
178
|
iterator: Iterator<[K, V[]]>;
|
|
181
179
|
```
|
|
182
180
|
|
|
183
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
181
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:330](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L330)
|
|
184
182
|
|
|
185
183
|
Iterates over all entries as [key, bucket] pairs.
|
|
186
184
|
|
|
@@ -206,7 +204,7 @@ Iterable.[iterator]
|
|
|
206
204
|
add(key, value): boolean;
|
|
207
205
|
```
|
|
208
206
|
|
|
209
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
207
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:200](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L200)
|
|
210
208
|
|
|
211
209
|
Append a single value.
|
|
212
210
|
|
|
@@ -228,8 +226,6 @@ Append a single value.
|
|
|
228
226
|
|
|
229
227
|
Time O(log n), Space O(1)
|
|
230
228
|
|
|
231
|
-
*
|
|
232
|
-
|
|
233
229
|
#### Example
|
|
234
230
|
|
|
235
231
|
```ts
|
|
@@ -249,7 +245,7 @@ Time O(log n), Space O(1)
|
|
|
249
245
|
ceiling(key): [K, V[]] | undefined;
|
|
250
246
|
```
|
|
251
247
|
|
|
252
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
248
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:525](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L525)
|
|
253
249
|
|
|
254
250
|
Returns the entry with the smallest key >= given key.
|
|
255
251
|
|
|
@@ -267,8 +263,6 @@ Returns the entry with the smallest key >= given key.
|
|
|
267
263
|
|
|
268
264
|
Time O(log n), Space O(1)
|
|
269
265
|
|
|
270
|
-
*
|
|
271
|
-
|
|
272
266
|
#### Example
|
|
273
267
|
|
|
274
268
|
```ts
|
|
@@ -288,7 +282,7 @@ Time O(log n), Space O(1)
|
|
|
288
282
|
clear(): void;
|
|
289
283
|
```
|
|
290
284
|
|
|
291
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
285
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:140](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L140)
|
|
292
286
|
|
|
293
287
|
Removes all entries from the map.
|
|
294
288
|
|
|
@@ -300,8 +294,6 @@ Removes all entries from the map.
|
|
|
300
294
|
|
|
301
295
|
Time O(1), Space O(1)
|
|
302
296
|
|
|
303
|
-
*
|
|
304
|
-
|
|
305
297
|
#### Example
|
|
306
298
|
|
|
307
299
|
```ts
|
|
@@ -320,12 +312,10 @@ Time O(1), Space O(1)
|
|
|
320
312
|
clone(): TreeMultiMap<K, V, R>;
|
|
321
313
|
```
|
|
322
314
|
|
|
323
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
315
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:781](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L781)
|
|
324
316
|
|
|
325
317
|
Deep copy
|
|
326
318
|
|
|
327
|
-
*
|
|
328
|
-
|
|
329
319
|
#### Returns
|
|
330
320
|
|
|
331
321
|
`TreeMultiMap`\<`K`, `V`, `R`\>
|
|
@@ -349,7 +339,7 @@ Deep copy
|
|
|
349
339
|
count(key): number;
|
|
350
340
|
```
|
|
351
341
|
|
|
352
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
342
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:154](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L154)
|
|
353
343
|
|
|
354
344
|
Bucket length for a key (missing => 0).
|
|
355
345
|
|
|
@@ -367,8 +357,6 @@ Bucket length for a key (missing => 0).
|
|
|
367
357
|
|
|
368
358
|
Time O(log n), Space O(1)
|
|
369
359
|
|
|
370
|
-
*
|
|
371
|
-
|
|
372
360
|
#### Example
|
|
373
361
|
|
|
374
362
|
```ts
|
|
@@ -387,7 +375,7 @@ Time O(log n), Space O(1)
|
|
|
387
375
|
delete(key): boolean;
|
|
388
376
|
```
|
|
389
377
|
|
|
390
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
378
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:256](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L256)
|
|
391
379
|
|
|
392
380
|
Deletes a key and its entire bucket.
|
|
393
381
|
|
|
@@ -405,8 +393,6 @@ Deletes a key and its entire bucket.
|
|
|
405
393
|
|
|
406
394
|
Time O(log n), Space O(1)
|
|
407
395
|
|
|
408
|
-
*
|
|
409
|
-
|
|
410
396
|
#### Example
|
|
411
397
|
|
|
412
398
|
```ts
|
|
@@ -429,7 +415,7 @@ deleteValue(
|
|
|
429
415
|
eq?): boolean;
|
|
430
416
|
```
|
|
431
417
|
|
|
432
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
418
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:288](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L288)
|
|
433
419
|
|
|
434
420
|
Delete a single occurrence of a value from a key's bucket.
|
|
435
421
|
|
|
@@ -455,8 +441,6 @@ Delete a single occurrence of a value from a key's bucket.
|
|
|
455
441
|
|
|
456
442
|
Time O(log n + m), Space O(1) where m is bucket size
|
|
457
443
|
|
|
458
|
-
*
|
|
459
|
-
|
|
460
444
|
#### Example
|
|
461
445
|
|
|
462
446
|
```ts
|
|
@@ -479,7 +463,7 @@ deleteValues(
|
|
|
479
463
|
eq?): number;
|
|
480
464
|
```
|
|
481
465
|
|
|
482
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
466
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:310](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L310)
|
|
483
467
|
|
|
484
468
|
Delete all occurrences of a value from a key's bucket.
|
|
485
469
|
|
|
@@ -505,8 +489,6 @@ Delete all occurrences of a value from a key's bucket.
|
|
|
505
489
|
|
|
506
490
|
Time O(log n + m), Space O(1) where m is bucket size
|
|
507
491
|
|
|
508
|
-
*
|
|
509
|
-
|
|
510
492
|
#### Example
|
|
511
493
|
|
|
512
494
|
```ts
|
|
@@ -527,7 +509,7 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
527
509
|
entries(): IterableIterator<[K, V[]]>;
|
|
528
510
|
```
|
|
529
511
|
|
|
530
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
512
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:379](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L379)
|
|
531
513
|
|
|
532
514
|
Iterate over all `[key, values[]]` entries (Map-compatible).
|
|
533
515
|
|
|
@@ -539,8 +521,6 @@ Iterate over all `[key, values[]]` entries (Map-compatible).
|
|
|
539
521
|
|
|
540
522
|
Time O(n), Space O(1) per step.
|
|
541
523
|
|
|
542
|
-
*
|
|
543
|
-
|
|
544
524
|
#### Example
|
|
545
525
|
|
|
546
526
|
```ts
|
|
@@ -563,7 +543,7 @@ Time O(n), Space O(1) per step.
|
|
|
563
543
|
entriesOf(key): IterableIterator<[K, V]>;
|
|
564
544
|
```
|
|
565
545
|
|
|
566
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
546
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:398](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L398)
|
|
567
547
|
|
|
568
548
|
Iterates over all entries for a specific key.
|
|
569
549
|
|
|
@@ -581,8 +561,6 @@ Iterates over all entries for a specific key.
|
|
|
581
561
|
|
|
582
562
|
Time O(log n + m), Space O(1) where m is bucket size
|
|
583
563
|
|
|
584
|
-
*
|
|
585
|
-
|
|
586
564
|
#### Example
|
|
587
565
|
|
|
588
566
|
```ts
|
|
@@ -590,7 +568,10 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
590
568
|
const mm = new TreeMultiMap<number, string>();
|
|
591
569
|
mm.add(1, 'a');
|
|
592
570
|
mm.add(1, 'b');
|
|
593
|
-
console.log([...mm.entriesOf(1)]); // [
|
|
571
|
+
console.log([...mm.entriesOf(1)]); // [
|
|
572
|
+
// [1, 'a'],
|
|
573
|
+
// [1, 'b']
|
|
574
|
+
// ];
|
|
594
575
|
```
|
|
595
576
|
|
|
596
577
|
***
|
|
@@ -601,7 +582,7 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
601
582
|
filter(predicate): TreeMultiMap<K, V, R>;
|
|
602
583
|
```
|
|
603
584
|
|
|
604
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
585
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:633](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L633)
|
|
605
586
|
|
|
606
587
|
Creates a new map with entries that pass the predicate.
|
|
607
588
|
|
|
@@ -619,8 +600,6 @@ Creates a new map with entries that pass the predicate.
|
|
|
619
600
|
|
|
620
601
|
Time O(n), Space O(n)
|
|
621
602
|
|
|
622
|
-
*
|
|
623
|
-
|
|
624
603
|
#### Example
|
|
625
604
|
|
|
626
605
|
```ts
|
|
@@ -641,7 +620,7 @@ Time O(n), Space O(n)
|
|
|
641
620
|
first(): [K, V[]] | undefined;
|
|
642
621
|
```
|
|
643
622
|
|
|
644
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
623
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:453](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L453)
|
|
645
624
|
|
|
646
625
|
Returns the entry with the smallest key.
|
|
647
626
|
|
|
@@ -653,8 +632,6 @@ Returns the entry with the smallest key.
|
|
|
653
632
|
|
|
654
633
|
Time O(log n), Space O(1)
|
|
655
634
|
|
|
656
|
-
*
|
|
657
|
-
|
|
658
635
|
#### Example
|
|
659
636
|
|
|
660
637
|
```ts
|
|
@@ -673,7 +650,7 @@ Time O(log n), Space O(1)
|
|
|
673
650
|
flatEntries(): IterableIterator<[K, V]>;
|
|
674
651
|
```
|
|
675
652
|
|
|
676
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
653
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:435](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L435)
|
|
677
654
|
|
|
678
655
|
Iterates over all [key, value] pairs (flattened from buckets).
|
|
679
656
|
|
|
@@ -685,8 +662,6 @@ Iterates over all [key, value] pairs (flattened from buckets).
|
|
|
685
662
|
|
|
686
663
|
Time O(T), Space O(1) where T is totalSize
|
|
687
664
|
|
|
688
|
-
*
|
|
689
|
-
|
|
690
665
|
#### Example
|
|
691
666
|
|
|
692
667
|
```ts
|
|
@@ -695,7 +670,11 @@ Time O(T), Space O(1) where T is totalSize
|
|
|
695
670
|
mm.add(1, 'a');
|
|
696
671
|
mm.add(1, 'b');
|
|
697
672
|
mm.add(2, 'c');
|
|
698
|
-
console.log([...mm.flatEntries()]); // [
|
|
673
|
+
console.log([...mm.flatEntries()]); // [
|
|
674
|
+
// [1, 'a'],
|
|
675
|
+
// [1, 'b'],
|
|
676
|
+
// [2, 'c']
|
|
677
|
+
// ];
|
|
699
678
|
```
|
|
700
679
|
|
|
701
680
|
***
|
|
@@ -706,7 +685,7 @@ Time O(T), Space O(1) where T is totalSize
|
|
|
706
685
|
floor(key): [K, V[]] | undefined;
|
|
707
686
|
```
|
|
708
687
|
|
|
709
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
688
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:544](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L544)
|
|
710
689
|
|
|
711
690
|
Returns the entry with the largest key <= given key.
|
|
712
691
|
|
|
@@ -724,8 +703,6 @@ Returns the entry with the largest key <= given key.
|
|
|
724
703
|
|
|
725
704
|
Time O(log n), Space O(1)
|
|
726
705
|
|
|
727
|
-
*
|
|
728
|
-
|
|
729
706
|
#### Example
|
|
730
707
|
|
|
731
708
|
```ts
|
|
@@ -745,7 +722,7 @@ Time O(log n), Space O(1)
|
|
|
745
722
|
forEach(callback): void;
|
|
746
723
|
```
|
|
747
724
|
|
|
748
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
725
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:615](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L615)
|
|
749
726
|
|
|
750
727
|
Executes a callback for each entry.
|
|
751
728
|
|
|
@@ -763,8 +740,6 @@ Executes a callback for each entry.
|
|
|
763
740
|
|
|
764
741
|
Time O(n), Space O(1)
|
|
765
742
|
|
|
766
|
-
*
|
|
767
|
-
|
|
768
743
|
#### Example
|
|
769
744
|
|
|
770
745
|
```ts
|
|
@@ -785,7 +760,7 @@ Time O(n), Space O(1)
|
|
|
785
760
|
get(key): V[] | undefined;
|
|
786
761
|
```
|
|
787
762
|
|
|
788
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
763
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:184](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L184)
|
|
789
764
|
|
|
790
765
|
Live bucket reference (do not auto-delete key if bucket becomes empty via mutation).
|
|
791
766
|
|
|
@@ -803,8 +778,6 @@ Live bucket reference (do not auto-delete key if bucket becomes empty via mutati
|
|
|
803
778
|
|
|
804
779
|
Time O(log n), Space O(1)
|
|
805
780
|
|
|
806
|
-
*
|
|
807
|
-
|
|
808
781
|
#### Example
|
|
809
782
|
|
|
810
783
|
```ts
|
|
@@ -823,7 +796,7 @@ Time O(log n), Space O(1)
|
|
|
823
796
|
getByRank(k): [K, V[]] | undefined;
|
|
824
797
|
```
|
|
825
798
|
|
|
826
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
799
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:729](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L729)
|
|
827
800
|
|
|
828
801
|
Creates a shallow clone of this map.
|
|
829
802
|
|
|
@@ -841,8 +814,6 @@ Creates a shallow clone of this map.
|
|
|
841
814
|
|
|
842
815
|
Time O(n log n), Space O(n)
|
|
843
816
|
|
|
844
|
-
*
|
|
845
|
-
|
|
846
817
|
#### Example
|
|
847
818
|
|
|
848
819
|
```ts
|
|
@@ -861,7 +832,7 @@ Time O(n log n), Space O(n)
|
|
|
861
832
|
getRank(key): number;
|
|
862
833
|
```
|
|
863
834
|
|
|
864
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
835
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:748](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L748)
|
|
865
836
|
|
|
866
837
|
Get the rank of a key in sorted order
|
|
867
838
|
|
|
@@ -897,7 +868,7 @@ Get the rank of a key in sorted order
|
|
|
897
868
|
has(key): boolean;
|
|
898
869
|
```
|
|
899
870
|
|
|
900
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
871
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:169](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L169)
|
|
901
872
|
|
|
902
873
|
Whether the map contains the given key.
|
|
903
874
|
|
|
@@ -915,8 +886,6 @@ Whether the map contains the given key.
|
|
|
915
886
|
|
|
916
887
|
Time O(log n), Space O(1)
|
|
917
888
|
|
|
918
|
-
*
|
|
919
|
-
|
|
920
889
|
#### Example
|
|
921
890
|
|
|
922
891
|
```ts
|
|
@@ -938,7 +907,7 @@ hasEntry(
|
|
|
938
907
|
eq?): boolean;
|
|
939
908
|
```
|
|
940
909
|
|
|
941
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
910
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:271](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L271)
|
|
942
911
|
|
|
943
912
|
Check if a specific value exists in a key's bucket.
|
|
944
913
|
|
|
@@ -964,8 +933,6 @@ Check if a specific value exists in a key's bucket.
|
|
|
964
933
|
|
|
965
934
|
Time O(log n + m), Space O(1) where m is bucket size
|
|
966
935
|
|
|
967
|
-
*
|
|
968
|
-
|
|
969
936
|
#### Example
|
|
970
937
|
|
|
971
938
|
```ts
|
|
@@ -984,7 +951,7 @@ Time O(log n + m), Space O(1) where m is bucket size
|
|
|
984
951
|
higher(key): [K, V[]] | undefined;
|
|
985
952
|
```
|
|
986
953
|
|
|
987
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
954
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:562](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L562)
|
|
988
955
|
|
|
989
956
|
Returns the entry with the smallest key > given key.
|
|
990
957
|
|
|
@@ -1002,8 +969,6 @@ Returns the entry with the smallest key > given key.
|
|
|
1002
969
|
|
|
1003
970
|
Time O(log n), Space O(1)
|
|
1004
971
|
|
|
1005
|
-
*
|
|
1006
|
-
|
|
1007
972
|
#### Example
|
|
1008
973
|
|
|
1009
974
|
```ts
|
|
@@ -1022,7 +987,7 @@ Time O(log n), Space O(1)
|
|
|
1022
987
|
isEmpty(): boolean;
|
|
1023
988
|
```
|
|
1024
989
|
|
|
1025
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
990
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:126](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L126)
|
|
1026
991
|
|
|
1027
992
|
Whether the map is empty.
|
|
1028
993
|
|
|
@@ -1034,8 +999,6 @@ Whether the map is empty.
|
|
|
1034
999
|
|
|
1035
1000
|
Time O(1), Space O(1)
|
|
1036
1001
|
|
|
1037
|
-
*
|
|
1038
|
-
|
|
1039
1002
|
#### Example
|
|
1040
1003
|
|
|
1041
1004
|
```ts
|
|
@@ -1051,7 +1014,7 @@ Time O(1), Space O(1)
|
|
|
1051
1014
|
keys(): IterableIterator<K>;
|
|
1052
1015
|
```
|
|
1053
1016
|
|
|
1054
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1017
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:347](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L347)
|
|
1055
1018
|
|
|
1056
1019
|
Iterates over all keys.
|
|
1057
1020
|
|
|
@@ -1063,8 +1026,6 @@ Iterates over all keys.
|
|
|
1063
1026
|
|
|
1064
1027
|
Time O(n), Space O(1)
|
|
1065
1028
|
|
|
1066
|
-
*
|
|
1067
|
-
|
|
1068
1029
|
#### Example
|
|
1069
1030
|
|
|
1070
1031
|
```ts
|
|
@@ -1083,7 +1044,7 @@ Time O(n), Space O(1)
|
|
|
1083
1044
|
last(): [K, V[]] | undefined;
|
|
1084
1045
|
```
|
|
1085
1046
|
|
|
1086
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1047
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:470](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L470)
|
|
1087
1048
|
|
|
1088
1049
|
Returns the entry with the largest key.
|
|
1089
1050
|
|
|
@@ -1095,8 +1056,6 @@ Returns the entry with the largest key.
|
|
|
1095
1056
|
|
|
1096
1057
|
Time O(log n), Space O(1)
|
|
1097
1058
|
|
|
1098
|
-
*
|
|
1099
|
-
|
|
1100
1059
|
#### Example
|
|
1101
1060
|
|
|
1102
1061
|
```ts
|
|
@@ -1115,7 +1074,7 @@ Time O(log n), Space O(1)
|
|
|
1115
1074
|
lower(key): [K, V[]] | undefined;
|
|
1116
1075
|
```
|
|
1117
1076
|
|
|
1118
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1077
|
+
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)
|
|
1119
1078
|
|
|
1120
1079
|
Returns the entry with the largest key < given key.
|
|
1121
1080
|
|
|
@@ -1133,8 +1092,6 @@ Returns the entry with the largest key < given key.
|
|
|
1133
1092
|
|
|
1134
1093
|
Time O(log n), Space O(1)
|
|
1135
1094
|
|
|
1136
|
-
*
|
|
1137
|
-
|
|
1138
1095
|
#### Example
|
|
1139
1096
|
|
|
1140
1097
|
```ts
|
|
@@ -1153,7 +1110,7 @@ Time O(log n), Space O(1)
|
|
|
1153
1110
|
map<V2>(mapper): TreeMultiMap<K, V2, R>;
|
|
1154
1111
|
```
|
|
1155
1112
|
|
|
1156
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1113
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:651](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L651)
|
|
1157
1114
|
|
|
1158
1115
|
Creates a new map by transforming each entry.
|
|
1159
1116
|
|
|
@@ -1177,8 +1134,6 @@ Creates a new map by transforming each entry.
|
|
|
1177
1134
|
|
|
1178
1135
|
Time O(n log n), Space O(n)
|
|
1179
1136
|
|
|
1180
|
-
*
|
|
1181
|
-
|
|
1182
1137
|
#### Example
|
|
1183
1138
|
|
|
1184
1139
|
```ts
|
|
@@ -1197,7 +1152,7 @@ Time O(n log n), Space O(n)
|
|
|
1197
1152
|
pollFirst(): [K, V[]] | undefined;
|
|
1198
1153
|
```
|
|
1199
1154
|
|
|
1200
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1155
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:489](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L489)
|
|
1201
1156
|
|
|
1202
1157
|
Removes and returns the entry with the smallest key.
|
|
1203
1158
|
|
|
@@ -1209,8 +1164,6 @@ Removes and returns the entry with the smallest key.
|
|
|
1209
1164
|
|
|
1210
1165
|
Time O(log n), Space O(1)
|
|
1211
1166
|
|
|
1212
|
-
*
|
|
1213
|
-
|
|
1214
1167
|
#### Example
|
|
1215
1168
|
|
|
1216
1169
|
```ts
|
|
@@ -1231,7 +1184,7 @@ Time O(log n), Space O(1)
|
|
|
1231
1184
|
pollLast(): [K, V[]] | undefined;
|
|
1232
1185
|
```
|
|
1233
1186
|
|
|
1234
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1187
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:507](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L507)
|
|
1235
1188
|
|
|
1236
1189
|
Removes and returns the entry with the largest key.
|
|
1237
1190
|
|
|
@@ -1243,8 +1196,6 @@ Removes and returns the entry with the largest key.
|
|
|
1243
1196
|
|
|
1244
1197
|
Time O(log n), Space O(1)
|
|
1245
1198
|
|
|
1246
|
-
*
|
|
1247
|
-
|
|
1248
1199
|
#### Example
|
|
1249
1200
|
|
|
1250
1201
|
```ts
|
|
@@ -1264,7 +1215,7 @@ Time O(log n), Space O(1)
|
|
|
1264
1215
|
print(): void;
|
|
1265
1216
|
```
|
|
1266
1217
|
|
|
1267
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1218
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:599](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L599)
|
|
1268
1219
|
|
|
1269
1220
|
Prints the internal tree structure (for debugging).
|
|
1270
1221
|
|
|
@@ -1276,8 +1227,6 @@ Prints the internal tree structure (for debugging).
|
|
|
1276
1227
|
|
|
1277
1228
|
Time O(n), Space O(n)
|
|
1278
1229
|
|
|
1279
|
-
*
|
|
1280
|
-
|
|
1281
1230
|
#### Example
|
|
1282
1231
|
|
|
1283
1232
|
```ts
|
|
@@ -1295,12 +1244,10 @@ Time O(n), Space O(n)
|
|
|
1295
1244
|
rangeByRank(start, end): [K, V[]][];
|
|
1296
1245
|
```
|
|
1297
1246
|
|
|
1298
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1247
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:766](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L766)
|
|
1299
1248
|
|
|
1300
1249
|
Get elements by rank range
|
|
1301
1250
|
|
|
1302
|
-
*
|
|
1303
|
-
|
|
1304
1251
|
#### Parameters
|
|
1305
1252
|
|
|
1306
1253
|
##### start
|
|
@@ -1319,10 +1266,7 @@ Get elements by rank range
|
|
|
1319
1266
|
|
|
1320
1267
|
```ts
|
|
1321
1268
|
// Pagination by position in tree order
|
|
1322
|
-
const tree = new TreeMultiMap<number>(
|
|
1323
|
-
[10, 20, 30, 40, 50, 60, 70, 80, 90],
|
|
1324
|
-
{ enableOrderStatistic: true }
|
|
1325
|
-
);
|
|
1269
|
+
const tree = new TreeMultiMap<number>([10, 20, 30, 40, 50, 60, 70, 80, 90], { enableOrderStatistic: true });
|
|
1326
1270
|
const pageSize = 3;
|
|
1327
1271
|
|
|
1328
1272
|
// Page 1
|
|
@@ -1341,7 +1285,7 @@ Get elements by rank range
|
|
|
1341
1285
|
rangeSearch<C>(range, callback?): ReturnType<C>[];
|
|
1342
1286
|
```
|
|
1343
1287
|
|
|
1344
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1288
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:711](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L711)
|
|
1345
1289
|
|
|
1346
1290
|
Searches for entries within a key range.
|
|
1347
1291
|
|
|
@@ -1369,8 +1313,6 @@ Searches for entries within a key range.
|
|
|
1369
1313
|
|
|
1370
1314
|
Time O(log n + k), Space O(k) where k is result size
|
|
1371
1315
|
|
|
1372
|
-
*
|
|
1373
|
-
|
|
1374
1316
|
#### Example
|
|
1375
1317
|
|
|
1376
1318
|
```ts
|
|
@@ -1391,7 +1333,7 @@ Time O(log n + k), Space O(k) where k is result size
|
|
|
1391
1333
|
reduce<U>(callback, initialValue): U;
|
|
1392
1334
|
```
|
|
1393
1335
|
|
|
1394
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1336
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:670](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L670)
|
|
1395
1337
|
|
|
1396
1338
|
Reduces all entries to a single value.
|
|
1397
1339
|
|
|
@@ -1419,8 +1361,6 @@ Reduces all entries to a single value.
|
|
|
1419
1361
|
|
|
1420
1362
|
Time O(n), Space O(1)
|
|
1421
1363
|
|
|
1422
|
-
*
|
|
1423
|
-
|
|
1424
1364
|
#### Example
|
|
1425
1365
|
|
|
1426
1366
|
```ts
|
|
@@ -1442,7 +1382,7 @@ Time O(n), Space O(1)
|
|
|
1442
1382
|
set(entry, value?): boolean;
|
|
1443
1383
|
```
|
|
1444
1384
|
|
|
1445
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1385
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:220](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L220)
|
|
1446
1386
|
|
|
1447
1387
|
Alias for compatibility with existing TreeMultiMap semantics.
|
|
1448
1388
|
|
|
@@ -1467,8 +1407,6 @@ Alias for compatibility with existing TreeMultiMap semantics.
|
|
|
1467
1407
|
|
|
1468
1408
|
Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
1469
1409
|
|
|
1470
|
-
*
|
|
1471
|
-
|
|
1472
1410
|
##### Example
|
|
1473
1411
|
|
|
1474
1412
|
```ts
|
|
@@ -1485,7 +1423,7 @@ Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
|
1485
1423
|
set(key, value): boolean;
|
|
1486
1424
|
```
|
|
1487
1425
|
|
|
1488
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1426
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:221](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L221)
|
|
1489
1427
|
|
|
1490
1428
|
Alias for compatibility with existing TreeMultiMap semantics.
|
|
1491
1429
|
|
|
@@ -1507,8 +1445,6 @@ Alias for compatibility with existing TreeMultiMap semantics.
|
|
|
1507
1445
|
|
|
1508
1446
|
Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
1509
1447
|
|
|
1510
|
-
*
|
|
1511
|
-
|
|
1512
1448
|
##### Example
|
|
1513
1449
|
|
|
1514
1450
|
```ts
|
|
@@ -1527,7 +1463,7 @@ Time O(log n), Space O(1) for single value; O(log n + m) for bucket append
|
|
|
1527
1463
|
setMany(keysNodesEntriesOrRaws): boolean[];
|
|
1528
1464
|
```
|
|
1529
1465
|
|
|
1530
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1466
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:690](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L690)
|
|
1531
1467
|
|
|
1532
1468
|
Sets multiple entries at once.
|
|
1533
1469
|
|
|
@@ -1545,14 +1481,15 @@ Sets multiple entries at once.
|
|
|
1545
1481
|
|
|
1546
1482
|
Time O(m log n), Space O(m) where m is input size
|
|
1547
1483
|
|
|
1548
|
-
*
|
|
1549
|
-
|
|
1550
1484
|
#### Example
|
|
1551
1485
|
|
|
1552
1486
|
```ts
|
|
1553
1487
|
// Set multiple entries
|
|
1554
1488
|
const mm = new TreeMultiMap<number, string>();
|
|
1555
|
-
mm.setMany([
|
|
1489
|
+
mm.setMany([
|
|
1490
|
+
[1, ['a']],
|
|
1491
|
+
[2, ['b']]
|
|
1492
|
+
]);
|
|
1556
1493
|
console.log(mm.size); // 2;
|
|
1557
1494
|
```
|
|
1558
1495
|
|
|
@@ -1564,7 +1501,7 @@ Time O(m log n), Space O(m) where m is input size
|
|
|
1564
1501
|
values(): IterableIterator<V[]>;
|
|
1565
1502
|
```
|
|
1566
1503
|
|
|
1567
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1504
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:361](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L361)
|
|
1568
1505
|
|
|
1569
1506
|
Iterates over all buckets.
|
|
1570
1507
|
|
|
@@ -1576,8 +1513,6 @@ Iterates over all buckets.
|
|
|
1576
1513
|
|
|
1577
1514
|
Time O(n), Space O(1)
|
|
1578
1515
|
|
|
1579
|
-
*
|
|
1580
|
-
|
|
1581
1516
|
#### Example
|
|
1582
1517
|
|
|
1583
1518
|
```ts
|
|
@@ -1596,7 +1531,7 @@ Time O(n), Space O(1)
|
|
|
1596
1531
|
valuesOf(key): IterableIterator<V>;
|
|
1597
1532
|
```
|
|
1598
1533
|
|
|
1599
|
-
Defined in: [data-structures/binary-tree/tree-multi-map.ts:
|
|
1534
|
+
Defined in: [data-structures/binary-tree/tree-multi-map.ts:414](https://github.com/zrwusa/data-structure-typed/blob/main/src/data-structures/binary-tree/tree-multi-map.ts#L414)
|
|
1600
1535
|
|
|
1601
1536
|
Iterates over all values for a specific key.
|
|
1602
1537
|
|
|
@@ -1614,8 +1549,6 @@ Iterates over all values for a specific key.
|
|
|
1614
1549
|
|
|
1615
1550
|
Time O(log n + m), Space O(1) where m is bucket size
|
|
1616
1551
|
|
|
1617
|
-
*
|
|
1618
|
-
|
|
1619
1552
|
#### Example
|
|
1620
1553
|
|
|
1621
1554
|
```ts
|