min-heap-typed 1.50.5 → 1.50.7

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.
@@ -1,11 +1,5 @@
1
- /**
2
- * data-structure-typed
3
- *
4
- * @author Tyler Zeng
5
- * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
- * @license MIT License
7
- */
8
- import { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, KeyOrNodeOrEntry, RBTNColor, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
1
+ import type { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, KeyOrNodeOrEntry, RBTreeOptions, RedBlackTreeNested, RedBlackTreeNodeNested } from '../../types';
2
+ import { CRUD, RBTNColor } from '../../types';
9
3
  import { BST, BSTNode } from './bst';
10
4
  import { IBinaryTree } from '../../interfaces';
11
5
  export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
@@ -24,7 +18,7 @@ export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTre
24
18
  protected _color: RBTNColor;
25
19
  /**
26
20
  * The function returns the color value of a variable.
27
- * @returns The color value stored in the protected variable `_color`.
21
+ * @returns The color value stored in the private variable `_color`.
28
22
  */
29
23
  get color(): RBTNColor;
30
24
  /**
@@ -33,82 +27,88 @@ export declare class RedBlackTreeNode<K = any, V = any, NODE extends RedBlackTre
33
27
  */
34
28
  set color(value: RBTNColor);
35
29
  }
36
- /**
37
- * 1. Each node is either red or black.
38
- * 2. The root node is always black.
39
- * 3. Leaf nodes are typically Sentinel nodes and are considered black.
40
- * 4. Red nodes must have black children.
41
- * 5. Black balance: Every path from any node to each of its leaf nodes contains the same number of black nodes.
42
- */
43
30
  export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNode<K, V, NODE> = RedBlackTreeNode<K, V, RedBlackTreeNodeNested<K, V>>, TREE extends RedBlackTree<K, V, NODE, TREE> = RedBlackTree<K, V, NODE, RedBlackTreeNested<K, V, NODE>>> extends BST<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
44
31
  /**
45
- * This is the constructor function for a Red-Black Tree data structure in TypeScript, which
46
- * initializes the tree with optional nodes and options.
47
- * @param [keysOrNodesOrEntries] - The `keysOrNodesOrEntries` parameter is an optional iterable of `KeyOrNodeOrEntry<K, V, NODE>`
48
- * objects. It represents the initial nodes that will be added to the RBTree during its
49
- * construction. If this parameter is provided, the `addMany` method is called to add all the
50
- * nodes to the
51
- * @param [options] - The `options` parameter is an optional object that allows you to customize the
52
- * behavior of the RBTree. It is of type `Partial<RBTreeOptions>`, which means that you can provide
53
- * only a subset of the properties defined in the `RBTreeOptions` interface.
32
+ * This is the constructor function for a Red-Black Tree data structure in TypeScript.
33
+ * @param keysOrNodesOrEntries - The `keysOrNodesOrEntries` parameter is an iterable object that can
34
+ * contain keys, nodes, or entries. It is used to initialize the RBTree with the provided keys,
35
+ * nodes, or entries.
36
+ * @param [options] - The `options` parameter is an optional object that can be passed to the
37
+ * constructor. It allows you to customize the behavior of the RBTree. It can include properties such
38
+ * as `compareKeys`, `compareValues`, `allowDuplicates`, etc. These properties define how the RBTree
39
+ * should compare keys and
54
40
  */
55
41
  constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, NODE>>, options?: RBTreeOptions<K>);
56
- protected _Sentinel: NODE;
42
+ protected _SENTINEL: NODE;
57
43
  /**
58
- * The function returns the value of the `_Sentinel` property.
59
- * @returns The method is returning the value of the `_Sentinel` property.
44
+ * The function returns the value of the _SENTINEL property.
45
+ * @returns The method is returning the value of the `_SENTINEL` property.
60
46
  */
61
- get Sentinel(): NODE;
62
- protected _root: NODE;
47
+ get SENTINEL(): NODE;
48
+ protected _root: NODE | undefined;
63
49
  /**
64
- * The function returns the root node.
65
- * @returns The root node of the data structure.
50
+ * The function returns the root node of a tree or undefined if there is no root.
51
+ * @returns The root node of the tree structure, or undefined if there is no root node.
66
52
  */
67
- get root(): NODE;
68
- protected _size: number;
69
- /**
70
- * The function returns the size of an object.
71
- * @returns The size of the object, which is a number.
72
- */
73
- get size(): number;
53
+ get root(): NODE | undefined;
74
54
  /**
75
55
  * The function creates a new Red-Black Tree node with the specified key, value, and color.
76
- * @param {K} key - The key parameter is the key value associated with the node. It is used to
77
- * identify and compare nodes in the Red-Black Tree.
56
+ * @param {K} key - The key parameter represents the key of the node being created. It is of type K,
57
+ * which is a generic type representing the key's data type.
78
58
  * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
79
- * associated with the node. It is of type `V`, which is a generic type that can be replaced with any
80
- * specific type when using the `createNode` method.
59
+ * associated with the key in the node. It is not required and can be omitted if not needed.
81
60
  * @param {RBTNColor} color - The "color" parameter is used to specify the color of the node in a
82
- * Red-Black Tree. It can be either "RED" or "BLACK". By default, the color is set to "BLACK".
61
+ * Red-Black Tree. It is an optional parameter with a default value of "RBTNColor.BLACK". The color
62
+ * can be either "RBTNColor.RED" or "RBTNColor.BLACK".
83
63
  * @returns The method is returning a new instance of a RedBlackTreeNode with the specified key,
84
64
  * value, and color.
85
65
  */
86
66
  createNode(key: K, value?: V, color?: RBTNColor): NODE;
87
67
  /**
88
- * The function creates a Red-Black Tree with the specified options and returns it.
89
- * @param {RBTreeOptions} [options] - The `options` parameter is an optional object that can be
90
- * passed to the `createTree` function. It is used to customize the behavior of the `RedBlackTree`
91
- * class.
68
+ * The function creates a Red-Black Tree with the given options and returns it.
69
+ * @param [options] - The `options` parameter is an optional object that contains configuration
70
+ * options for creating the Red-Black Tree. It is of type `RBTreeOptions<K>`, where `K` represents
71
+ * the type of keys in the tree.
92
72
  * @returns a new instance of a RedBlackTree object.
93
73
  */
94
74
  createTree(options?: RBTreeOptions<K>): TREE;
95
75
  /**
96
- * The function `keyValueOrEntryToNode` takes an keyOrNodeOrEntry and converts it into a node object if possible.
97
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`, where:
98
- * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
99
- * `keyValueOrEntryToNode` function. It represents the value associated with the keyOrNodeOrEntry node. If a value
100
- * is provided, it will be used when creating the new node. If no value is provided, the new node
101
- * @returns a node of type NODE or undefined.
76
+ * Time Complexity: O(1)
77
+ * Space Complexity: O(1)
78
+ */
79
+ /**
80
+ * Time Complexity: O(1)
81
+ * Space Complexity: O(1)
82
+ *
83
+ * The function `keyValueOrEntryToNode` takes a key, value, or entry and returns a node if it is
84
+ * valid, otherwise it returns undefined.
85
+ * @param {KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntry - The key, value, or entry to convert.
86
+ * @param {V} [value] - The value associated with the key (if `keyOrNodeOrEntry` is a key).
87
+ * @returns {NODE | undefined} - The corresponding Red-Black Tree node, or `undefined` if conversion fails.
102
88
  */
103
89
  keyValueOrEntryToNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V): NODE | undefined;
104
90
  /**
105
- * The function checks if an keyOrNodeOrEntry is an instance of the RedBlackTreeNode class.
106
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`.
107
- * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the RedBlackTreeNode
108
- * class.
91
+ * Time Complexity: O(1)
92
+ * Space Complexity: O(1)
93
+ * /
94
+
95
+ /**
96
+ * Time Complexity: O(1)
97
+ * Space Complexity: O(1)
98
+ *
99
+ * The function checks if the input is an instance of the RedBlackTreeNode class.
100
+ * @param {KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntry - The object to check.
101
+ * @returns {boolean} - `true` if the object is a Red-Black Tree node, `false` otherwise.
109
102
  */
110
103
  isNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is NODE;
111
104
  /**
105
+ * Time Complexity: O(1)
106
+ * Space Complexity: O(1)
107
+ */
108
+ /**
109
+ * Time Complexity: O(1)
110
+ * Space Complexity: O(1)
111
+ *
112
112
  * The function checks if a given node is a real node in a Red-Black Tree.
113
113
  * @param {NODE | undefined} node - The `node` parameter is of type `NODE | undefined`, which means
114
114
  * it can either be of type `NODE` or `undefined`.
@@ -118,21 +118,41 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
118
118
  /**
119
119
  * Time Complexity: O(log n)
120
120
  * Space Complexity: O(1)
121
- * On average (where n is the number of nodes in the tree)
122
121
  */
123
122
  /**
124
123
  * Time Complexity: O(log n)
125
124
  * Space Complexity: O(1)
126
125
  *
127
- * The `add` function adds a new node to a binary search tree and performs necessary rotations and
128
- * color changes to maintain the red-black tree properties.
129
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be either a key, a node, or an
130
- * entry.
131
- * @param {V} [value] - The `value` parameter represents the value associated with the key that is
132
- * being added to the binary search tree.
133
- * @returns The method `add` returns either the newly added node (`NODE`) or `undefined`.
126
+ * The `getNode` function retrieves a node from a Red-Black Tree based on the provided identifier and
127
+ * callback function.
128
+ * @param {ReturnType<C> | undefined} identifier - The `identifier` parameter is the value or key
129
+ * that you want to search for in the binary search tree. It can be of any type that is compatible
130
+ * with the type of nodes in the tree.
131
+ * @param {C} callback - The `callback` parameter is a function that will be called for each node in
132
+ * the tree. It is used to determine whether a node matches the given identifier. The `callback`
133
+ * function should take a node as its parameter and return a value that can be compared to the
134
+ * `identifier` parameter.
135
+ * @param beginRoot - The `beginRoot` parameter is the starting point for the search in the binary
136
+ * search tree. It can be either a key or a node. If it is a key, it will be converted to a node
137
+ * using the `ensureNode` method. If it is not provided, the `root`
138
+ * @param iterationType - The `iterationType` parameter is used to specify the type of iteration to
139
+ * be performed when searching for nodes in the binary search tree. It is an optional parameter and
140
+ * its default value is taken from the `iterationType` property of the class.
141
+ * @returns The method is returning a value of type `NODE | null | undefined`.
142
+ */
143
+ getNode<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | undefined, callback?: C, beginRoot?: BSTNKeyOrNode<K, NODE>, iterationType?: import("../../types").IterationType): NODE | null | undefined;
144
+ /**
145
+ * Time Complexity: O(1)
146
+ * Space Complexity: O(1)
134
147
  */
135
- add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
148
+ /**
149
+ * Time Complexity: O(1)
150
+ * Space Complexity: O(1)
151
+ *
152
+ * The "clear" function sets the root node of a data structure to a sentinel value and resets the
153
+ * size counter to zero.
154
+ */
155
+ clear(): void;
136
156
  /**
137
157
  * Time Complexity: O(log n)
138
158
  * Space Complexity: O(1)
@@ -141,18 +161,16 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
141
161
  * Time Complexity: O(log n)
142
162
  * Space Complexity: O(1)
143
163
  *
144
- * The `delete` function removes a node from a binary tree based on a given identifier and updates
145
- * the tree accordingly.
146
- * @param {ReturnType<C> | null | undefined} identifier - The `identifier` parameter is the value
147
- * that you want to use to identify the node that you want to delete from the binary tree. It can be
148
- * of any type that is returned by the callback function `C`. It can also be `null` or `undefined` if
149
- * you don't want to
150
- * @param {C} callback - The `callback` parameter is a function that takes a node of type `NODE` and
151
- * returns a value of type `ReturnType<C>`. It is used to determine if a node should be deleted based
152
- * on its identifier. The `callback` function is optional and defaults to `this._defaultOneParam
153
- * @returns an array of `BinaryTreeDeleteResult<NODE>`.
164
+ * The function adds a new node to a Red-Black Tree data structure and returns a boolean indicating
165
+ * whether the operation was successful.
166
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be either a key, a node, or an
167
+ * entry.
168
+ * @param {V} [value] - The `value` parameter is the value associated with the key that is being
169
+ * added to the tree.
170
+ * @returns The method is returning a boolean value. It returns true if the node was successfully
171
+ * added or updated, and false otherwise.
154
172
  */
155
- delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null | undefined, callback?: C): BinaryTreeDeleteResult<NODE>[];
173
+ add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
156
174
  /**
157
175
  * Time Complexity: O(log n)
158
176
  * Space Complexity: O(1)
@@ -161,24 +179,25 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
161
179
  * Time Complexity: O(log n)
162
180
  * Space Complexity: O(1)
163
181
  *
164
- * The function `getNode` retrieves a single node from a binary tree based on a given identifier and
165
- * callback function.
166
- * @param {ReturnType<C> | undefined} identifier - The `identifier` parameter is the value used to
167
- * identify the node you want to retrieve. It can be of any type that is the return type of the `C`
168
- * callback function. If the `identifier` is `undefined`, it means you want to retrieve the first
169
- * node that matches the other criteria
170
- * @param {C} callback - The `callback` parameter is a function that will be called for each node in
171
- * the binary tree. It is used to determine if a node matches the given identifier. The `callback`
172
- * function should take a single parameter of type `NODE` (the type of the nodes in the binary tree) and
173
- * @param {K | NODE | undefined} beginRoot - The `beginRoot` parameter is the starting point for
174
- * searching for a node in a binary tree. It can be either a key value or a node object. If it is not
175
- * provided, the search will start from the root of the binary tree.
176
- * @param iterationType - The `iterationType` parameter is a variable that determines the type of
177
- * iteration to be performed when searching for nodes in the binary tree. It is used in the
178
- * `getNodes` method, which is called within the `getNode` method.
179
- * @returns a value of type `NODE`, `null`, or `undefined`.
182
+ * The function `delete` in a binary tree class deletes a node from the tree and fixes the tree if
183
+ * necessary.
184
+ * @param {ReturnType<C> | null | undefined} identifier - The `identifier` parameter is the
185
+ * identifier of the node that needs to be deleted from the binary tree. It can be of any type that
186
+ * is returned by the callback function `C`. It can also be `null` or `undefined` if the node to be
187
+ * deleted is not found.
188
+ * @param {C} callback - The `callback` parameter is a function that is used to retrieve a node from
189
+ * the binary tree based on its identifier. It is an optional parameter and if not provided, the
190
+ * `_defaultOneParamCallback` function is used as the default callback. The callback function should
191
+ * return the identifier of the node to
192
+ * @returns an array of BinaryTreeDeleteResult<NODE> objects.
180
193
  */
181
- getNode<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | undefined, callback?: C, beginRoot?: BSTNKeyOrNode<K, NODE>, iterationType?: import("../../types").IterationType): NODE | null | undefined;
194
+ delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null | undefined, callback?: C): BinaryTreeDeleteResult<NODE>[];
195
+ /**
196
+ * The function sets the root of a tree-like structure and updates the parent property of the new
197
+ * root.
198
+ * @param {NODE | undefined} v - v is a parameter of type NODE or undefined.
199
+ */
200
+ protected _setRoot(v: NODE | undefined): void;
182
201
  /**
183
202
  * Time Complexity: O(1)
184
203
  * Space Complexity: O(1)
@@ -187,9 +206,15 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
187
206
  * Time Complexity: O(1)
188
207
  * Space Complexity: O(1)
189
208
  *
190
- * The "clear" function sets the root node to the sentinel node and resets the size to 0.
209
+ * The function replaces an old node with a new node while preserving the color of the old node.
210
+ * @param {NODE} oldNode - The `oldNode` parameter represents the node that needs to be replaced in
211
+ * the data structure.
212
+ * @param {NODE} newNode - The `newNode` parameter is the new node that will replace the old node in
213
+ * the data structure.
214
+ * @returns The method is returning the result of calling the `_replaceNode` method from the
215
+ * superclass, with the `oldNode` and `newNode` parameters.
191
216
  */
192
- clear(): void;
217
+ protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
193
218
  /**
194
219
  * Time Complexity: O(log n)
195
220
  * Space Complexity: O(1)
@@ -198,19 +223,14 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
198
223
  * Time Complexity: O(log n)
199
224
  * Space Complexity: O(1)
200
225
  *
201
- * The function returns the predecessor of a given node in a red-black tree.
202
- * @param {RedBlackTreeNode} x - The parameter `x` is of type `RedBlackTreeNode`, which represents a node in a
203
- * Red-Black Tree.
204
- * @returns the predecessor of the given RedBlackTreeNode 'x'.
205
- */
206
- getPredecessor(x: NODE): NODE;
207
- /**
208
- * The function sets the root node of a tree structure and updates the parent property of the new
209
- * root node.
210
- * @param {NODE} v - The parameter "v" is of type "NODE", which represents a node in a data
211
- * structure.
226
+ * The `_insert` function inserts or updates a node in a binary search tree and performs necessary
227
+ * fix-ups to maintain the red-black tree properties.
228
+ * @param {NODE} node - The `node` parameter represents the node that needs to be inserted into a
229
+ * binary search tree. It contains a `key` property that is used to determine the position of the
230
+ * node in the tree.
231
+ * @returns {'inserted' | 'updated'} - The result of the insertion.
212
232
  */
213
- protected _setRoot(v: NODE): void;
233
+ protected _insert(node: NODE): CRUD;
214
234
  /**
215
235
  * Time Complexity: O(1)
216
236
  * Space Complexity: O(1)
@@ -219,23 +239,25 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
219
239
  * Time Complexity: O(1)
220
240
  * Space Complexity: O(1)
221
241
  *
222
- * The function performs a left rotation on a binary tree node.
223
- * @param {RedBlackTreeNode} x - The parameter `x` is of type `NODE`, which likely represents a node in a binary tree.
242
+ * The function `_transplant` is used to replace a node `u` with another node `v` in a binary tree.
243
+ * @param {NODE} u - The parameter "u" represents a node in a binary tree.
244
+ * @param {NODE | undefined} v - The parameter `v` is of type `NODE | undefined`, which means it can
245
+ * either be a `NODE` object or `undefined`.
224
246
  */
225
- protected _leftRotate(x: NODE): void;
247
+ protected _transplant(u: NODE, v: NODE | undefined): void;
226
248
  /**
227
- * Time Complexity: O(1)
249
+ * Time Complexity: O(log n)
228
250
  * Space Complexity: O(1)
229
251
  */
230
252
  /**
231
- * Time Complexity: O(1)
253
+ * Time Complexity: O(log n)
232
254
  * Space Complexity: O(1)
233
255
  *
234
- * The function performs a right rotation on a red-black tree node.
235
- * @param {RedBlackTreeNode} x - x is a RedBlackTreeNode, which represents the node that needs to be right
236
- * rotated.
256
+ * The `_insertFixup` function is used to fix the Red-Black Tree after inserting a new node.
257
+ * @param {NODE | undefined} z - The parameter `z` represents a node in the Red-Black Tree. It can
258
+ * either be a valid node object or `undefined`.
237
259
  */
238
- protected _rightRotate(x: NODE): void;
260
+ protected _insertFixup(z: NODE | undefined): void;
239
261
  /**
240
262
  * Time Complexity: O(log n)
241
263
  * Space Complexity: O(1)
@@ -244,23 +266,27 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
244
266
  * Time Complexity: O(log n)
245
267
  * Space Complexity: O(1)
246
268
  *
247
- * The `_fixInsert` function is used to fix the red-black tree after an insertion operation.
248
- * @param {RedBlackTreeNode} k - The parameter `k` is a RedBlackTreeNode object, which represents a node in a
249
- * red-black tree.
269
+ * The `_deleteFixup` function is used to fix the red-black tree after a node deletion by adjusting
270
+ * the colors and performing rotations.
271
+ * @param {NODE | undefined} node - The `node` parameter represents a node in a Red-Black Tree data
272
+ * structure. It can be either a valid node object or `undefined`.
273
+ * @returns The function does not return any value. It has a return type of `void`.
250
274
  */
251
- protected _fixInsert(k: NODE): void;
275
+ protected _deleteFixup(node: NODE | undefined): void;
252
276
  /**
253
- * Time Complexity: O(log n)
277
+ * Time Complexity: O(1)
254
278
  * Space Complexity: O(1)
255
279
  */
256
280
  /**
257
- * Time Complexity: O(log n)
281
+ * Time Complexity: O(1)
258
282
  * Space Complexity: O(1)
259
283
  *
260
- * The function `_fixDelete` is used to fix the red-black tree after a node deletion.
261
- * @param {RedBlackTreeNode} x - The parameter `x` represents a node in a Red-Black Tree (RBT).
284
+ * The `_leftRotate` function performs a left rotation on a given node in a binary tree.
285
+ * @param {NODE | undefined} x - The parameter `x` is of type `NODE | undefined`. It represents a
286
+ * node in a binary tree or `undefined` if there is no node.
287
+ * @returns void, which means it does not return any value.
262
288
  */
263
- protected _fixDelete(x: NODE): void;
289
+ protected _leftRotate(x: NODE | undefined): void;
264
290
  /**
265
291
  * Time Complexity: O(1)
266
292
  * Space Complexity: O(1)
@@ -269,19 +295,10 @@ export declare class RedBlackTree<K = any, V = any, NODE extends RedBlackTreeNod
269
295
  * Time Complexity: O(1)
270
296
  * Space Complexity: O(1)
271
297
  *
272
- * The function `_rbTransplant` replaces one node in a red-black tree with another node.
273
- * @param {RedBlackTreeNode} u - The parameter "u" represents a RedBlackTreeNode object.
274
- * @param {RedBlackTreeNode} v - The parameter "v" is a RedBlackTreeNode object.
275
- */
276
- protected _rbTransplant(u: NODE, v: NODE): void;
277
- /**
278
- * The function replaces an old node with a new node while preserving the color of the old node.
279
- * @param {NODE} oldNode - The `oldNode` parameter represents the node that needs to be replaced in a
280
- * data structure. It is of type `NODE`, which is the type of the nodes in the data structure.
281
- * @param {NODE} newNode - The `newNode` parameter is the node that will replace the `oldNode` in the
282
- * data structure.
283
- * @returns The method is returning the result of calling the `_replaceNode` method from the
284
- * superclass, passing in the `oldNode` and `newNode` as arguments.
298
+ * The `_rightRotate` function performs a right rotation on a given node in a binary tree.
299
+ * @param {NODE | undefined} y - The parameter `y` is of type `NODE | undefined`. It represents a
300
+ * node in a binary tree or `undefined` if there is no node.
301
+ * @returns void, which means it does not return any value.
285
302
  */
286
- protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
303
+ protected _rightRotate(y: NODE | undefined): void;
287
304
  }