min-heap-typed 1.39.3 → 1.39.5

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 (30) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.d.ts +1 -1
  2. package/dist/data-structures/binary-tree/avl-tree.js +4 -2
  3. package/dist/data-structures/binary-tree/binary-tree.d.ts +5 -13
  4. package/dist/data-structures/binary-tree/binary-tree.js +17 -25
  5. package/dist/data-structures/binary-tree/bst.d.ts +1 -1
  6. package/dist/data-structures/binary-tree/bst.js +6 -6
  7. package/dist/data-structures/binary-tree/tree-multiset.d.ts +1 -1
  8. package/dist/data-structures/binary-tree/tree-multiset.js +2 -2
  9. package/dist/data-structures/graph/abstract-graph.d.ts +88 -88
  10. package/dist/data-structures/graph/abstract-graph.js +41 -41
  11. package/dist/data-structures/graph/directed-graph.d.ts +63 -63
  12. package/dist/data-structures/graph/directed-graph.js +36 -36
  13. package/dist/data-structures/graph/map-graph.d.ts +10 -10
  14. package/dist/data-structures/graph/map-graph.js +7 -7
  15. package/dist/data-structures/graph/undirected-graph.d.ts +38 -38
  16. package/dist/data-structures/graph/undirected-graph.js +21 -21
  17. package/dist/data-structures/queue/queue.d.ts +1 -1
  18. package/dist/data-structures/queue/queue.js +3 -3
  19. package/dist/interfaces/graph.d.ts +3 -3
  20. package/package.json +2 -2
  21. package/src/data-structures/binary-tree/avl-tree.ts +3 -2
  22. package/src/data-structures/binary-tree/binary-tree.ts +19 -28
  23. package/src/data-structures/binary-tree/bst.ts +6 -6
  24. package/src/data-structures/binary-tree/tree-multiset.ts +2 -2
  25. package/src/data-structures/graph/abstract-graph.ts +135 -133
  26. package/src/data-structures/graph/directed-graph.ts +92 -87
  27. package/src/data-structures/graph/map-graph.ts +17 -20
  28. package/src/data-structures/graph/undirected-graph.ts +56 -54
  29. package/src/data-structures/queue/queue.ts +1 -1
  30. package/src/interfaces/graph.ts +3 -3
@@ -50,7 +50,7 @@ export declare class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode<
50
50
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
51
51
  * value. This value is compared with the `identifier` parameter to determine if the node should be
52
52
  * included in the result. The `callback` parameter has a default value of
53
- * `this._defaultCallbackByKey`
53
+ * `((node: N) => node.key)`
54
54
  * @returns The method is returning an array of `BinaryTreeDeletedResult<N>` objects.
55
55
  */
56
56
  delete<C extends BTNCallback<N>>(identifier: ReturnType<C>, callback?: C): BinaryTreeDeletedResult<N>[];
@@ -63,10 +63,12 @@ class AVLTree extends bst_1.BST {
63
63
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
64
64
  * value. This value is compared with the `identifier` parameter to determine if the node should be
65
65
  * included in the result. The `callback` parameter has a default value of
66
- * `this._defaultCallbackByKey`
66
+ * `((node: N) => node.key)`
67
67
  * @returns The method is returning an array of `BinaryTreeDeletedResult<N>` objects.
68
68
  */
69
- delete(identifier, callback = this._defaultCallbackByKey) {
69
+ delete(identifier, callback = ((node) => node.key)) {
70
+ if (identifier instanceof AVLTreeNode)
71
+ callback = (node => node);
70
72
  const deletedResults = super.delete(identifier, callback);
71
73
  for (const { needBalanced } of deletedResults) {
72
74
  if (needBalanced) {
@@ -180,8 +180,8 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
180
180
  * @returns The method is returning a boolean value.
181
181
  */
182
182
  isPerfectlyBalanced(beginRoot?: N | null): boolean;
183
- getNodes<C extends BTNCallback<N, BTNKey>>(identifier: BTNKey, callback: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
184
- getNodes<C extends BTNCallback<N, N>>(identifier: N | null, callback: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
183
+ getNodes<C extends BTNCallback<N, BTNKey>>(identifier: BTNKey, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
184
+ getNodes<C extends BTNCallback<N, N>>(identifier: N | null, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
185
185
  getNodes<C extends BTNCallback<N>>(identifier: ReturnType<C>, callback: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
186
186
  has<C extends BTNCallback<N, BTNKey>>(identifier: BTNKey, callback?: C, beginRoot?: N, iterationType?: IterationType): boolean;
187
187
  has<C extends BTNCallback<N, N>>(identifier: N | null, callback?: C, beginRoot?: N, iterationType?: IterationType): boolean;
@@ -263,7 +263,7 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
263
263
  * function on each node according to a specified order pattern.
264
264
  * @param callback - The `callback` parameter is a function that will be called on each node during
265
265
  * the depth-first search traversal. It takes a node as input and returns a value. The default value
266
- * is `this._defaultCallbackByKey`, which is a callback function defined elsewhere in the code.
266
+ * is `((node: N) => node.key)`, which is a callback function defined elsewhere in the code.
267
267
  * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter determines the order in which the
268
268
  * nodes are visited during the depth-first search. There are three possible values for `pattern`:
269
269
  * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the depth-first
@@ -279,7 +279,7 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
279
279
  * function on each node.
280
280
  * @param callback - The `callback` parameter is a function that will be called for each node in the
281
281
  * breadth-first search. It takes a node of type `N` as its argument and returns a value of type
282
- * `ReturnType<BTNCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
282
+ * `ReturnType<BTNCallback<N>>`. The default value for this parameter is `((node: N) => node.key)
283
283
  * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first
284
284
  * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search
285
285
  * will not be performed and an empty array will be returned.
@@ -315,7 +315,7 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
315
315
  * algorithm and returns an array of values obtained by applying a callback function to each node.
316
316
  * @param callback - The `callback` parameter is a function that will be called on each node in the
317
317
  * tree. It takes a node of type `N` as input and returns a value of type `ReturnType<BTNCallback<N>>`. The
318
- * default value for this parameter is `this._defaultCallbackByKey`.
318
+ * default value for this parameter is `((node: N) => node.key)`.
319
319
  * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter in the `morris` function
320
320
  * determines the order in which the nodes of a binary tree are traversed. It can have one of the
321
321
  * following values:
@@ -342,14 +342,6 @@ export declare class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = Binary
342
342
  * @returns {N} - The destination node after the swap.
343
343
  */
344
344
  protected _swap(srcNode: N, destNode: N): N;
345
- /**
346
- * Time complexity is O(n)
347
- * Space complexity of Iterative dfs equals to recursive dfs which is O(n) because of the stack
348
- * The Morris algorithm only modifies the tree's structure during traversal; once the traversal is complete,
349
- * the tree's structure should be restored to its original state to maintain the tree's integrity.
350
- * This is because the purpose of the Morris algorithm is to save space rather than permanently alter the tree's shape.
351
- */
352
- protected _defaultCallbackByKey: BTNCallback<N, BTNKey>;
353
345
  /**
354
346
  * The function `_addTo` adds a new node to a binary tree if there is an available position.
355
347
  * @param {N | null} newNode - The `newNode` parameter represents the node that you want to add to
@@ -90,14 +90,6 @@ class BinaryTree {
90
90
  this._iterationType = types_1.IterationType.ITERATIVE;
91
91
  this._root = null;
92
92
  this._size = 0;
93
- /**
94
- * Time complexity is O(n)
95
- * Space complexity of Iterative dfs equals to recursive dfs which is O(n) because of the stack
96
- * The Morris algorithm only modifies the tree's structure during traversal; once the traversal is complete,
97
- * the tree's structure should be restored to its original state to maintain the tree's integrity.
98
- * This is because the purpose of the Morris algorithm is to save space rather than permanently alter the tree's shape.
99
- */
100
- this._defaultCallbackByKey = node => node.key;
101
93
  if (options !== undefined) {
102
94
  const { iterationType = types_1.IterationType.ITERATIVE } = options;
103
95
  this._iterationType = iterationType;
@@ -192,7 +184,7 @@ class BinaryTree {
192
184
  return;
193
185
  }
194
186
  const key = typeof keyOrNode === 'number' ? keyOrNode : keyOrNode ? keyOrNode.key : undefined;
195
- const existNode = key !== undefined ? this.get(key, this._defaultCallbackByKey) : undefined;
187
+ const existNode = key !== undefined ? this.get(key, (node) => node.key) : undefined;
196
188
  if (this.root) {
197
189
  if (existNode) {
198
190
  existNode.val = val;
@@ -262,9 +254,9 @@ class BinaryTree {
262
254
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
263
255
  * value. This value is compared with the `identifier` parameter to determine if the node should be
264
256
  * included in the result. The `callback` parameter has a default value of
265
- * `this._defaultCallbackByKey`, which
257
+ * `((node: N) => node.key)`, which
266
258
  */
267
- delete(identifier, callback = this._defaultCallbackByKey) {
259
+ delete(identifier, callback = ((node) => node.key)) {
268
260
  const bstDeletedResult = [];
269
261
  if (!this.root)
270
262
  return bstDeletedResult;
@@ -455,7 +447,7 @@ class BinaryTree {
455
447
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
456
448
  * value. This value is compared with the `identifier` parameter to determine if the node should be
457
449
  * included in the result. The `callback` parameter has a default value of
458
- * `this._defaultCallbackByKey`, which
450
+ * `((node: N) => node.key)`, which
459
451
  * @param [onlyOne=false] - A boolean value indicating whether to stop searching after finding the
460
452
  * first node that matches the identifier. If set to true, the function will return an array with
461
453
  * only one element (or an empty array if no matching node is found). If set to false (default), the
@@ -467,7 +459,7 @@ class BinaryTree {
467
459
  * traverse the binary tree. It can have two possible values:
468
460
  * @returns The function `getNodes` returns an array of nodes (`N[]`).
469
461
  */
470
- getNodes(identifier, callback = this._defaultCallbackByKey, onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
462
+ getNodes(identifier, callback = ((node) => node.key), onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
471
463
  if (!beginRoot)
472
464
  return [];
473
465
  if (identifier instanceof BinaryTreeNode)
@@ -512,7 +504,7 @@ class BinaryTree {
512
504
  * @param callback - The `callback` parameter is a function that is used to determine whether a node
513
505
  * matches the desired criteria. It takes a node as input and returns a boolean value indicating
514
506
  * whether the node matches the criteria or not. The default callback function
515
- * `this._defaultCallbackByKey` is used if no callback function is
507
+ * `((node: N) => node.key)` is used if no callback function is
516
508
  * @param beginRoot - The `beginRoot` parameter is the starting point for the search. It specifies
517
509
  * the node from which the search should begin. By default, it is set to `this.root`, which means the
518
510
  * search will start from the root node of the binary tree. However, you can provide a different node
@@ -521,7 +513,7 @@ class BinaryTree {
521
513
  * performed when searching for nodes in the binary tree. It can have one of the following values:
522
514
  * @returns a boolean value.
523
515
  */
524
- has(identifier, callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
516
+ has(identifier, callback = ((node) => node.key), beginRoot = this.root, iterationType = this.iterationType) {
525
517
  if (identifier instanceof BinaryTreeNode)
526
518
  callback = (node => node);
527
519
  // TODO may support finding node by value equal
@@ -535,14 +527,14 @@ class BinaryTree {
535
527
  * @param callback - The `callback` parameter is a function that is used to determine whether a node
536
528
  * matches the desired criteria. It takes a node as input and returns a boolean value indicating
537
529
  * whether the node matches the criteria or not. The default callback function
538
- * (`this._defaultCallbackByKey`) is used if no callback function is
530
+ * (`((node: N) => node.key)`) is used if no callback function is
539
531
  * @param beginRoot - The `beginRoot` parameter is the starting point for the search. It specifies
540
532
  * the root node from which the search should begin.
541
533
  * @param iterationType - The `iterationType` parameter specifies the type of iteration to be
542
534
  * performed when searching for a node in the binary tree. It can have one of the following values:
543
535
  * @returns either the found node (of type N) or null if no node is found.
544
536
  */
545
- get(identifier, callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
537
+ get(identifier, callback = ((node) => node.key), beginRoot = this.root, iterationType = this.iterationType) {
546
538
  var _a;
547
539
  if (identifier instanceof BinaryTreeNode)
548
540
  callback = (node => node);
@@ -705,7 +697,7 @@ class BinaryTree {
705
697
  * performed on the binary tree. It can have two possible values:
706
698
  * @returns The function `subTreeTraverse` returns an array of `ReturnType<BTNCallback<N>>`.
707
699
  */
708
- subTreeTraverse(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
700
+ subTreeTraverse(callback = ((node) => node.key), beginRoot = this.root, iterationType = this.iterationType) {
709
701
  if (typeof beginRoot === 'number')
710
702
  beginRoot = this.get(beginRoot);
711
703
  const ans = [];
@@ -735,7 +727,7 @@ class BinaryTree {
735
727
  * function on each node according to a specified order pattern.
736
728
  * @param callback - The `callback` parameter is a function that will be called on each node during
737
729
  * the depth-first search traversal. It takes a node as input and returns a value. The default value
738
- * is `this._defaultCallbackByKey`, which is a callback function defined elsewhere in the code.
730
+ * is `((node: N) => node.key)`, which is a callback function defined elsewhere in the code.
739
731
  * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter determines the order in which the
740
732
  * nodes are visited during the depth-first search. There are three possible values for `pattern`:
741
733
  * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the depth-first
@@ -745,7 +737,7 @@ class BinaryTree {
745
737
  * iteration used in the depth-first search algorithm. It can have two possible values:
746
738
  * @returns The function `dfs` returns an array of `ReturnType<BTNCallback<N>>` values.
747
739
  */
748
- dfs(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root, iterationType = types_1.IterationType.ITERATIVE) {
740
+ dfs(callback = ((node) => node.key), pattern = 'in', beginRoot = this.root, iterationType = types_1.IterationType.ITERATIVE) {
749
741
  if (!beginRoot)
750
742
  return [];
751
743
  const ans = [];
@@ -820,7 +812,7 @@ class BinaryTree {
820
812
  * function on each node.
821
813
  * @param callback - The `callback` parameter is a function that will be called for each node in the
822
814
  * breadth-first search. It takes a node of type `N` as its argument and returns a value of type
823
- * `ReturnType<BTNCallback<N>>`. The default value for this parameter is `this._defaultCallbackByKey
815
+ * `ReturnType<BTNCallback<N>>`. The default value for this parameter is `((node: N) => node.key)
824
816
  * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the breadth-first
825
817
  * search. It determines from which node the search will begin. If `beginRoot` is `null`, the search
826
818
  * will not be performed and an empty array will be returned.
@@ -828,7 +820,7 @@ class BinaryTree {
828
820
  * in the breadth-first search (BFS) algorithm. It can have two possible values:
829
821
  * @returns The function `bfs` returns an array of `ReturnType<BTNCallback<N>>[]`.
830
822
  */
831
- bfs(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
823
+ bfs(callback = ((node) => node.key), beginRoot = this.root, iterationType = this.iterationType) {
832
824
  if (!beginRoot)
833
825
  return [];
834
826
  const ans = [];
@@ -878,7 +870,7 @@ class BinaryTree {
878
870
  * level in a binary tree. Each inner array contains the return type of the provided callback
879
871
  * function `C` applied to the nodes at that level.
880
872
  */
881
- listLevels(callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
873
+ listLevels(callback = ((node) => node.key), beginRoot = this.root, iterationType = this.iterationType) {
882
874
  if (!beginRoot)
883
875
  return [];
884
876
  const levelsNodes = [];
@@ -935,7 +927,7 @@ class BinaryTree {
935
927
  * algorithm and returns an array of values obtained by applying a callback function to each node.
936
928
  * @param callback - The `callback` parameter is a function that will be called on each node in the
937
929
  * tree. It takes a node of type `N` as input and returns a value of type `ReturnType<BTNCallback<N>>`. The
938
- * default value for this parameter is `this._defaultCallbackByKey`.
930
+ * default value for this parameter is `((node: N) => node.key)`.
939
931
  * @param {DFSOrderPattern} [pattern=in] - The `pattern` parameter in the `morris` function
940
932
  * determines the order in which the nodes of a binary tree are traversed. It can have one of the
941
933
  * following values:
@@ -944,7 +936,7 @@ class BinaryTree {
944
936
  * `beginRoot` is `null`, an empty array will be returned.
945
937
  * @returns The `morris` function returns an array of `ReturnType<BTNCallback<N>>` values.
946
938
  */
947
- morris(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root) {
939
+ morris(callback = ((node) => node.key), pattern = 'in', beginRoot = this.root) {
948
940
  if (beginRoot === null)
949
941
  return [];
950
942
  const ans = [];
@@ -97,7 +97,7 @@ export declare class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNe
97
97
  * generic type `N`.
98
98
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
99
99
  * value. This value is compared with the `nodeProperty` parameter to determine if the node should be
100
- * included in the result. The default value for `callback` is `this._defaultCallbackByKey`, which is
100
+ * included in the result. The default value for `callback` is `((node: N) => node.key)`, which is
101
101
  * a
102
102
  * @param [onlyOne=false] - A boolean value indicating whether to stop the traversal after finding
103
103
  * the first node that matches the nodeProperty. If set to true, the function will return an array
@@ -223,7 +223,7 @@ class BST extends binary_tree_1.BinaryTree {
223
223
  * @returns either the first node that matches the given nodeProperty and callback, or null if no
224
224
  * matching node is found.
225
225
  */
226
- get(identifier, callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
226
+ get(identifier, callback = ((node) => node.key), beginRoot = this.root, iterationType = this.iterationType) {
227
227
  var _a;
228
228
  return (_a = this.getNodes(identifier, callback, true, beginRoot, iterationType)[0]) !== null && _a !== void 0 ? _a : null;
229
229
  }
@@ -259,7 +259,7 @@ class BST extends binary_tree_1.BinaryTree {
259
259
  * generic type `N`.
260
260
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
261
261
  * value. This value is compared with the `nodeProperty` parameter to determine if the node should be
262
- * included in the result. The default value for `callback` is `this._defaultCallbackByKey`, which is
262
+ * included in the result. The default value for `callback` is `((node: N) => node.key)`, which is
263
263
  * a
264
264
  * @param [onlyOne=false] - A boolean value indicating whether to stop the traversal after finding
265
265
  * the first node that matches the nodeProperty. If set to true, the function will return an array
@@ -272,7 +272,7 @@ class BST extends binary_tree_1.BinaryTree {
272
272
  * traverse the binary tree. It can have one of the following values:
273
273
  * @returns an array of nodes (N[]).
274
274
  */
275
- getNodes(identifier, callback = this._defaultCallbackByKey, onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
275
+ getNodes(identifier, callback = ((node) => node.key), onlyOne = false, beginRoot = this.root, iterationType = this.iterationType) {
276
276
  if (!beginRoot)
277
277
  return [];
278
278
  const ans = [];
@@ -287,7 +287,7 @@ class BST extends binary_tree_1.BinaryTree {
287
287
  if (!cur.left && !cur.right)
288
288
  return;
289
289
  // TODO potential bug
290
- if (callback === this._defaultCallbackByKey) {
290
+ if (callback === ((node) => node.key)) {
291
291
  if (this._compare(cur.key, identifier) === types_1.CP.gt)
292
292
  cur.left && _traverse(cur.left);
293
293
  if (this._compare(cur.key, identifier) === types_1.CP.lt)
@@ -312,7 +312,7 @@ class BST extends binary_tree_1.BinaryTree {
312
312
  return ans;
313
313
  }
314
314
  // TODO potential bug
315
- if (callback === this._defaultCallbackByKey) {
315
+ if (callback === ((node) => node.key)) {
316
316
  if (this._compare(cur.key, identifier) === types_1.CP.gt)
317
317
  cur.left && queue.push(cur.left);
318
318
  if (this._compare(cur.key, identifier) === types_1.CP.lt)
@@ -345,7 +345,7 @@ class BST extends binary_tree_1.BinaryTree {
345
345
  * done recursively or iteratively. It can have two possible values:
346
346
  * @returns The function `lesserOrGreaterTraverse` returns an array of `ReturnType<BTNCallback<N>>`.
347
347
  */
348
- lesserOrGreaterTraverse(callback = this._defaultCallbackByKey, lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.iterationType) {
348
+ lesserOrGreaterTraverse(callback = ((node) => node.key), lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.iterationType) {
349
349
  if (typeof targetNode === 'number')
350
350
  targetNode = this.get(targetNode);
351
351
  const ans = [];
@@ -98,7 +98,7 @@ export declare class TreeMultiset<V = any, N extends TreeMultisetNode<V, N> = Tr
98
98
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
99
99
  * value. This value is compared with the `identifier` parameter to determine if the node should be
100
100
  * included in the result. The `callback` parameter has a default value of
101
- * `this._defaultCallbackByKey`
101
+ * `((node: N) => node.key)`
102
102
  * @param [ignoreCount=false] - A boolean flag indicating whether to ignore the count of the node
103
103
  * being deleted. If set to true, the count of the node will not be considered and the node will be
104
104
  * deleted regardless of its count. If set to false (default), the count of the node will be
@@ -251,14 +251,14 @@ class TreeMultiset extends avl_tree_1.AVLTree {
251
251
  * @param callback - The `callback` parameter is a function that takes a node as input and returns a
252
252
  * value. This value is compared with the `identifier` parameter to determine if the node should be
253
253
  * included in the result. The `callback` parameter has a default value of
254
- * `this._defaultCallbackByKey`
254
+ * `((node: N) => node.key)`
255
255
  * @param [ignoreCount=false] - A boolean flag indicating whether to ignore the count of the node
256
256
  * being deleted. If set to true, the count of the node will not be considered and the node will be
257
257
  * deleted regardless of its count. If set to false (default), the count of the node will be
258
258
  * decremented by 1 and
259
259
  * @returns The method `delete` returns an array of `BinaryTreeDeletedResult<N>` objects.
260
260
  */
261
- delete(identifier, callback = this._defaultCallbackByKey, ignoreCount = false) {
261
+ delete(identifier, callback = ((node) => node.key), ignoreCount = false) {
262
262
  const bstDeletedResult = [];
263
263
  if (!this.root)
264
264
  return bstDeletedResult;