data-structure-typed 1.38.6 → 1.38.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +6 -6
  3. package/dist/cjs/data-structures/binary-tree/avl-tree.js +1 -1
  4. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  5. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +28 -28
  6. package/dist/cjs/data-structures/binary-tree/binary-tree.js +22 -22
  7. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  8. package/dist/cjs/data-structures/binary-tree/bst.d.ts +6 -6
  9. package/dist/cjs/data-structures/binary-tree/bst.js +1 -1
  10. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +3 -3
  12. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  13. package/dist/cjs/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  14. package/dist/cjs/data-structures/binary-tree/tree-multiset.js +2 -2
  15. package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -1
  16. package/dist/cjs/interfaces/binary-tree.d.ts +2 -2
  17. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +6 -6
  18. package/dist/mjs/data-structures/binary-tree/avl-tree.js +1 -1
  19. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +28 -28
  20. package/dist/mjs/data-structures/binary-tree/binary-tree.js +22 -22
  21. package/dist/mjs/data-structures/binary-tree/bst.d.ts +6 -6
  22. package/dist/mjs/data-structures/binary-tree/bst.js +1 -1
  23. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +3 -3
  24. package/dist/mjs/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  25. package/dist/mjs/data-structures/binary-tree/tree-multiset.js +2 -2
  26. package/dist/mjs/interfaces/binary-tree.d.ts +2 -2
  27. package/dist/umd/index.global.js +1 -1
  28. package/dist/umd/index.global.js.map +1 -1
  29. package/package.json +5 -5
  30. package/src/data-structures/binary-tree/avl-tree.ts +10 -10
  31. package/src/data-structures/binary-tree/binary-tree.ts +42 -42
  32. package/src/data-structures/binary-tree/bst.ts +9 -9
  33. package/src/data-structures/binary-tree/rb-tree.ts +4 -7
  34. package/src/data-structures/binary-tree/tree-multiset.ts +10 -13
  35. package/src/interfaces/binary-tree.ts +2 -2
  36. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +2 -2
  37. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +1 -1
  38. package/test/unit/data-structures/binary-tree/bst.test.ts +1 -1
  39. package/test/unit/data-structures/binary-tree/overall.test.ts +20 -20
  40. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +1 -1
@@ -9,7 +9,7 @@ import type { BinaryTreeNodeKey, TreeMultisetNodeNested, TreeMultisetOptions } f
9
9
  import { BinaryTreeDeletedResult, IterationType, MapCallback } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
11
  import { AVLTree, AVLTreeNode } from './avl-tree';
12
- export declare class TreeMultisetNode<V = any, FAMILY extends TreeMultisetNode<V, FAMILY> = TreeMultisetNodeNested<V>> extends AVLTreeNode<V, FAMILY> {
12
+ export declare class TreeMultisetNode<V = any, N extends TreeMultisetNode<V, N> = TreeMultisetNodeNested<V>> extends AVLTreeNode<V, N> {
13
13
  count: number;
14
14
  /**
15
15
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
@@ -26,7 +26,7 @@ export declare class TreeMultisetNode<V = any, FAMILY extends TreeMultisetNode<V
26
26
  /**
27
27
  * The only distinction between a TreeMultiset and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
28
28
  */
29
- export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = TreeMultisetNode> extends AVLTree<N> implements IBinaryTree<N> {
29
+ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = TreeMultisetNode> extends AVLTree<V, N> implements IBinaryTree<V, N> {
30
30
  /**
31
31
  * The constructor function for a TreeMultiset class in TypeScript, which extends another class and sets an option to
32
32
  * merge duplicated values.
@@ -45,7 +45,7 @@ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = Tree
45
45
  * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
46
46
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
47
47
  */
48
- createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
48
+ createNode(key: BinaryTreeNodeKey, val?: V, count?: number): N;
49
49
  /**
50
50
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
51
51
  * exists, and balancing the tree if necessary.
@@ -59,7 +59,7 @@ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = Tree
59
59
  * count is specified, the default count will be 1.
60
60
  * @returns The function `add` returns a value of type `N | null | undefined`.
61
61
  */
62
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val'], count?: number): N | null | undefined;
62
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V, count?: number): N | null | undefined;
63
63
  /**
64
64
  * The function adds a new node to a binary tree if there is an available slot in the parent node.
65
65
  * @param {N | null} newNode - The `newNode` parameter represents the node that needs to be added to
@@ -74,12 +74,12 @@ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = Tree
74
74
  * inserted nodes.
75
75
  * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
76
76
  * added to the multiset. Each element can be either a BinaryTreeNodeKey or a TreeMultisetNode.
77
- * @param {N['val'][]} [data] - The `data` parameter is an optional array of values that correspond
77
+ * @param {V[]} [data] - The `data` parameter is an optional array of values that correspond
78
78
  * to the keys or nodes being added to the multiset. It is used to associate additional data with
79
79
  * each key or node.
80
80
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
81
81
  */
82
- addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: N['val'][]): (N | null | undefined)[];
82
+ addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: V[]): (N | null | undefined)[];
83
83
  /**
84
84
  * The `perfectlyBalance` function in TypeScript takes a sorted array of nodes and builds a balanced
85
85
  * binary search tree using either a recursive or iterative approach.
@@ -177,7 +177,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
177
177
  * inserted nodes.
178
178
  * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
179
179
  * added to the multiset. Each element can be either a BinaryTreeNodeKey or a TreeMultisetNode.
180
- * @param {N['val'][]} [data] - The `data` parameter is an optional array of values that correspond
180
+ * @param {V[]} [data] - The `data` parameter is an optional array of values that correspond
181
181
  * to the keys or nodes being added to the multiset. It is used to associate additional data with
182
182
  * each key or node.
183
183
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
@@ -191,7 +191,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
191
191
  continue;
192
192
  }
193
193
  if (keyOrNode === null) {
194
- inserted.push(this.add(NaN, null, 0));
194
+ inserted.push(this.add(NaN, undefined, 0));
195
195
  continue;
196
196
  }
197
197
  inserted.push(this.add(keyOrNode, data === null || data === void 0 ? void 0 : data[i], 1));
@@ -1 +1 @@
1
- {"version":3,"file":"tree-multiset.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/tree-multiset.ts"],"names":[],"mappings":";;;AAQA,uCAAoG;AAEpG,yCAAgD;AAEhD,MAAa,gBAGX,SAAQ,sBAAsB;IAG9B;;;;;;;;;OASG;IACH,YAAY,GAAsB,EAAE,GAAO,EAAE,KAAK,GAAG,CAAC;QACpD,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AApBD,4CAoBC;AAED;;GAEG;AACH,MAAa,YACX,SAAQ,kBAAU;I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GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;YAC3B,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC/B,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;SAClC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,SAAS,CAAC,CAAS;QAC3B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;CACF;AAtVD,oCAsVC"}
@@ -1,6 +1,6 @@
1
1
  import { BinaryTreeNode } from '../data-structures';
2
- import { BinaryTreeDeletedResult, BinaryTreeNodeKey, MapCallback } from '../types';
3
- export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> {
2
+ import { BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, MapCallback } from '../types';
3
+ export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {
4
4
  createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
5
5
  add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
6
6
  delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
@@ -7,13 +7,13 @@
7
7
  */
8
8
  import { BST, BSTNode } from './bst';
9
9
  import type { AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BinaryTreeNodeKey } from '../../types';
10
- import { IBinaryTree } from '../../interfaces';
11
10
  import { MapCallback } from '../../types';
12
- export declare class AVLTreeNode<V = any, FAMILY extends AVLTreeNode<V, FAMILY> = AVLTreeNodeNested<V>> extends BSTNode<V, FAMILY> {
11
+ import { IBinaryTree } from '../../interfaces';
12
+ export declare class AVLTreeNode<V = any, N extends AVLTreeNode<V, N> = AVLTreeNodeNested<V>> extends BSTNode<V, N> {
13
13
  height: number;
14
14
  constructor(key: BinaryTreeNodeKey, val?: V);
15
15
  }
16
- export declare class AVLTree<N extends AVLTreeNode<N['val'], N> = AVLTreeNode> extends BST<N> implements IBinaryTree<N> {
16
+ export declare class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode> extends BST<V, N> implements IBinaryTree<V, N> {
17
17
  /**
18
18
  * This is a constructor function for an AVL tree data structure in TypeScript.
19
19
  * @param {AVLTreeOptions} [options] - The `options` parameter is an optional object that can be passed to the
@@ -26,11 +26,11 @@ export declare class AVLTree<N extends AVLTreeNode<N['val'], N> = AVLTreeNode> e
26
26
  * @param {BinaryTreeNodeKey} key - The key parameter is the key value that will be associated with
27
27
  * the new node. It is used to determine the position of the node in the binary search tree.
28
28
  * @param [val] - The parameter `val` is an optional value that can be assigned to the node. It is of
29
- * type `N['val']`, which means it can be any value that is assignable to the `val` property of the
29
+ * type `V`, which means it can be any value that is assignable to the `val` property of the
30
30
  * node type `N`.
31
31
  * @returns a new AVLTreeNode object with the specified key and value.
32
32
  */
33
- createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
33
+ createNode(key: BinaryTreeNodeKey, val?: V): N;
34
34
  /**
35
35
  * The function overrides the add method of a binary tree node and balances the tree after inserting
36
36
  * a new node.
@@ -40,7 +40,7 @@ export declare class AVLTree<N extends AVLTreeNode<N['val'], N> = AVLTreeNode> e
40
40
  * are adding to the binary search tree.
41
41
  * @returns The method is returning the inserted node (`N`), `null`, or `undefined`.
42
42
  */
43
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
43
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V): N | null | undefined;
44
44
  /**
45
45
  * The function overrides the delete method of a binary tree and balances the tree after deleting a
46
46
  * node if necessary.
@@ -32,7 +32,7 @@ class AVLTree extends bst_1.BST {
32
32
  * @param {BinaryTreeNodeKey} key - The key parameter is the key value that will be associated with
33
33
  * the new node. It is used to determine the position of the node in the binary search tree.
34
34
  * @param [val] - The parameter `val` is an optional value that can be assigned to the node. It is of
35
- * type `N['val']`, which means it can be any value that is assignable to the `val` property of the
35
+ * type `V`, which means it can be any value that is assignable to the `val` property of the
36
36
  * node type `N`.
37
37
  * @returns a new AVLTreeNode object with the specified key and value.
38
38
  */
@@ -11,9 +11,9 @@ import { IBinaryTree } from '../../interfaces';
11
11
  /**
12
12
  * Represents a node in a binary tree.
13
13
  * @template V - The type of data stored in the node.
14
- * @template FAMILY - The type of the family relationship in the binary tree.
14
+ * @template N - The type of the family relationship in the binary tree.
15
15
  */
16
- export declare class BinaryTreeNode<V = any, FAMILY extends BinaryTreeNode<V, FAMILY> = BinaryTreeNodeNested<V>> {
16
+ export declare class BinaryTreeNode<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>> {
17
17
  /**
18
18
  * The key associated with the node.
19
19
  */
@@ -25,7 +25,7 @@ export declare class BinaryTreeNode<V = any, FAMILY extends BinaryTreeNode<V, FA
25
25
  /**
26
26
  * The parent node of the current node.
27
27
  */
28
- parent: FAMILY | null | undefined;
28
+ parent: N | null | undefined;
29
29
  /**
30
30
  * Creates a new instance of BinaryTreeNode.
31
31
  * @param {BinaryTreeNodeKey} key - The key associated with the node.
@@ -36,22 +36,22 @@ export declare class BinaryTreeNode<V = any, FAMILY extends BinaryTreeNode<V, FA
36
36
  /**
37
37
  * Get the left child node.
38
38
  */
39
- get left(): FAMILY | null | undefined;
39
+ get left(): N | null | undefined;
40
40
  /**
41
41
  * Set the left child node.
42
- * @param {FAMILY | null | undefined} v - The left child node.
42
+ * @param {N | null | undefined} v - The left child node.
43
43
  */
44
- set left(v: FAMILY | null | undefined);
44
+ set left(v: N | null | undefined);
45
45
  private _right;
46
46
  /**
47
47
  * Get the right child node.
48
48
  */
49
- get right(): FAMILY | null | undefined;
49
+ get right(): N | null | undefined;
50
50
  /**
51
51
  * Set the right child node.
52
- * @param {FAMILY | null | undefined} v - The right child node.
52
+ * @param {N | null | undefined} v - The right child node.
53
53
  */
54
- set right(v: FAMILY | null | undefined);
54
+ set right(v: N | null | undefined);
55
55
  /**
56
56
  * Get the position of the node within its family.
57
57
  * @returns {FamilyPosition} - The family position of the node.
@@ -62,13 +62,22 @@ export declare class BinaryTreeNode<V = any, FAMILY extends BinaryTreeNode<V, FA
62
62
  * Represents a binary tree data structure.
63
63
  * @template N - The type of the binary tree's nodes.
64
64
  */
65
- export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTreeNode> implements IBinaryTree<N> {
66
- private _loopType;
65
+ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode> implements IBinaryTree<V, N> {
67
66
  /**
68
67
  * Creates a new instance of BinaryTree.
69
68
  * @param {BinaryTreeOptions} [options] - The options for the binary tree.
70
69
  */
71
70
  constructor(options?: BinaryTreeOptions);
71
+ private _iterationType;
72
+ /**
73
+ * Get the iteration type used in the binary tree.
74
+ */
75
+ get iterationType(): IterationType;
76
+ /**
77
+ * Set the iteration type for the binary tree.
78
+ * @param {IterationType} v - The new iteration type to set.
79
+ */
80
+ set iterationType(v: IterationType);
72
81
  private _root;
73
82
  /**
74
83
  * Get the root node of the binary tree.
@@ -79,22 +88,13 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
79
88
  * Get the number of nodes in the binary tree.
80
89
  */
81
90
  get size(): number;
82
- /**
83
- * Get the iteration type used in the binary tree.
84
- */
85
- get iterationType(): IterationType;
86
- /**
87
- * Set the iteration type for the binary tree.
88
- * @param {IterationType} v - The new iteration type to set.
89
- */
90
- set iterationType(v: IterationType);
91
91
  /**
92
92
  * Creates a new instance of BinaryTreeNode with the given key and value.
93
93
  * @param {BinaryTreeNodeKey} key - The key for the new node.
94
- * @param {N['val']} val - The value for the new node.
94
+ * @param {V} val - The value for the new node.
95
95
  * @returns {N} - The newly created BinaryTreeNode.
96
96
  */
97
- createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
97
+ createNode(key: BinaryTreeNodeKey, val?: V): N;
98
98
  /**
99
99
  * Clear the binary tree, removing all nodes.
100
100
  */
@@ -107,31 +107,31 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
107
107
  /**
108
108
  * Add a node with the given key and value to the binary tree.
109
109
  * @param {BinaryTreeNodeKey | N | null} keyOrNode - The key or node to add to the binary tree.
110
- * @param {N['val']} val - The value for the new node (optional).
110
+ * @param {V} val - The value for the new node (optional).
111
111
  * @returns {N | null | undefined} - The inserted node, or null if nothing was inserted, or undefined if the operation failed.
112
112
  */
113
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
113
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V): N | null | undefined;
114
114
  /**
115
115
  * The `addMany` function takes an array of binary tree node IDs or nodes, and optionally an array of corresponding data
116
116
  * values, and adds them to the binary tree.
117
117
  * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of BinaryTreeNodeKey or BinaryTreeNode
118
118
  * objects, or null values.
119
- * @param {N['val'][]} [values] - The `values` parameter is an optional array of values (`N['val'][]`) that corresponds to
119
+ * @param {V[]} [values] - The `values` parameter is an optional array of values (`V[]`) that corresponds to
120
120
  * the nodes or node IDs being added. It is used to set the value of each node being added. If `values` is not provided,
121
121
  * the value of the nodes will be `undefined`.
122
122
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
123
123
  */
124
- addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], values?: N['val'][]): (N | null | undefined)[];
124
+ addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], values?: V[]): (N | null | undefined)[];
125
125
  /**
126
126
  * The `refill` function clears the binary tree and adds multiple nodes with the given IDs or nodes and optional data.
127
127
  * @param {(BinaryTreeNodeKey | N)[]} keysOrNodes - The `keysOrNodes` parameter is an array that can contain either
128
128
  * `BinaryTreeNodeKey` or `N` values.
129
- * @param {N[] | Array<N['val']>} [data] - The `data` parameter is an optional array of values that will be assigned to
129
+ * @param {N[] | Array<V>} [data] - The `data` parameter is an optional array of values that will be assigned to
130
130
  * the nodes being added. If provided, the length of the `data` array should be equal to the length of the `keysOrNodes`
131
131
  * array. Each value in the `data` array will be assigned to the
132
132
  * @returns The method is returning a boolean value.
133
133
  */
134
- refill(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: N[] | Array<N['val']>): boolean;
134
+ refill(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: Array<V>): boolean;
135
135
  delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N): BinaryTreeDeletedResult<N>[];
136
136
  delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];
137
137
  /**
@@ -14,7 +14,7 @@ const queue_1 = require("../queue");
14
14
  /**
15
15
  * Represents a node in a binary tree.
16
16
  * @template V - The type of data stored in the node.
17
- * @template FAMILY - The type of the family relationship in the binary tree.
17
+ * @template N - The type of the family relationship in the binary tree.
18
18
  */
19
19
  class BinaryTreeNode {
20
20
  /**
@@ -47,7 +47,7 @@ class BinaryTreeNode {
47
47
  }
48
48
  /**
49
49
  * Set the left child node.
50
- * @param {FAMILY | null | undefined} v - The left child node.
50
+ * @param {N | null | undefined} v - The left child node.
51
51
  */
52
52
  set left(v) {
53
53
  if (v) {
@@ -64,7 +64,7 @@ class BinaryTreeNode {
64
64
  }
65
65
  /**
66
66
  * Set the right child node.
67
- * @param {FAMILY | null | undefined} v - The right child node.
67
+ * @param {N | null | undefined} v - The right child node.
68
68
  */
69
69
  set right(v) {
70
70
  if (v) {
@@ -96,7 +96,6 @@ exports.BinaryTreeNode = BinaryTreeNode;
96
96
  * @template N - The type of the binary tree's nodes.
97
97
  */
98
98
  class BinaryTree {
99
- _loopType = types_1.IterationType.ITERATIVE;
100
99
  /**
101
100
  * Creates a new instance of BinaryTree.
102
101
  * @param {BinaryTreeOptions} [options] - The options for the binary tree.
@@ -104,9 +103,23 @@ class BinaryTree {
104
103
  constructor(options) {
105
104
  if (options !== undefined) {
106
105
  const { iterationType = types_1.IterationType.ITERATIVE } = options;
107
- this._loopType = iterationType;
106
+ this._iterationType = iterationType;
108
107
  }
109
108
  }
109
+ _iterationType = types_1.IterationType.ITERATIVE;
110
+ /**
111
+ * Get the iteration type used in the binary tree.
112
+ */
113
+ get iterationType() {
114
+ return this._iterationType;
115
+ }
116
+ /**
117
+ * Set the iteration type for the binary tree.
118
+ * @param {IterationType} v - The new iteration type to set.
119
+ */
120
+ set iterationType(v) {
121
+ this._iterationType = v;
122
+ }
110
123
  _root = null;
111
124
  /**
112
125
  * Get the root node of the binary tree.
@@ -121,23 +134,10 @@ class BinaryTree {
121
134
  get size() {
122
135
  return this._size;
123
136
  }
124
- /**
125
- * Get the iteration type used in the binary tree.
126
- */
127
- get iterationType() {
128
- return this._loopType;
129
- }
130
- /**
131
- * Set the iteration type for the binary tree.
132
- * @param {IterationType} v - The new iteration type to set.
133
- */
134
- set iterationType(v) {
135
- this._loopType = v;
136
- }
137
137
  /**
138
138
  * Creates a new instance of BinaryTreeNode with the given key and value.
139
139
  * @param {BinaryTreeNodeKey} key - The key for the new node.
140
- * @param {N['val']} val - The value for the new node.
140
+ * @param {V} val - The value for the new node.
141
141
  * @returns {N} - The newly created BinaryTreeNode.
142
142
  */
143
143
  createNode(key, val) {
@@ -160,7 +160,7 @@ class BinaryTree {
160
160
  /**
161
161
  * Add a node with the given key and value to the binary tree.
162
162
  * @param {BinaryTreeNodeKey | N | null} keyOrNode - The key or node to add to the binary tree.
163
- * @param {N['val']} val - The value for the new node (optional).
163
+ * @param {V} val - The value for the new node (optional).
164
164
  * @returns {N | null | undefined} - The inserted node, or null if nothing was inserted, or undefined if the operation failed.
165
165
  */
166
166
  add(keyOrNode, val) {
@@ -225,7 +225,7 @@ class BinaryTree {
225
225
  * values, and adds them to the binary tree.
226
226
  * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of BinaryTreeNodeKey or BinaryTreeNode
227
227
  * objects, or null values.
228
- * @param {N['val'][]} [values] - The `values` parameter is an optional array of values (`N['val'][]`) that corresponds to
228
+ * @param {V[]} [values] - The `values` parameter is an optional array of values (`V[]`) that corresponds to
229
229
  * the nodes or node IDs being added. It is used to set the value of each node being added. If `values` is not provided,
230
230
  * the value of the nodes will be `undefined`.
231
231
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
@@ -247,7 +247,7 @@ class BinaryTree {
247
247
  * The `refill` function clears the binary tree and adds multiple nodes with the given IDs or nodes and optional data.
248
248
  * @param {(BinaryTreeNodeKey | N)[]} keysOrNodes - The `keysOrNodes` parameter is an array that can contain either
249
249
  * `BinaryTreeNodeKey` or `N` values.
250
- * @param {N[] | Array<N['val']>} [data] - The `data` parameter is an optional array of values that will be assigned to
250
+ * @param {N[] | Array<V>} [data] - The `data` parameter is an optional array of values that will be assigned to
251
251
  * the nodes being added. If provided, the length of the `data` array should be equal to the length of the `keysOrNodes`
252
252
  * array. Each value in the `data` array will be assigned to the
253
253
  * @returns The method is returning a boolean value.
@@ -9,10 +9,10 @@ import type { BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, MapCa
9
9
  import { CP, IterationType } from '../../types';
10
10
  import { BinaryTree, BinaryTreeNode } from './binary-tree';
11
11
  import { IBinaryTree } from '../../interfaces';
12
- export declare class BSTNode<V = any, FAMILY extends BSTNode<V, FAMILY> = BSTNodeNested<V>> extends BinaryTreeNode<V, FAMILY> {
12
+ export declare class BSTNode<V = any, N extends BSTNode<V, N> = BSTNodeNested<V>> extends BinaryTreeNode<V, N> {
13
13
  constructor(key: BinaryTreeNodeKey, val?: V);
14
14
  }
15
- export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends BinaryTree<N> implements IBinaryTree<N> {
15
+ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode> extends BinaryTree<V, N> implements IBinaryTree<V, N> {
16
16
  /**
17
17
  * The constructor function initializes a binary search tree object with an optional comparator
18
18
  * function.
@@ -28,7 +28,7 @@ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends Binar
28
28
  * represents the value associated with the node in a binary search tree.
29
29
  * @returns a new instance of the BSTNode class with the specified key and value.
30
30
  */
31
- createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
31
+ createNode(key: BinaryTreeNodeKey, val?: V): N;
32
32
  /**
33
33
  * The `add` function in a binary search tree class inserts a new node with a given key and value
34
34
  * into the tree.
@@ -39,7 +39,7 @@ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends Binar
39
39
  * @returns the inserted node (N) if it was successfully added to the binary search tree. If the node
40
40
  * was not added or if the parameters were invalid, it returns null or undefined.
41
41
  */
42
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
42
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V): N | null | undefined;
43
43
  /**
44
44
  * The `addMany` function is used to efficiently add multiple nodes to a binary search tree while
45
45
  * maintaining balance.
@@ -47,13 +47,13 @@ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends Binar
47
47
  * represents an array of keys or nodes that need to be added to the binary search tree. It can be an
48
48
  * array of `BinaryTreeNodeKey` or `N` (which represents the node type in the binary search tree) or
49
49
  * `null
50
- * @param {N['val'][]} data - The values of tree nodes
50
+ * @param {V[]} data - The values of tree nodes
51
51
  * @param {boolean} isBalanceAdd - If true the nodes will be balance inserted in binary search method.
52
52
  * @param iterationType - The `iterationType` parameter determines the type of iteration to be used.
53
53
  * It can have two possible values:
54
54
  * @returns The `addMany` function returns an array of `N`, `null`, or `undefined` values.
55
55
  */
56
- addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: N['val'][], isBalanceAdd?: boolean, iterationType?: IterationType): (N | null | undefined)[];
56
+ addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: V[], isBalanceAdd?: boolean, iterationType?: IterationType): (N | null | undefined)[];
57
57
  /**
58
58
  * The function returns the first node in the binary tree that matches the given node property and
59
59
  * callback.
@@ -129,7 +129,7 @@ class BST extends binary_tree_1.BinaryTree {
129
129
  * represents an array of keys or nodes that need to be added to the binary search tree. It can be an
130
130
  * array of `BinaryTreeNodeKey` or `N` (which represents the node type in the binary search tree) or
131
131
  * `null
132
- * @param {N['val'][]} data - The values of tree nodes
132
+ * @param {V[]} data - The values of tree nodes
133
133
  * @param {boolean} isBalanceAdd - If true the nodes will be balance inserted in binary search method.
134
134
  * @param iterationType - The `iterationType` parameter determines the type of iteration to be used.
135
135
  * It can have two possible values:
@@ -1,13 +1,13 @@
1
1
  import { BinaryTreeNodeKey, RBColor, RBTreeNodeNested, RBTreeOptions } from '../../types';
2
2
  import { IBinaryTree } from '../../interfaces';
3
3
  import { BST, BSTNode } from './bst';
4
- export declare class RBTreeNode<V = any, FAMILY extends RBTreeNode<V, FAMILY> = RBTreeNodeNested<V>> extends BSTNode<V, FAMILY> {
4
+ export declare class RBTreeNode<V = any, N extends RBTreeNode<V, N> = RBTreeNodeNested<V>> extends BSTNode<V, N> {
5
5
  constructor(key: BinaryTreeNodeKey, val?: V);
6
6
  private _color;
7
7
  get color(): RBColor;
8
8
  set color(value: RBColor);
9
9
  }
10
- export declare class RBTree<N extends RBTreeNode<N['val'], N> = RBTreeNode> extends BST<N> implements IBinaryTree<N> {
10
+ export declare class RBTree<V, N extends RBTreeNode<V, N> = RBTreeNode> extends BST<V, N> implements IBinaryTree<V, N> {
11
11
  constructor(options?: RBTreeOptions);
12
- createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
12
+ createNode(key: BinaryTreeNodeKey, val?: V): N;
13
13
  }
@@ -9,7 +9,7 @@ import type { BinaryTreeNodeKey, TreeMultisetNodeNested, TreeMultisetOptions } f
9
9
  import { BinaryTreeDeletedResult, IterationType, MapCallback } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
11
  import { AVLTree, AVLTreeNode } from './avl-tree';
12
- export declare class TreeMultisetNode<V = any, FAMILY extends TreeMultisetNode<V, FAMILY> = TreeMultisetNodeNested<V>> extends AVLTreeNode<V, FAMILY> {
12
+ export declare class TreeMultisetNode<V = any, N extends TreeMultisetNode<V, N> = TreeMultisetNodeNested<V>> extends AVLTreeNode<V, N> {
13
13
  count: number;
14
14
  /**
15
15
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
@@ -26,7 +26,7 @@ export declare class TreeMultisetNode<V = any, FAMILY extends TreeMultisetNode<V
26
26
  /**
27
27
  * The only distinction between a TreeMultiset and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
28
28
  */
29
- export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = TreeMultisetNode> extends AVLTree<N> implements IBinaryTree<N> {
29
+ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = TreeMultisetNode> extends AVLTree<V, N> implements IBinaryTree<V, N> {
30
30
  /**
31
31
  * The constructor function for a TreeMultiset class in TypeScript, which extends another class and sets an option to
32
32
  * merge duplicated values.
@@ -45,7 +45,7 @@ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = Tree
45
45
  * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
46
46
  * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
47
47
  */
48
- createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
48
+ createNode(key: BinaryTreeNodeKey, val?: V, count?: number): N;
49
49
  /**
50
50
  * The `add` function adds a new node to a binary search tree, updating the count if the key already
51
51
  * exists, and balancing the tree if necessary.
@@ -59,7 +59,7 @@ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = Tree
59
59
  * count is specified, the default count will be 1.
60
60
  * @returns The function `add` returns a value of type `N | null | undefined`.
61
61
  */
62
- add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val'], count?: number): N | null | undefined;
62
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: V, count?: number): N | null | undefined;
63
63
  /**
64
64
  * The function adds a new node to a binary tree if there is an available slot in the parent node.
65
65
  * @param {N | null} newNode - The `newNode` parameter represents the node that needs to be added to
@@ -74,12 +74,12 @@ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = Tree
74
74
  * inserted nodes.
75
75
  * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
76
76
  * added to the multiset. Each element can be either a BinaryTreeNodeKey or a TreeMultisetNode.
77
- * @param {N['val'][]} [data] - The `data` parameter is an optional array of values that correspond
77
+ * @param {V[]} [data] - The `data` parameter is an optional array of values that correspond
78
78
  * to the keys or nodes being added to the multiset. It is used to associate additional data with
79
79
  * each key or node.
80
80
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
81
81
  */
82
- addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: N['val'][]): (N | null | undefined)[];
82
+ addMany(keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[], data?: V[]): (N | null | undefined)[];
83
83
  /**
84
84
  * The `perfectlyBalance` function in TypeScript takes a sorted array of nodes and builds a balanced
85
85
  * binary search tree using either a recursive or iterative approach.
@@ -178,7 +178,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
178
178
  * inserted nodes.
179
179
  * @param {(BinaryTreeNodeKey | null)[] | (N | null)[]} keysOrNodes - An array of keys or nodes to be
180
180
  * added to the multiset. Each element can be either a BinaryTreeNodeKey or a TreeMultisetNode.
181
- * @param {N['val'][]} [data] - The `data` parameter is an optional array of values that correspond
181
+ * @param {V[]} [data] - The `data` parameter is an optional array of values that correspond
182
182
  * to the keys or nodes being added to the multiset. It is used to associate additional data with
183
183
  * each key or node.
184
184
  * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
@@ -192,7 +192,7 @@ class TreeMultiset extends avl_tree_1.AVLTree {
192
192
  continue;
193
193
  }
194
194
  if (keyOrNode === null) {
195
- inserted.push(this.add(NaN, null, 0));
195
+ inserted.push(this.add(NaN, undefined, 0));
196
196
  continue;
197
197
  }
198
198
  inserted.push(this.add(keyOrNode, data?.[i], 1));
@@ -1,6 +1,6 @@
1
1
  import { BinaryTreeNode } from '../data-structures';
2
- import { BinaryTreeDeletedResult, BinaryTreeNodeKey, MapCallback } from '../types';
3
- export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> {
2
+ import { BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodeNested, MapCallback } from '../types';
3
+ export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {
4
4
  createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
5
5
  add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
6
6
  delete<C extends MapCallback<N>>(identifier: ReturnType<C> | N, callback: C): BinaryTreeDeletedResult<N>[];