min-heap-typed 1.51.8 → 1.52.0

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 (106) hide show
  1. package/dist/data-structures/base/index.d.ts +2 -1
  2. package/dist/data-structures/base/index.js +2 -1
  3. package/dist/data-structures/base/iterable-element-base.d.ts +171 -0
  4. package/dist/data-structures/base/iterable-element-base.js +225 -0
  5. package/dist/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
  6. package/dist/data-structures/base/{iterable-base.js → iterable-entry-base.js} +12 -189
  7. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +106 -68
  8. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +119 -87
  9. package/dist/data-structures/binary-tree/avl-tree.d.ts +82 -62
  10. package/dist/data-structures/binary-tree/avl-tree.js +78 -59
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +318 -226
  12. package/dist/data-structures/binary-tree/binary-tree.js +475 -363
  13. package/dist/data-structures/binary-tree/bst.d.ts +192 -202
  14. package/dist/data-structures/binary-tree/bst.js +207 -249
  15. package/dist/data-structures/binary-tree/rb-tree.d.ts +73 -74
  16. package/dist/data-structures/binary-tree/rb-tree.js +107 -98
  17. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +92 -75
  18. package/dist/data-structures/binary-tree/tree-multi-map.js +105 -93
  19. package/dist/data-structures/graph/abstract-graph.d.ts +10 -15
  20. package/dist/data-structures/graph/abstract-graph.js +10 -15
  21. package/dist/data-structures/hash/hash-map.d.ts +33 -40
  22. package/dist/data-structures/hash/hash-map.js +40 -55
  23. package/dist/data-structures/heap/heap.d.ts +43 -114
  24. package/dist/data-structures/heap/heap.js +59 -127
  25. package/dist/data-structures/heap/max-heap.d.ts +50 -4
  26. package/dist/data-structures/heap/max-heap.js +76 -10
  27. package/dist/data-structures/heap/min-heap.d.ts +51 -5
  28. package/dist/data-structures/heap/min-heap.js +68 -11
  29. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
  30. package/dist/data-structures/linked-list/doubly-linked-list.js +26 -28
  31. package/dist/data-structures/linked-list/singly-linked-list.d.ts +22 -25
  32. package/dist/data-structures/linked-list/singly-linked-list.js +29 -26
  33. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
  34. package/dist/data-structures/priority-queue/max-priority-queue.js +79 -10
  35. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
  36. package/dist/data-structures/priority-queue/min-priority-queue.js +71 -11
  37. package/dist/data-structures/priority-queue/priority-queue.d.ts +50 -4
  38. package/dist/data-structures/priority-queue/priority-queue.js +70 -1
  39. package/dist/data-structures/queue/deque.d.ts +21 -20
  40. package/dist/data-structures/queue/deque.js +29 -23
  41. package/dist/data-structures/queue/queue.d.ts +8 -28
  42. package/dist/data-structures/queue/queue.js +15 -31
  43. package/dist/data-structures/stack/stack.d.ts +17 -22
  44. package/dist/data-structures/stack/stack.js +25 -24
  45. package/dist/data-structures/trie/trie.d.ts +19 -14
  46. package/dist/data-structures/trie/trie.js +27 -16
  47. package/dist/interfaces/binary-tree.d.ts +7 -7
  48. package/dist/types/common.d.ts +1 -2
  49. package/dist/types/data-structures/base/base.d.ts +5 -2
  50. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -4
  51. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +3 -4
  52. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +5 -5
  53. package/dist/types/data-structures/binary-tree/bst.d.ts +4 -5
  54. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +3 -4
  55. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
  56. package/dist/types/data-structures/heap/heap.d.ts +3 -2
  57. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
  58. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
  59. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  60. package/dist/types/data-structures/queue/deque.d.ts +3 -2
  61. package/dist/types/data-structures/queue/queue.d.ts +2 -1
  62. package/dist/types/data-structures/stack/stack.d.ts +2 -1
  63. package/dist/types/data-structures/trie/trie.d.ts +3 -2
  64. package/dist/utils/utils.js +3 -5
  65. package/package.json +2 -2
  66. package/src/data-structures/base/index.ts +2 -1
  67. package/src/data-structures/base/iterable-element-base.ts +250 -0
  68. package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +22 -213
  69. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +144 -95
  70. package/src/data-structures/binary-tree/avl-tree.ts +96 -69
  71. package/src/data-structures/binary-tree/binary-tree.ts +535 -403
  72. package/src/data-structures/binary-tree/bst.ts +247 -277
  73. package/src/data-structures/binary-tree/rb-tree.ts +123 -103
  74. package/src/data-structures/binary-tree/tree-multi-map.ts +127 -102
  75. package/src/data-structures/graph/abstract-graph.ts +10 -10
  76. package/src/data-structures/hash/hash-map.ts +46 -53
  77. package/src/data-structures/heap/heap.ts +71 -152
  78. package/src/data-structures/heap/max-heap.ts +88 -13
  79. package/src/data-structures/heap/min-heap.ts +78 -15
  80. package/src/data-structures/linked-list/doubly-linked-list.ts +32 -32
  81. package/src/data-structures/linked-list/singly-linked-list.ts +37 -29
  82. package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
  83. package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
  84. package/src/data-structures/priority-queue/priority-queue.ts +81 -4
  85. package/src/data-structures/queue/deque.ts +37 -26
  86. package/src/data-structures/queue/queue.ts +23 -36
  87. package/src/data-structures/stack/stack.ts +31 -26
  88. package/src/data-structures/trie/trie.ts +35 -20
  89. package/src/interfaces/binary-tree.ts +9 -9
  90. package/src/types/common.ts +1 -2
  91. package/src/types/data-structures/base/base.ts +14 -6
  92. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +3 -4
  93. package/src/types/data-structures/binary-tree/avl-tree.ts +3 -4
  94. package/src/types/data-structures/binary-tree/binary-tree.ts +6 -6
  95. package/src/types/data-structures/binary-tree/bst.ts +4 -5
  96. package/src/types/data-structures/binary-tree/rb-tree.ts +3 -4
  97. package/src/types/data-structures/binary-tree/tree-multi-map.ts +3 -4
  98. package/src/types/data-structures/heap/heap.ts +4 -1
  99. package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -1
  100. package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -1
  101. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
  102. package/src/types/data-structures/queue/deque.ts +3 -1
  103. package/src/types/data-structures/queue/queue.ts +3 -1
  104. package/src/types/data-structures/stack/stack.ts +3 -1
  105. package/src/types/data-structures/trie/trie.ts +3 -1
  106. package/src/utils/utils.ts +3 -3
@@ -1,7 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IterableElementBase = exports.IterableEntryBase = void 0;
3
+ exports.IterableEntryBase = void 0;
4
4
  class IterableEntryBase {
5
+ // protected _toEntryFn?: (rawElement: R) => BTNEntry<K, V>;
6
+ //
7
+ // /**
8
+ // * The function returns the value of the _toEntryFn property.
9
+ // * @returns The function being returned is `this._toEntryFn`.
10
+ // */
11
+ // get toEntryFn() {
12
+ // return this._toEntryFn;
13
+ // }
5
14
  /**
6
15
  * Time Complexity: O(n)
7
16
  * Space Complexity: O(1)
@@ -262,32 +271,6 @@ class IterableEntryBase {
262
271
  }
263
272
  return accumulator;
264
273
  }
265
- /**
266
- * Time Complexity: O(n)
267
- * Space Complexity: O(n)
268
- */
269
- print() {
270
- console.log([...this]);
271
- }
272
- }
273
- exports.IterableEntryBase = IterableEntryBase;
274
- class IterableElementBase {
275
- /**
276
- * Time Complexity: O(n)
277
- * Space Complexity: O(1)
278
- */
279
- /**
280
- * Time Complexity: O(n)
281
- * Space Complexity: O(1)
282
- *
283
- * The function is an implementation of the Symbol.iterator method that returns an IterableIterator.
284
- * @param {any[]} args - The `args` parameter in the code snippet represents a rest parameter. It
285
- * allows the function to accept any number of arguments as an array. In this case, the `args`
286
- * parameter is used to pass any number of arguments to the `_getIterator` method.
287
- */
288
- *[Symbol.iterator](...args) {
289
- yield* this._getIterator(...args);
290
- }
291
274
  /**
292
275
  * Time Complexity: O(n)
293
276
  * Space Complexity: O(n)
@@ -296,170 +279,10 @@ class IterableElementBase {
296
279
  * Time Complexity: O(n)
297
280
  * Space Complexity: O(n)
298
281
  *
299
- * The function returns an iterator that yields all the values in the object.
300
- */
301
- *values() {
302
- for (const item of this) {
303
- yield item;
304
- }
305
- }
306
- /**
307
- * Time Complexity: O(n)
308
- * Space Complexity: O(1)
309
- */
310
- /**
311
- * Time Complexity: O(n)
312
- * Space Complexity: O(1)
313
- *
314
- * The `every` function checks if every element in the array satisfies a given predicate.
315
- * @param predicate - The `predicate` parameter is a callback function that takes three arguments:
316
- * the current element being processed, its index, and the array it belongs to. It should return a
317
- * boolean value indicating whether the element satisfies a certain condition or not.
318
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
319
- * to be used as `this` when executing the `predicate` function. If `thisArg` is provided, it will be
320
- * passed as the `this` value to the `predicate` function. If `thisArg` is
321
- * @returns The `every` method is returning a boolean value. It returns `true` if every element in
322
- * the array satisfies the provided predicate function, and `false` otherwise.
323
- */
324
- every(predicate, thisArg) {
325
- let index = 0;
326
- for (const item of this) {
327
- if (!predicate.call(thisArg, item, index++, this)) {
328
- return false;
329
- }
330
- }
331
- return true;
332
- }
333
- /**
334
- * Time Complexity: O(n)
335
- * Space Complexity: O(1)
336
- */
337
- /**
338
- * Time Complexity: O(n)
339
- * Space Complexity: O(1)
340
- */
341
- /**
342
- * Time Complexity: O(n)
343
- * Space Complexity: O(1)
344
- *
345
- * The "some" function checks if at least one element in a collection satisfies a given predicate.
346
- * @param predicate - The `predicate` parameter is a callback function that takes three arguments:
347
- * `value`, `index`, and `array`. It should return a boolean value indicating whether the current
348
- * element satisfies the condition.
349
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
350
- * to be used as the `this` value when executing the `predicate` function. If `thisArg` is provided,
351
- * it will be passed as the `this` value to the `predicate` function. If `thisArg
352
- * @returns a boolean value. It returns true if the predicate function returns true for any element
353
- * in the collection, and false otherwise.
354
- */
355
- some(predicate, thisArg) {
356
- let index = 0;
357
- for (const item of this) {
358
- if (predicate.call(thisArg, item, index++, this)) {
359
- return true;
360
- }
361
- }
362
- return false;
363
- }
364
- /**
365
- * Time Complexity: O(n)
366
- * Space Complexity: O(1)
367
- */
368
- /**
369
- * Time Complexity: O(n)
370
- * Space Complexity: O(1)
371
- *
372
- * The `forEach` function iterates over each element in an array-like object and calls a callback
373
- * function for each element.
374
- * @param callbackfn - The callbackfn parameter is a function that will be called for each element in
375
- * the array. It takes three arguments: the current element being processed, the index of the current
376
- * element, and the array that forEach was called upon.
377
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
378
- * to be used as `this` when executing the `callbackfn` function. If `thisArg` is provided, it will
379
- * be passed as the `this` value to the `callbackfn` function. If `thisArg
380
- */
381
- forEach(callbackfn, thisArg) {
382
- let index = 0;
383
- for (const item of this) {
384
- callbackfn.call(thisArg, item, index++, this);
385
- }
386
- }
387
- /**
388
- * Time Complexity: O(n)
389
- * Space Complexity: O(1)
390
- */
391
- /**
392
- * Time Complexity: O(n)
393
- * Space Complexity: O(1)
394
- *
395
- * The `find` function iterates over the elements of an array-like object and returns the first
396
- * element that satisfies the provided callback function.
397
- * @param callbackfn - The callbackfn parameter is a function that will be called for each element in
398
- * the array. It takes three arguments: the current element being processed, the index of the current
399
- * element, and the array itself. The function should return a boolean value indicating whether the
400
- * current element matches the desired condition.
401
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
402
- * to be used as `this` when executing the `callbackfn` function. If `thisArg` is provided, it will
403
- * be passed as the `this` value to the `callbackfn` function. If `thisArg
404
- * @returns The `find` method returns the first element in the array that satisfies the provided
405
- * callback function. If no element satisfies the callback function, `undefined` is returned.
406
- */
407
- find(callbackfn, thisArg) {
408
- let index = 0;
409
- for (const item of this) {
410
- if (callbackfn.call(thisArg, item, index++, this))
411
- return item;
412
- }
413
- return;
414
- }
415
- /**
416
- * Time Complexity: O(n)
417
- * Space Complexity: O(1)
418
- *
419
- * The function checks if a given element exists in a collection.
420
- * @param {E} element - The parameter "element" is of type E, which means it can be any type. It
421
- * represents the element that we want to check for existence in the collection.
422
- * @returns a boolean value. It returns true if the element is found in the collection, and false
423
- * otherwise.
424
- */
425
- has(element) {
426
- for (const ele of this) {
427
- if (ele === element)
428
- return true;
429
- }
430
- return false;
431
- }
432
- /**
433
- * Time Complexity: O(n)
434
- * Space Complexity: O(1)
435
- */
436
- /**
437
- * Time Complexity: O(n)
438
- * Space Complexity: O(1)
439
- *
440
- * The `reduce` function iterates over the elements of an array-like object and applies a callback
441
- * function to reduce them into a single value.
442
- * @param callbackfn - The callbackfn parameter is a function that will be called for each element in
443
- * the array. It takes four arguments:
444
- * @param {U} initialValue - The initialValue parameter is the initial value of the accumulator. It
445
- * is the value that the accumulator starts with before the reduction operation begins.
446
- * @returns The `reduce` method is returning the final value of the accumulator after iterating over
447
- * all the elements in the array and applying the callback function to each element.
448
- */
449
- reduce(callbackfn, initialValue) {
450
- let accumulator = initialValue;
451
- let index = 0;
452
- for (const item of this) {
453
- accumulator = callbackfn(accumulator, item, index++, this);
454
- }
455
- return accumulator;
456
- }
457
- /**
458
- * Time Complexity: O(n)
459
- * Space Complexity: O(n)
282
+ * The print function logs the elements of an array to the console.
460
283
  */
461
284
  print() {
462
285
  console.log([...this]);
463
286
  }
464
287
  }
465
- exports.IterableElementBase = IterableElementBase;
288
+ exports.IterableEntryBase = IterableEntryBase;
@@ -5,10 +5,11 @@
5
5
  * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
- import type { AVLTreeMultiMapNested, AVLTreeMultiMapNodeNested, AVLTreeMultiMapOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, Comparable, IterationType, KeyOrNodeOrEntry } from '../../types';
8
+ import type { AVLTreeMultiMapNested, AVLTreeMultiMapNodeNested, AVLTreeMultiMapOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, IterationType, KeyOrNodeOrEntry } from '../../types';
9
+ import { BTNEntry } from '../../types';
9
10
  import { IBinaryTree } from '../../interfaces';
10
11
  import { AVLTree, AVLTreeNode } from './avl-tree';
11
- export declare class AVLTreeMultiMapNode<K extends Comparable, V = any, NODE extends AVLTreeMultiMapNode<K, V, NODE> = AVLTreeMultiMapNodeNested<K, V>> extends AVLTreeNode<K, V, NODE> {
12
+ export declare class AVLTreeMultiMapNode<K = any, V = any, NODE extends AVLTreeMultiMapNode<K, V, NODE> = AVLTreeMultiMapNodeNested<K, V>> extends AVLTreeNode<K, V, NODE> {
12
13
  /**
13
14
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
14
15
  * @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
@@ -36,8 +37,16 @@ export declare class AVLTreeMultiMapNode<K extends Comparable, V = any, NODE ext
36
37
  /**
37
38
  * The only distinction between a AVLTreeMultiMap and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
38
39
  */
39
- export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends AVLTreeMultiMapNode<K, V, NODE> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNodeNested<K, V>>, TREE extends AVLTreeMultiMap<K, V, NODE, TREE> = AVLTreeMultiMap<K, V, NODE, AVLTreeMultiMapNested<K, V, NODE>>> extends AVLTree<K, V, NODE, TREE> implements IBinaryTree<K, V, NODE, TREE> {
40
- constructor(keysOrNodesOrEntries?: Iterable<KeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeMultiMapOptions<K>);
40
+ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE extends AVLTreeMultiMapNode<K, V, NODE> = AVLTreeMultiMapNode<K, V, AVLTreeMultiMapNodeNested<K, V>>, TREE extends AVLTreeMultiMap<K, V, R, NODE, TREE> = AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMapNested<K, V, R, NODE>>> extends AVLTree<K, V, R, NODE, TREE> implements IBinaryTree<K, V, R, NODE, TREE> {
41
+ /**
42
+ * The constructor initializes a new AVLTreeMultiMap object with optional initial elements.
43
+ * @param keysOrNodesOrEntriesOrRawElements - The `keysOrNodesOrEntriesOrRawElements` parameter is an
44
+ * iterable object that can contain either keys, nodes, entries, or raw elements.
45
+ * @param [options] - The `options` parameter is an optional object that can be used to customize the
46
+ * behavior of the AVLTreeMultiMap. It can include properties such as `compareKeys` and
47
+ * `compareValues` functions to define custom comparison logic for keys and values, respectively.
48
+ */
49
+ constructor(keysOrNodesOrEntriesOrRawElements?: Iterable<R | KeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeMultiMapOptions<K, V, R>);
41
50
  protected _count: number;
42
51
  /**
43
52
  * The function calculates the sum of the count property of all nodes in a tree using depth-first
@@ -59,35 +68,46 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends
59
68
  */
60
69
  getComputedCount(): number;
61
70
  /**
62
- * The function creates a new BSTNode with the given key, value, and count.
63
- * @param {K} key - The key parameter is the unique identifier for the binary tree node. It is used to
64
- * distinguish one node from another in the tree.
65
- * @param {NODE} value - The `value` parameter represents the value that will be stored in the binary search tree node.
66
- * @param {number} [count] - The "count" parameter is an optional parameter of type number. It represents the number of
67
- * occurrences of the value in the binary search tree node. If not provided, the count will default to 1.
68
- * @returns A new instance of the BSTNode class with the specified key, value, and count (if provided).
71
+ * The function creates a new AVLTreeMultiMapNode with the specified key, value, and count.
72
+ * @param {K} key - The key parameter represents the key of the node being created. It is of type K,
73
+ * which is a generic type that can be replaced with any specific type when using the function.
74
+ * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
75
+ * associated with the key in the node. It is of type `V`, which can be any data type.
76
+ * @param {number} [count] - The `count` parameter represents the number of occurrences of a
77
+ * key-value pair in the AVLTreeMultiMapNode. It is an optional parameter, so it can be omitted when
78
+ * calling the `createNode` method. If provided, it specifies the initial count for the node.
79
+ * @returns a new instance of the AVLTreeMultiMapNode class, casted as NODE.
69
80
  */
70
81
  createNode(key: K, value?: V, count?: number): NODE;
71
- createTree(options?: AVLTreeMultiMapOptions<K>): TREE;
72
- /**
73
- * The function `keyValueOrEntryToNode` converts an keyOrNodeOrEntry object into a node object.
74
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`, which means it
75
- * can be one of the following:
76
- * @param {V} [value] - The `value` parameter is an optional argument that represents the value
77
- * associated with the node. It is of type `V`, which can be any data type. If no value is provided,
78
- * it defaults to `undefined`.
79
- * @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
80
- * times the value should be added to the node. If not provided, it defaults to 1.
81
- * @returns a node of type `NODE` or `undefined`.
82
- */
83
- keyValueOrEntryToNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
84
82
  /**
85
- * The function checks if an keyOrNodeOrEntry is an instance of the AVLTreeMultiMapNode class.
86
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter is of type `KeyOrNodeOrEntry<K, V, NODE>`.
87
- * @returns a boolean value indicating whether the keyOrNodeOrEntry is an instance of the AVLTreeMultiMapNode
88
- * class.
83
+ * The function creates a new AVLTreeMultiMap object with the specified options and returns it.
84
+ * @param [options] - The `options` parameter is an optional object that contains additional
85
+ * configuration options for creating the AVLTreeMultiMap. It can have the following properties:
86
+ * @returns a new instance of the AVLTreeMultiMap class, with the specified options, as a TREE
87
+ * object.
88
+ */
89
+ createTree(options?: AVLTreeMultiMapOptions<K, V, R>): TREE;
90
+ /**
91
+ * The function checks if the input is an instance of AVLTreeMultiMapNode.
92
+ * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
93
+ * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
94
+ * @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
95
+ * an instance of the `AVLTreeMultiMapNode` class.
96
+ */
97
+ isNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
98
+ /**
99
+ * The function `keyValueOrEntryOrRawElementToNode` converts a key, value, entry, or raw element into
100
+ * a node object.
101
+ * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
102
+ * `keyOrNodeOrEntryOrRawElement` parameter can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
103
+ * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
104
+ * `override` function. It represents the value associated with the key in the data structure. If no
105
+ * value is provided, it will default to `undefined`.
106
+ * @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
107
+ * times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
108
+ * @returns either a NODE object or undefined.
89
109
  */
90
- isNode(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntry is NODE;
110
+ keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
91
111
  /**
92
112
  * Time Complexity: O(log n)
93
113
  * Space Complexity: O(1)
@@ -96,19 +116,20 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends
96
116
  * Time Complexity: O(log n)
97
117
  * Space Complexity: O(1)
98
118
  *
99
- * The function overrides the add method of a binary tree node and adds a new node to the tree.
100
- * @param keyOrNodeOrEntry - The `keyOrNodeOrEntry` parameter can be either a key, a node, or an
101
- * entry. It represents the key, node, or entry that you want to add to the binary tree.
119
+ * The function overrides the add method of a TypeScript class to add a new node to a data structure
120
+ * and update the count.
121
+ * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
122
+ * `keyOrNodeOrEntryOrRawElement` parameter can accept a value of type `R`, which can be any type. It
123
+ * can also accept a value of type `KeyOrNodeOrEntry<K, V, NODE>`, which represents a key, node,
124
+ * entry, or raw element
102
125
  * @param {V} [value] - The `value` parameter represents the value associated with the key in the
103
- * binary tree node. It is an optional parameter, meaning it can be omitted when calling the `add`
104
- * method.
126
+ * data structure. It is an optional parameter, so it can be omitted if not needed.
105
127
  * @param [count=1] - The `count` parameter represents the number of times the key-value pair should
106
- * be added to the binary tree. By default, it is set to 1, meaning that the key-value pair will be
107
- * added once. However, you can specify a different value for `count` if you want to add
108
- * @returns The method is returning either the newly inserted node or `undefined` if the insertion
109
- * was not successful.
128
+ * be added to the data structure. By default, it is set to 1, meaning that the key-value pair will
129
+ * be added once. However, you can specify a different value for `count` if you want to add
130
+ * @returns a boolean value.
110
131
  */
111
- add(keyOrNodeOrEntry: KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
132
+ add(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
112
133
  /**
113
134
  * Time Complexity: O(log n)
114
135
  * Space Complexity: O(1)
@@ -117,19 +138,19 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends
117
138
  * Time Complexity: O(log n)
118
139
  * Space Complexity: O(1)
119
140
  *
120
- * The `delete` function in TypeScript is used to remove a node from a binary tree, taking into
121
- * account the count of the node and balancing the tree if necessary.
122
- * @param identifier - The identifier is the value or key that is used to identify the node that
123
- * needs to be deleted from the binary tree. It can be of any type that is returned by the callback
141
+ * The `delete` function in a binary tree data structure deletes a node based on its identifier and
142
+ * returns the deleted node along with the parent node that needs to be balanced.
143
+ * @param identifier - The identifier parameter is the value used to identify the node that needs to
144
+ * be deleted from the binary tree. It can be of any type and is the return type of the callback
124
145
  * function.
125
- * @param {C} callback - The `callback` parameter is a function that is used to determine if a node
126
- * should be deleted. It is optional and defaults to a default callback function. The `callback`
127
- * function takes one parameter, which is the identifier of the node, and returns a value that is
128
- * used to identify the node to
146
+ * @param {C} callback - The `callback` parameter is a function that is used to determine the
147
+ * equality of nodes in the binary tree. It is optional and has a default value of
148
+ * `this._DEFAULT_CALLBACK`. The `callback` function takes a single argument, which is the identifier
149
+ * of a node, and returns a value that
129
150
  * @param [ignoreCount=false] - A boolean flag indicating whether to ignore the count of the node
130
151
  * being deleted. If set to true, the count of the node will not be considered and the node will be
131
- * deleted regardless of its count. If set to false (default), the count of the node will be
132
- * decremented by 1 and
152
+ * deleted regardless of its count. If set to false (default), the count of the node will be taken
153
+ * into account and the node
133
154
  * @returns an array of `BinaryTreeDeleteResult<NODE>`.
134
155
  */
135
156
  delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C>, callback?: C, ignoreCount?: boolean): BinaryTreeDeleteResult<NODE>[];
@@ -141,7 +162,8 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends
141
162
  * Time Complexity: O(1)
142
163
  * Space Complexity: O(1)
143
164
  *
144
- * The clear() function clears the contents of a data structure and sets the count to zero.
165
+ * The "clear" function overrides the parent class's "clear" function and also resets the count to
166
+ * zero.
145
167
  */
146
168
  clear(): void;
147
169
  /**
@@ -151,13 +173,14 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends
151
173
  /**
152
174
  * Time Complexity: O(n log n)
153
175
  * Space Complexity: O(log n)
154
- *
155
176
  * The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
156
177
  * tree using either a recursive or iterative approach.
157
- * @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
158
- * type of iteration to use when building the balanced binary search tree. It can have two possible
159
- * values:
160
- * @returns a boolean value.
178
+ * @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
179
+ * specifies the type of iteration to use when building the balanced binary search tree. It has a
180
+ * default value of `this.iterationType`, which means it will use the iteration type currently set in
181
+ * the object.
182
+ * @returns The function `perfectlyBalance` returns a boolean value. It returns `true` if the
183
+ * balancing operation is successful, and `false` if there are no nodes to balance.
161
184
  */
162
185
  perfectlyBalance(iterationType?: IterationType): boolean;
163
186
  /**
@@ -168,27 +191,42 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, NODE extends
168
191
  * Time complexity: O(n)
169
192
  * Space complexity: O(n)
170
193
  *
171
- * The `clone` function creates a deep copy of a tree object.
194
+ * The function overrides the clone method to create a deep copy of a tree object.
172
195
  * @returns The `clone()` method is returning a cloned instance of the `TREE` object.
173
196
  */
174
197
  clone(): TREE;
175
198
  /**
176
- * The `_swapProperties` function swaps the key, value, count, and height properties between two nodes.
177
- * @param {K | NODE | undefined} srcNode - The `srcNode` parameter represents the source node from
178
- * which the values will be swapped. It can be of type `K`, `NODE`, or `undefined`.
179
- * @param {K | NODE | undefined} destNode - The `destNode` parameter represents the destination
180
- * node where the values from the source node will be swapped to.
181
- * @returns either the `destNode` object if both `srcNode` and `destNode` are defined, or `undefined`
182
- * if either `srcNode` or `destNode` is undefined.
199
+ * Time Complexity: O(1)
200
+ * Space Complexity: O(1)
201
+ */
202
+ /**
203
+ * Time Complexity: O(1)
204
+ * Space Complexity: O(1)
205
+ *
206
+ * The `_swapProperties` function swaps the properties (key, value, count, height) between two nodes
207
+ * in a binary search tree.
208
+ * @param {R | BSTNKeyOrNode<K, NODE>} srcNode - The `srcNode` parameter represents the source node
209
+ * that will be swapped with the `destNode`.
210
+ * @param {R | BSTNKeyOrNode<K, NODE>} destNode - The `destNode` parameter represents the destination
211
+ * node where the properties will be swapped with the source node.
212
+ * @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
213
+ * If either `srcNode` or `destNode` is undefined, it returns `undefined`.
183
214
  */
184
- protected _swapProperties(srcNode: BSTNKeyOrNode<K, NODE>, destNode: BSTNKeyOrNode<K, NODE>): NODE | undefined;
215
+ protected _swapProperties(srcNode: R | BSTNKeyOrNode<K, NODE>, destNode: R | BSTNKeyOrNode<K, NODE>): NODE | undefined;
185
216
  /**
217
+ * Time Complexity: O(1)
218
+ * Space Complexity: O(1)
219
+ */
220
+ /**
221
+ * Time Complexity: O(1)
222
+ * Space Complexity: O(1)
223
+ *
186
224
  * The function replaces an old node with a new node and updates the count property of the new node.
187
- * @param {NODE} oldNode - The `oldNode` parameter is of type `NODE` and represents the node that
188
- * needs to be replaced in a data structure.
189
- * @param {NODE} newNode - The `newNode` parameter is an object of type `NODE`.
225
+ * @param {NODE} oldNode - The oldNode parameter represents the node that needs to be replaced in the
226
+ * data structure. It is of type NODE.
227
+ * @param {NODE} newNode - The `newNode` parameter is an instance of the `NODE` class.
190
228
  * @returns The method is returning the result of calling the `_replaceNode` method from the
191
- * superclass, after updating the `count` property of the `newNode` object.
229
+ * superclass, which is of type `NODE`.
192
230
  */
193
231
  protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
194
232
  }