bst-typed 1.54.0 → 1.54.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.
Files changed (92) hide show
  1. package/LICENSE +1 -1
  2. package/coverage/lcov-report/index.ts.html +2 -2
  3. package/dist/data-structures/binary-tree/avl-tree-counter.d.ts +213 -0
  4. package/dist/data-structures/binary-tree/avl-tree-counter.js +407 -0
  5. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +71 -177
  6. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +135 -340
  7. package/dist/data-structures/binary-tree/avl-tree.d.ts +102 -57
  8. package/dist/data-structures/binary-tree/avl-tree.js +110 -47
  9. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
  10. package/dist/data-structures/binary-tree/binary-indexed-tree.js +3 -0
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +240 -190
  12. package/dist/data-structures/binary-tree/binary-tree.js +269 -240
  13. package/dist/data-structures/binary-tree/bst.d.ts +145 -112
  14. package/dist/data-structures/binary-tree/bst.js +180 -129
  15. package/dist/data-structures/binary-tree/index.d.ts +2 -0
  16. package/dist/data-structures/binary-tree/index.js +2 -0
  17. package/dist/data-structures/binary-tree/red-black-tree.d.ts +100 -82
  18. package/dist/data-structures/binary-tree/red-black-tree.js +115 -79
  19. package/dist/data-structures/binary-tree/tree-counter.d.ts +212 -0
  20. package/dist/data-structures/binary-tree/tree-counter.js +444 -0
  21. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +78 -174
  22. package/dist/data-structures/binary-tree/tree-multi-map.js +142 -377
  23. package/dist/data-structures/graph/directed-graph.d.ts +3 -0
  24. package/dist/data-structures/graph/directed-graph.js +3 -0
  25. package/dist/data-structures/graph/map-graph.d.ts +3 -0
  26. package/dist/data-structures/graph/map-graph.js +3 -0
  27. package/dist/data-structures/graph/undirected-graph.d.ts +3 -0
  28. package/dist/data-structures/graph/undirected-graph.js +3 -0
  29. package/dist/data-structures/linked-list/singly-linked-list.d.ts +3 -0
  30. package/dist/data-structures/linked-list/singly-linked-list.js +3 -0
  31. package/dist/data-structures/linked-list/skip-linked-list.d.ts +3 -0
  32. package/dist/data-structures/linked-list/skip-linked-list.js +3 -0
  33. package/dist/data-structures/matrix/matrix.d.ts +3 -0
  34. package/dist/data-structures/matrix/matrix.js +3 -0
  35. package/dist/data-structures/matrix/navigator.d.ts +3 -0
  36. package/dist/data-structures/matrix/navigator.js +3 -0
  37. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
  38. package/dist/data-structures/priority-queue/max-priority-queue.js +3 -0
  39. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
  40. package/dist/data-structures/priority-queue/min-priority-queue.js +3 -0
  41. package/dist/data-structures/trie/trie.d.ts +0 -4
  42. package/dist/data-structures/trie/trie.js +0 -4
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.js +2 -2
  45. package/dist/interfaces/binary-tree.d.ts +8 -8
  46. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
  47. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -4
  48. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -3
  49. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +0 -3
  50. package/dist/types/data-structures/binary-tree/bst.d.ts +3 -3
  51. package/dist/types/data-structures/binary-tree/index.d.ts +3 -1
  52. package/dist/types/data-structures/binary-tree/index.js +3 -1
  53. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +3 -0
  54. package/dist/types/data-structures/binary-tree/red-black-tree.js +2 -0
  55. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
  56. package/dist/types/data-structures/binary-tree/tree-counter.js +2 -0
  57. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -5
  58. package/package.json +3 -3
  59. package/src/data-structures/binary-tree/avl-tree-counter.ts +463 -0
  60. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +155 -393
  61. package/src/data-structures/binary-tree/avl-tree.ts +144 -93
  62. package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -0
  63. package/src/data-structures/binary-tree/binary-tree.ts +433 -405
  64. package/src/data-structures/binary-tree/bst.ts +261 -239
  65. package/src/data-structures/binary-tree/index.ts +2 -0
  66. package/src/data-structures/binary-tree/red-black-tree.ts +163 -134
  67. package/src/data-structures/binary-tree/tree-counter.ts +504 -0
  68. package/src/data-structures/binary-tree/tree-multi-map.ts +161 -429
  69. package/src/data-structures/graph/directed-graph.ts +3 -0
  70. package/src/data-structures/graph/map-graph.ts +3 -0
  71. package/src/data-structures/graph/undirected-graph.ts +3 -0
  72. package/src/data-structures/linked-list/singly-linked-list.ts +3 -0
  73. package/src/data-structures/linked-list/skip-linked-list.ts +3 -0
  74. package/src/data-structures/matrix/matrix.ts +3 -0
  75. package/src/data-structures/matrix/navigator.ts +3 -0
  76. package/src/data-structures/priority-queue/max-priority-queue.ts +3 -0
  77. package/src/data-structures/priority-queue/min-priority-queue.ts +3 -0
  78. package/src/data-structures/trie/trie.ts +0 -4
  79. package/src/index.ts +2 -2
  80. package/src/interfaces/binary-tree.ts +10 -24
  81. package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
  82. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -6
  83. package/src/types/data-structures/binary-tree/avl-tree.ts +0 -5
  84. package/src/types/data-structures/binary-tree/binary-tree.ts +0 -5
  85. package/src/types/data-structures/binary-tree/bst.ts +5 -5
  86. package/src/types/data-structures/binary-tree/index.ts +3 -1
  87. package/src/types/data-structures/binary-tree/red-black-tree.ts +5 -0
  88. package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
  89. package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -7
  90. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +0 -6
  91. package/src/types/data-structures/binary-tree/rb-tree.ts +0 -10
  92. /package/dist/types/data-structures/binary-tree/{rb-tree.js → avl-tree-counter.js} +0 -0
@@ -1,19 +1,25 @@
1
- import type { BinaryTreeDeleteResult, BTNRep, CRUD, EntryCallback, RBTNColor, RedBlackTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
1
+ import type { BinaryTreeDeleteResult, BTNRep, CRUD, EntryCallback, OptNodeOrNull, RBTNColor, RedBlackTreeOptions } from '../../types';
2
2
  import { BST, BSTNode } from './bst';
3
3
  import { IBinaryTree } from '../../interfaces';
4
- export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
4
+ export declare class RedBlackTreeNode<K = any, V = any> extends BSTNode<K, V> {
5
5
  /**
6
- * The constructor function initializes a Red-Black Tree Node with a key, an optional value, and a
7
- * color.
8
- * @param {K} key - The key parameter is of type K and represents the key of the node in the
9
- * Red-Black Tree.
10
- * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
11
- * associated with the key in the Red-Black Tree Node. It is not required and can be omitted when
12
- * creating a new instance of the Red-Black Tree Node.
13
- * @param {RBTNColor} color - The `color` parameter is used to specify the color of the Red-Black
14
- * Tree Node. It is an optional parameter with a default value of `'BLACK'`.
6
+ * The constructor initializes a node with a key, value, and color for a Red-Black Tree.
7
+ * @param {K} key - The `key` parameter is a key of type `K` that is used to identify the node in a
8
+ * Red-Black Tree data structure.
9
+ * @param {V} [value] - The `value` parameter in the constructor is an optional parameter of type
10
+ * `V`. It represents the value associated with the key in the data structure being constructed.
11
+ * @param {RBTNColor} [color=BLACK] - The `color` parameter in the constructor is used to specify the
12
+ * color of the node in a Red-Black Tree. It has a default value of 'BLACK' if not provided
13
+ * explicitly.
15
14
  */
16
15
  constructor(key: K, value?: V, color?: RBTNColor);
16
+ parent?: RedBlackTreeNode<K, V>;
17
+ _left?: OptNodeOrNull<RedBlackTreeNode<K, V>>;
18
+ get left(): OptNodeOrNull<RedBlackTreeNode<K, V>>;
19
+ set left(v: OptNodeOrNull<RedBlackTreeNode<K, V>>);
20
+ _right?: OptNodeOrNull<RedBlackTreeNode<K, V>>;
21
+ get right(): OptNodeOrNull<RedBlackTreeNode<K, V>>;
22
+ set right(v: OptNodeOrNull<RedBlackTreeNode<K, V>>);
17
23
  }
18
24
  /**
19
25
  * 1. Efficient self-balancing, but not completely balanced. Compared with AVLTree, the addition and deletion efficiency is high but the query efficiency is slightly lower.
@@ -68,25 +74,25 @@ export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTre
68
74
  * );
69
75
  * console.log(stocksInRange); // ['GOOGL', 'MSFT', 'META']
70
76
  */
71
- export declare class RedBlackTree<K = any, V = any, R = object, MK = any, MV = any, MR = object, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNode<K, V, RedBlackTreeNodeNested<K, V>>, TREE extends RedBlackTree<K, V, R, MK, MV, MR, NODE, TREE> = RedBlackTree<K, V, R, MK, MV, MR, NODE, RedBlackTreeNested<K, V, R, MK, MV, MR, NODE>>> extends BST<K, V, R, MK, MV, MR, NODE, TREE> implements IBinaryTree<K, V, R, MK, MV, MR, NODE, TREE> {
72
- /**
73
- * This is the constructor function for a Red-Black Tree data structure in TypeScript.
74
- * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter is an
75
- * iterable object that can contain either keys, nodes, entries, or raw elements. It is used to
76
- * initialize the RBTree with the provided elements.
77
- * @param [options] - The `options` parameter is an optional object that can be passed to the
78
- * constructor. It is of type `RedBlackTreeOptions<K, V, R>`. This object can contain various options for
79
- * configuring the behavior of the Red-Black Tree. The specific properties and their meanings would
80
- * depend on the implementation
81
- */
82
- constructor(keysNodesEntriesOrRaws?: Iterable<R | BTNRep<K, V, NODE>>, options?: RedBlackTreeOptions<K, V, R>);
83
- protected _root: NODE | undefined;
77
+ export declare class RedBlackTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends BST<K, V, R, MK, MV, MR> implements IBinaryTree<K, V, R, MK, MV, MR> {
84
78
  /**
85
- * The function returns the root node of a tree or undefined if there is no root.
86
- * @returns The root node of the tree structure, or undefined if there is no root node.
79
+ * This TypeScript constructor initializes a Red-Black Tree with optional keys, nodes, entries, or
80
+ * raw data.
81
+ * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
82
+ * iterable that can contain either `BTNRep<K, V, RedBlackTreeNode<K, V>>` objects or `R` objects. It
83
+ * is used to initialize the Red-Black Tree with keys, nodes, entries, or
84
+ * @param [options] - The `options` parameter in the constructor is of type `RedBlackTreeOptions<K,
85
+ * V, R>`. It is an optional parameter that allows you to specify additional options for the
86
+ * RedBlackTree class. These options could include configuration settings, behavior customization, or
87
+ * any other parameters that are specific to
87
88
  */
88
- get root(): NODE | undefined;
89
+ constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V, RedBlackTreeNode<K, V>> | R>, options?: RedBlackTreeOptions<K, V, R>);
90
+ protected _root: RedBlackTreeNode<K, V> | undefined;
91
+ get root(): RedBlackTreeNode<K, V> | undefined;
89
92
  /**
93
+ * Time Complexity: O(1)
94
+ * Space Complexity: O(1)
95
+ *
90
96
  * The function creates a new Red-Black Tree node with the specified key, value, and color.
91
97
  * @param {K} key - The key parameter represents the key value of the node being created. It is of
92
98
  * type K, which is a generic type that can be replaced with any specific type when using the
@@ -100,25 +106,28 @@ export declare class RedBlackTree<K = any, V = any, R = object, MK = any, MV = a
100
106
  * @returns A new instance of a RedBlackTreeNode with the specified key, value, and color is being
101
107
  * returned.
102
108
  */
103
- createNode(key: K, value?: V, color?: RBTNColor): NODE;
109
+ createNode(key: K, value?: V, color?: RBTNColor): RedBlackTreeNode<K, V>;
104
110
  /**
111
+ * Time Complexity: O(1)
112
+ * Space Complexity: O(1)
113
+ *
105
114
  * The function creates a new Red-Black Tree with the specified options.
106
115
  * @param [options] - The `options` parameter is an optional object that contains additional
107
116
  * configuration options for creating the Red-Black Tree. It has the following properties:
108
117
  * @returns a new instance of a RedBlackTree object.
109
118
  */
110
- createTree(options?: RedBlackTreeOptions<K, V, R>): TREE;
119
+ createTree(options?: RedBlackTreeOptions<K, V, R>): RedBlackTree<K, V, R, MK, MV, MR>;
111
120
  /**
112
121
  * Time Complexity: O(1)
113
122
  * Space Complexity: O(1)
114
123
  *
115
124
  * The function checks if the input is an instance of the RedBlackTreeNode class.
116
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The parameter
117
- * `keyNodeEntryOrRaw` can be of type `R` or `BTNRep<K, V, NODE>`.
118
- * @returns a boolean value indicating whether the input parameter `keyNodeEntryOrRaw` is
125
+ * @param {BTNRep<K, V, RedBlackTreeNode<K, V>>} keyNodeOrEntry - The parameter
126
+ * `keyNodeOrEntry` can be of type `R` or `BTNRep<K, V, RedBlackTreeNode<K, V>>`.
127
+ * @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
119
128
  * an instance of the `RedBlackTreeNode` class.
120
129
  */
121
- isNode(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R): keyNodeEntryOrRaw is NODE;
130
+ isNode(keyNodeOrEntry: BTNRep<K, V, RedBlackTreeNode<K, V>>): keyNodeOrEntry is RedBlackTreeNode<K, V>;
122
131
  /**
123
132
  * Time Complexity: O(1)
124
133
  * Space Complexity: O(1)
@@ -129,12 +138,12 @@ export declare class RedBlackTree<K = any, V = any, R = object, MK = any, MV = a
129
138
  clear(): void;
130
139
  /**
131
140
  * Time Complexity: O(log n)
132
- * Space Complexity: O(1)
141
+ * Space Complexity: O(log n)
133
142
  *
134
143
  * The function adds a new node to a binary search tree and returns true if the node was successfully
135
144
  * added.
136
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The parameter
137
- * `keyNodeEntryOrRaw` can accept a value of type `R` or `BTNRep<K, V, NODE>`.
145
+ * @param {BTNRep<K, V, RedBlackTreeNode<K, V>>} keyNodeOrEntry - The parameter
146
+ * `keyNodeOrEntry` can accept a value of type `R` or `BTNRep<K, V, RedBlackTreeNode<K, V>>`.
138
147
  * @param {V} [value] - The `value` parameter is an optional value that you want to associate with
139
148
  * the key in the data structure. It represents the value that you want to add or update in the data
140
149
  * structure.
@@ -142,127 +151,136 @@ export declare class RedBlackTree<K = any, V = any, R = object, MK = any, MV = a
142
151
  * the method returns true. If the node already exists and its value is updated, the method also
143
152
  * returns true. If the node cannot be added or updated, the method returns false.
144
153
  */
145
- add(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R, value?: V): boolean;
154
+ add(keyNodeOrEntry: BTNRep<K, V, RedBlackTreeNode<K, V>>, value?: V): boolean;
146
155
  /**
147
156
  * Time Complexity: O(log n)
148
- * Space Complexity: O(1)
157
+ * Space Complexity: O(log n)
149
158
  *
150
159
  * The function overrides the delete method in a binary tree data structure to remove a node based on
151
160
  * a given predicate and maintain the binary search tree properties.
152
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The `keyNodeEntryOrRaw`
161
+ * @param {BTNRep<K, V, RedBlackTreeNode<K, V>>} keyNodeOrEntry - The `keyNodeOrEntry`
153
162
  * parameter in the `override delete` method is used to specify the condition or key based on which a
154
163
  * node should be deleted from the binary tree. It can be a key, a node, an entry, or a predicate
155
164
  * function that determines which node(s) should be deleted.
156
- * @returns The `override delete` method is returning an array of `BinaryTreeDeleteResult<NODE>`
165
+ * @returns The `override delete` method is returning an array of `BinaryTreeDeleteResult<RedBlackTreeNode<K, V>>`
157
166
  * objects. Each object in the array contains information about the deleted node and whether
158
167
  * balancing is needed.
159
168
  */
160
- delete(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R): BinaryTreeDeleteResult<NODE>[];
169
+ delete(keyNodeOrEntry: BTNRep<K, V, RedBlackTreeNode<K, V>>): BinaryTreeDeleteResult<RedBlackTreeNode<K, V>>[];
170
+ /**
171
+ * Time Complexity: O(n)
172
+ * Space Complexity: O(n)
173
+ *
174
+ * The `map` function in TypeScript overrides the default behavior to create a new Red-Black Tree by
175
+ * applying a callback to each entry in the original tree.
176
+ * @param callback - A function that will be called for each entry in the tree, with parameters
177
+ * representing the key, value, index, and the tree itself. It should return an entry for the new
178
+ * tree.
179
+ * @param [options] - The `options` parameter in the `map` method is of type `RedBlackTreeOptions<MK, MV,
180
+ * MR>`. This parameter allows you to specify additional options or configurations for the Red-Black
181
+ * Tree that will be created during the mapping process. These options could include things like
182
+ * custom comparators
183
+ * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
184
+ * the value of `this` when executing the `callback` function. It allows you to set the context
185
+ * (value of `this`) for the callback function. This can be useful when you want to access properties
186
+ * or
187
+ * @returns A new Red-Black Tree is being returned, where each entry has been transformed using the
188
+ * provided callback function.
189
+ */
190
+ map(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: RedBlackTreeOptions<MK, MV, MR>, thisArg?: any): RedBlackTree<MK, MV, MR>;
191
+ /**
192
+ * Time Complexity: O(n)
193
+ * Space Complexity: O(n)
194
+ *
195
+ * The function `clone` overrides the default cloning behavior to create a deep copy of a tree
196
+ * structure.
197
+ * @returns The `cloned` object is being returned.
198
+ */
199
+ clone(): RedBlackTree<K, V, R, MK, MV, MR>;
161
200
  /**
162
201
  * Time Complexity: O(1)
163
202
  * Space Complexity: O(1)
164
203
  *
165
204
  * The function sets the root of a tree-like structure and updates the parent property of the new
166
205
  * root.
167
- * @param {NODE | undefined} v - v is a parameter of type NODE or undefined.
206
+ * @param {RedBlackTreeNode<K, V> | undefined} v - v is a parameter of type RedBlackTreeNode<K, V> or undefined.
168
207
  */
169
- protected _setRoot(v: NODE | undefined): void;
208
+ protected _setRoot(v: RedBlackTreeNode<K, V> | undefined): void;
170
209
  /**
171
210
  * Time Complexity: O(1)
172
211
  * Space Complexity: O(1)
173
212
  *
174
213
  * The function replaces an old node with a new node while preserving the color of the old node.
175
- * @param {NODE} oldNode - The `oldNode` parameter represents the node that needs to be replaced in
214
+ * @param {RedBlackTreeNode<K, V>} oldNode - The `oldNode` parameter represents the node that needs to be replaced in
176
215
  * the data structure.
177
- * @param {NODE} newNode - The `newNode` parameter is of type `NODE`, which represents a node in a
216
+ * @param {RedBlackTreeNode<K, V>} newNode - The `newNode` parameter is of type `RedBlackTreeNode<K, V>`, which represents a node in a
178
217
  * data structure.
179
218
  * @returns The method is returning the result of calling the `_replaceNode` method from the
180
219
  * superclass, with the `oldNode` and `newNode` parameters.
181
220
  */
182
- protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
221
+ protected _replaceNode(oldNode: RedBlackTreeNode<K, V>, newNode: RedBlackTreeNode<K, V>): RedBlackTreeNode<K, V>;
183
222
  /**
184
223
  * Time Complexity: O(log n)
185
- * Space Complexity: O(1)
224
+ * Space Complexity: O(log n)
186
225
  *
187
226
  * The `_insert` function inserts a node into a binary search tree and performs necessary fix-ups to
188
227
  * maintain the red-black tree properties.
189
- * @param {NODE} node - The `node` parameter represents the node that needs to be inserted into the
228
+ * @param {RedBlackTreeNode<K, V>} node - The `node` parameter represents the node that needs to be inserted into the
190
229
  * binary search tree.
191
230
  * @returns a string value indicating the result of the insertion operation. It can return either
192
231
  * 'UPDATED' if the node with the same key already exists and was updated, or 'CREATED' if a new node
193
232
  * was created and inserted into the tree.
194
233
  */
195
- protected _insert(node: NODE): CRUD;
234
+ protected _insert(node: RedBlackTreeNode<K, V>): CRUD;
196
235
  /**
197
236
  * Time Complexity: O(1)
198
237
  * Space Complexity: O(1)
199
238
  *
200
239
  * The function `_transplant` is used to replace a node `u` with another node `v` in a binary tree.
201
- * @param {NODE} u - The parameter "u" represents a node in a binary tree.
202
- * @param {NODE | undefined} v - The parameter `v` is of type `NODE | undefined`, which means it can
203
- * either be a `NODE` object or `undefined`.
240
+ * @param {RedBlackTreeNode<K, V>} u - The parameter "u" represents a node in a binary tree.
241
+ * @param {RedBlackTreeNode<K, V> | undefined} v - The parameter `v` is of type `RedBlackTreeNode<K, V> | undefined`, which means it can
242
+ * either be a `RedBlackTreeNode<K, V>` object or `undefined`.
204
243
  */
205
- protected _transplant(u: NODE, v: NODE | undefined): void;
244
+ protected _transplant(u: RedBlackTreeNode<K, V>, v: RedBlackTreeNode<K, V> | undefined): void;
206
245
  /**
207
246
  * Time Complexity: O(log n)
208
247
  * Space Complexity: O(1)
209
248
  *
210
249
  * The `_insertFixup` function is used to fix the Red-Black Tree after inserting a new node.
211
- * @param {NODE | undefined} z - The parameter `z` represents a node in the Red-Black Tree data
250
+ * @param {RedBlackTreeNode<K, V> | undefined} z - The parameter `z` represents a node in the Red-Black Tree data
212
251
  * structure. It can either be a valid node or `undefined`.
213
252
  */
214
- protected _insertFixup(z: NODE | undefined): void;
253
+ protected _insertFixup(z: RedBlackTreeNode<K, V> | undefined): void;
215
254
  /**
216
255
  * Time Complexity: O(log n)
217
256
  * Space Complexity: O(1)
218
257
  *
219
258
  * The `_deleteFixup` function is used to fix the red-black tree after a node deletion by adjusting
220
259
  * the colors and performing rotations.
221
- * @param {NODE | undefined} node - The `node` parameter represents a node in a binary tree. It can
260
+ * @param {RedBlackTreeNode<K, V> | undefined} node - The `node` parameter represents a node in a binary tree. It can
222
261
  * be either a valid node object or `undefined`.
223
262
  * @returns The function does not return any value. It has a return type of `void`, which means it
224
263
  * does not return anything.
225
264
  */
226
- protected _deleteFixup(node: NODE | undefined): void;
265
+ protected _deleteFixup(node: RedBlackTreeNode<K, V> | undefined): void;
227
266
  /**
228
267
  * Time Complexity: O(1)
229
268
  * Space Complexity: O(1)
230
269
  *
231
270
  * The `_leftRotate` function performs a left rotation on a given node in a binary tree.
232
- * @param {NODE | undefined} x - The parameter `x` is of type `NODE | undefined`. It represents a
271
+ * @param {RedBlackTreeNode<K, V> | undefined} x - The parameter `x` is of type `RedBlackTreeNode<K, V> | undefined`. It represents a
233
272
  * node in a binary tree or `undefined` if there is no node.
234
273
  * @returns void, which means it does not return any value.
235
274
  */
236
- protected _leftRotate(x: NODE | undefined): void;
275
+ protected _leftRotate(x: RedBlackTreeNode<K, V> | undefined): void;
237
276
  /**
238
277
  * Time Complexity: O(1)
239
278
  * Space Complexity: O(1)
240
279
  *
241
280
  * The `_rightRotate` function performs a right rotation on a given node in a binary tree.
242
- * @param {NODE | undefined} y - The parameter `y` is of type `NODE | undefined`. It represents a
281
+ * @param {RedBlackTreeNode<K, V> | undefined} y - The parameter `y` is of type `RedBlackTreeNode<K, V> | undefined`. It represents a
243
282
  * node in a binary tree or `undefined` if there is no node.
244
283
  * @returns void, which means it does not return any value.
245
284
  */
246
- protected _rightRotate(y: NODE | undefined): void;
247
- /**
248
- * Time Complexity: O(n)
249
- * Space Complexity: O(n)
250
- *
251
- * The `map` function in TypeScript overrides the default behavior to create a new Red-Black Tree by
252
- * applying a callback to each entry in the original tree.
253
- * @param callback - A function that will be called for each entry in the tree, with parameters
254
- * representing the key, value, index, and the tree itself. It should return an entry for the new
255
- * tree.
256
- * @param [options] - The `options` parameter in the `map` method is of type `RedBlackTreeOptions<MK, MV,
257
- * MR>`. This parameter allows you to specify additional options or configurations for the Red-Black
258
- * Tree that will be created during the mapping process. These options could include things like
259
- * custom comparators
260
- * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
261
- * the value of `this` when executing the `callback` function. It allows you to set the context
262
- * (value of `this`) for the callback function. This can be useful when you want to access properties
263
- * or
264
- * @returns A new Red-Black Tree is being returned, where each entry has been transformed using the
265
- * provided callback function.
266
- */
267
- map(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: RedBlackTreeOptions<MK, MV, MR>, thisArg?: any): RedBlackTree<MK, MV, MR>;
285
+ protected _rightRotate(y: RedBlackTreeNode<K, V> | undefined): void;
268
286
  }