data-structure-typed 1.39.1 → 1.39.3

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 (77) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +10 -10
  3. package/dist/cjs/data-structures/binary-tree/avl-tree.js +4 -4
  4. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  5. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +58 -107
  6. package/dist/cjs/data-structures/binary-tree/binary-tree.js +65 -27
  7. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  8. package/dist/cjs/data-structures/binary-tree/bst.d.ts +22 -22
  9. package/dist/cjs/data-structures/binary-tree/bst.js +12 -12
  10. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +3 -3
  12. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  13. package/dist/cjs/data-structures/binary-tree/tree-multiset.d.ts +14 -14
  14. package/dist/cjs/data-structures/binary-tree/tree-multiset.js +7 -7
  15. package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -1
  16. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +46 -28
  17. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +59 -49
  18. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  19. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +75 -7
  20. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +110 -9
  21. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  22. package/dist/cjs/data-structures/queue/deque.d.ts +20 -20
  23. package/dist/cjs/data-structures/queue/deque.js +22 -22
  24. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  25. package/dist/cjs/data-structures/queue/queue.d.ts +3 -3
  26. package/dist/cjs/data-structures/queue/queue.js +3 -3
  27. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  28. package/dist/cjs/interfaces/binary-tree.d.ts +4 -4
  29. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
  30. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +2 -2
  31. package/dist/cjs/types/helpers.d.ts +1 -1
  32. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +10 -10
  33. package/dist/mjs/data-structures/binary-tree/avl-tree.js +4 -4
  34. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +58 -107
  35. package/dist/mjs/data-structures/binary-tree/binary-tree.js +65 -27
  36. package/dist/mjs/data-structures/binary-tree/bst.d.ts +22 -22
  37. package/dist/mjs/data-structures/binary-tree/bst.js +12 -12
  38. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +3 -3
  39. package/dist/mjs/data-structures/binary-tree/tree-multiset.d.ts +14 -14
  40. package/dist/mjs/data-structures/binary-tree/tree-multiset.js +7 -7
  41. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +46 -28
  42. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +59 -49
  43. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +75 -7
  44. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +110 -9
  45. package/dist/mjs/data-structures/queue/deque.d.ts +20 -20
  46. package/dist/mjs/data-structures/queue/deque.js +22 -22
  47. package/dist/mjs/data-structures/queue/queue.d.ts +3 -3
  48. package/dist/mjs/data-structures/queue/queue.js +3 -3
  49. package/dist/mjs/interfaces/binary-tree.d.ts +4 -4
  50. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
  51. package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +2 -2
  52. package/dist/mjs/types/helpers.d.ts +1 -1
  53. package/dist/umd/data-structure-typed.min.js +1 -1
  54. package/dist/umd/data-structure-typed.min.js.map +1 -1
  55. package/package.json +5 -5
  56. package/src/data-structures/binary-tree/avl-tree.ts +10 -10
  57. package/src/data-structures/binary-tree/binary-tree.ts +165 -53
  58. package/src/data-structures/binary-tree/bst.ts +29 -31
  59. package/src/data-structures/binary-tree/rb-tree.ts +5 -5
  60. package/src/data-structures/binary-tree/tree-multiset.ts +14 -14
  61. package/src/data-structures/linked-list/doubly-linked-list.ts +62 -56
  62. package/src/data-structures/linked-list/singly-linked-list.ts +118 -13
  63. package/src/data-structures/queue/deque.ts +22 -22
  64. package/src/data-structures/queue/queue.ts +3 -3
  65. package/src/interfaces/binary-tree.ts +4 -4
  66. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
  67. package/src/types/data-structures/binary-tree/bst.ts +2 -2
  68. package/src/types/helpers.ts +1 -1
  69. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +33 -7
  70. package/test/unit/data-structures/hash/coordinate-map.test.ts +20 -0
  71. package/test/unit/data-structures/hash/coordinate-set.test.ts +25 -0
  72. package/test/unit/data-structures/hash/hash-table.test.ts +3 -1
  73. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +65 -6
  74. package/test/unit/data-structures/linked-list/linked-list.test.ts +2 -2
  75. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +57 -13
  76. package/test/unit/data-structures/queue/deque.test.ts +43 -43
  77. package/test/unit/data-structures/queue/queue.test.ts +7 -7
@@ -31,7 +31,7 @@ class BinaryTreeNode {
31
31
  parent;
32
32
  /**
33
33
  * Creates a new instance of BinaryTreeNode.
34
- * @param {BinaryTreeNodeKey} key - The key associated with the node.
34
+ * @param {BTNKey} key - The key associated with the node.
35
35
  * @param {V} val - The value stored in the node.
36
36
  */
37
37
  constructor(key, val) {
@@ -136,7 +136,7 @@ class BinaryTree {
136
136
  }
137
137
  /**
138
138
  * Creates a new instance of BinaryTreeNode with the given key and value.
139
- * @param {BinaryTreeNodeKey} key - The key for the new node.
139
+ * @param {BTNKey} key - The key for the new node.
140
140
  * @param {V} val - The value for the new node.
141
141
  * @returns {N} - The newly created BinaryTreeNode.
142
142
  */
@@ -159,7 +159,7 @@ class BinaryTree {
159
159
  }
160
160
  /**
161
161
  * Add a node with the given key and value to the binary tree.
162
- * @param {BinaryTreeNodeKey | N | null} keyOrNode - The key or node to add to the binary tree.
162
+ * @param {BTNKey | N | null} keyOrNode - The key or node to add to the binary tree.
163
163
  * @param {V} val - The value for the new node (optional).
164
164
  * @returns {N | null | undefined} - The inserted node, or null if nothing was inserted, or undefined if the operation failed.
165
165
  */
@@ -223,7 +223,7 @@ class BinaryTree {
223
223
  /**
224
224
  * The `addMany` function takes an array of binary tree node IDs or nodes, and optionally an array of corresponding data
225
225
  * values, and adds them to the binary tree.
226
- * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of BinaryTreeNodeKey or BinaryTreeNode
226
+ * @param {(BTNKey | null)[] | (N | null)[]} keysOrNodes - An array of BTNKey or BinaryTreeNode
227
227
  * objects, or null values.
228
228
  * @param {V[]} [values] - The `values` parameter is an optional array of values (`V[]`) that corresponds to
229
229
  * the nodes or node IDs being added. It is used to set the value of each node being added. If `values` is not provided,
@@ -245,8 +245,8 @@ class BinaryTree {
245
245
  }
246
246
  /**
247
247
  * The `refill` function clears the binary tree and adds multiple nodes with the given IDs or nodes and optional data.
248
- * @param {(BinaryTreeNodeKey | N)[]} keysOrNodes - The `keysOrNodes` parameter is an array that can contain either
249
- * `BinaryTreeNodeKey` or `N` values.
248
+ * @param {(BTNKey | N)[]} keysOrNodes - The `keysOrNodes` parameter is an array that can contain either
249
+ * `BTNKey` or `N` values.
250
250
  * @param {N[] | Array<V>} [data] - The `data` parameter is an optional array of values that will be assigned to
251
251
  * the nodes being added. If provided, the length of the `data` array should be equal to the length of the `keysOrNodes`
252
252
  * array. Each value in the `data` array will be assigned to the
@@ -259,11 +259,11 @@ class BinaryTree {
259
259
  /**
260
260
  * The `delete` function removes a node from a binary search tree and returns the deleted node along
261
261
  * with the parent node that needs to be balanced.
262
- * a key (`BinaryTreeNodeKey`). If it is a key, the function will find the corresponding node in the
262
+ * a key (`BTNKey`). If it is a key, the function will find the corresponding node in the
263
263
  * binary tree.
264
264
  * @returns an array of `BinaryTreeDeletedResult<N>` objects.
265
265
  * @param {ReturnType<C>} identifier - The `identifier` parameter is either a
266
- * `BinaryTreeNodeKey` or a generic type `N`. It represents the property of the node that we are
266
+ * `BTNKey` or a generic type `N`. It represents the property of the node that we are
267
267
  * searching for. It can be a specific key value or any other property of the node.
268
268
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
269
269
  * value. This value is compared with the `identifier` parameter to determine if the node should be
@@ -318,10 +318,10 @@ class BinaryTree {
318
318
  /**
319
319
  * The function `getDepth` calculates the depth of a given node in a binary tree relative to a
320
320
  * specified root node.
321
- * @param {BinaryTreeNodeKey | N | null} distNode - The `distNode` parameter represents the node
321
+ * @param {BTNKey | N | null} distNode - The `distNode` parameter represents the node
322
322
  * whose depth we want to find in the binary tree. It can be either a node object (`N`), a key value
323
- * of the node (`BinaryTreeNodeKey`), or `null`.
324
- * @param {BinaryTreeNodeKey | N | null} beginRoot - The `beginRoot` parameter represents the
323
+ * of the node (`BTNKey`), or `null`.
324
+ * @param {BTNKey | N | null} beginRoot - The `beginRoot` parameter represents the
325
325
  * starting node from which we want to calculate the depth. It can be either a node object or the key
326
326
  * of a node in the binary tree. If no value is provided for `beginRoot`, it defaults to the root
327
327
  * node of the binary tree.
@@ -345,9 +345,9 @@ class BinaryTree {
345
345
  /**
346
346
  * The `getHeight` function calculates the maximum height of a binary tree using either recursive or
347
347
  * iterative approach.
348
- * @param {BinaryTreeNodeKey | N | null} beginRoot - The `beginRoot` parameter represents the
348
+ * @param {BTNKey | N | null} beginRoot - The `beginRoot` parameter represents the
349
349
  * starting node from which the height of the binary tree is calculated. It can be either a node
350
- * object (`N`), a key value of a node in the tree (`BinaryTreeNodeKey`), or `null` if no starting
350
+ * object (`N`), a key value of a node in the tree (`BTNKey`), or `null` if no starting
351
351
  * node is specified. If `
352
352
  * @param iterationType - The `iterationType` parameter is used to determine whether to calculate the
353
353
  * height of the binary tree using a recursive approach or an iterative approach. It can have two
@@ -455,7 +455,7 @@ class BinaryTree {
455
455
  * The function `getNodes` returns an array of nodes that match a given node property, using either
456
456
  * recursive or iterative traversal.
457
457
  * @param {ReturnType<C>} identifier - The `identifier` parameter is either a
458
- * `BinaryTreeNodeKey` or a generic type `N`. It represents the property of the node that we are
458
+ * `BTNKey` or a generic type `N`. It represents the property of the node that we are
459
459
  * searching for. It can be a specific key value or any other property of the node.
460
460
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
461
461
  * value. This value is compared with the `identifier` parameter to determine if the node should be
@@ -511,8 +511,8 @@ class BinaryTree {
511
511
  }
512
512
  /**
513
513
  * The function checks if a binary tree has a node with a given property or key.
514
- * @param {BinaryTreeNodeKey | N} identifier - The `identifier` parameter is the key or value of
515
- * the node that you want to find in the binary tree. It can be either a `BinaryTreeNodeKey` or a
514
+ * @param {BTNKey | N} identifier - The `identifier` parameter is the key or value of
515
+ * the node that you want to find in the binary tree. It can be either a `BTNKey` or a
516
516
  * generic type `N`.
517
517
  * @param callback - The `callback` parameter is a function that is used to determine whether a node
518
518
  * matches the desired criteria. It takes a node as input and returns a boolean value indicating
@@ -534,8 +534,8 @@ class BinaryTree {
534
534
  }
535
535
  /**
536
536
  * The function `get` returns the first node in a binary tree that matches the given property or key.
537
- * @param {BinaryTreeNodeKey | N} identifier - The `identifier` parameter is the key or value of
538
- * the node that you want to find in the binary tree. It can be either a `BinaryTreeNodeKey` or `N`
537
+ * @param {BTNKey | N} identifier - The `identifier` parameter is the key or value of
538
+ * the node that you want to find in the binary tree. It can be either a `BTNKey` or `N`
539
539
  * type.
540
540
  * @param callback - The `callback` parameter is a function that is used to determine whether a node
541
541
  * matches the desired criteria. It takes a node as input and returns a boolean value indicating
@@ -578,9 +578,9 @@ class BinaryTree {
578
578
  /**
579
579
  * The function `getLeftMost` returns the leftmost node in a binary tree, either using recursive or
580
580
  * iterative traversal.
581
- * @param {BinaryTreeNodeKey | N | null} beginRoot - The `beginRoot` parameter is the starting point
581
+ * @param {BTNKey | N | null} beginRoot - The `beginRoot` parameter is the starting point
582
582
  * for finding the leftmost node in a binary tree. It can be either a node object (`N`), a key value
583
- * of a node (`BinaryTreeNodeKey`), or `null` if the tree is empty.
583
+ * of a node (`BTNKey`), or `null` if the tree is empty.
584
584
  * @param iterationType - The `iterationType` parameter is used to determine the type of iteration to
585
585
  * be performed when finding the leftmost node in a binary tree. It can have two possible values:
586
586
  * @returns The function `getLeftMost` returns the leftmost node (`N`) in a binary tree. If there is
@@ -702,12 +702,12 @@ class BinaryTree {
702
702
  * subtree traversal. It takes a single argument, which is the current node being traversed, and
703
703
  * returns a value. The return values from each callback invocation will be collected and returned as
704
704
  * an array.
705
- * @param {BinaryTreeNodeKey | N | null} beginRoot - The `beginRoot` parameter is the starting point
705
+ * @param {BTNKey | N | null} beginRoot - The `beginRoot` parameter is the starting point
706
706
  * for traversing the subtree. It can be either a node object, a key value of a node, or `null` to
707
707
  * start from the root of the tree.
708
708
  * @param iterationType - The `iterationType` parameter determines the type of traversal to be
709
709
  * performed on the binary tree. It can have two possible values:
710
- * @returns The function `subTreeTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
710
+ * @returns The function `subTreeTraverse` returns an array of `ReturnType<BTNCallback<N>>`.
711
711
  */
712
712
  subTreeTraverse(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
713
713
  if (typeof beginRoot === 'number')
@@ -747,7 +747,7 @@ class BinaryTree {
747
747
  * is `null`, an empty array will be returned.
748
748
  * @param {IterationType} iterationType - The `iterationType` parameter determines the type of
749
749
  * iteration used in the depth-first search algorithm. It can have two possible values:
750
- * @returns The function `dfs` returns an array of `ReturnType<OneParamCallback<N>>` values.
750
+ * @returns The function `dfs` returns an array of `ReturnType<BTNCallback<N>>` values.
751
751
  */
752
752
  dfs(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root, iterationType = types_1.IterationType.ITERATIVE) {
753
753
  if (!beginRoot)
@@ -824,13 +824,13 @@ class BinaryTree {
824
824
  * function on each node.
825
825
  * @param callback - The `callback` parameter is a function that will be called for each node in the
826
826
  * breadth-first search. It takes a node of type `N` as its argument and returns a value of type
827
- * `ReturnType<OneParamCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
827
+ * `ReturnType<BTNCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
828
828
  * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first
829
829
  * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search
830
830
  * will not be performed and an empty array will be returned.
831
831
  * @param iterationType - The `iterationType` parameter determines the type of iteration to be used
832
832
  * in the breadth-first search (BFS) algorithm. It can have two possible values:
833
- * @returns The function `bfs` returns an array of `ReturnType<OneParamCallback<N>>[]`.
833
+ * @returns The function `bfs` returns an array of `ReturnType<BTNCallback<N>>[]`.
834
834
  */
835
835
  bfs(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
836
836
  if (!beginRoot)
@@ -938,7 +938,7 @@ class BinaryTree {
938
938
  * The `morris` function performs a depth-first traversal of a binary tree using the Morris traversal
939
939
  * algorithm and returns an array of values obtained by applying a callback function to each node.
940
940
  * @param callback - The `callback` parameter is a function that will be called on each node in the
941
- * tree. It takes a node of type `N` as input and returns a value of type `ReturnType<OneParamCallback<N>>`. The
941
+ * tree. It takes a node of type `N` as input and returns a value of type `ReturnType<BTNCallback<N>>`. The
942
942
  * default value for this parameter is `this._defaultCallbackByKey`.
943
943
  * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter in the `morris` function
944
944
  * determines the order in which the nodes of a binary tree are traversed. It can have one of the
@@ -946,7 +946,7 @@ class BinaryTree {
946
946
  * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the Morris
947
947
  * traversal. It specifies the root node of the tree from which the traversal should begin. If
948
948
  * `beginRoot` is `null`, an empty array will be returned.
949
- * @returns The `morris` function returns an array of `ReturnType<OneParamCallback<N>>` values.
949
+ * @returns The `morris` function returns an array of `ReturnType<BTNCallback<N>>` values.
950
950
  */
951
951
  morris(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root) {
952
952
  if (beginRoot === null)
@@ -1032,6 +1032,44 @@ class BinaryTree {
1032
1032
  }
1033
1033
  return ans;
1034
1034
  }
1035
+ /**
1036
+ * The above function is an iterator for a binary tree that can be used to traverse the tree in
1037
+ * either an iterative or recursive manner.
1038
+ * @param node - The `node` parameter represents the current node in the binary tree from which the
1039
+ * iteration starts. It is an optional parameter with a default value of `this.root`, which means
1040
+ * that if no node is provided, the iteration will start from the root of the binary tree.
1041
+ * @returns The `*[Symbol.iterator]` method returns a generator object that yields the keys of the
1042
+ * binary tree nodes in a specific order.
1043
+ */
1044
+ *[Symbol.iterator](node = this.root) {
1045
+ if (!node) {
1046
+ return;
1047
+ }
1048
+ if (this.iterationType === types_1.IterationType.ITERATIVE) {
1049
+ const stack = [];
1050
+ let current = node;
1051
+ while (current || stack.length > 0) {
1052
+ while (current) {
1053
+ stack.push(current);
1054
+ current = current.left;
1055
+ }
1056
+ current = stack.pop();
1057
+ if (current)
1058
+ yield current.key;
1059
+ if (current)
1060
+ current = current.right;
1061
+ }
1062
+ }
1063
+ else {
1064
+ if (node.left) {
1065
+ yield* this[Symbol.iterator](node.left);
1066
+ }
1067
+ yield node.key;
1068
+ if (node.right) {
1069
+ yield* this[Symbol.iterator](node.right);
1070
+ }
1071
+ }
1072
+ }
1035
1073
  /**
1036
1074
  * Swap the data of two nodes in the binary tree.
1037
1075
  * @param {N} srcNode - The source node to swap.
@@ -5,12 +5,12 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import type { BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, OneParamCallback } from '../../types';
8
+ import type { BTNKey, BSTComparator, BSTNodeNested, BSTOptions, BTNCallback } from '../../types';
9
9
  import { CP, IterationType } from '../../types';
10
10
  import { BinaryTree, BinaryTreeNode } from './binary-tree';
11
11
  import { IBinaryTree } from '../../interfaces';
12
12
  export declare class BSTNode<V = any, N extends BSTNode<V, N> = BSTNodeNested<V>> extends BinaryTreeNode<V, N> {
13
- constructor(key: BinaryTreeNodeKey, val?: V);
13
+ constructor(key: BTNKey, val?: V);
14
14
  }
15
15
  export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>> extends BinaryTree<V, N> implements IBinaryTree<V, N> {
16
16
  /**
@@ -22,30 +22,30 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
22
22
  constructor(options?: BSTOptions);
23
23
  /**
24
24
  * The function creates a new binary search tree node with the given key and value.
25
- * @param {BinaryTreeNodeKey} key - The key parameter is the key value that will be associated with
25
+ * @param {BTNKey} key - The key parameter is the key value that will be associated with
26
26
  * the new node. It is used to determine the position of the node in the binary search tree.
27
27
  * @param [val] - The parameter `val` is an optional value that can be assigned to the node. It
28
28
  * represents the value associated with the node in a binary search tree.
29
29
  * @returns a new instance of the BSTNode class with the specified key and value.
30
30
  */
31
- createNode(key: BinaryTreeNodeKey, val?: V): N;
31
+ createNode(key: BTNKey, val?: V): N;
32
32
  /**
33
33
  * The `add` function in a binary search tree class inserts a new node with a given key and value
34
34
  * into the tree.
35
- * @param {BinaryTreeNodeKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
36
- * `BinaryTreeNodeKey` (which can be a number or a string), a `BSTNode` object, or `null`.
35
+ * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
36
+ * `BTNKey` (which can be a number or a string), a `BSTNode` object, or `null`.
37
37
  * @param [val] - The `val` parameter is the value to be assigned to the new node being added to the
38
38
  * binary search tree.
39
39
  * @returns the inserted node (N) if it was successfully added to the binary search tree. If the node
40
40
  * was not added or if the parameters were invalid, it returns null or undefined.
41
41
  */
42
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V): N | null | undefined;
42
+ add(keyOrNode: BTNKey | N | null, val?: V): N | null | undefined;
43
43
  /**
44
44
  * The `addMany` function is used to efficiently add multiple nodes to a binary search tree while
45
45
  * maintaining balance.
46
- * @param {[BinaryTreeNodeKey | N, N['val']][]} keysOrNodes - The `arr` parameter in the `addMany` function
46
+ * @param {[BTNKey | N, N['val']][]} keysOrNodes - The `arr` parameter in the `addMany` function
47
47
  * represents an array of keys or nodes that need to be added to the binary search tree. It can be an
48
- * array of `BinaryTreeNodeKey` or `N` (which represents the node type in the binary search tree) or
48
+ * array of `BTNKey` or `N` (which represents the node type in the binary search tree) or
49
49
  * `null
50
50
  * @param {V[]} data - The values of tree nodes
51
51
  * @param {boolean} isBalanceAdd - If true the nodes will be balance inserted in binary search method.
@@ -53,13 +53,13 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
53
53
  * It can have two possible values:
54
54
  * @returns The `addMany` function returns an array of `N`, `null`, or `undefined` values.
55
55
  */
56
- addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: V[], isBalanceAdd?: boolean, iterationType?: IterationType): (N | null | undefined)[];
56
+ addMany(keysOrNodes: (BTNKey | null)[] | (N | null)[], data?: V[], isBalanceAdd?: boolean, iterationType?: IterationType): (N | null | undefined)[];
57
57
  /**
58
58
  * The function returns the first node in the binary tree that matches the given node property and
59
59
  * callback.
60
60
  * @param {ReturnType<C> | N} identifier - The `nodeProperty` parameter is used to specify the
61
61
  * property of the binary tree node that you want to search for. It can be either a specific key
62
- * value (`BinaryTreeNodeKey`) or a custom callback function (`OneParamCallback<N>`) that determines
62
+ * value (`BTNKey`) or a custom callback function (`BTNCallback<N>`) that determines
63
63
  * whether a node matches the desired property.
64
64
  * @param callback - The `callback` parameter is a function that is used to determine whether a node
65
65
  * matches the desired property. It takes a node as input and returns a boolean value indicating
@@ -72,7 +72,7 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
72
72
  * @returns either the first node that matches the given nodeProperty and callback, or null if no
73
73
  * matching node is found.
74
74
  */
75
- get<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
75
+ get<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
76
76
  /**
77
77
  * The function `lastKey` returns the key of the rightmost node if the comparison result is less
78
78
  * than, the key of the leftmost node if the comparison result is greater than, and the key of the
@@ -88,12 +88,12 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
88
88
  * the key of the leftmost node if the comparison result is greater than, and the key of the
89
89
  * rightmost node otherwise. If no node is found, it returns 0.
90
90
  */
91
- lastKey(beginRoot?: N | null, iterationType?: IterationType): BinaryTreeNodeKey;
91
+ lastKey(beginRoot?: N | null, iterationType?: IterationType): BTNKey;
92
92
  /**
93
93
  * The function `getNodes` retrieves nodes from a binary tree based on a given node property or key,
94
94
  * using either recursive or iterative traversal.
95
95
  * @param {ReturnType<C> | N} identifier - The `nodeProperty` parameter represents the property
96
- * of the binary tree node that you want to search for. It can be either a `BinaryTreeNodeKey` or a
96
+ * of the binary tree node that you want to search for. It can be either a `BTNKey` or a
97
97
  * generic type `N`.
98
98
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
99
99
  * value. This value is compared with the `nodeProperty` parameter to determine if the node should be
@@ -110,7 +110,7 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
110
110
  * traverse the binary tree. It can have one of the following values:
111
111
  * @returns an array of nodes (N[]).
112
112
  */
113
- getNodes<C extends OneParamCallback<N>>(identifier: ReturnType<C> | null, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
113
+ getNodes<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
114
114
  /**
115
115
  * The `lesserOrGreaterTraverse` function traverses a binary tree and applies a callback function to
116
116
  * nodes that have a key value lesser or greater than a target key value.
@@ -120,15 +120,15 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
120
120
  * @param {CP} lesserOrGreater - The `lesserOrGreater` parameter is used to determine whether to
121
121
  * traverse nodes that are lesser than, greater than, or equal to the `targetNode`. It can take one
122
122
  * of the following values:
123
- * @param {BinaryTreeNodeKey | N | null} targetNode - The `targetNode` parameter in the
123
+ * @param {BTNKey | N | null} targetNode - The `targetNode` parameter in the
124
124
  * `lesserOrGreaterTraverse` function is used to specify the node from which the traversal should
125
125
  * start. It can be either a reference to a specific node (`N`), the key of a node
126
- * (`BinaryTreeNodeKey`), or `null` to
126
+ * (`BTNKey`), or `null` to
127
127
  * @param iterationType - The `iterationType` parameter determines whether the traversal should be
128
128
  * done recursively or iteratively. It can have two possible values:
129
- * @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
129
+ * @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<BTNCallback<N>>`.
130
130
  */
131
- lesserOrGreaterTraverse<C extends OneParamCallback<N>>(callback?: C, lesserOrGreater?: CP, targetNode?: BinaryTreeNodeKey | N | null, iterationType?: IterationType): ReturnType<C>[];
131
+ lesserOrGreaterTraverse<C extends BTNCallback<N>>(callback?: C, lesserOrGreater?: CP, targetNode?: BTNKey | N | null, iterationType?: IterationType): ReturnType<C>[];
132
132
  /**
133
133
  * Balancing Adjustment:
134
134
  * Perfectly Balanced Binary Tree: Since the balance of a perfectly balanced binary tree is already fixed, no additional balancing adjustment is needed. Any insertion or deletion operation will disrupt the perfect balance, often requiring a complete reconstruction of the tree.
@@ -158,10 +158,10 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
158
158
  /**
159
159
  * The function compares two values using a comparator function and returns whether the first value
160
160
  * is greater than, less than, or equal to the second value.
161
- * @param {BinaryTreeNodeKey} a - The parameter "a" is of type BinaryTreeNodeKey.
162
- * @param {BinaryTreeNodeKey} b - The parameter "b" in the above code represents a BinaryTreeNodeKey.
161
+ * @param {BTNKey} a - The parameter "a" is of type BTNKey.
162
+ * @param {BTNKey} b - The parameter "b" in the above code represents a BTNKey.
163
163
  * @returns a value of type CP (ComparisonResult). The possible return values are CP.gt (greater
164
164
  * than), CP.lt (less than), or CP.eq (equal).
165
165
  */
166
- protected _compare(a: BinaryTreeNodeKey, b: BinaryTreeNodeKey): CP;
166
+ protected _compare(a: BTNKey, b: BTNKey): CP;
167
167
  }
@@ -28,7 +28,7 @@ class BST extends binary_tree_1.BinaryTree {
28
28
  }
29
29
  /**
30
30
  * The function creates a new binary search tree node with the given key and value.
31
- * @param {BinaryTreeNodeKey} key - The key parameter is the key value that will be associated with
31
+ * @param {BTNKey} key - The key parameter is the key value that will be associated with
32
32
  * the new node. It is used to determine the position of the node in the binary search tree.
33
33
  * @param [val] - The parameter `val` is an optional value that can be assigned to the node. It
34
34
  * represents the value associated with the node in a binary search tree.
@@ -40,8 +40,8 @@ class BST extends binary_tree_1.BinaryTree {
40
40
  /**
41
41
  * The `add` function in a binary search tree class inserts a new node with a given key and value
42
42
  * into the tree.
43
- * @param {BinaryTreeNodeKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
44
- * `BinaryTreeNodeKey` (which can be a number or a string), a `BSTNode` object, or `null`.
43
+ * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
44
+ * `BTNKey` (which can be a number or a string), a `BSTNode` object, or `null`.
45
45
  * @param [val] - The `val` parameter is the value to be assigned to the new node being added to the
46
46
  * binary search tree.
47
47
  * @returns the inserted node (N) if it was successfully added to the binary search tree. If the node
@@ -125,9 +125,9 @@ class BST extends binary_tree_1.BinaryTree {
125
125
  /**
126
126
  * The `addMany` function is used to efficiently add multiple nodes to a binary search tree while
127
127
  * maintaining balance.
128
- * @param {[BinaryTreeNodeKey | N, N['val']][]} keysOrNodes - The `arr` parameter in the `addMany` function
128
+ * @param {[BTNKey | N, N['val']][]} keysOrNodes - The `arr` parameter in the `addMany` function
129
129
  * represents an array of keys or nodes that need to be added to the binary search tree. It can be an
130
- * array of `BinaryTreeNodeKey` or `N` (which represents the node type in the binary search tree) or
130
+ * array of `BTNKey` or `N` (which represents the node type in the binary search tree) or
131
131
  * `null
132
132
  * @param {V[]} data - The values of tree nodes
133
133
  * @param {boolean} isBalanceAdd - If true the nodes will be balance inserted in binary search method.
@@ -209,7 +209,7 @@ class BST extends binary_tree_1.BinaryTree {
209
209
  * callback.
210
210
  * @param {ReturnType<C> | N} identifier - The `nodeProperty` parameter is used to specify the
211
211
  * property of the binary tree node that you want to search for. It can be either a specific key
212
- * value (`BinaryTreeNodeKey`) or a custom callback function (`OneParamCallback<N>`) that determines
212
+ * value (`BTNKey`) or a custom callback function (`BTNCallback<N>`) that determines
213
213
  * whether a node matches the desired property.
214
214
  * @param callback - The `callback` parameter is a function that is used to determine whether a node
215
215
  * matches the desired property. It takes a node as input and returns a boolean value indicating
@@ -252,7 +252,7 @@ class BST extends binary_tree_1.BinaryTree {
252
252
  * The function `getNodes` retrieves nodes from a binary tree based on a given node property or key,
253
253
  * using either recursive or iterative traversal.
254
254
  * @param {ReturnType<C> | N} identifier - The `nodeProperty` parameter represents the property
255
- * of the binary tree node that you want to search for. It can be either a `BinaryTreeNodeKey` or a
255
+ * of the binary tree node that you want to search for. It can be either a `BTNKey` or a
256
256
  * generic type `N`.
257
257
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
258
258
  * value. This value is compared with the `nodeProperty` parameter to determine if the node should be
@@ -334,13 +334,13 @@ class BST extends binary_tree_1.BinaryTree {
334
334
  * @param {CP} lesserOrGreater - The `lesserOrGreater` parameter is used to determine whether to
335
335
  * traverse nodes that are lesser than, greater than, or equal to the `targetNode`. It can take one
336
336
  * of the following values:
337
- * @param {BinaryTreeNodeKey | N | null} targetNode - The `targetNode` parameter in the
337
+ * @param {BTNKey | N | null} targetNode - The `targetNode` parameter in the
338
338
  * `lesserOrGreaterTraverse` function is used to specify the node from which the traversal should
339
339
  * start. It can be either a reference to a specific node (`N`), the key of a node
340
- * (`BinaryTreeNodeKey`), or `null` to
340
+ * (`BTNKey`), or `null` to
341
341
  * @param iterationType - The `iterationType` parameter determines whether the traversal should be
342
342
  * done recursively or iteratively. It can have two possible values:
343
- * @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<OneParamCallback<N>>`.
343
+ * @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<BTNCallback<N>>`.
344
344
  */
345
345
  lesserOrGreaterTraverse(callback = this._defaultCallbackByKey, lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.iterationType) {
346
346
  if (typeof targetNode === 'number')
@@ -491,8 +491,8 @@ class BST extends binary_tree_1.BinaryTree {
491
491
  /**
492
492
  * The function compares two values using a comparator function and returns whether the first value
493
493
  * is greater than, less than, or equal to the second value.
494
- * @param {BinaryTreeNodeKey} a - The parameter "a" is of type BinaryTreeNodeKey.
495
- * @param {BinaryTreeNodeKey} b - The parameter "b" in the above code represents a BinaryTreeNodeKey.
494
+ * @param {BTNKey} a - The parameter "a" is of type BTNKey.
495
+ * @param {BTNKey} b - The parameter "b" in the above code represents a BTNKey.
496
496
  * @returns a value of type CP (ComparisonResult). The possible return values are CP.gt (greater
497
497
  * than), CP.lt (less than), or CP.eq (equal).
498
498
  */
@@ -1,13 +1,13 @@
1
- import { BinaryTreeNodeKey, RBColor, RBTreeNodeNested, RBTreeOptions } from '../../types';
1
+ import { BTNKey, RBColor, RBTreeNodeNested, RBTreeOptions } from '../../types';
2
2
  import { IBinaryTree } from '../../interfaces';
3
3
  import { BST, BSTNode } from './bst';
4
4
  export declare class RBTreeNode<V = any, N extends RBTreeNode<V, N> = RBTreeNodeNested<V>> extends BSTNode<V, N> {
5
- constructor(key: BinaryTreeNodeKey, val?: V);
5
+ constructor(key: BTNKey, val?: V);
6
6
  private _color;
7
7
  get color(): RBColor;
8
8
  set color(value: RBColor);
9
9
  }
10
10
  export declare class RBTree<V, N extends RBTreeNode<V, N> = RBTreeNode<V, RBTreeNodeNested<V>>> extends BST<V, N> implements IBinaryTree<V, N> {
11
11
  constructor(options?: RBTreeOptions);
12
- createNode(key: BinaryTreeNodeKey, val?: V): N;
12
+ createNode(key: BTNKey, val?: V): N;
13
13
  }
@@ -5,15 +5,15 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import type { BinaryTreeNodeKey, TreeMultisetNodeNested, TreeMultisetOptions } from '../../types';
9
- import { BinaryTreeDeletedResult, IterationType, OneParamCallback } from '../../types';
8
+ import type { BTNKey, TreeMultisetNodeNested, TreeMultisetOptions } from '../../types';
9
+ import { BinaryTreeDeletedResult, IterationType, BTNCallback } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
11
  import { AVLTree, AVLTreeNode } from './avl-tree';
12
12
  export declare class TreeMultisetNode<V = any, N extends TreeMultisetNode<V, N> = TreeMultisetNodeNested<V>> extends AVLTreeNode<V, N> {
13
13
  count: number;
14
14
  /**
15
15
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
16
- * @param {BinaryTreeNodeKey} key - The `key` parameter is of type `BinaryTreeNodeKey` and represents the unique identifier
16
+ * @param {BTNKey} key - The `key` parameter is of type `BTNKey` and represents the unique identifier
17
17
  * of the binary tree node.
18
18
  * @param {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value of the binary
19
19
  * tree node. If no value is provided, it will be `undefined`.
@@ -21,7 +21,7 @@ export declare class TreeMultisetNode<V = any, N extends TreeMultisetNode<V, N>
21
21
  * occurs in a binary tree node. It has a default value of 1, which means that if no value is provided for the `count`
22
22
  * parameter when creating a new instance of the `BinaryTreeNode` class.
23
23
  */
24
- constructor(key: BinaryTreeNodeKey, val?: V, count?: number);
24
+ constructor(key: BTNKey, val?: V, count?: number);
25
25
  }
26
26
  /**
27
27
  * The only distinction between a TreeMultiset and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
@@ -38,19 +38,19 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
38
38
  get count(): number;
39
39
  /**
40
40
  * The function creates a new BSTNode with the given key, value, and count.
41
- * @param {BinaryTreeNodeKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
41
+ * @param {BTNKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
42
42
  * distinguish one node from another in the tree.
43
43
  * @param {N} val - The `val` parameter represents the value that will be stored in the binary search tree node.
44
44
  * @param {number} [count] - The "count" parameter is an optional parameter of type number. It represents the number of
45
45
  * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
46
46
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
47
47
  */
48
- createNode(key: BinaryTreeNodeKey, val?: V, count?: number): N;
48
+ createNode(key: BTNKey, val?: V, count?: number): N;
49
49
  /**
50
50
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
51
51
  * exists, and balancing the tree if necessary.
52
- * @param {BinaryTreeNodeKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
53
- * `BinaryTreeNodeKey` (which represents the key of the node to be added), a `N` (which represents a
52
+ * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
53
+ * `BTNKey` (which represents the key of the node to be added), a `N` (which represents a
54
54
  * node to be added), or `null` (which represents a null node).
55
55
  * @param [val] - The `val` parameter represents the value associated with the key that is being
56
56
  * added to the binary tree.
@@ -59,7 +59,7 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
59
59
  * count is specified, the default count will be 1.
60
60
  * @returns The function `add` returns a value of type `N | null | undefined`.
61
61
  */
62
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V, count?: number): N | null | undefined;
62
+ add(keyOrNode: BTNKey | N | null, val?: V, count?: number): N | null | undefined;
63
63
  /**
64
64
  * The function adds a new node to a binary tree if there is an available slot in the parent node.
65
65
  * @param {N | null} newNode - The `newNode` parameter represents the node that needs to be added to
@@ -72,14 +72,14 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
72
72
  /**
73
73
  * The `addMany` function adds multiple keys or nodes to a TreeMultiset and returns an array of the
74
74
  * inserted nodes.
75
- * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
76
- * added to the multiset. Each element can be either a BinaryTreeNodeKey or a TreeMultisetNode.
75
+ * @param {(BTNKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
76
+ * added to the multiset. Each element can be either a BTNKey or a TreeMultisetNode.
77
77
  * @param {V[]} [data] - The `data` parameter is an optional array of values that correspond
78
78
  * to the keys or nodes being added to the multiset. It is used to associate additional data with
79
79
  * each key or node.
80
80
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
81
81
  */
82
- addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: V[]): (N | null | undefined)[];
82
+ addMany(keysOrNodes: (BTNKey | null)[] | (N | null)[], data?: V[]): (N | null | undefined)[];
83
83
  /**
84
84
  * The `perfectlyBalance` function in TypeScript takes a sorted array of nodes and builds a balanced
85
85
  * binary search tree using either a recursive or iterative approach.
@@ -93,7 +93,7 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
93
93
  * The `delete` function in a binary search tree deletes a node from the tree and returns the deleted
94
94
  * node along with the parent node that needs to be balanced.
95
95
  * @param {ReturnType<C>} identifier - The `identifier` parameter is either a
96
- * `BinaryTreeNodeKey` or a generic type `N`. It represents the property of the node that we are
96
+ * `BTNKey` or a generic type `N`. It represents the property of the node that we are
97
97
  * searching for. It can be a specific key value or any other property of the node.
98
98
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
99
99
  * value. This value is compared with the `identifier` parameter to determine if the node should be
@@ -105,7 +105,7 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
105
105
  * decremented by 1 and
106
106
  * @returns The method `delete` returns an array of `BinaryTreeDeletedResult<N>` objects.
107
107
  */
108
- delete<C extends OneParamCallback<N>>(identifier: ReturnType<C>, callback?: C, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
108
+ delete<C extends BTNCallback<N>>(identifier: ReturnType<C>, callback?: C, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
109
109
  /**
110
110
  * The clear() function clears the contents of a data structure and sets the count to zero.
111
111
  */
@@ -7,7 +7,7 @@ class TreeMultisetNode extends avl_tree_1.AVLTreeNode {
7
7
  count;
8
8
  /**
9
9
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
10
- * @param {BinaryTreeNodeKey} key - The `key` parameter is of type `BinaryTreeNodeKey` and represents the unique identifier
10
+ * @param {BTNKey} key - The `key` parameter is of type `BTNKey` and represents the unique identifier
11
11
  * of the binary tree node.
12
12
  * @param {V} [val] - The `val` parameter is an optional parameter of type `V`. It represents the value of the binary
13
13
  * tree node. If no value is provided, it will be `undefined`.
@@ -40,7 +40,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
40
40
  }
41
41
  /**
42
42
  * The function creates a new BSTNode with the given key, value, and count.
43
- * @param {BinaryTreeNodeKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
43
+ * @param {BTNKey} key - The key parameter is the unique identifier for the binary tree node. It is used to
44
44
  * distinguish one node from another in the tree.
45
45
  * @param {N} val - The `val` parameter represents the value that will be stored in the binary search tree node.
46
46
  * @param {number} [count] - The "count" parameter is an optional parameter of type number. It represents the number of
@@ -53,8 +53,8 @@ class TreeMultiset extends avl_tree_1.AVLTree {
53
53
  /**
54
54
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
55
55
  * exists, and balancing the tree if necessary.
56
- * @param {BinaryTreeNodeKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
57
- * `BinaryTreeNodeKey` (which represents the key of the node to be added), a `N` (which represents a
56
+ * @param {BTNKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
57
+ * `BTNKey` (which represents the key of the node to be added), a `N` (which represents a
58
58
  * node to be added), or `null` (which represents a null node).
59
59
  * @param [val] - The `val` parameter represents the value associated with the key that is being
60
60
  * added to the binary tree.
@@ -176,8 +176,8 @@ class TreeMultiset extends avl_tree_1.AVLTree {
176
176
  /**
177
177
  * The `addMany` function adds multiple keys or nodes to a TreeMultiset and returns an array of the
178
178
  * inserted nodes.
179
- * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
180
- * added to the multiset. Each element can be either a BinaryTreeNodeKey or a TreeMultisetNode.
179
+ * @param {(BTNKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
180
+ * added to the multiset. Each element can be either a BTNKey or a TreeMultisetNode.
181
181
  * @param {V[]} [data] - The `data` parameter is an optional array of values that correspond
182
182
  * to the keys or nodes being added to the multiset. It is used to associate additional data with
183
183
  * each key or node.
@@ -247,7 +247,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
247
247
  * The `delete` function in a binary search tree deletes a node from the tree and returns the deleted
248
248
  * node along with the parent node that needs to be balanced.
249
249
  * @param {ReturnType<C>} identifier - The `identifier` parameter is either a
250
- * `BinaryTreeNodeKey` or a generic type `N`. It represents the property of the node that we are
250
+ * `BTNKey` or a generic type `N`. It represents the property of the node that we are
251
251
  * searching for. It can be a specific key value or any other property of the node.
252
252
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
253
253
  * value. This value is compared with the `identifier` parameter to determine if the node should be