data-structure-typed 2.2.6 → 2.2.8

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/CONTRIBUTING.md +47 -1
  3. package/README.md +19 -8
  4. package/README_CN.md +119 -275
  5. package/benchmark/report.html +1 -1
  6. package/benchmark/report.json +20 -324
  7. package/dist/cjs/index.cjs +109 -107
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs-legacy/index.cjs +109 -107
  10. package/dist/cjs-legacy/index.cjs.map +1 -1
  11. package/dist/esm/index.mjs +109 -107
  12. package/dist/esm/index.mjs.map +1 -1
  13. package/dist/esm-legacy/index.mjs +109 -107
  14. package/dist/esm-legacy/index.mjs.map +1 -1
  15. package/dist/leetcode/avl-tree-counter.mjs +2957 -0
  16. package/dist/leetcode/avl-tree-multi-map.mjs +2889 -0
  17. package/dist/leetcode/avl-tree.mjs +2720 -0
  18. package/dist/leetcode/binary-tree.mjs +1594 -0
  19. package/dist/leetcode/bst.mjs +2398 -0
  20. package/dist/leetcode/deque.mjs +683 -0
  21. package/dist/leetcode/directed-graph.mjs +1733 -0
  22. package/dist/leetcode/doubly-linked-list.mjs +709 -0
  23. package/dist/leetcode/hash-map.mjs +493 -0
  24. package/dist/leetcode/heap.mjs +542 -0
  25. package/dist/leetcode/max-heap.mjs +375 -0
  26. package/dist/leetcode/max-priority-queue.mjs +383 -0
  27. package/dist/leetcode/min-heap.mjs +363 -0
  28. package/dist/leetcode/min-priority-queue.mjs +371 -0
  29. package/dist/leetcode/priority-queue.mjs +363 -0
  30. package/dist/leetcode/queue.mjs +943 -0
  31. package/dist/leetcode/red-black-tree.mjs +2765 -0
  32. package/dist/leetcode/singly-linked-list.mjs +754 -0
  33. package/dist/leetcode/stack.mjs +217 -0
  34. package/dist/leetcode/tree-counter.mjs +3039 -0
  35. package/dist/leetcode/tree-multi-map.mjs +2913 -0
  36. package/dist/leetcode/trie.mjs +413 -0
  37. package/dist/leetcode/undirected-graph.mjs +1650 -0
  38. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +1 -1
  39. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -2
  40. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +10 -10
  41. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +22 -23
  42. package/dist/types/data-structures/binary-tree/bst.d.ts +11 -11
  43. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +1 -1
  44. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +1 -1
  45. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -2
  46. package/dist/umd/data-structure-typed.js +105 -103
  47. package/dist/umd/data-structure-typed.js.map +1 -1
  48. package/dist/umd/data-structure-typed.min.js +2 -2
  49. package/dist/umd/data-structure-typed.min.js.map +1 -1
  50. package/package.json +48 -171
  51. package/src/data-structures/binary-tree/avl-tree-counter.ts +6 -6
  52. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +13 -13
  53. package/src/data-structures/binary-tree/avl-tree.ts +15 -15
  54. package/src/data-structures/binary-tree/binary-tree.ts +53 -55
  55. package/src/data-structures/binary-tree/bst.ts +21 -22
  56. package/src/data-structures/binary-tree/red-black-tree.ts +3 -3
  57. package/src/data-structures/binary-tree/tree-counter.ts +4 -4
  58. package/src/data-structures/binary-tree/tree-multi-map.ts +13 -13
  59. package/test/performance/data-structures/binary-tree/red-black-tree.test.ts +1 -2
  60. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +30 -30
  61. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +46 -46
  62. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +43 -43
  63. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +151 -151
  64. package/test/unit/data-structures/binary-tree/bst.test.ts +99 -99
  65. package/test/unit/data-structures/binary-tree/overall.test.ts +20 -20
  66. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +141 -141
  67. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +37 -37
  68. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +145 -145
  69. package/tsup.config.js +50 -21
  70. package/tsup.leetcode.config.js +1 -1
  71. package/tsup.umd.config.js +29 -0
  72. package/tsup.node.config.js +0 -83
@@ -147,7 +147,7 @@ export declare class AVLTreeCounter<K = any, V = any, R = any> extends AVLTree<K
147
147
  * @param [count] - How much to increase the node's count (default 1).
148
148
  * @returns True if inserted/updated; false if ignored.
149
149
  */
150
- add(keyNodeOrEntry: K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): boolean;
150
+ set(keyNodeOrEntry: K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): boolean;
151
151
  /**
152
152
  * Delete a node (or decrement its count) and rebalance if needed.
153
153
  * @remarks Time O(log N), Space O(1)
@@ -132,8 +132,8 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = any> extends AVLTree<
132
132
  * @returns True if it's a AVLTreeMultiMapNode, false otherwise.
133
133
  */
134
134
  isNode(keyNodeOrEntry: K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): keyNodeOrEntry is AVLTreeMultiMapNode<K, V>;
135
- add(keyNodeOrEntry: K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
136
- add(key: K, value: V): boolean;
135
+ set(keyNodeOrEntry: K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
136
+ set(key: K, value: V): boolean;
137
137
  /**
138
138
  * Delete a single value from the bucket at a given key. Removes the key if the bucket becomes empty.
139
139
  * @remarks Time O(log N), Space O(1)
@@ -112,7 +112,7 @@ export declare class AVLTreeNode<K = any, V = any> {
112
112
  }
113
113
  /**
114
114
  * Represents a self-balancing AVL (Adelson-Velsky and Landis) Tree.
115
- * This tree extends BST and performs rotations on add/delete to maintain balance.
115
+ * This tree extends BST and performs rotations on set/delete to maintain balance.
116
116
  *
117
117
  * @template K - The type of the key.
118
118
  * @template V - The type of the value.
@@ -145,7 +145,7 @@ export declare class AVLTreeNode<K = any, V = any> {
145
145
  * console.log(tree.size); // 5;
146
146
  *
147
147
  * // Add a new element
148
- * tree.add(3);
148
+ * tree.set(3);
149
149
  * console.log(tree.size); // 6;
150
150
  * console.log([...tree.keys()]); // [1, 2, 3, 5, 8, 9];
151
151
  * @example
@@ -208,7 +208,7 @@ export declare class AVLTreeNode<K = any, V = any> {
208
208
  * console.log(universityTree.isAVLBalanced()); // true;
209
209
  *
210
210
  * // Add more universities
211
- * universityTree.add(6, { name: 'Oxford', rank: 6, students: 2000 });
211
+ * universityTree.set(6, { name: 'Oxford', rank: 6, students: 2000 });
212
212
  * console.log(universityTree.isAVLBalanced()); // true;
213
213
  *
214
214
  * // Delete and verify balance is maintained
@@ -288,9 +288,9 @@ export declare class AVLTreeNode<K = any, V = any> {
288
288
  export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements IBinaryTree<K, V, R> {
289
289
  /**
290
290
  * Creates an instance of AVLTree.
291
- * @remarks Time O(N log N) (from `addMany` with balanced add). Space O(N).
291
+ * @remarks Time O(N log N) (from `setMany` with balanced set). Space O(N).
292
292
  *
293
- * @param [keysNodesEntriesOrRaws=[]] - An iterable of items to add.
293
+ * @param [keysNodesEntriesOrRaws=[]] - An iterable of items to set.
294
294
  * @param [options] - Configuration options for the AVL tree.
295
295
  */
296
296
  constructor(keysNodesEntriesOrRaws?: Iterable<K | AVLTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, options?: AVLTreeOptions<K, V, R>);
@@ -312,14 +312,14 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
312
312
  */
313
313
  isNode(keyNodeOrEntry: K | AVLTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is AVLTreeNode<K, V>;
314
314
  /**
315
- * Adds a new node to the AVL tree and balances the tree path.
316
- * @remarks Time O(log N) (O(H) for BST add + O(H) for `_balancePath`). Space O(H) for path/recursion.
315
+ * Sets a new node to the AVL tree and balances the tree path.
316
+ * @remarks Time O(log N) (O(H) for BST set + O(H) for `_balancePath`). Space O(H) for path/recursion.
317
317
  *
318
- * @param keyNodeOrEntry - The key, node, or entry to add.
318
+ * @param keyNodeOrEntry - The key, node, or entry to set.
319
319
  * @param [value] - The value, if providing just a key.
320
320
  * @returns True if the addition was successful, false otherwise.
321
321
  */
322
- add(keyNodeOrEntry: K | AVLTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
322
+ set(keyNodeOrEntry: K | AVLTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
323
323
  /**
324
324
  * Deletes a node from the AVL tree and re-balances the tree.
325
325
  * @remarks Time O(log N) (O(H) for BST delete + O(H) for `_balancePath`). Space O(H) for path/recursion.
@@ -339,7 +339,7 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
339
339
  perfectlyBalance(iterationType?: IterationType): boolean;
340
340
  /**
341
341
  * Creates a new AVLTree by mapping each [key, value] pair.
342
- * @remarks Time O(N log N) (O(N) iteration + O(log M) `add` for each item into the new tree). Space O(N) for the new tree.
342
+ * @remarks Time O(N log N) (O(N) iteration + O(log M) `set` for each item into the new tree). Space O(N) for the new tree.
343
343
  *
344
344
  * @template MK - New key type.
345
345
  * @template MV - New value type.
@@ -113,7 +113,7 @@ export declare class BinaryTreeNode<K = any, V = any> {
113
113
  *
114
114
  * @remarks
115
115
  * This class implements a basic Binary Tree, not a Binary Search Tree.
116
- * The `add` operation inserts nodes level-by-level (BFS) into the first available slot.
116
+ * The `set` operation inserts nodes level-by-level (BFS) into the first available slot.
117
117
  *
118
118
  * @template K - The type of the key.
119
119
  * @template V - The type of the value.
@@ -145,7 +145,7 @@ export declare class BinaryTreeNode<K = any, V = any> {
145
145
  * console.log(tree.size); // 9;
146
146
  *
147
147
  * // Add new element
148
- * tree.add(10, 'ten');
148
+ * tree.set(10, 'ten');
149
149
  * console.log(tree.size); // 10;
150
150
  * @example
151
151
  * // BinaryTree get and has operations
@@ -269,9 +269,9 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
269
269
  iterationType: IterationType;
270
270
  /**
271
271
  * Creates an instance of BinaryTree.
272
- * @remarks Time O(N * M), where N is the number of items in `keysNodesEntriesOrRaws` and M is the tree size at insertion time (due to O(M) `add` operation). Space O(N) for storing the nodes.
272
+ * @remarks Time O(N * M), where N is the number of items in `keysNodesEntriesOrRaws` and M is the tree size at insertion time (due to O(M) `set` operation). Space O(N) for storing the nodes.
273
273
  *
274
- * @param [keysNodesEntriesOrRaws=[]] - An iterable of items to add.
274
+ * @param [keysNodesEntriesOrRaws=[]] - An iterable of items to set.
275
275
  * @param [options] - Configuration options for the tree.
276
276
  */
277
277
  constructor(keysNodesEntriesOrRaws?: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, options?: BinaryTreeOptions<K, V, R>);
@@ -434,49 +434,48 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
434
434
  * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation adds the node at the first available position in a level-order (BFS) traversal. This is NOT a Binary Search Tree insertion. Time O(N), where N is the number of nodes. It must traverse level-by-level to find an empty slot. Space O(N) in the worst case for the BFS queue (e.g., a full last level).
435
435
  *
436
436
  * @param keyNodeOrEntry - The key, node, or entry to add.
437
- * @param [value] - The value, if providing just a key.
438
437
  * @returns True if the addition was successful, false otherwise.
439
438
  */
440
- add(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
439
+ add(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
441
440
  /**
442
441
  * Adds or updates a new node to the tree.
443
- * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation adds the node at the first available position in a level-order (BFS) traversal. This is NOT a Binary Search Tree insertion. Time O(N), where N is the number of nodes. It must traverse level-by-level to find an empty slot. Space O(N) in the worst case for the BFS queue (e.g., a full last level).
442
+ * @remarks Time O(log N), For BST, Red-Black Tree, and AVL Tree subclasses, the worst-case time is O(log N). This implementation sets the node at the first available position in a level-order (BFS) traversal. This is NOT a Binary Search Tree insertion. Time O(N), where N is the number of nodes. It must traverse level-by-level to find an empty slot. Space O(N) in the worst case for the BFS queue (e.g., a full last level).
444
443
  *
445
- * @param keyNodeOrEntry - The key, node, or entry to add or update.
444
+ * @param keyNodeOrEntry - The key, node, or entry to set or update.
446
445
  * @param [value] - The value, if providing just a key.
447
446
  * @returns True if the addition was successful, false otherwise.
448
447
  */
449
448
  set(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
450
449
  /**
451
450
  * Adds multiple items to the tree.
452
- * @remarks Time O(N * M), where N is the number of items to add and M is the size of the tree at insertion (due to O(M) `add` operation). Space O(M) (from `add`) + O(N) (for the `inserted` array).
451
+ * @remarks Time O(N * M), where N is the number of items to set and M is the size of the tree at insertion (due to O(M) `set` operation). Space O(M) (from `set`) + O(N) (for the `inserted` array).
453
452
  *
454
- * @param keysNodesEntriesOrRaws - An iterable of items to add.
453
+ * @param keysNodesEntriesOrRaws - An iterable of items to set.
455
454
  * @param [values] - An optional parallel iterable of values.
456
- * @returns An array of booleans indicating the success of each individual `add` operation.
455
+ * @returns An array of booleans indicating the success of each individual `set` operation.
457
456
  */
458
- addMany(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): boolean[];
457
+ addMany(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>): boolean[];
459
458
  /**
460
459
  * Adds or updates multiple items to the tree.
461
- * @remarks Time O(N * M), where N is the number of items to add and M is the size of the tree at insertion (due to O(M) `add` operation). Space O(M) (from `add`) + O(N) (for the `inserted` array).
460
+ * @remarks Time O(N * M), where N is the number of items to set and M is the size of the tree at insertion (due to O(M) `set` operation). Space O(M) (from `set`) + O(N) (for the `inserted` array).
462
461
  *
463
- * @param keysNodesEntriesOrRaws - An iterable of items to add or update.
462
+ * @param keysNodesEntriesOrRaws - An iterable of items to set or update.
464
463
  * @param [values] - An optional parallel iterable of values.
465
- * @returns An array of booleans indicating the success of each individual `add` operation.
464
+ * @returns An array of booleans indicating the success of each individual `set` operation.
466
465
  */
467
466
  setMany(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): boolean[];
468
467
  /**
469
- * Merges another tree into this one by adding all its nodes.
470
- * @remarks Time O(N * M), same as `addMany`, where N is the size of `anotherTree` and M is the size of this tree. Space O(M) (from `add`).
468
+ * Merges another tree into this one by seting all its nodes.
469
+ * @remarks Time O(N * M), same as `setMany`, where N is the size of `anotherTree` and M is the size of this tree. Space O(M) (from `set`).
471
470
  *
472
471
  * @param anotherTree - The tree to merge.
473
472
  */
474
473
  merge(anotherTree: BinaryTree<K, V, R>): void;
475
474
  /**
476
475
  * Clears the tree and refills it with new items.
477
- * @remarks Time O(N) (for `clear`) + O(N * M) (for `addMany`) = O(N * M). Space O(M) (from `addMany`).
476
+ * @remarks Time O(N) (for `clear`) + O(N * M) (for `setMany`) = O(N * M). Space O(M) (from `setMany`).
478
477
  *
479
- * @param keysNodesEntriesOrRaws - An iterable of items to add.
478
+ * @param keysNodesEntriesOrRaws - An iterable of items to set.
480
479
  * @param [values] - An optional parallel iterable of values.
481
480
  */
482
481
  refill(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): void;
@@ -624,14 +623,14 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
624
623
  morris<C extends NodeCallback<BinaryTreeNode<K, V>>>(callback?: C, pattern?: DFSOrderPattern, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): ReturnType<C>[];
625
624
  /**
626
625
  * Clones the tree.
627
- * @remarks Time O(N * M), where N is the number of nodes and M is the tree size during insertion (due to `bfs` + `add`, and `add` is O(M)). Space O(N) for the new tree and the BFS queue.
626
+ * @remarks Time O(N * M), where N is the number of nodes and M is the tree size during insertion (due to `bfs` + `set`, and `set` is O(M)). Space O(N) for the new tree and the BFS queue.
628
627
  *
629
628
  * @returns A new, cloned instance of the tree.
630
629
  */
631
630
  clone(): this;
632
631
  /**
633
632
  * Creates a new tree containing only the entries that satisfy the predicate.
634
- * @remarks Time O(N * M), where N is nodes in this tree, and M is size of the new tree during insertion (O(N) iteration + O(M) `add` for each item). Space O(N) for the new tree.
633
+ * @remarks Time O(N * M), where N is nodes in this tree, and M is size of the new tree during insertion (O(N) iteration + O(M) `set` for each item). Space O(N) for the new tree.
635
634
  *
636
635
  * @param predicate - A function to test each [key, value] pair.
637
636
  * @param [thisArg] - `this` context for the predicate.
@@ -722,8 +721,8 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
722
721
  */
723
722
  protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): [BinaryTreeNode<K, V> | null | undefined, V | undefined];
724
723
  /**
725
- * (Protected) Helper for cloning. Performs a BFS and adds all nodes to the new tree.
726
- * @remarks Time O(N * M) (O(N) BFS + O(M) `add` for each node).
724
+ * (Protected) Helper for cloning. Performs a BFS and sets all nodes to the new tree.
725
+ * @remarks Time O(N * M) (O(N) BFS + O(M) `set` for each node).
727
726
  *
728
727
  * @param cloned - The new, empty tree instance to populate.
729
728
  */
@@ -145,8 +145,8 @@ export declare class BSTNode<K = any, V = any> {
145
145
  * console.log(bst.size); // 16;
146
146
  *
147
147
  * // Add new elements
148
- * bst.add(17);
149
- * bst.add(0);
148
+ * bst.set(17);
149
+ * bst.set(0);
150
150
  * console.log(bst.size); // 18;
151
151
  *
152
152
  * // Verify keys are searchable
@@ -192,7 +192,7 @@ export declare class BSTNode<K = any, V = any> {
192
192
  *
193
193
  * // Merge datasets into a single BinarySearchTree
194
194
  * const merged = new BST<number, string>(dataset1);
195
- * merged.addMany(dataset2);
195
+ * merged.setMany(dataset2);
196
196
  * merged.merge(dataset3);
197
197
  *
198
198
  * // Verify merged dataset is in sorted order
@@ -276,7 +276,7 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
276
276
  * Creates an instance of BST.
277
277
  * @remarks Time O(N log N) or O(N^2) depending on `isBalanceAdd` in `addMany` and input order. Space O(N).
278
278
  *
279
- * @param [keysNodesEntriesOrRaws=[]] - An iterable of items to add.
279
+ * @param [keysNodesEntriesOrRaws=[]] - An iterable of items to set.
280
280
  * @param [options] - Configuration options for the BST, including comparator.
281
281
  */
282
282
  constructor(keysNodesEntriesOrRaws?: Iterable<K | BSTNode | [K | null | undefined, V | undefined] | null | undefined | R>, options?: BSTOptions<K, V, R>);
@@ -359,24 +359,24 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
359
359
  * Adds a new node to the BST based on key comparison.
360
360
  * @remarks Time O(log N), where H is tree height. O(N) worst-case (unbalanced tree), O(log N) average. Space O(1).
361
361
  *
362
- * @param keyNodeOrEntry - The key, node, or entry to add.
362
+ * @param keyNodeOrEntry - The key, node, or entry to set.
363
363
  * @param [value] - The value, if providing just a key.
364
364
  * @returns True if the addition was successful, false otherwise.
365
365
  */
366
- add(keyNodeOrEntry: K | BSTNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
366
+ set(keyNodeOrEntry: K | BSTNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
367
367
  /**
368
368
  * Adds multiple items to the tree.
369
- * @remarks If `isBalanceAdd` is true, sorts the input and builds a balanced tree. Time O(N log N) (due to sort and balanced add).
369
+ * @remarks If `isBalanceAdd` is true, sorts the input and builds a balanced tree. Time O(N log N) (due to sort and balanced set).
370
370
  * If false, adds items one by one. Time O(N * H), which is O(N^2) worst-case.
371
371
  * Space O(N) for sorting and recursion/iteration stack.
372
372
  *
373
- * @param keysNodesEntriesOrRaws - An iterable of items to add.
373
+ * @param keysNodesEntriesOrRaws - An iterable of items to set.
374
374
  * @param [values] - An optional parallel iterable of values.
375
375
  * @param [isBalanceAdd=true] - If true, builds a balanced tree from the items.
376
- * @param [iterationType=this.iterationType] - The traversal method for balanced add (recursive or iterative).
377
- * @returns An array of booleans indicating the success of each individual `add` operation.
376
+ * @param [iterationType=this.iterationType] - The traversal method for balanced set (recursive or iterative).
377
+ * @returns An array of booleans indicating the success of each individual `set` operation.
378
378
  */
379
- addMany(keysNodesEntriesOrRaws: Iterable<R | BTNRep<K, V, BSTNode<K, V>>>, values?: Iterable<V | undefined>, isBalanceAdd?: boolean, iterationType?: IterationType): boolean[];
379
+ setMany(keysNodesEntriesOrRaws: Iterable<R | BTNRep<K, V, BSTNode<K, V>>>, values?: Iterable<V | undefined>, isBalanceAdd?: boolean, iterationType?: IterationType): boolean[];
380
380
  /**
381
381
  * Returns the first key with a value >= target.
382
382
  * Equivalent to Java TreeMap.ceiling.
@@ -242,7 +242,7 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
242
242
  * @param [value]- See parameter type for details.
243
243
  * @returns True if inserted or updated; false if ignored.
244
244
  */
245
- add(keyNodeOrEntry: K | RedBlackTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
245
+ set(keyNodeOrEntry: K | RedBlackTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
246
246
  /**
247
247
  * Delete a node by key/node/entry and rebalance as needed.
248
248
  * @remarks Time O(log n), Space O(1)
@@ -154,7 +154,7 @@ export declare class TreeCounter<K = any, V = any, R = any> extends RedBlackTree
154
154
  * @param [count] - How much to increase the node's count (default 1).
155
155
  * @returns True if inserted/updated; false if ignored.
156
156
  */
157
- add(keyNodeOrEntry: K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): boolean;
157
+ set(keyNodeOrEntry: K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): boolean;
158
158
  /**
159
159
  * Delete a node (or decrement its count) and rebalance if needed.
160
160
  * @remarks Time O(log N), Space O(1)
@@ -297,8 +297,8 @@ export declare class TreeMultiMap<K = any, V = any, R = any> extends RedBlackTre
297
297
  * @returns True if it's a TreeMultiMapNode, false otherwise.
298
298
  */
299
299
  isNode(keyNodeOrEntry: K | TreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): keyNodeOrEntry is TreeMultiMapNode<K, V>;
300
- add(keyNodeOrEntry: K | TreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
301
- add(key: K, value: V): boolean;
300
+ set(keyNodeOrEntry: K | TreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
301
+ set(key: K, value: V): boolean;
302
302
  /**
303
303
  * Delete a single value from the bucket at a given key. Removes the key if the bucket becomes empty.
304
304
  * @remarks Time O(log N), Space O(1)