undirected-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
@@ -5,210 +5,102 @@
5
5
  * @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import type { BinaryTreeDeleteResult, BSTNOptKeyOrNode, BTNRep, EntryCallback, IterationType, RBTNColor, TreeMultiMapNodeNested, TreeMultiMapOptions } from '../../types';
9
- import { IBinaryTree } from '../../interfaces';
8
+ import type { BTNRep, OptNodeOrNull, TreeMultiMapOptions } from '../../types';
10
9
  import { RedBlackTree, RedBlackTreeNode } from './red-black-tree';
11
- export declare class TreeMultiMapNode<K = any, V = any, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNodeNested<K, V>> extends RedBlackTreeNode<K, V, NODE> {
12
- /**
13
- * The constructor function initializes a Red-Black Tree node with a key, value, count, and color.
14
- * @param {K} key - The key parameter represents the key of the node in the Red-Black Tree. It is
15
- * used to identify and locate the node within the tree.
16
- * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
17
- * associated with the key in the Red-Black Tree node. It is not required and can be omitted when
18
- * creating a new node.
19
- * @param [count=1] - The `count` parameter represents the number of occurrences of a particular key
20
- * in the Red-Black Tree. It is an optional parameter with a default value of 1.
21
- * @param {RBTNColor} [color=BLACK] - The `color` parameter is used to specify the color of the node
22
- * in a Red-Black Tree. It is optional and has a default value of `'BLACK'`.
23
- */
24
- constructor(key: K, value?: V, count?: number, color?: RBTNColor);
25
- protected _count: number;
26
- /**
27
- * The function returns the value of the private variable _count.
28
- * @returns The count property of the object, which is of type number.
29
- */
30
- get count(): number;
31
- /**
32
- * The above function sets the value of the count property.
33
- * @param {number} value - The value parameter is of type number, which means it can accept any
34
- * numeric value.
35
- */
36
- set count(value: number);
10
+ import { IBinaryTree } from '../../interfaces';
11
+ export declare class TreeMultiMapNode<K = any, V = any> extends RedBlackTreeNode<K, V[]> {
12
+ /**
13
+ * This TypeScript constructor initializes an object with a key of type K and an array of values of
14
+ * type V.
15
+ * @param {K} key - The `key` parameter is typically used to store a unique identifier or key for the
16
+ * data being stored in the data structure. It helps in quickly accessing or retrieving the
17
+ * associated value in the data structure.
18
+ * @param {V[]} value - The `value` parameter in the constructor represents an array of values of
19
+ * type `V`.
20
+ */
21
+ constructor(key: K, value: V[]);
22
+ parent?: TreeMultiMapNode<K, V>;
23
+ _left?: OptNodeOrNull<TreeMultiMapNode<K, V>>;
24
+ get left(): OptNodeOrNull<TreeMultiMapNode<K, V>>;
25
+ set left(v: OptNodeOrNull<TreeMultiMapNode<K, V>>);
26
+ _right?: OptNodeOrNull<TreeMultiMapNode<K, V>>;
27
+ get right(): OptNodeOrNull<TreeMultiMapNode<K, V>>;
28
+ set right(v: OptNodeOrNull<TreeMultiMapNode<K, V>>);
37
29
  }
38
- export declare class TreeMultiMap<K = any, V = any, R = object, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNode<K, V, TreeMultiMapNodeNested<K, V>>> extends RedBlackTree<K, V, R, NODE> implements IBinaryTree<K, V, R, NODE> {
39
- /**
40
- * The constructor function initializes a TreeMultiMap object with optional initial data.
41
- * @param keysNodesEntriesOrRaws - The parameter `keysNodesEntriesOrRaws` is an
42
- * iterable that can contain keys, nodes, entries, or raw elements. It is used to initialize the
43
- * TreeMultiMap with initial data.
44
- * @param [options] - The `options` parameter is an optional object that can be used to customize the
45
- * behavior of the `TreeMultiMap` constructor. It can include properties such as `compareKeys` and
46
- * `compareValues`, which are functions used to compare keys and values respectively.
47
- */
48
- constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V, NODE>>, options?: TreeMultiMapOptions<K, V, R>);
49
- protected _count: number;
50
- /**
51
- * The function calculates the sum of the count property of all nodes in a tree structure.
52
- * @returns the sum of the count property of all nodes in the tree.
53
- */
54
- get count(): number;
55
- /**
56
- * Time Complexity: O(n)
57
- * Space Complexity: O(1)
58
- *
59
- * The function calculates the sum of the count property of all nodes in a tree using depth-first
60
- * search.
61
- * @returns the sum of the count property of all nodes in the tree.
62
- */
63
- getComputedCount(): number;
64
- /**
65
- * The function creates a new TreeMultiMapNode with the specified key, value, color, and count.
66
- * @param {K} key - The key parameter represents the key of the node being created. It is of type K,
67
- * which is a generic type representing the type of keys in the tree.
68
- * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
69
- * associated with the key in the node. It is of type `V`, which can be any data type.
70
- * @param {RBTNColor} [color=BLACK] - The color parameter is used to specify the color of the node in
71
- * a Red-Black Tree. It can have two possible values: 'RED' or 'BLACK'. The default value is 'BLACK'.
72
- * @param {number} [count] - The `count` parameter represents the number of occurrences of a key in
73
- * the tree. It is an optional parameter and is used to keep track of the number of values associated
74
- * with a key in the tree.
75
- * @returns A new instance of the TreeMultiMapNode class, casted as NODE.
76
- */
77
- createNode(key: K, value?: V, color?: RBTNColor, count?: number): NODE;
78
- /**
79
- * The function creates a new instance of a TreeMultiMap with the specified options and returns it.
80
- * @param [options] - The `options` parameter is an optional object that contains additional
81
- * configuration options for creating the `TreeMultiMap`. It is of type `TreeMultiMapOptions<K, V,
82
- * R>`.
83
- * @returns a new instance of the `TreeMultiMap` class, with the provided options merged with the
84
- * existing `iterationType` property. The returned value is casted as `TREE`.
85
- */
86
- createTree(options?: TreeMultiMapOptions<K, V, R>): TreeMultiMap<K, V, R, NODE>;
87
- /**
88
- * The function checks if the input is an instance of the TreeMultiMapNode class.
89
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The parameter
90
- * `keyNodeEntryOrRaw` can be of type `R` or `BTNRep<K, V, NODE>`.
91
- * @returns a boolean value indicating whether the input parameter `keyNodeEntryOrRaw` is
92
- * an instance of the `TreeMultiMapNode` class.
93
- */
94
- isNode(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R): keyNodeEntryOrRaw is NODE;
30
+ /**
31
+ *
32
+ * @example
33
+ * // Find elements in a range
34
+ * const tmm = new TreeMultiMap<number>([10, 5, 15, 3, 7, 12, 18]);
35
+ * console.log(tmm.search(new Range(5, 10))); // [5, 10, 7]
36
+ * console.log(tmm.search(new Range(4, 12))); // [5, 10, 12, 7]
37
+ * console.log(tmm.search(new Range(15, 20))); // [15, 18]
38
+ */
39
+ export declare class TreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends RedBlackTree<K, V[], R, MK, MV[], MR> implements IBinaryTree<K, V[], R, MK, MV, MR> {
95
40
  /**
96
- * Time Complexity: O(log n)
97
- * Space Complexity: O(1)
98
- *
99
- * The function overrides the add method of a class and adds a new node to a data structure, updating
100
- * the count and returning a boolean indicating success.
101
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The
102
- * `keyNodeEntryOrRaw` parameter can accept one of the following types:
103
- * @param {V} [value] - The `value` parameter represents the value associated with the key in the
104
- * data structure. It is an optional parameter, so it can be omitted if not needed.
105
- * @param [count=1] - The `count` parameter represents the number of times the key-value pair should
106
- * be added to the data structure. By default, it is set to 1, meaning that if no value is provided
107
- * for `count`, the key-value pair will be added once.
108
- * @returns The method is returning a boolean value. It returns true if the addition of the new node
109
- * was successful, and false otherwise.
41
+ * The constructor initializes an TreeMultiMap with the provided keys, nodes, entries, or raw data
42
+ * and options.
43
+ * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
44
+ * iterable that can contain either key-value pairs represented as `BTNRep<K, V[],
45
+ * TreeMultiMapNode<K, V>>` or raw data represented as `R`. This parameter is used to initialize
46
+ * the RedBlackTreeMulti
47
+ * @param [options] - The `options` parameter in the constructor is of type
48
+ * `TreeMultiMapOptions<K, V[], R>`. It is an optional parameter that allows you to specify
49
+ * additional options for configuring the TreeMultiMap instance.
110
50
  */
111
- add(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R, value?: V, count?: number): boolean;
51
+ constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V[], TreeMultiMapNode<K, V>> | R>, options?: TreeMultiMapOptions<K, V[], R>);
112
52
  /**
113
- * Time Complexity: O(log n)
53
+ * Time Complexity: O(1)
114
54
  * Space Complexity: O(1)
115
55
  *
116
- * The function `delete` in TypeScript overrides the deletion operation in a binary tree data
117
- * structure, handling cases where nodes have children and maintaining balance in the tree.
118
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The `predicate`
119
- * parameter in the `delete` method is used to specify the condition or key based on which a node
120
- * should be deleted from the binary tree. It can be a key, a node, or an entry.
121
- * @param [ignoreCount=false] - The `ignoreCount` parameter in the `override delete` method is a
122
- * boolean flag that determines whether to ignore the count of nodes when performing deletion. If
123
- * `ignoreCount` is set to `true`, the method will delete the node regardless of its count. If
124
- * `ignoreCount` is `false
125
- * @returns The `override delete` method returns an array of `BinaryTreeDeleteResult<NODE>` objects.
56
+ * The `createTree` function in TypeScript overrides the default implementation to create a new
57
+ * TreeMultiMap with specified options.
58
+ * @param [options] - The `options` parameter in the `createTree` method is of type
59
+ * `TreeMultiMapOptions<K, V[], R>`. This parameter allows you to pass additional configuration
60
+ * options when creating a new `TreeMultiMap` instance. It includes properties such as
61
+ * `iterationType`, `specifyComparable
62
+ * @returns A new instance of `TreeMultiMap` is being returned, with an empty array as the initial
63
+ * data and the provided options merged with the existing properties of the current object.
126
64
  */
127
- delete(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R, ignoreCount?: boolean): BinaryTreeDeleteResult<NODE>[];
65
+ createTree(options?: TreeMultiMapOptions<K, V[], R>): TreeMultiMap<K, V, R, MK, MV, MR>;
128
66
  /**
129
67
  * Time Complexity: O(1)
130
68
  * Space Complexity: O(1)
131
69
  *
132
- * The "clear" function overrides the parent class's "clear" function and also resets the count to
133
- * zero.
70
+ * The function `createNode` overrides the method to create a new `TreeMultiMapNode` with a specified
71
+ * key and an empty array of values.
72
+ * @param {K} key - The `key` parameter in the `createNode` method represents the key of the node
73
+ * that will be created in the TreeMultiMap data structure.
74
+ * @returns A new instance of `TreeMultiMapNode<K, V>` is being returned, with the specified key and
75
+ * an empty array as its value.
134
76
  */
135
- clear(): void;
77
+ createNode(key: K): TreeMultiMapNode<K, V>;
78
+ add(node: BTNRep<K, V[], TreeMultiMapNode<K, V>>): boolean;
79
+ add(key: K, value: V): boolean;
136
80
  /**
137
- * Time Complexity: O(n log n)
81
+ * Time Complexity: O(log n)
138
82
  * Space Complexity: O(log n)
139
83
  *
140
- * The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
141
- * tree using either a recursive or iterative approach.
142
- * @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
143
- * specifies the type of iteration to use when building the balanced binary search tree. It has a
144
- * default value of `this.iterationType`, which means it will use the iteration type specified by the
145
- * `iterationType` property of the current object.
146
- * @returns The function `perfectlyBalance` returns a boolean value. It returns `true` if the
147
- * balancing operation is successful, and `false` if there are no nodes to balance.
148
- */
149
- perfectlyBalance(iterationType?: IterationType): boolean;
150
- /**
151
- * Time complexity: O(n)
152
- * Space complexity: O(n)
153
- *
154
- * The function overrides the clone method to create a deep copy of a tree object.
155
- * @returns The `clone()` method is returning a cloned instance of the `TREE` object.
156
- */
157
- clone(): TreeMultiMap<K, V, R, NODE>;
158
- /**
159
- * The `map` function in TypeScript overrides the default behavior to create a new TreeMultiMap with
160
- * modified entries based on a provided callback.
161
- * @param callback - The `callback` parameter is a function that will be called for each entry in the
162
- * map. It takes four arguments:
163
- * @param [options] - The `options` parameter in the `override map` function is of type
164
- * `TreeMultiMapOptions<MK, MV, MR>`. This parameter allows you to provide additional configuration
165
- * options when creating a new `TreeMultiMap` instance within the `map` function. These options could
166
- * include things like
167
- * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
168
- * the value of `this` when executing the `callback` function. It allows you to set the context
169
- * (value of `this`) for the callback function when it is called within the `map` function. This
170
- * @returns A new TreeMultiMap instance is being returned, which is populated with entries generated
171
- * by the provided callback function.
172
- */
173
- map<MK, MV, MR>(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: TreeMultiMapOptions<MK, MV, MR>, thisArg?: any): TreeMultiMap<MK, MV, MR, TreeMultiMapNode<MK, MV, TreeMultiMapNodeNested<MK, MV>>>;
174
- /**
175
- * The function `keyValueNodeEntryRawToNodeAndValue` takes in a key, value, and count and returns a
176
- * node based on the input.
177
- * @param {BTNRep<K, V, NODE> | R} keyNodeEntryOrRaw - The parameter
178
- * `keyNodeEntryOrRaw` can be of type `R` or `BTNRep<K, V, NODE>`.
179
- * @param {V} [value] - The `value` parameter is an optional value that represents the value
180
- * associated with the key in the node. It is used when creating a new node or updating the value of
181
- * an existing node.
182
- * @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
183
- * times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
184
- * @returns either a NODE object or undefined.
185
- */
186
- protected _keyValueNodeEntryRawToNodeAndValue(keyNodeEntryOrRaw: BTNRep<K, V, NODE> | R, value?: V, count?: number): [NODE | undefined, V | undefined];
187
- /**
188
- * Time Complexity: O(1)
189
- * Space Complexity: O(1)
190
- *
191
- * The `_swapProperties` function swaps the properties (key, value, count, color) between two nodes
192
- * in a binary search tree.
193
- * @param {R | BSTNOptKeyOrNode<K, NODE>} srcNode - The `srcNode` parameter represents the source node
194
- * that will be swapped with the `destNode`. It can be either an instance of the `R` class or an
195
- * instance of the `BSTNOptKeyOrNode<K, NODE>` class.
196
- * @param {R | BSTNOptKeyOrNode<K, NODE>} destNode - The `destNode` parameter represents the destination
197
- * node where the properties will be swapped with the source node.
198
- * @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
199
- * If either `srcNode` or `destNode` is undefined, it returns undefined.
200
- */
201
- protected _swapProperties(srcNode: R | BSTNOptKeyOrNode<K, NODE>, destNode: R | BSTNOptKeyOrNode<K, NODE>): NODE | undefined;
84
+ * The function `deleteValue` removes a specific value from a key in a TreeMultiMap data structure
85
+ * and deletes the entire node if no values are left for that key.
86
+ * @param {BTNRep<K, V[], TreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
87
+ * parameter in the `deleteValue` function can be either a `BTNRep` object containing a key and an
88
+ * array of values, or just a key itself.
89
+ * @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
90
+ * value that you want to remove from the multi-map data structure associated with a particular key.
91
+ * The function checks if the value exists in the array of values associated with the key, and if
92
+ * found, removes it from the array.
93
+ * @returns The `deleteValue` function returns a boolean value - `true` if the specified `value` was
94
+ * successfully deleted from the values associated with the `keyNodeOrEntry`, and `false` otherwise.
95
+ */
96
+ deleteValue(keyNodeOrEntry: BTNRep<K, V[], TreeMultiMapNode<K, V>> | K, value: V): boolean;
202
97
  /**
203
- * Time Complexity: O(1)
204
- * Space Complexity: O(1)
98
+ * Time Complexity: O(n)
99
+ * Space Complexity: O(n)
205
100
  *
206
- * The function replaces an old node with a new node and updates the count property of the new node.
207
- * @param {NODE} oldNode - The `oldNode` parameter is the node that you want to replace in the data
101
+ * The function `clone` overrides the default cloning behavior to create a deep copy of a tree
208
102
  * structure.
209
- * @param {NODE} newNode - The `newNode` parameter is an instance of the `NODE` class.
210
- * @returns The method is returning the result of calling the `_replaceNode` method from the
211
- * superclass, which is of type `NODE`.
103
+ * @returns The `cloned` object is being returned.
212
104
  */
213
- protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
105
+ clone(): TreeMultiMap<K, V, R, MK, MV, MR>;
214
106
  }