data-structure-typed 1.36.1 → 1.36.3

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 (207) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/README.md +1 -1
  3. package/dist/data-structures/binary-tree/avl-tree.d.ts +3 -3
  4. package/dist/data-structures/binary-tree/avl-tree.js.map +1 -1
  5. package/dist/data-structures/binary-tree/binary-tree.d.ts +8 -8
  6. package/dist/data-structures/binary-tree/binary-tree.js +11 -13
  7. package/dist/data-structures/binary-tree/binary-tree.js.map +1 -1
  8. package/dist/data-structures/binary-tree/bst.d.ts +3 -3
  9. package/dist/data-structures/binary-tree/bst.js.map +1 -1
  10. package/dist/data-structures/binary-tree/index.d.ts +0 -5
  11. package/dist/data-structures/binary-tree/index.js +0 -5
  12. package/dist/data-structures/binary-tree/index.js.map +1 -1
  13. package/dist/data-structures/binary-tree/rb-tree.d.ts +3 -3
  14. package/dist/data-structures/binary-tree/rb-tree.js.map +1 -1
  15. package/dist/data-structures/binary-tree/tree-multiset.d.ts +3 -3
  16. package/dist/data-structures/binary-tree/tree-multiset.js.map +1 -1
  17. package/dist/data-structures/graph/abstract-graph.d.ts +2 -2
  18. package/dist/data-structures/graph/directed-graph.d.ts +2 -2
  19. package/dist/data-structures/graph/map-graph.d.ts +1 -1
  20. package/dist/data-structures/graph/map-graph.js +1 -1
  21. package/dist/data-structures/graph/undirected-graph.d.ts +2 -2
  22. package/dist/data-structures/hash/index.d.ts +0 -1
  23. package/dist/data-structures/hash/index.js +0 -1
  24. package/dist/data-structures/hash/index.js.map +1 -1
  25. package/dist/data-structures/heap/heap.d.ts +4 -4
  26. package/dist/data-structures/heap/heap.js.map +1 -1
  27. package/dist/data-structures/heap/max-heap.d.ts +2 -2
  28. package/dist/data-structures/heap/max-heap.js.map +1 -1
  29. package/dist/data-structures/heap/min-heap.d.ts +2 -2
  30. package/dist/data-structures/heap/min-heap.js.map +1 -1
  31. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
  32. package/dist/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  33. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
  34. package/dist/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  35. package/dist/data-structures/priority-queue/priority-queue.d.ts +2 -2
  36. package/dist/data-structures/priority-queue/priority-queue.js.map +1 -1
  37. package/dist/interfaces/binary-tree.d.ts +5 -4
  38. package/dist/interfaces/{abstract-graph.d.ts → graph.d.ts} +1 -1
  39. package/dist/interfaces/{bst.js → graph.js} +1 -1
  40. package/dist/interfaces/graph.js.map +1 -0
  41. package/dist/interfaces/index.d.ts +1 -8
  42. package/dist/interfaces/index.js +1 -8
  43. package/dist/interfaces/index.js.map +1 -1
  44. package/dist/types/data-structures/abstract-graph.d.ts +0 -1
  45. package/dist/types/data-structures/binary-tree.d.ts +30 -2
  46. package/dist/types/data-structures/binary-tree.js +22 -0
  47. package/dist/types/data-structures/binary-tree.js.map +1 -1
  48. package/dist/types/data-structures/bst.d.ts +1 -2
  49. package/dist/types/data-structures/heap.d.ts +2 -1
  50. package/dist/types/data-structures/index.d.ts +0 -2
  51. package/dist/types/data-structures/index.js +0 -2
  52. package/dist/types/data-structures/index.js.map +1 -1
  53. package/lib/data-structures/binary-tree/avl-tree.d.ts +3 -3
  54. package/lib/data-structures/binary-tree/binary-tree.d.ts +8 -8
  55. package/lib/data-structures/binary-tree/binary-tree.js +11 -13
  56. package/lib/data-structures/binary-tree/bst.d.ts +3 -3
  57. package/lib/data-structures/binary-tree/index.d.ts +0 -5
  58. package/lib/data-structures/binary-tree/index.js +0 -5
  59. package/lib/data-structures/binary-tree/rb-tree.d.ts +3 -3
  60. package/lib/data-structures/binary-tree/tree-multiset.d.ts +3 -3
  61. package/lib/data-structures/graph/abstract-graph.d.ts +2 -2
  62. package/lib/data-structures/graph/directed-graph.d.ts +2 -2
  63. package/lib/data-structures/graph/map-graph.d.ts +1 -1
  64. package/lib/data-structures/graph/map-graph.js +1 -1
  65. package/lib/data-structures/graph/undirected-graph.d.ts +2 -2
  66. package/lib/data-structures/hash/index.d.ts +0 -1
  67. package/lib/data-structures/hash/index.js +0 -1
  68. package/lib/data-structures/heap/heap.d.ts +4 -4
  69. package/lib/data-structures/heap/max-heap.d.ts +2 -2
  70. package/lib/data-structures/heap/min-heap.d.ts +2 -2
  71. package/lib/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
  72. package/lib/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
  73. package/lib/data-structures/priority-queue/priority-queue.d.ts +2 -2
  74. package/lib/interfaces/binary-tree.d.ts +5 -4
  75. package/lib/interfaces/{abstract-graph.d.ts → graph.d.ts} +1 -1
  76. package/lib/interfaces/index.d.ts +1 -8
  77. package/lib/interfaces/index.js +1 -8
  78. package/lib/types/data-structures/abstract-graph.d.ts +0 -1
  79. package/lib/types/data-structures/binary-tree.d.ts +30 -2
  80. package/lib/types/data-structures/binary-tree.js +21 -1
  81. package/lib/types/data-structures/bst.d.ts +1 -2
  82. package/lib/types/data-structures/heap.d.ts +2 -1
  83. package/lib/types/data-structures/index.d.ts +0 -2
  84. package/lib/types/data-structures/index.js +0 -2
  85. package/package.json +5 -5
  86. package/src/data-structures/binary-tree/avl-tree.ts +6 -6
  87. package/src/data-structures/binary-tree/binary-tree.ts +29 -39
  88. package/src/data-structures/binary-tree/bst.ts +3 -6
  89. package/src/data-structures/binary-tree/index.ts +0 -5
  90. package/src/data-structures/binary-tree/rb-tree.ts +6 -6
  91. package/src/data-structures/binary-tree/tree-multiset.ts +6 -6
  92. package/src/data-structures/graph/abstract-graph.ts +2 -2
  93. package/src/data-structures/graph/directed-graph.ts +2 -2
  94. package/src/data-structures/graph/map-graph.ts +1 -1
  95. package/src/data-structures/graph/undirected-graph.ts +2 -2
  96. package/src/data-structures/hash/index.ts +0 -1
  97. package/src/data-structures/heap/heap.ts +5 -5
  98. package/src/data-structures/heap/max-heap.ts +2 -2
  99. package/src/data-structures/heap/min-heap.ts +2 -2
  100. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  101. package/src/data-structures/priority-queue/min-priority-queue.ts +2 -2
  102. package/src/data-structures/priority-queue/priority-queue.ts +2 -2
  103. package/src/interfaces/binary-tree.ts +7 -4
  104. package/src/interfaces/{abstract-graph.ts → graph.ts} +1 -1
  105. package/src/interfaces/index.ts +1 -8
  106. package/src/types/data-structures/abstract-graph.ts +1 -1
  107. package/src/types/data-structures/binary-tree.ts +42 -2
  108. package/src/types/data-structures/bst.ts +2 -2
  109. package/src/types/data-structures/heap.ts +3 -1
  110. package/src/types/data-structures/index.ts +0 -2
  111. package/src/types/data-structures/navigator.ts +1 -0
  112. package/test/unit/data-structures/heap/max-heap.test.ts +2 -2
  113. package/test/unit/data-structures/heap/min-heap.test.ts +2 -2
  114. package/umd/bundle.min.js +1 -1
  115. package/umd/bundle.min.js.map +1 -1
  116. package/dist/data-structures/binary-tree/aa-tree.d.ts +0 -2
  117. package/dist/data-structures/binary-tree/aa-tree.js +0 -7
  118. package/dist/data-structures/binary-tree/aa-tree.js.map +0 -1
  119. package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +0 -21
  120. package/dist/data-structures/binary-tree/abstract-binary-tree.js +0 -25
  121. package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +0 -1
  122. package/dist/data-structures/binary-tree/b-tree.d.ts +0 -2
  123. package/dist/data-structures/binary-tree/b-tree.js +0 -7
  124. package/dist/data-structures/binary-tree/b-tree.js.map +0 -1
  125. package/dist/data-structures/binary-tree/splay-tree.d.ts +0 -2
  126. package/dist/data-structures/binary-tree/splay-tree.js +0 -7
  127. package/dist/data-structures/binary-tree/splay-tree.js.map +0 -1
  128. package/dist/data-structures/binary-tree/two-three-tree.d.ts +0 -2
  129. package/dist/data-structures/binary-tree/two-three-tree.js +0 -7
  130. package/dist/data-structures/binary-tree/two-three-tree.js.map +0 -1
  131. package/dist/data-structures/hash/pair.d.ts +0 -2
  132. package/dist/data-structures/hash/pair.js +0 -7
  133. package/dist/data-structures/hash/pair.js.map +0 -1
  134. package/dist/interfaces/abstract-binary-tree.d.ts +0 -7
  135. package/dist/interfaces/abstract-binary-tree.js +0 -3
  136. package/dist/interfaces/abstract-binary-tree.js.map +0 -1
  137. package/dist/interfaces/abstract-graph.js +0 -3
  138. package/dist/interfaces/abstract-graph.js.map +0 -1
  139. package/dist/interfaces/avl-tree.d.ts +0 -7
  140. package/dist/interfaces/avl-tree.js +0 -3
  141. package/dist/interfaces/avl-tree.js.map +0 -1
  142. package/dist/interfaces/bst.d.ts +0 -6
  143. package/dist/interfaces/bst.js.map +0 -1
  144. package/dist/interfaces/directed-graph.d.ts +0 -3
  145. package/dist/interfaces/directed-graph.js +0 -3
  146. package/dist/interfaces/directed-graph.js.map +0 -1
  147. package/dist/interfaces/rb-tree.d.ts +0 -6
  148. package/dist/interfaces/rb-tree.js +0 -3
  149. package/dist/interfaces/rb-tree.js.map +0 -1
  150. package/dist/interfaces/tree-multiset.d.ts +0 -6
  151. package/dist/interfaces/tree-multiset.js +0 -3
  152. package/dist/interfaces/tree-multiset.js.map +0 -1
  153. package/dist/interfaces/undirected-graph.d.ts +0 -3
  154. package/dist/interfaces/undirected-graph.js +0 -3
  155. package/dist/interfaces/undirected-graph.js.map +0 -1
  156. package/dist/types/data-structures/abstract-binary-tree.d.ts +0 -32
  157. package/dist/types/data-structures/abstract-binary-tree.js +0 -25
  158. package/dist/types/data-structures/abstract-binary-tree.js.map +0 -1
  159. package/dist/types/data-structures/priority-queue.d.ts +0 -7
  160. package/dist/types/data-structures/priority-queue.js +0 -3
  161. package/dist/types/data-structures/priority-queue.js.map +0 -1
  162. package/lib/data-structures/binary-tree/aa-tree.d.ts +0 -2
  163. package/lib/data-structures/binary-tree/aa-tree.js +0 -2
  164. package/lib/data-structures/binary-tree/abstract-binary-tree.d.ts +0 -21
  165. package/lib/data-structures/binary-tree/abstract-binary-tree.js +0 -19
  166. package/lib/data-structures/binary-tree/b-tree.d.ts +0 -2
  167. package/lib/data-structures/binary-tree/b-tree.js +0 -2
  168. package/lib/data-structures/binary-tree/splay-tree.d.ts +0 -2
  169. package/lib/data-structures/binary-tree/splay-tree.js +0 -2
  170. package/lib/data-structures/binary-tree/two-three-tree.d.ts +0 -2
  171. package/lib/data-structures/binary-tree/two-three-tree.js +0 -2
  172. package/lib/data-structures/hash/pair.d.ts +0 -2
  173. package/lib/data-structures/hash/pair.js +0 -2
  174. package/lib/interfaces/abstract-binary-tree.d.ts +0 -7
  175. package/lib/interfaces/abstract-graph.js +0 -1
  176. package/lib/interfaces/avl-tree.d.ts +0 -7
  177. package/lib/interfaces/avl-tree.js +0 -1
  178. package/lib/interfaces/bst.d.ts +0 -6
  179. package/lib/interfaces/bst.js +0 -1
  180. package/lib/interfaces/directed-graph.d.ts +0 -3
  181. package/lib/interfaces/directed-graph.js +0 -1
  182. package/lib/interfaces/rb-tree.d.ts +0 -6
  183. package/lib/interfaces/rb-tree.js +0 -1
  184. package/lib/interfaces/tree-multiset.d.ts +0 -6
  185. package/lib/interfaces/tree-multiset.js +0 -1
  186. package/lib/interfaces/undirected-graph.d.ts +0 -3
  187. package/lib/interfaces/undirected-graph.js +0 -1
  188. package/lib/types/data-structures/abstract-binary-tree.d.ts +0 -32
  189. package/lib/types/data-structures/abstract-binary-tree.js +0 -21
  190. package/lib/types/data-structures/priority-queue.d.ts +0 -7
  191. package/lib/types/data-structures/priority-queue.js +0 -1
  192. package/src/data-structures/binary-tree/aa-tree.ts +0 -1
  193. package/src/data-structures/binary-tree/abstract-binary-tree.ts +0 -33
  194. package/src/data-structures/binary-tree/b-tree.ts +0 -1
  195. package/src/data-structures/binary-tree/splay-tree.ts +0 -1
  196. package/src/data-structures/binary-tree/two-three-tree.ts +0 -1
  197. package/src/data-structures/hash/pair.ts +0 -1
  198. package/src/interfaces/abstract-binary-tree.ts +0 -8
  199. package/src/interfaces/avl-tree.ts +0 -8
  200. package/src/interfaces/bst.ts +0 -6
  201. package/src/interfaces/directed-graph.ts +0 -3
  202. package/src/interfaces/rb-tree.ts +0 -6
  203. package/src/interfaces/tree-multiset.ts +0 -7
  204. package/src/interfaces/undirected-graph.ts +0 -3
  205. package/src/types/data-structures/abstract-binary-tree.ts +0 -49
  206. package/src/types/data-structures/priority-queue.ts +0 -9
  207. /package/lib/interfaces/{abstract-binary-tree.js → graph.js} +0 -0
@@ -5,10 +5,9 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import { AbstractBinaryTree, AbstractBinaryTreeNode } from './abstract-binary-tree';
9
8
  import { FamilyPosition, LoopType } from '../../types';
10
9
  import { trampoline } from '../../utils';
11
- export class BinaryTreeNode extends AbstractBinaryTreeNode {
10
+ export class BinaryTreeNode {
12
11
  /**
13
12
  * The constructor function initializes a BinaryTreeNode object with a key and an optional value.
14
13
  * @param {BinaryTreeNodeKey} key - The `key` parameter is of type `BinaryTreeNodeKey` and represents the unique identifier
@@ -17,8 +16,8 @@ export class BinaryTreeNode extends AbstractBinaryTreeNode {
17
16
  * stored in the binary tree node. If no value is provided, it will be set to undefined.
18
17
  */
19
18
  constructor(key, val) {
20
- super(val);
21
19
  this.key = key;
20
+ this.val = val;
22
21
  }
23
22
  get left() {
24
23
  return this._left;
@@ -75,7 +74,7 @@ export class BinaryTreeNode extends AbstractBinaryTreeNode {
75
74
  }
76
75
  }
77
76
  }
78
- export class BinaryTree extends AbstractBinaryTree {
77
+ export class BinaryTree {
79
78
  /**
80
79
  * This is a constructor function for a binary tree class that takes an optional options parameter.
81
80
  * @param {BinaryTreeOptions} [options] - The `options` parameter is an optional object that can be passed to the
@@ -83,7 +82,6 @@ export class BinaryTree extends AbstractBinaryTree {
83
82
  * different configuration options.
84
83
  */
85
84
  constructor(options) {
86
- super();
87
85
  // TODO placeholder node may need redesigned
88
86
  this._root = null;
89
87
  this._size = 0;
@@ -190,7 +188,7 @@ export class BinaryTree extends AbstractBinaryTree {
190
188
  else if (typeof keyOrNode === 'number') {
191
189
  needInsert = this.createNode(keyOrNode, val);
192
190
  }
193
- else if (keyOrNode instanceof AbstractBinaryTreeNode) {
191
+ else if (keyOrNode instanceof BinaryTreeNode) {
194
192
  needInsert = keyOrNode;
195
193
  }
196
194
  else {
@@ -233,7 +231,7 @@ export class BinaryTree extends AbstractBinaryTree {
233
231
  const inserted = [];
234
232
  for (let i = 0; i < keysOrNodes.length; i++) {
235
233
  const keyOrNode = keysOrNodes[i];
236
- if (keyOrNode instanceof AbstractBinaryTreeNode) {
234
+ if (keyOrNode instanceof BinaryTreeNode) {
237
235
  inserted.push(this.add(keyOrNode.key, keyOrNode.val));
238
236
  continue;
239
237
  }
@@ -755,7 +753,7 @@ export class BinaryTree extends AbstractBinaryTree {
755
753
  * @param {NodeOrPropertyName} [nodeOrPropertyName] - An optional parameter that represents either a node or a property name.
756
754
  * If a node is provided, the bfs algorithm will be performed starting from that node.
757
755
  * If a property name is provided, the bfs algorithm will be performed starting from the root node, accumulating the specified property.
758
- * @returns An instance of the `AbstractBinaryTreeNodeProperties` class with generic type `N`.
756
+ * @returns An instance of the `BinaryTreeNodeProperties` class with generic type `N`.
759
757
  */
760
758
  bfs(nodeOrPropertyName = 'key') {
761
759
  this._clearResults();
@@ -777,7 +775,7 @@ export class BinaryTree extends AbstractBinaryTree {
777
775
  * each node based on the specified pattern and property name.
778
776
  * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
779
777
  * @param {NodeOrPropertyName} [nodeOrPropertyName] - The name of a property of the nodes in the binary tree. This property will be used to accumulate values during the depth-first search traversal. If no `nodeOrPropertyName` is provided, the default value is `'key'`.
780
- * @returns an instance of the AbstractBinaryTreeNodeProperties class, which contains the accumulated properties of the binary tree nodes based on the specified pattern and node or property name.
778
+ * @returns an instance of the BinaryTreeNodeProperties class, which contains the accumulated properties of the binary tree nodes based on the specified pattern and node or property name.
781
779
  */
782
780
  dfs(pattern = 'in', nodeOrPropertyName = 'key') {
783
781
  this._clearResults();
@@ -814,7 +812,7 @@ export class BinaryTree extends AbstractBinaryTree {
814
812
  * specify the traversal pattern and the property name to accumulate results by.
815
813
  * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
816
814
  * @param {NodeOrPropertyName} [nodeOrPropertyName] - The name of a property of the nodes in the binary tree. This property will be used to accumulate values during the depth-first search traversal. By default, it is set to `'key'`.
817
- * @returns An object of type AbstractBinaryTreeNodeProperties<N>.
815
+ * @returns An object of type BinaryTreeNodeProperties<N>.
818
816
  */
819
817
  dfsIterative(pattern = 'in', nodeOrPropertyName = 'key') {
820
818
  this._clearResults();
@@ -866,7 +864,7 @@ export class BinaryTree extends AbstractBinaryTree {
866
864
  * can be either a `BinaryTreeNode` property name or the string `'key'`. If a property name is provided, the function
867
865
  * will accumulate results based on that property. If no property name is provided, the function will default to
868
866
  * accumulating results based on the 'key' property.
869
- * @returns An object of type `AbstractBinaryTreeNodeProperties<N>`.
867
+ * @returns An object of type `BinaryTreeNodeProperties<N>`.
870
868
  */
871
869
  levelIterative(node = this.root, nodeOrPropertyName = 'key') {
872
870
  if (!node)
@@ -964,7 +962,7 @@ export class BinaryTree extends AbstractBinaryTree {
964
962
  * The `morris` function performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm.
965
963
  * @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
966
964
  * @param {NodeOrPropertyName} [nodeOrPropertyName] - The property name of the nodes to retrieve or perform operations on during the traversal. It can be any valid property name of the nodes in the binary tree. If not provided, it defaults to 'key'.
967
- * @returns An array of AbstractBinaryTreeNodeProperties<N> objects.
965
+ * @returns An array of BinaryTreeNodeProperties<N> objects.
968
966
  */
969
967
  morris(pattern = 'in', nodeOrPropertyName = 'key') {
970
968
  if (this.root === null)
@@ -1189,7 +1187,7 @@ export class BinaryTree extends AbstractBinaryTree {
1189
1187
  * name.
1190
1188
  * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
1191
1189
  * can accept either a `NodeOrPropertyName` type or be undefined.
1192
- * @returns The method `_getResultByPropertyName` returns an instance of `AbstractBinaryTreeNodeProperties<N>`.
1190
+ * @returns The method `_getResultByPropertyName` returns an instance of `BinaryTreeNodeProperties<N>`.
1193
1191
  */
1194
1192
  _getResultByPropertyName(nodeOrPropertyName = 'key') {
1195
1193
  switch (nodeOrPropertyName) {
@@ -8,11 +8,11 @@
8
8
  import type { BinaryTreeNodeKey, BinaryTreeNodePropertyName, BSTComparator, BSTNodeNested, BSTOptions } from '../../types';
9
9
  import { CP } from '../../types';
10
10
  import { BinaryTree, BinaryTreeNode } from './binary-tree';
11
- import { IBST, IBSTNode } from '../../interfaces';
12
- export declare class BSTNode<V = any, FAMILY extends BSTNode<V, FAMILY> = BSTNodeNested<V>> extends BinaryTreeNode<V, FAMILY> implements IBSTNode<V, FAMILY> {
11
+ import { IBinaryTree } from '../../interfaces';
12
+ export declare class BSTNode<V = any, FAMILY extends BSTNode<V, FAMILY> = BSTNodeNested<V>> extends BinaryTreeNode<V, FAMILY> {
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 IBST<N> {
15
+ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends BinaryTree<N> implements IBinaryTree<N> {
16
16
  /**
17
17
  * The constructor function initializes a binary search tree object with an optional comparator function.
18
18
  * @param {BSTOptions} [options] - An optional object that contains configuration options for the binary search tree.
@@ -1,12 +1,7 @@
1
- export * from './abstract-binary-tree';
2
1
  export * from './binary-tree';
3
2
  export * from './bst';
4
3
  export * from './binary-indexed-tree';
5
4
  export * from './segment-tree';
6
5
  export * from './avl-tree';
7
- export * from './b-tree';
8
6
  export * from './rb-tree';
9
- export * from './splay-tree';
10
- export * from './aa-tree';
11
7
  export * from './tree-multiset';
12
- export * from './two-three-tree';
@@ -1,12 +1,7 @@
1
- export * from './abstract-binary-tree';
2
1
  export * from './binary-tree';
3
2
  export * from './bst';
4
3
  export * from './binary-indexed-tree';
5
4
  export * from './segment-tree';
6
5
  export * from './avl-tree';
7
- export * from './b-tree';
8
6
  export * from './rb-tree';
9
- export * from './splay-tree';
10
- export * from './aa-tree';
11
7
  export * from './tree-multiset';
12
- export * from './two-three-tree';
@@ -1,13 +1,13 @@
1
1
  import { BinaryTreeNodeKey, RBColor, RBTreeNodeNested, RBTreeOptions } from '../../types';
2
- import { IRBTree, IRBTreeNode } from '../../interfaces';
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> implements IRBTreeNode<V, FAMILY> {
4
+ export declare class RBTreeNode<V = any, FAMILY extends RBTreeNode<V, FAMILY> = RBTreeNodeNested<V>> extends BSTNode<V, FAMILY> {
5
5
  private _color;
6
6
  constructor(key: BinaryTreeNodeKey, val?: V);
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 IRBTree<N> {
10
+ export declare class RBTree<N extends RBTreeNode<N['val'], N> = RBTreeNode> extends BST<N> implements IBinaryTree<N> {
11
11
  constructor(options?: RBTreeOptions);
12
12
  createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
13
13
  }
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import type { BinaryTreeNodeKey, TreeMultisetNodeNested, TreeMultisetOptions } from '../../types';
9
9
  import { BinaryTreeDeletedResult, DFSOrderPattern } from '../../types';
10
- import { ITreeMultiset, ITreeMultisetNode } from '../../interfaces';
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> implements ITreeMultisetNode<V, FAMILY> {
12
+ export declare class TreeMultisetNode<V = any, FAMILY extends TreeMultisetNode<V, FAMILY> = TreeMultisetNodeNested<V>> extends AVLTreeNode<V, FAMILY> {
13
13
  /**
14
14
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
15
15
  * @param {BinaryTreeNodeKey} key - The `key` parameter is of type `BinaryTreeNodeKey` and represents the unique identifier
@@ -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 ITreeMultiset<N> {
29
+ export declare class TreeMultiset<N extends TreeMultisetNode<N['val'], N> = TreeMultisetNode> extends AVLTree<N> implements IBinaryTree<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.
@@ -1,5 +1,5 @@
1
1
  import type { DijkstraResult, VertexKey } from '../../types';
2
- import { IAbstractGraph } from '../../interfaces';
2
+ import { IGraph } from '../../interfaces';
3
3
  export declare abstract class AbstractVertex<V = any> {
4
4
  /**
5
5
  * The function is a protected constructor that takes an key and an optional value as parameters.
@@ -46,7 +46,7 @@ export declare abstract class AbstractEdge<V = any> {
46
46
  */
47
47
  protected _setHashCode(v: string): void;
48
48
  }
49
- export declare abstract class AbstractGraph<V extends AbstractVertex<any> = AbstractVertex<any>, E extends AbstractEdge<any> = AbstractEdge<any>> implements IAbstractGraph<V, E> {
49
+ export declare abstract class AbstractGraph<V extends AbstractVertex<any> = AbstractVertex<any>, E extends AbstractEdge<any> = AbstractEdge<any>> implements IGraph<V, E> {
50
50
  private _vertices;
51
51
  get vertices(): Map<VertexKey, V>;
52
52
  /**
@@ -1,6 +1,6 @@
1
1
  import { AbstractEdge, AbstractGraph, AbstractVertex } from './abstract-graph';
2
2
  import type { VertexKey } from '../../types';
3
- import { IDirectedGraph } from '../../interfaces';
3
+ import { IGraph } from '../../interfaces';
4
4
  export declare class DirectedVertex<V = any> extends AbstractVertex<V> {
5
5
  /**
6
6
  * The constructor function initializes a vertex with an optional value.
@@ -31,7 +31,7 @@ export declare class DirectedEdge<V = any> extends AbstractEdge<V> {
31
31
  get dest(): VertexKey;
32
32
  set dest(v: VertexKey);
33
33
  }
34
- export declare class DirectedGraph<V extends DirectedVertex<any> = DirectedVertex, E extends DirectedEdge<any> = DirectedEdge> extends AbstractGraph<V, E> implements IDirectedGraph<V, E> {
34
+ export declare class DirectedGraph<V extends DirectedVertex<any> = DirectedVertex, E extends DirectedEdge<any> = DirectedEdge> extends AbstractGraph<V, E> implements IGraph<V, E> {
35
35
  /**
36
36
  * The constructor function initializes an instance of a class.
37
37
  */
@@ -73,7 +73,7 @@ export declare class MapGraph<V extends MapVertex<V['val']> = MapVertex, E exten
73
73
  * If the weight is not provided, it can be set to a default value or left undefined.
74
74
  * @param [val] - The `val` parameter is an optional value that can be assigned to the edge. It can be of any type,
75
75
  * depending on the specific implementation of the `MapEdge` class.
76
- * @returns a new instance of the `MapEdge` class, casted as type `E`.
76
+ * @returns a new instance of the `MapEdge` class, cast as type `E`.
77
77
  */
78
78
  createEdge(src: VertexKey, dest: VertexKey, weight?: number, val?: E['val']): E;
79
79
  }
@@ -97,7 +97,7 @@ export class MapGraph extends DirectedGraph {
97
97
  * If the weight is not provided, it can be set to a default value or left undefined.
98
98
  * @param [val] - The `val` parameter is an optional value that can be assigned to the edge. It can be of any type,
99
99
  * depending on the specific implementation of the `MapEdge` class.
100
- * @returns a new instance of the `MapEdge` class, casted as type `E`.
100
+ * @returns a new instance of the `MapEdge` class, cast as type `E`.
101
101
  */
102
102
  createEdge(src, dest, weight, val) {
103
103
  return new MapEdge(src, dest, weight, val);
@@ -1,6 +1,6 @@
1
1
  import { AbstractEdge, AbstractGraph, AbstractVertex } from './abstract-graph';
2
2
  import type { VertexKey } from '../../types';
3
- import { IUNDirectedGraph } from '../../interfaces';
3
+ import { IGraph } from '../../interfaces';
4
4
  export declare class UndirectedVertex<V = any> extends AbstractVertex<V> {
5
5
  /**
6
6
  * The constructor function initializes a vertex with an optional value.
@@ -27,7 +27,7 @@ export declare class UndirectedEdge<V = number> extends AbstractEdge<V> {
27
27
  get vertices(): [VertexKey, VertexKey];
28
28
  set vertices(v: [VertexKey, VertexKey]);
29
29
  }
30
- export declare class UndirectedGraph<V extends UndirectedVertex<any> = UndirectedVertex, E extends UndirectedEdge<any> = UndirectedEdge> extends AbstractGraph<V, E> implements IUNDirectedGraph<V, E> {
30
+ export declare class UndirectedGraph<V extends UndirectedVertex<any> = UndirectedVertex, E extends UndirectedEdge<any> = UndirectedEdge> extends AbstractGraph<V, E> implements IGraph<V, E> {
31
31
  /**
32
32
  * The constructor initializes a new Map object to store edges.
33
33
  */
@@ -1,7 +1,6 @@
1
1
  export * from './hash-table';
2
2
  export * from './coordinate-map';
3
3
  export * from './coordinate-set';
4
- export * from './pair';
5
4
  export * from './tree-map';
6
5
  export * from './tree-set';
7
6
  export * from './hash-map';
@@ -1,7 +1,6 @@
1
1
  export * from './hash-table';
2
2
  export * from './coordinate-map';
3
3
  export * from './coordinate-set';
4
- export * from './pair';
5
4
  export * from './tree-map';
6
5
  export * from './tree-set';
7
6
  export * from './hash-map';
@@ -4,11 +4,11 @@
4
4
  * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
5
5
  * @license MIT License
6
6
  */
7
- import type { CompareFunction } from '../../types';
7
+ import type { HeapComparator, HeapDFSOrderPattern } from '../../types';
8
8
  export declare class Heap<E> {
9
9
  protected nodes: E[];
10
10
  private readonly comparator;
11
- constructor(comparator: CompareFunction<E>);
11
+ constructor(comparator: HeapComparator<E>);
12
12
  /**
13
13
  * Insert an element into the heap and maintain the heap properties.
14
14
  * @param value - The element to be inserted.
@@ -72,7 +72,7 @@ export declare class Heap<E> {
72
72
  * @param order - Traversal order parameter: 'in' (in-order), 'pre' (pre-order) or 'post' (post-order).
73
73
  * @returns An array containing elements traversed in the specified order.
74
74
  */
75
- dfs(order: 'in' | 'pre' | 'post'): E[];
75
+ dfs(order: HeapDFSOrderPattern): E[];
76
76
  /**
77
77
  * Convert the heap to an array.
78
78
  * @returns An array containing the elements of the heap.
@@ -95,5 +95,5 @@ export declare class Heap<E> {
95
95
  * @param comparator - Comparison function.
96
96
  * @returns A new Heap instance.
97
97
  */
98
- static heapify<E>(nodes: E[], comparator: CompareFunction<E>): Heap<E>;
98
+ static heapify<E>(nodes: E[], comparator: HeapComparator<E>): Heap<E>;
99
99
  }
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { Heap } from './heap';
9
- import type { CompareFunction } from '../../types';
9
+ import type { HeapComparator } from '../../types';
10
10
  export declare class MaxHeap<E = any> extends Heap<E> {
11
- constructor(comparator?: CompareFunction<E>);
11
+ constructor(comparator?: HeapComparator<E>);
12
12
  }
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { Heap } from './heap';
9
- import type { CompareFunction } from '../../types';
9
+ import type { HeapComparator } from '../../types';
10
10
  export declare class MinHeap<E = any> extends Heap<E> {
11
- constructor(comparator?: CompareFunction<E>);
11
+ constructor(comparator?: HeapComparator<E>);
12
12
  }
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { PriorityQueue } from './priority-queue';
9
- import type { CompareFunction } from '../../types';
9
+ import type { HeapComparator } from '../../types';
10
10
  export declare class MaxPriorityQueue<E = any> extends PriorityQueue<E> {
11
- constructor(compare?: CompareFunction<E>);
11
+ constructor(compare?: HeapComparator<E>);
12
12
  }
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { PriorityQueue } from './priority-queue';
9
- import type { CompareFunction } from '../../types';
9
+ import type { HeapComparator } from '../../types';
10
10
  export declare class MinPriorityQueue<E = any> extends PriorityQueue<E> {
11
- constructor(compare?: CompareFunction<E>);
11
+ constructor(compare?: HeapComparator<E>);
12
12
  }
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { Heap } from '../heap';
9
- import { CompareFunction } from '../../types';
9
+ import { HeapComparator } from '../../types';
10
10
  export declare class PriorityQueue<E> extends Heap<E> {
11
- constructor(comparator: CompareFunction<E>);
11
+ constructor(comparator: HeapComparator<E>);
12
12
  }
@@ -1,6 +1,7 @@
1
1
  import { BinaryTreeNode } from '../data-structures';
2
- import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from './abstract-binary-tree';
3
- export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> extends IAbstractBinaryTreeNode<T, NEIGHBOR> {
4
- }
5
- export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> extends IAbstractBinaryTree<N> {
2
+ import { BinaryTreeDeletedResult, BinaryTreeNodeKey } from '../types';
3
+ export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> {
4
+ createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
5
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
6
+ remove(nodeOrKey: N | BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
6
7
  }
@@ -1,5 +1,5 @@
1
1
  import { VertexKey } from '../types';
2
- export interface IAbstractGraph<V, E> {
2
+ export interface IGraph<V, E> {
3
3
  createVertex(key: VertexKey, val?: V): V;
4
4
  createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): E;
5
5
  }
@@ -1,15 +1,8 @@
1
- export * from './abstract-binary-tree';
2
- export * from './abstract-graph';
3
- export * from './avl-tree';
1
+ export * from './graph';
4
2
  export * from './binary-tree';
5
- export * from './bst';
6
- export * from './directed-graph';
7
3
  export * from './doubly-linked-list';
8
4
  export * from './heap';
9
5
  export * from './navigator';
10
6
  export * from './priority-queue';
11
- export * from './rb-tree';
12
7
  export * from './segment-tree';
13
8
  export * from './singly-linked-list';
14
- export * from './tree-multiset';
15
- export * from './undirected-graph';
@@ -1,15 +1,8 @@
1
- export * from './abstract-binary-tree';
2
- export * from './abstract-graph';
3
- export * from './avl-tree';
1
+ export * from './graph';
4
2
  export * from './binary-tree';
5
- export * from './bst';
6
- export * from './directed-graph';
7
3
  export * from './doubly-linked-list';
8
4
  export * from './heap';
9
5
  export * from './navigator';
10
6
  export * from './priority-queue';
11
- export * from './rb-tree';
12
7
  export * from './segment-tree';
13
8
  export * from './singly-linked-list';
14
- export * from './tree-multiset';
15
- export * from './undirected-graph';
@@ -1,5 +1,4 @@
1
1
  export type VertexKey = string | number;
2
- export type EdgeKey = string;
3
2
  export type DijkstraResult<V> = {
4
3
  distMap: Map<V, number>;
5
4
  distPaths?: Map<V, V[]>;
@@ -1,6 +1,34 @@
1
1
  import { BinaryTreeNode } from '../../data-structures/binary-tree';
2
- import { AbstractBinaryTreeOptions, LoopType } from './abstract-binary-tree';
2
+ /**
3
+ * Enum representing different loop types.
4
+ *
5
+ * - `iterative`: Indicates the iterative loop type (with loops that use iterations).
6
+ * - `recursive`: Indicates the recursive loop type (with loops that call themselves).
7
+ */
8
+ export declare enum LoopType {
9
+ ITERATIVE = "ITERATIVE",
10
+ RECURSIVE = "RECURSIVE"
11
+ }
12
+ export declare enum FamilyPosition {
13
+ ROOT = "ROOT",
14
+ LEFT = "LEFT",
15
+ RIGHT = "RIGHT",
16
+ ROOT_LEFT = "ROOT_LEFT",
17
+ ROOT_RIGHT = "ROOT_RIGHT",
18
+ ISOLATED = "ISOLATED",
19
+ MAL_NODE = "MAL_NODE"
20
+ }
21
+ export type BinaryTreeNodePropertyName = 'key' | 'val';
22
+ export type NodeOrPropertyName = 'node' | BinaryTreeNodePropertyName;
23
+ export type DFSOrderPattern = 'in' | 'pre' | 'post';
24
+ export type BinaryTreeNodeKey = number;
25
+ export type BinaryTreeNodeProperty<N extends BinaryTreeNode<N['val'], N>> = N['val'] | N | number | BinaryTreeNodeKey;
26
+ export type BinaryTreeDeletedResult<N> = {
27
+ deleted: N | null | undefined;
28
+ needBalanced: N | null;
29
+ };
30
+ export type BinaryTreeNodeProperties<N extends BinaryTreeNode<N['val'], N>> = BinaryTreeNodeProperty<N>[];
3
31
  export type BinaryTreeNodeNested<T> = BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
4
- export type BinaryTreeOptions = AbstractBinaryTreeOptions & {
32
+ export type BinaryTreeOptions = {
5
33
  loopType?: LoopType;
6
34
  };
@@ -1 +1,21 @@
1
- export {};
1
+ /**
2
+ * Enum representing different loop types.
3
+ *
4
+ * - `iterative`: Indicates the iterative loop type (with loops that use iterations).
5
+ * - `recursive`: Indicates the recursive loop type (with loops that call themselves).
6
+ */
7
+ export var LoopType;
8
+ (function (LoopType) {
9
+ LoopType["ITERATIVE"] = "ITERATIVE";
10
+ LoopType["RECURSIVE"] = "RECURSIVE";
11
+ })(LoopType || (LoopType = {}));
12
+ export var FamilyPosition;
13
+ (function (FamilyPosition) {
14
+ FamilyPosition["ROOT"] = "ROOT";
15
+ FamilyPosition["LEFT"] = "LEFT";
16
+ FamilyPosition["RIGHT"] = "RIGHT";
17
+ FamilyPosition["ROOT_LEFT"] = "ROOT_LEFT";
18
+ FamilyPosition["ROOT_RIGHT"] = "ROOT_RIGHT";
19
+ FamilyPosition["ISOLATED"] = "ISOLATED";
20
+ FamilyPosition["MAL_NODE"] = "MAL_NODE";
21
+ })(FamilyPosition || (FamilyPosition = {}));
@@ -1,6 +1,5 @@
1
1
  import { BSTNode } from '../../data-structures/binary-tree';
2
- import type { BinaryTreeOptions } from './binary-tree';
3
- import { BinaryTreeNodeKey } from './abstract-binary-tree';
2
+ import type { BinaryTreeNodeKey, BinaryTreeOptions } from './binary-tree';
4
3
  export type BSTComparator = (a: BinaryTreeNodeKey, b: BinaryTreeNodeKey) => number;
5
4
  export type BSTNodeNested<T> = BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
6
5
  export type BSTOptions = BinaryTreeOptions & {
@@ -1 +1,2 @@
1
- export type CompareFunction<T> = (a: T, b: T) => number;
1
+ export type HeapComparator<T> = (a: T, b: T) => number;
2
+ export type HeapDFSOrderPattern = 'pre' | 'in' | 'post';
@@ -5,10 +5,8 @@ export * from './segment-tree';
5
5
  export * from './tree-multiset';
6
6
  export * from './abstract-graph';
7
7
  export * from './map-graph';
8
- export * from './abstract-binary-tree';
9
8
  export * from './rb-tree';
10
9
  export * from './directed-graph';
11
- export * from './priority-queue';
12
10
  export * from './heap';
13
11
  export * from './singly-linked-list';
14
12
  export * from './doubly-linked-list';
@@ -5,10 +5,8 @@ export * from './segment-tree';
5
5
  export * from './tree-multiset';
6
6
  export * from './abstract-graph';
7
7
  export * from './map-graph';
8
- export * from './abstract-binary-tree';
9
8
  export * from './rb-tree';
10
9
  export * from './directed-graph';
11
- export * from './priority-queue';
12
10
  export * from './heap';
13
11
  export * from './singly-linked-list';
14
12
  export * from './doubly-linked-list';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-structure-typed",
3
- "version": "1.36.1",
3
+ "version": "1.36.3",
4
4
  "description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
5
5
  "main": "dist/index.js",
6
6
  "module": "lib/index.js",
@@ -54,17 +54,17 @@
54
54
  "@typescript-eslint/eslint-plugin": "^6.7.4",
55
55
  "@typescript-eslint/parser": "^6.7.4",
56
56
  "auto-changelog": "^2.4.0",
57
- "avl-tree-typed": "^1.36.0",
57
+ "avl-tree-typed": "^1.36.2",
58
58
  "benchmark": "^2.1.4",
59
- "binary-tree-typed": "^1.36.0",
60
- "bst-typed": "^1.36.0",
59
+ "binary-tree-typed": "^1.36.2",
60
+ "bst-typed": "^1.36.2",
61
61
  "dependency-cruiser": "^14.1.0",
62
62
  "eslint": "^8.50.0",
63
63
  "eslint-config-prettier": "^9.0.0",
64
64
  "eslint-import-resolver-alias": "^1.1.2",
65
65
  "eslint-import-resolver-typescript": "^3.6.1",
66
66
  "eslint-plugin-import": "^2.28.1",
67
- "heap-typed": "^1.35.1",
67
+ "heap-typed": "^1.36.2",
68
68
  "istanbul-badges-readme": "^1.8.5",
69
69
  "jest": "^29.7.0",
70
70
  "prettier": "^3.0.3",
@@ -7,12 +7,12 @@
7
7
  */
8
8
  import {BST, BSTNode} from './bst';
9
9
  import type {AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BinaryTreeNodeKey} from '../../types';
10
- import {IAVLTree, IAVLTreeNode} from '../../interfaces';
10
+ import {IBinaryTree} from '../../interfaces';
11
11
 
12
- export class AVLTreeNode<V = any, FAMILY extends AVLTreeNode<V, FAMILY> = AVLTreeNodeNested<V>>
13
- extends BSTNode<V, FAMILY>
14
- implements IAVLTreeNode<V, FAMILY>
15
- {
12
+ export class AVLTreeNode<V = any, FAMILY extends AVLTreeNode<V, FAMILY> = AVLTreeNodeNested<V>> extends BSTNode<
13
+ V,
14
+ FAMILY
15
+ > {
16
16
  height: number;
17
17
 
18
18
  constructor(key: BinaryTreeNodeKey, val?: V) {
@@ -21,7 +21,7 @@ export class AVLTreeNode<V = any, FAMILY extends AVLTreeNode<V, FAMILY> = AVLTre
21
21
  }
22
22
  }
23
23
 
24
- export class AVLTree<N extends AVLTreeNode<N['val'], N> = AVLTreeNode> extends BST<N> implements IAVLTree<N> {
24
+ export class AVLTree<N extends AVLTreeNode<N['val'], N> = AVLTreeNode> extends BST<N> implements IBinaryTree<N> {
25
25
  /**
26
26
  * This is a constructor function for an AVL tree data structure in TypeScript.
27
27
  * @param {AVLTreeOptions} [options] - The `options` parameter is an optional object that can be passed to the