directed-graph-typed 1.53.9 → 1.54.1

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