data-structure-typed 1.48.4 → 1.48.6

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 (97) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +109 -59
  3. package/README_zh-CN.md +1028 -0
  4. package/benchmark/report.html +16 -16
  5. package/benchmark/report.json +204 -174
  6. package/dist/cjs/data-structures/base/iterable-base.d.ts +6 -6
  7. package/dist/cjs/data-structures/base/iterable-base.js +3 -3
  8. package/dist/cjs/data-structures/base/iterable-base.js.map +1 -1
  9. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +5 -3
  10. package/dist/cjs/data-structures/binary-tree/avl-tree.js +6 -4
  11. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +24 -22
  13. package/dist/cjs/data-structures/binary-tree/binary-tree.js +35 -22
  14. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/bst.d.ts +30 -22
  16. package/dist/cjs/data-structures/binary-tree/bst.js +38 -26
  17. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +19 -13
  19. package/dist/cjs/data-structures/binary-tree/rb-tree.js +20 -14
  20. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +21 -14
  22. package/dist/cjs/data-structures/binary-tree/tree-multimap.js +25 -18
  23. package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
  24. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +52 -52
  25. package/dist/cjs/data-structures/graph/abstract-graph.js +78 -78
  26. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  27. package/dist/cjs/data-structures/graph/directed-graph.d.ts +47 -47
  28. package/dist/cjs/data-structures/graph/directed-graph.js +56 -56
  29. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  30. package/dist/cjs/data-structures/graph/map-graph.d.ts +5 -5
  31. package/dist/cjs/data-structures/graph/map-graph.js +8 -8
  32. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
  33. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +29 -29
  34. package/dist/cjs/data-structures/graph/undirected-graph.js +57 -57
  35. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  36. package/dist/cjs/data-structures/hash/hash-map.d.ts +8 -8
  37. package/dist/cjs/data-structures/hash/hash-map.js +2 -2
  38. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  39. package/dist/cjs/interfaces/binary-tree.d.ts +2 -2
  40. package/dist/cjs/types/data-structures/base/base.d.ts +3 -3
  41. package/dist/mjs/data-structures/base/iterable-base.d.ts +6 -6
  42. package/dist/mjs/data-structures/base/iterable-base.js +1 -1
  43. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +5 -3
  44. package/dist/mjs/data-structures/binary-tree/avl-tree.js +6 -4
  45. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +24 -22
  46. package/dist/mjs/data-structures/binary-tree/binary-tree.js +36 -23
  47. package/dist/mjs/data-structures/binary-tree/bst.d.ts +30 -22
  48. package/dist/mjs/data-structures/binary-tree/bst.js +38 -26
  49. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +19 -13
  50. package/dist/mjs/data-structures/binary-tree/rb-tree.js +20 -14
  51. package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +21 -14
  52. package/dist/mjs/data-structures/binary-tree/tree-multimap.js +25 -18
  53. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +52 -52
  54. package/dist/mjs/data-structures/graph/abstract-graph.js +79 -79
  55. package/dist/mjs/data-structures/graph/directed-graph.d.ts +47 -47
  56. package/dist/mjs/data-structures/graph/directed-graph.js +56 -56
  57. package/dist/mjs/data-structures/graph/map-graph.d.ts +5 -5
  58. package/dist/mjs/data-structures/graph/map-graph.js +8 -8
  59. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +29 -29
  60. package/dist/mjs/data-structures/graph/undirected-graph.js +59 -59
  61. package/dist/mjs/data-structures/hash/hash-map.d.ts +8 -8
  62. package/dist/mjs/data-structures/hash/hash-map.js +3 -3
  63. package/dist/mjs/interfaces/binary-tree.d.ts +2 -2
  64. package/dist/mjs/types/data-structures/base/base.d.ts +3 -3
  65. package/dist/umd/data-structure-typed.js +336 -295
  66. package/dist/umd/data-structure-typed.min.js +2 -2
  67. package/dist/umd/data-structure-typed.min.js.map +1 -1
  68. package/package.json +2 -2
  69. package/src/data-structures/base/iterable-base.ts +6 -6
  70. package/src/data-structures/binary-tree/avl-tree.ts +7 -4
  71. package/src/data-structures/binary-tree/binary-tree.ts +47 -27
  72. package/src/data-structures/binary-tree/bst.ts +52 -32
  73. package/src/data-structures/binary-tree/rb-tree.ts +20 -14
  74. package/src/data-structures/binary-tree/tree-multimap.ts +26 -18
  75. package/src/data-structures/graph/abstract-graph.ts +82 -82
  76. package/src/data-structures/graph/directed-graph.ts +56 -56
  77. package/src/data-structures/graph/map-graph.ts +8 -8
  78. package/src/data-structures/graph/undirected-graph.ts +59 -59
  79. package/src/data-structures/hash/hash-map.ts +8 -8
  80. package/src/interfaces/binary-tree.ts +2 -2
  81. package/src/types/data-structures/base/base.ts +3 -3
  82. package/test/integration/bst.test.ts +1 -1
  83. package/test/performance/data-structures/binary-tree/rb-tree.test.ts +1 -1
  84. package/test/performance/data-structures/hash/hash-map.test.ts +8 -8
  85. package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +2 -2
  86. package/test/performance/data-structures/linked-list/singly-linked-list.test.ts +12 -1
  87. package/test/performance/data-structures/priority-queue/priority-queue.test.ts +1 -1
  88. package/test/performance/data-structures/queue/deque.test.ts +27 -15
  89. package/test/performance/data-structures/queue/queue.test.ts +27 -4
  90. package/test/performance/data-structures/stack/stack.test.ts +2 -2
  91. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +1 -1
  92. package/test/unit/data-structures/binary-tree/bst.test.ts +29 -29
  93. package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
  94. package/test/unit/data-structures/binary-tree/tree-multimap.test.ts +3 -3
  95. package/test/unit/data-structures/graph/directed-graph.test.ts +15 -15
  96. package/test/unit/data-structures/graph/map-graph.test.ts +3 -3
  97. package/test/unit/data-structures/graph/undirected-graph.test.ts +12 -12
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LinkedHashMap = exports.HashMap = void 0;
11
11
  const utils_1 = require("../../utils");
12
12
  const base_1 = require("../base");
13
- class HashMap extends base_1.IterablePairBase {
13
+ class HashMap extends base_1.IterableEntryBase {
14
14
  /**
15
15
  * The constructor function initializes a new instance of a class with optional elements and options.
16
16
  * @param elements - The `elements` parameter is an iterable containing key-value pairs `[K, V]`. It
@@ -230,7 +230,7 @@ class HashMap extends base_1.IterablePairBase {
230
230
  }
231
231
  }
232
232
  exports.HashMap = HashMap;
233
- class LinkedHashMap extends base_1.IterablePairBase {
233
+ class LinkedHashMap extends base_1.IterableEntryBase {
234
234
  constructor(elements, options = {
235
235
  hashFn: (key) => String(key),
236
236
  objHashFn: (key) => key
@@ -1 +1 @@
1
- {"version":3,"file":"hash-map.js","sourceRoot":"","sources":["../../../../src/data-structures/hash/hash-map.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,uCAAoD;AAEpD,kCAA2C;AAE3C,MAAa,OAA0B,SAAQ,uBAAsB;IAInE;;;;;;;OAOG;IACH,YAAY,WAA6B,EAAE,EAAE,OAE5C;QACC,KAAK,EAAE,CAAC;QAdA,WAAM,GAA8C,EAAE,CAAC;QACvD,YAAO,GAAmB,IAAI,GAAG,EAAE,CAAC;QA0BpC,UAAK,GAAG,CAAC,CAAC;QAyLV,YAAO,GAAuB,CAAC,GAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,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AAI,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,MAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;IAED;;;;;;;;;OASG;IACO,WAAW,CAAC,IAAyC;QAC7D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,IAAI,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QAED,IAAI,IAAI,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;IAClB,CAAC;CACF;AAvZD,sCAuZC"}
@@ -3,7 +3,7 @@ import { BinaryTreeNested, BinaryTreeNodeNested, BinaryTreeOptions, BiTreeDelete
3
3
  export interface IBinaryTree<K = number, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNodeNested<K, V>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTreeNested<K, V, N>> {
4
4
  createNode(key: K, value?: N['value']): N;
5
5
  createTree(options?: Partial<BinaryTreeOptions<K>>): TREE;
6
- add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, count?: number): N | null | undefined;
7
- addMany(nodes: Iterable<BTNodeExemplar<K, V, N>>): (N | null | undefined)[];
6
+ add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, value?: V, count?: number): N | null | undefined;
7
+ addMany(nodes: Iterable<BTNodeExemplar<K, V, N>>, values?: Iterable<V | undefined>): (N | null | undefined)[];
8
8
  delete<C extends BTNCallback<N>>(identifier: ReturnType<C> | null, callback: C): BiTreeDeleteResult<N>[];
9
9
  }
@@ -1,5 +1,5 @@
1
- import { IterableElementBase, IterablePairBase } from "../../../data-structures";
2
- export type PairCallback<K, V, R> = (value: V, key: K, index: number, container: IterablePairBase<K, V>) => R;
1
+ import { IterableElementBase, IterableEntryBase } from "../../../data-structures";
2
+ export type EntryCallback<K, V, R> = (value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
3
3
  export type ElementCallback<V, R> = (element: V, index: number, container: IterableElementBase<V>) => R;
4
- export type ReducePairCallback<K, V, R> = (accumulator: R, value: V, key: K, index: number, container: IterablePairBase<K, V>) => R;
4
+ export type ReduceEntryCallback<K, V, R> = (accumulator: R, value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
5
5
  export type ReduceElementCallback<V, R> = (accumulator: R, element: V, index: number, container: IterableElementBase<V>) => R;
@@ -1,5 +1,5 @@
1
- import { ElementCallback, PairCallback, ReduceElementCallback, ReducePairCallback } from "../../types";
2
- export declare abstract class IterablePairBase<K = any, V = any> {
1
+ import { ElementCallback, EntryCallback, ReduceElementCallback, ReduceEntryCallback } from "../../types";
2
+ export declare abstract class IterableEntryBase<K = any, V = any> {
3
3
  /**
4
4
  * Time Complexity: O(n)
5
5
  * Space Complexity: O(1)
@@ -66,7 +66,7 @@ export declare abstract class IterablePairBase<K = any, V = any> {
66
66
  * @returns The `every` method is returning a boolean value. It returns `true` if every element in
67
67
  * the collection satisfies the provided predicate function, and `false` otherwise.
68
68
  */
69
- every(predicate: PairCallback<K, V, boolean>, thisArg?: any): boolean;
69
+ every(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean;
70
70
  /**
71
71
  * Time Complexity: O(n)
72
72
  * Space Complexity: O(1)
@@ -86,7 +86,7 @@ export declare abstract class IterablePairBase<K = any, V = any> {
86
86
  * @returns a boolean value. It returns true if the predicate function returns true for any pair in
87
87
  * the collection, and false otherwise.
88
88
  */
89
- some(predicate: PairCallback<K, V, boolean>, thisArg?: any): boolean;
89
+ some(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean;
90
90
  /**
91
91
  * Time Complexity: O(n)
92
92
  * Space Complexity: O(1)
@@ -104,7 +104,7 @@ export declare abstract class IterablePairBase<K = any, V = any> {
104
104
  * specify the value of `this` within the callback function. If `thisArg` is provided, it will be
105
105
  * used as the `this` value when calling the callback function. If `thisArg` is not provided, `
106
106
  */
107
- forEach(callbackfn: PairCallback<K, V, void>, thisArg?: any): void;
107
+ forEach(callbackfn: EntryCallback<K, V, void>, thisArg?: any): void;
108
108
  /**
109
109
  * Time Complexity: O(n)
110
110
  * Space Complexity: O(1)
@@ -125,7 +125,7 @@ export declare abstract class IterablePairBase<K = any, V = any> {
125
125
  * @returns The `reduce` method is returning the final value of the accumulator after iterating over
126
126
  * all the elements in the collection.
127
127
  */
128
- reduce<U>(callbackfn: ReducePairCallback<K, V, U>, initialValue: U): U;
128
+ reduce<U>(callbackfn: ReduceEntryCallback<K, V, U>, initialValue: U): U;
129
129
  protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;
130
130
  }
131
131
  export declare abstract class IterableElementBase<V> {
@@ -1,4 +1,4 @@
1
- export class IterablePairBase {
1
+ export class IterableEntryBase {
2
2
  /**
3
3
  * Time Complexity: O(n)
4
4
  * Space Complexity: O(1)
@@ -68,11 +68,13 @@ export declare class AVLTree<K = any, V = any, N extends AVLTreeNode<K, V, N> =
68
68
  *
69
69
  * The function overrides the add method of a binary tree node and balances the tree after inserting
70
70
  * a new node.
71
- * @param keyOrNodeOrEntry - The parameter `keyOrNodeOrEntry` can be either a key, a node, or an
71
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be either a key, a node, or an
72
72
  * entry.
73
- * @returns The method is returning either the inserted node or `undefined`.
73
+ * @param {V} [value] - The `value` parameter represents the value associated with the key that is
74
+ * being added to the binary tree.
75
+ * @returns The method is returning either the inserted node or undefined.
74
76
  */
75
- add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>): N | undefined;
77
+ add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, value?: V): N | undefined;
76
78
  /**
77
79
  * Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The add method of the superclass (BST) has logarithmic time complexity.
78
80
  * Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
@@ -81,14 +81,16 @@ export class AVLTree extends BST {
81
81
  *
82
82
  * The function overrides the add method of a binary tree node and balances the tree after inserting
83
83
  * a new node.
84
- * @param keyOrNodeOrEntry - The parameter `keyOrNodeOrEntry` can be either a key, a node, or an
84
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be either a key, a node, or an
85
85
  * entry.
86
- * @returns The method is returning either the inserted node or `undefined`.
86
+ * @param {V} [value] - The `value` parameter represents the value associated with the key that is
87
+ * being added to the binary tree.
88
+ * @returns The method is returning either the inserted node or undefined.
87
89
  */
88
- add(keyOrNodeOrEntry) {
90
+ add(keyOrNodeOrEntry, value) {
89
91
  if (keyOrNodeOrEntry === null)
90
92
  return undefined;
91
- const inserted = super.add(keyOrNodeOrEntry);
93
+ const inserted = super.add(keyOrNodeOrEntry, value);
92
94
  if (inserted)
93
95
  this._balancePath(inserted);
94
96
  return inserted;
@@ -6,9 +6,9 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import type { BinaryTreeNodeNested, BinaryTreeOptions, BTNCallback, BTNodeEntry, BTNodeExemplar, BTNodeKeyOrNode } from '../../types';
9
- import { BinaryTreeNested, BinaryTreePrintOptions, BiTreeDeleteResult, DFSOrderPattern, FamilyPosition, IterationType, NodeDisplayLayout, PairCallback } from '../../types';
9
+ import { BinaryTreeNested, BinaryTreePrintOptions, BiTreeDeleteResult, DFSOrderPattern, EntryCallback, FamilyPosition, IterationType, NodeDisplayLayout } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
- import { IterablePairBase } from "../base";
11
+ import { IterableEntryBase } from "../base";
12
12
  /**
13
13
  * Represents a node in a binary tree.
14
14
  * @template V - The type of data stored in the node.
@@ -42,7 +42,7 @@ export declare class BinaryTreeNode<K = any, V = any, N extends BinaryTreeNode<K
42
42
  * 8. Full Trees: Every node has either 0 or 2 children.
43
43
  * 9. Complete Trees: All levels are fully filled except possibly the last, filled from left to right.
44
44
  */
45
- export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNode<K, V, BinaryTreeNodeNested<K, V>>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTree<K, V, N, BinaryTreeNested<K, V, N>>> extends IterablePairBase<K, V | undefined> implements IBinaryTree<K, V, N, TREE> {
45
+ export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V, N> = BinaryTreeNode<K, V, BinaryTreeNodeNested<K, V>>, TREE extends BinaryTree<K, V, N, TREE> = BinaryTree<K, V, N, BinaryTreeNested<K, V, N>>> extends IterableEntryBase<K, V | undefined> implements IBinaryTree<K, V, N, TREE> {
46
46
  iterationType: IterationType;
47
47
  /**
48
48
  * The constructor function initializes a binary tree object with optional elements and options.
@@ -82,13 +82,14 @@ export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V,
82
82
  */
83
83
  isNode(exemplar: BTNodeExemplar<K, V, N>): exemplar is N;
84
84
  /**
85
- * The function `exemplarToNode` converts an exemplar of a binary tree node into an actual node
86
- * object.
87
- * @param exemplar - BTNodeExemplar<K, V,N> - A generic type representing the exemplar parameter of the
88
- * function. It can be any type.
89
- * @returns a value of type `N` (which represents a node), or `null`, or `undefined`.
85
+ * The function `exemplarToNode` converts an exemplar object into a node object.
86
+ * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
87
+ * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
88
+ * `exemplarToNode` function. It represents the value associated with the exemplar node. If no value
89
+ * is provided, it will be `undefined`.
90
+ * @returns a value of type N (node), or null, or undefined.
90
91
  */
91
- exemplarToNode(exemplar: BTNodeExemplar<K, V, N>): N | null | undefined;
92
+ exemplarToNode(exemplar: BTNodeExemplar<K, V, N>, value?: V): N | null | undefined;
92
93
  /**
93
94
  * The function checks if a given value is an entry in a binary tree node.
94
95
  * @param kne - BTNodeExemplar<K, V,N> - A generic type representing a node in a binary tree. It has
@@ -104,11 +105,13 @@ export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V,
104
105
  * Time Complexity O(log n) - O(n)
105
106
  * Space Complexity O(1)
106
107
  *
107
- * The `add` function adds a new node to a binary tree, either by key or by providing a node object.
108
- * @param keyOrNodeOrEntry - The parameter `keyOrNodeOrEntry` can be one of the following:
109
- * @returns The function `add` returns the inserted node (`N`), `null`, or `undefined`.
108
+ * The `add` function adds a new node to a binary tree, either by creating a new node or replacing an
109
+ * existing node with the same key.
110
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be one of the following:
111
+ * @param {V} [value] - The value to be inserted into the binary tree.
112
+ * @returns The function `add` returns either a node (`N`), `null`, or `undefined`.
110
113
  */
111
- add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>): N | null | undefined;
114
+ add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, value?: V): N | null | undefined;
112
115
  /**
113
116
  * Time Complexity: O(k log n) - O(k * n)
114
117
  * Space Complexity: O(1)
@@ -118,14 +121,13 @@ export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V,
118
121
  * Time Complexity: O(k log n) - O(k * n)
119
122
  * Space Complexity: O(1)
120
123
  *
121
- * The function `addMany` takes in an iterable of `BTNodeExemplar` objects, adds each object to the
122
- * current instance, and returns an array of the inserted nodes.
123
- * @param nodes - The `nodes` parameter is an iterable (such as an array or a set) of
124
- * `BTNodeExemplar<K, V,N>` objects.
125
- * @returns The function `addMany` returns an array of values, where each value is either of type
126
- * `N`, `null`, or `undefined`.
124
+ * The `addMany` function takes in a collection of nodes and an optional collection of values, and
125
+ * adds each node with its corresponding value to the data structure.
126
+ * @param nodes - An iterable collection of BTNodeExemplar objects.
127
+ * @param [values] - An optional iterable of values that will be assigned to each node being added.
128
+ * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
127
129
  */
128
- addMany(nodes: Iterable<BTNodeExemplar<K, V, N>>): (N | null | undefined)[];
130
+ addMany(nodes: Iterable<BTNodeExemplar<K, V, N>>, values?: Iterable<V | undefined>): (N | null | undefined)[];
129
131
  /**
130
132
  * Time Complexity: O(k * n) "n" is the number of nodes in the tree, and "k" is the number of keys to be inserted.
131
133
  * Space Complexity: O(1)
@@ -495,7 +497,7 @@ export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V,
495
497
  * @returns The `filter` method is returning a new tree object that contains the key-value pairs that
496
498
  * pass the given predicate function.
497
499
  */
498
- filter(predicate: PairCallback<K, V | undefined, boolean>, thisArg?: any): TREE;
500
+ filter(predicate: EntryCallback<K, V | undefined, boolean>, thisArg?: any): TREE;
499
501
  /**
500
502
  * Time Complexity: O(n)
501
503
  * Space Complexity: O(n)
@@ -515,7 +517,7 @@ export declare class BinaryTree<K = any, V = any, N extends BinaryTreeNode<K, V,
515
517
  * will be used as the `this` value when the callback function is called. If you don't pass a value
516
518
  * @returns The `map` method is returning a new tree object.
517
519
  */
518
- map(callback: PairCallback<K, V | undefined, V>, thisArg?: any): TREE;
520
+ map(callback: EntryCallback<K, V | undefined, V>, thisArg?: any): TREE;
519
521
  /**
520
522
  * The `print` function is used to display a binary tree structure in a visually appealing way.
521
523
  * @param {K | N | null | undefined} [beginRoot=this.root] - The `root` parameter is of type `K | N | null |
@@ -8,7 +8,7 @@
8
8
  import { FamilyPosition, IterationType } from '../../types';
9
9
  import { trampoline } from '../../utils';
10
10
  import { Queue } from '../queue';
11
- import { IterablePairBase } from "../base";
11
+ import { IterableEntryBase } from "../base";
12
12
  /**
13
13
  * Represents a node in a binary tree.
14
14
  * @template V - The type of data stored in the node.
@@ -71,7 +71,7 @@ export class BinaryTreeNode {
71
71
  * 8. Full Trees: Every node has either 0 or 2 children.
72
72
  * 9. Complete Trees: All levels are fully filled except possibly the last, filled from left to right.
73
73
  */
74
- export class BinaryTree extends IterablePairBase {
74
+ export class BinaryTree extends IterableEntryBase {
75
75
  iterationType = IterationType.ITERATIVE;
76
76
  /**
77
77
  * The constructor function initializes a binary tree object with optional elements and options.
@@ -137,13 +137,14 @@ export class BinaryTree extends IterablePairBase {
137
137
  return exemplar instanceof BinaryTreeNode;
138
138
  }
139
139
  /**
140
- * The function `exemplarToNode` converts an exemplar of a binary tree node into an actual node
141
- * object.
142
- * @param exemplar - BTNodeExemplar<K, V,N> - A generic type representing the exemplar parameter of the
143
- * function. It can be any type.
144
- * @returns a value of type `N` (which represents a node), or `null`, or `undefined`.
140
+ * The function `exemplarToNode` converts an exemplar object into a node object.
141
+ * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
142
+ * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
143
+ * `exemplarToNode` function. It represents the value associated with the exemplar node. If no value
144
+ * is provided, it will be `undefined`.
145
+ * @returns a value of type N (node), or null, or undefined.
145
146
  */
146
- exemplarToNode(exemplar) {
147
+ exemplarToNode(exemplar, value) {
147
148
  if (exemplar === undefined)
148
149
  return;
149
150
  let node;
@@ -166,7 +167,7 @@ export class BinaryTree extends IterablePairBase {
166
167
  node = exemplar;
167
168
  }
168
169
  else if (this.isNotNodeInstance(exemplar)) {
169
- node = this.createNode(exemplar);
170
+ node = this.createNode(exemplar, value);
170
171
  }
171
172
  else {
172
173
  return;
@@ -190,13 +191,15 @@ export class BinaryTree extends IterablePairBase {
190
191
  * Time Complexity O(log n) - O(n)
191
192
  * Space Complexity O(1)
192
193
  *
193
- * The `add` function adds a new node to a binary tree, either by key or by providing a node object.
194
- * @param keyOrNodeOrEntry - The parameter `keyOrNodeOrEntry` can be one of the following:
195
- * @returns The function `add` returns the inserted node (`N`), `null`, or `undefined`.
194
+ * The `add` function adds a new node to a binary tree, either by creating a new node or replacing an
195
+ * existing node with the same key.
196
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be one of the following:
197
+ * @param {V} [value] - The value to be inserted into the binary tree.
198
+ * @returns The function `add` returns either a node (`N`), `null`, or `undefined`.
196
199
  */
197
- add(keyOrNodeOrEntry) {
200
+ add(keyOrNodeOrEntry, value) {
198
201
  let inserted;
199
- const newNode = this.exemplarToNode(keyOrNodeOrEntry);
202
+ const newNode = this.exemplarToNode(keyOrNodeOrEntry, value);
200
203
  if (newNode === undefined)
201
204
  return;
202
205
  const _bfs = (root, newNode) => {
@@ -240,18 +243,28 @@ export class BinaryTree extends IterablePairBase {
240
243
  * Time Complexity: O(k log n) - O(k * n)
241
244
  * Space Complexity: O(1)
242
245
  *
243
- * The function `addMany` takes in an iterable of `BTNodeExemplar` objects, adds each object to the
244
- * current instance, and returns an array of the inserted nodes.
245
- * @param nodes - The `nodes` parameter is an iterable (such as an array or a set) of
246
- * `BTNodeExemplar<K, V,N>` objects.
247
- * @returns The function `addMany` returns an array of values, where each value is either of type
248
- * `N`, `null`, or `undefined`.
249
- */
250
- addMany(nodes) {
246
+ * The `addMany` function takes in a collection of nodes and an optional collection of values, and
247
+ * adds each node with its corresponding value to the data structure.
248
+ * @param nodes - An iterable collection of BTNodeExemplar objects.
249
+ * @param [values] - An optional iterable of values that will be assigned to each node being added.
250
+ * @returns The function `addMany` returns an array of `N`, `null`, or `undefined` values.
251
+ */
252
+ addMany(nodes, values) {
251
253
  // TODO not sure addMany not be run multi times
252
254
  const inserted = [];
255
+ let valuesIterator;
256
+ if (values) {
257
+ valuesIterator = values[Symbol.iterator]();
258
+ }
253
259
  for (const kne of nodes) {
254
- inserted.push(this.add(kne));
260
+ let value = undefined;
261
+ if (valuesIterator) {
262
+ const valueResult = valuesIterator.next();
263
+ if (!valueResult.done) {
264
+ value = valueResult.value;
265
+ }
266
+ }
267
+ inserted.push(this.add(kne, value));
255
268
  }
256
269
  return inserted;
257
270
  }
@@ -80,12 +80,14 @@ export declare class BST<K = any, V = any, N extends BSTNode<K, V, N> = BSTNode<
80
80
  */
81
81
  isNode(exemplar: BTNodeExemplar<K, V, N>): exemplar is N;
82
82
  /**
83
- * The function `exemplarToNode` takes an exemplar and returns a corresponding node if the exemplar
84
- * is valid, otherwise it returns undefined.
85
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
86
- * @returns a variable `node` which is of type `N` or `undefined`.
83
+ * The function `exemplarToNode` takes an exemplar and returns a node if the exemplar is valid,
84
+ * otherwise it returns undefined.
85
+ * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`, where:
86
+ * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
87
+ * `exemplarToNode` function. It represents the value associated with the exemplar node.
88
+ * @returns a node of type N or undefined.
87
89
  */
88
- exemplarToNode(exemplar: BTNodeExemplar<K, V, N>): N | undefined;
90
+ exemplarToNode(exemplar: BTNodeExemplar<K, V, N>, value?: V): N | undefined;
89
91
  /**
90
92
  * Time Complexity: O(log n) - Average case for a balanced tree. In the worst case (unbalanced tree), it can be O(n).
91
93
  * Space Complexity: O(1) - Constant space is used.
@@ -94,13 +96,15 @@ export declare class BST<K = any, V = any, N extends BSTNode<K, V, N> = BSTNode<
94
96
  * Time Complexity: O(log n) - Average case for a balanced tree. In the worst case (unbalanced tree), it can be O(n).
95
97
  * Space Complexity: O(1) - Constant space is used.
96
98
  *
97
- * The `add` function adds a new node to a binary search tree, either by key or by providing a node
98
- * object.
99
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be one of the following:
100
- * @returns The method returns either the newly added node (`newNode`) or `undefined` if the input
101
- * (`keyOrNodeOrEntry`) is null, undefined, or does not match any of the expected types.
99
+ * The `add` function adds a new node to a binary tree, updating the value if the key already exists
100
+ * or inserting a new node if the key is unique.
101
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can accept three types of values:
102
+ * @param {V} [value] - The `value` parameter represents the value associated with the key that is
103
+ * being added to the binary tree.
104
+ * @returns The method `add` returns either the newly added node (`newNode`) or `undefined` if the
105
+ * node was not added.
102
106
  */
103
- add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>): N | undefined;
107
+ add(keyOrNodeOrEntry: BTNodeExemplar<K, V, N>, value?: V): N | undefined;
104
108
  /**
105
109
  * Time Complexity: O(k log n) - Adding each element individually in a balanced tree.
106
110
  * Space Complexity: O(k) - Additional space is required for the sorted array.
@@ -109,19 +113,23 @@ export declare class BST<K = any, V = any, N extends BSTNode<K, V, N> = BSTNode<
109
113
  * Time Complexity: O(k log n) - Adding each element individually in a balanced tree.
110
114
  * Space Complexity: O(k) - Additional space is required for the sorted array.
111
115
  *
112
- * The `addMany` function in TypeScript adds multiple nodes to a binary tree, either in a balanced or
113
- * unbalanced manner, and returns an array of the inserted nodes.
114
- * @param keysOrNodesOrEntries - An iterable containing keys, nodes, or entries to be added to the
115
- * binary tree.
116
- * @param [isBalanceAdd=true] - A boolean flag indicating whether the tree should be balanced after
117
- * adding the nodes. The default value is true.
116
+ * The `addMany` function in TypeScript adds multiple keys or nodes to a binary tree, optionally
117
+ * balancing the tree after each addition.
118
+ * @param keysOrNodesOrEntries - An iterable containing the keys, nodes, or entries to be added to
119
+ * the binary tree.
120
+ * @param [values] - An optional iterable of values to be associated with the keys or nodes being
121
+ * added. If provided, the values will be assigned to the corresponding keys or nodes in the same
122
+ * order. If not provided, undefined will be assigned as the value for each key or node.
123
+ * @param [isBalanceAdd=true] - A boolean flag indicating whether the add operation should be
124
+ * balanced or not. If set to true, the add operation will be balanced using a binary search tree
125
+ * algorithm. If set to false, the add operation will not be balanced and the elements will be added
126
+ * in the order they appear in the input.
118
127
  * @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
119
- * type of iteration to use when adding multiple keys or nodes to the binary tree. It has a default
120
- * value of `this.iterationType`, which means it will use the iteration type specified by the binary
121
- * tree instance.
122
- * @returns The `addMany` function returns an array of `N` or `undefined` values.
128
+ * type of iteration to use when adding multiple keys or nodes. It has a default value of
129
+ * `this.iterationType`, which suggests that it is a property of the current object.
130
+ * @returns The function `addMany` returns an array of nodes (`N`) or `undefined` values.
123
131
  */
124
- addMany(keysOrNodesOrEntries: Iterable<BTNodeExemplar<K, V, N>>, isBalanceAdd?: boolean, iterationType?: IterationType): (N | undefined)[];
132
+ addMany(keysOrNodesOrEntries: Iterable<BTNodeExemplar<K, V, N>>, values?: Iterable<V | undefined>, isBalanceAdd?: boolean, iterationType?: IterationType): (N | undefined)[];
125
133
  /**
126
134
  * Time Complexity: O(log n) - Average case for a balanced tree.
127
135
  * Space Complexity: O(1) - Constant space is used.
@@ -115,12 +115,14 @@ export class BST extends BinaryTree {
115
115
  return exemplar instanceof BSTNode;
116
116
  }
117
117
  /**
118
- * The function `exemplarToNode` takes an exemplar and returns a corresponding node if the exemplar
119
- * is valid, otherwise it returns undefined.
120
- * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`.
121
- * @returns a variable `node` which is of type `N` or `undefined`.
118
+ * The function `exemplarToNode` takes an exemplar and returns a node if the exemplar is valid,
119
+ * otherwise it returns undefined.
120
+ * @param exemplar - The `exemplar` parameter is of type `BTNodeExemplar<K, V, N>`, where:
121
+ * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
122
+ * `exemplarToNode` function. It represents the value associated with the exemplar node.
123
+ * @returns a node of type N or undefined.
122
124
  */
123
- exemplarToNode(exemplar) {
125
+ exemplarToNode(exemplar, value) {
124
126
  let node;
125
127
  if (exemplar === null || exemplar === undefined) {
126
128
  return;
@@ -138,7 +140,7 @@ export class BST extends BinaryTree {
138
140
  }
139
141
  }
140
142
  else if (this.isNotNodeInstance(exemplar)) {
141
- node = this.createNode(exemplar);
143
+ node = this.createNode(exemplar, value);
142
144
  }
143
145
  else {
144
146
  return;
@@ -153,14 +155,16 @@ export class BST extends BinaryTree {
153
155
  * Time Complexity: O(log n) - Average case for a balanced tree. In the worst case (unbalanced tree), it can be O(n).
154
156
  * Space Complexity: O(1) - Constant space is used.
155
157
  *
156
- * The `add` function adds a new node to a binary search tree, either by key or by providing a node
157
- * object.
158
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be one of the following:
159
- * @returns The method returns either the newly added node (`newNode`) or `undefined` if the input
160
- * (`keyOrNodeOrEntry`) is null, undefined, or does not match any of the expected types.
158
+ * The `add` function adds a new node to a binary tree, updating the value if the key already exists
159
+ * or inserting a new node if the key is unique.
160
+ * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can accept three types of values:
161
+ * @param {V} [value] - The `value` parameter represents the value associated with the key that is
162
+ * being added to the binary tree.
163
+ * @returns The method `add` returns either the newly added node (`newNode`) or `undefined` if the
164
+ * node was not added.
161
165
  */
162
- add(keyOrNodeOrEntry) {
163
- const newNode = this.exemplarToNode(keyOrNodeOrEntry);
166
+ add(keyOrNodeOrEntry, value) {
167
+ const newNode = this.exemplarToNode(keyOrNodeOrEntry, value);
164
168
  if (newNode === undefined)
165
169
  return;
166
170
  if (this.root === undefined) {
@@ -210,23 +214,32 @@ export class BST extends BinaryTree {
210
214
  * Time Complexity: O(k log n) - Adding each element individually in a balanced tree.
211
215
  * Space Complexity: O(k) - Additional space is required for the sorted array.
212
216
  *
213
- * The `addMany` function in TypeScript adds multiple nodes to a binary tree, either in a balanced or
214
- * unbalanced manner, and returns an array of the inserted nodes.
215
- * @param keysOrNodesOrEntries - An iterable containing keys, nodes, or entries to be added to the
216
- * binary tree.
217
- * @param [isBalanceAdd=true] - A boolean flag indicating whether the tree should be balanced after
218
- * adding the nodes. The default value is true.
217
+ * The `addMany` function in TypeScript adds multiple keys or nodes to a binary tree, optionally
218
+ * balancing the tree after each addition.
219
+ * @param keysOrNodesOrEntries - An iterable containing the keys, nodes, or entries to be added to
220
+ * the binary tree.
221
+ * @param [values] - An optional iterable of values to be associated with the keys or nodes being
222
+ * added. If provided, the values will be assigned to the corresponding keys or nodes in the same
223
+ * order. If not provided, undefined will be assigned as the value for each key or node.
224
+ * @param [isBalanceAdd=true] - A boolean flag indicating whether the add operation should be
225
+ * balanced or not. If set to true, the add operation will be balanced using a binary search tree
226
+ * algorithm. If set to false, the add operation will not be balanced and the elements will be added
227
+ * in the order they appear in the input.
219
228
  * @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
220
- * type of iteration to use when adding multiple keys or nodes to the binary tree. It has a default
221
- * value of `this.iterationType`, which means it will use the iteration type specified by the binary
222
- * tree instance.
223
- * @returns The `addMany` function returns an array of `N` or `undefined` values.
229
+ * type of iteration to use when adding multiple keys or nodes. It has a default value of
230
+ * `this.iterationType`, which suggests that it is a property of the current object.
231
+ * @returns The function `addMany` returns an array of nodes (`N`) or `undefined` values.
224
232
  */
225
- addMany(keysOrNodesOrEntries, isBalanceAdd = true, iterationType = this.iterationType) {
233
+ addMany(keysOrNodesOrEntries, values, isBalanceAdd = true, iterationType = this.iterationType) {
226
234
  const inserted = [];
235
+ let valuesIterator;
236
+ if (values) {
237
+ valuesIterator = values[Symbol.iterator]();
238
+ }
227
239
  if (!isBalanceAdd) {
228
240
  for (const kve of keysOrNodesOrEntries) {
229
- const nn = this.add(kve);
241
+ const value = valuesIterator?.next().value;
242
+ const nn = this.add(kve, value);
230
243
  inserted.push(nn);
231
244
  }
232
245
  return inserted;
@@ -240,7 +253,6 @@ export class BST extends BinaryTree {
240
253
  for (const kve of keysOrNodesOrEntries) {
241
254
  isRealBTNExemplar(kve) && realBTNExemplars.push(kve);
242
255
  }
243
- // TODO this addMany function is inefficient, it should be optimized
244
256
  let sorted = [];
245
257
  sorted = realBTNExemplars.sort((a, b) => {
246
258
  let aR, bR;