undirected-graph-typed 1.51.9 → 1.52.2

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 +13 -13
  8. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +6 -6
  9. package/dist/data-structures/binary-tree/avl-tree.d.ts +13 -13
  10. package/dist/data-structures/binary-tree/avl-tree.js +6 -6
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +99 -99
  12. package/dist/data-structures/binary-tree/binary-tree.js +56 -54
  13. package/dist/data-structures/binary-tree/bst.d.ts +37 -45
  14. package/dist/data-structures/binary-tree/bst.js +19 -27
  15. package/dist/data-structures/binary-tree/rb-tree.d.ts +10 -10
  16. package/dist/data-structures/binary-tree/rb-tree.js +6 -6
  17. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +12 -12
  18. package/dist/data-structures/binary-tree/tree-multi-map.js +5 -5
  19. package/dist/data-structures/graph/directed-graph.js +2 -1
  20. package/dist/data-structures/hash/hash-map.d.ts +2 -2
  21. package/dist/data-structures/heap/heap.d.ts +43 -114
  22. package/dist/data-structures/heap/heap.js +59 -127
  23. package/dist/data-structures/heap/max-heap.d.ts +50 -4
  24. package/dist/data-structures/heap/max-heap.js +76 -10
  25. package/dist/data-structures/heap/min-heap.d.ts +51 -5
  26. package/dist/data-structures/heap/min-heap.js +68 -11
  27. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
  28. package/dist/data-structures/linked-list/doubly-linked-list.js +26 -28
  29. package/dist/data-structures/linked-list/singly-linked-list.d.ts +22 -25
  30. package/dist/data-structures/linked-list/singly-linked-list.js +29 -26
  31. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
  32. package/dist/data-structures/priority-queue/max-priority-queue.js +79 -10
  33. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
  34. package/dist/data-structures/priority-queue/min-priority-queue.js +71 -11
  35. package/dist/data-structures/priority-queue/priority-queue.d.ts +50 -4
  36. package/dist/data-structures/priority-queue/priority-queue.js +70 -1
  37. package/dist/data-structures/queue/deque.d.ts +27 -18
  38. package/dist/data-structures/queue/deque.js +43 -21
  39. package/dist/data-structures/queue/queue.d.ts +26 -29
  40. package/dist/data-structures/queue/queue.js +47 -38
  41. package/dist/data-structures/stack/stack.d.ts +17 -22
  42. package/dist/data-structures/stack/stack.js +25 -24
  43. package/dist/data-structures/trie/trie.d.ts +18 -13
  44. package/dist/data-structures/trie/trie.js +26 -15
  45. package/dist/interfaces/binary-tree.d.ts +4 -4
  46. package/dist/types/common.d.ts +1 -22
  47. package/dist/types/data-structures/base/base.d.ts +5 -2
  48. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -3
  49. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +2 -3
  50. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +20 -4
  51. package/dist/types/data-structures/binary-tree/bst.d.ts +5 -3
  52. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +2 -3
  53. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -3
  54. package/dist/types/data-structures/heap/heap.d.ts +3 -2
  55. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
  56. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
  57. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  58. package/dist/types/data-structures/queue/deque.d.ts +4 -2
  59. package/dist/types/data-structures/queue/queue.d.ts +4 -1
  60. package/dist/types/data-structures/stack/stack.d.ts +2 -1
  61. package/dist/types/data-structures/trie/trie.d.ts +3 -2
  62. package/package.json +2 -2
  63. package/src/data-structures/base/index.ts +2 -1
  64. package/src/data-structures/base/iterable-element-base.ts +250 -0
  65. package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +26 -217
  66. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +26 -26
  67. package/src/data-structures/binary-tree/avl-tree.ts +21 -21
  68. package/src/data-structures/binary-tree/binary-tree.ts +166 -161
  69. package/src/data-structures/binary-tree/bst.ts +61 -68
  70. package/src/data-structures/binary-tree/rb-tree.ts +19 -19
  71. package/src/data-structures/binary-tree/tree-multi-map.ts +19 -19
  72. package/src/data-structures/graph/abstract-graph.ts +15 -14
  73. package/src/data-structures/graph/directed-graph.ts +9 -7
  74. package/src/data-structures/graph/undirected-graph.ts +7 -6
  75. package/src/data-structures/hash/hash-map.ts +8 -8
  76. package/src/data-structures/heap/heap.ts +72 -153
  77. package/src/data-structures/heap/max-heap.ts +88 -13
  78. package/src/data-structures/heap/min-heap.ts +78 -15
  79. package/src/data-structures/linked-list/doubly-linked-list.ts +33 -33
  80. package/src/data-structures/linked-list/singly-linked-list.ts +38 -30
  81. package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
  82. package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
  83. package/src/data-structures/priority-queue/priority-queue.ts +81 -4
  84. package/src/data-structures/queue/deque.ts +53 -28
  85. package/src/data-structures/queue/queue.ts +61 -44
  86. package/src/data-structures/stack/stack.ts +32 -27
  87. package/src/data-structures/trie/trie.ts +34 -19
  88. package/src/interfaces/binary-tree.ts +4 -5
  89. package/src/types/common.ts +2 -24
  90. package/src/types/data-structures/base/base.ts +14 -6
  91. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +2 -3
  92. package/src/types/data-structures/binary-tree/avl-tree.ts +2 -3
  93. package/src/types/data-structures/binary-tree/binary-tree.ts +24 -5
  94. package/src/types/data-structures/binary-tree/bst.ts +9 -3
  95. package/src/types/data-structures/binary-tree/rb-tree.ts +2 -3
  96. package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -3
  97. package/src/types/data-structures/graph/abstract-graph.ts +8 -8
  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 +6 -1
  103. package/src/types/data-structures/queue/queue.ts +5 -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/types/utils/utils.ts +4 -4
@@ -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,11 +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, BTNKeyOrNodeOrEntry, IterationType } from '../../types';
9
9
  import { BTNEntry } from '../../types';
10
10
  import { IBinaryTree } from '../../interfaces';
11
11
  import { AVLTree, AVLTreeNode } from './avl-tree';
12
- 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> {
13
13
  /**
14
14
  * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
15
15
  * @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
@@ -37,7 +37,7 @@ export declare class AVLTreeMultiMapNode<K extends Comparable, V = any, NODE ext
37
37
  /**
38
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.
39
39
  */
40
- export declare class AVLTreeMultiMap<K extends Comparable, 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> {
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
41
  /**
42
42
  * The constructor initializes a new AVLTreeMultiMap object with optional initial elements.
43
43
  * @param keysOrNodesOrEntriesOrRawElements - The `keysOrNodesOrEntriesOrRawElements` parameter is an
@@ -46,7 +46,7 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, R = BTNEntry
46
46
  * behavior of the AVLTreeMultiMap. It can include properties such as `compareKeys` and
47
47
  * `compareValues` functions to define custom comparison logic for keys and values, respectively.
48
48
  */
49
- constructor(keysOrNodesOrEntriesOrRawElements?: Iterable<R | KeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeMultiMapOptions<K, V, R>);
49
+ constructor(keysOrNodesOrEntriesOrRawElements?: Iterable<R | BTNKeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeMultiMapOptions<K, V, R>);
50
50
  protected _count: number;
51
51
  /**
52
52
  * The function calculates the sum of the count property of all nodes in a tree using depth-first
@@ -89,17 +89,17 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, R = BTNEntry
89
89
  createTree(options?: AVLTreeMultiMapOptions<K, V, R>): TREE;
90
90
  /**
91
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>`.
92
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
93
+ * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `BTNKeyOrNodeOrEntry<K, V, NODE>`.
94
94
  * @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
95
95
  * an instance of the `AVLTreeMultiMapNode` class.
96
96
  */
97
- isNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
97
+ isNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
98
98
  /**
99
99
  * The function `keyValueOrEntryOrRawElementToNode` converts a key, value, entry, or raw element into
100
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>`.
101
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
102
+ * `keyOrNodeOrEntryOrRawElement` parameter can be of type `R` or `BTNKeyOrNodeOrEntry<K, V, NODE>`.
103
103
  * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
104
104
  * `override` function. It represents the value associated with the key in the data structure. If no
105
105
  * value is provided, it will default to `undefined`.
@@ -107,7 +107,7 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, R = BTNEntry
107
107
  * times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
108
108
  * @returns either a NODE object or undefined.
109
109
  */
110
- keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
110
+ keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
111
111
  /**
112
112
  * Time Complexity: O(log n)
113
113
  * Space Complexity: O(1)
@@ -118,9 +118,9 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, R = BTNEntry
118
118
  *
119
119
  * The function overrides the add method of a TypeScript class to add a new node to a data structure
120
120
  * and update the count.
121
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
121
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
122
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,
123
+ * can also accept a value of type `BTNKeyOrNodeOrEntry<K, V, NODE>`, which represents a key, node,
124
124
  * entry, or raw element
125
125
  * @param {V} [value] - The `value` parameter represents the value associated with the key in the
126
126
  * data structure. It is an optional parameter, so it can be omitted if not needed.
@@ -129,7 +129,7 @@ export declare class AVLTreeMultiMap<K extends Comparable, V = any, R = BTNEntry
129
129
  * be added once. However, you can specify a different value for `count` if you want to add
130
130
  * @returns a boolean value.
131
131
  */
132
- add(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
132
+ add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
133
133
  /**
134
134
  * Time Complexity: O(log n)
135
135
  * Space Complexity: O(1)
@@ -104,8 +104,8 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
104
104
  }
105
105
  /**
106
106
  * The function checks if the input is an instance of AVLTreeMultiMapNode.
107
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
108
- * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
107
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
108
+ * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `BTNKeyOrNodeOrEntry<K, V, NODE>`.
109
109
  * @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
110
110
  * an instance of the `AVLTreeMultiMapNode` class.
111
111
  */
@@ -115,8 +115,8 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
115
115
  /**
116
116
  * The function `keyValueOrEntryOrRawElementToNode` converts a key, value, entry, or raw element into
117
117
  * a node object.
118
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
119
- * `keyOrNodeOrEntryOrRawElement` parameter can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
118
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
119
+ * `keyOrNodeOrEntryOrRawElement` parameter can be of type `R` or `BTNKeyOrNodeOrEntry<K, V, NODE>`.
120
120
  * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
121
121
  * `override` function. It represents the value associated with the key in the data structure. If no
122
122
  * value is provided, it will default to `undefined`.
@@ -155,9 +155,9 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
155
155
  *
156
156
  * The function overrides the add method of a TypeScript class to add a new node to a data structure
157
157
  * and update the count.
158
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
158
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
159
159
  * `keyOrNodeOrEntryOrRawElement` parameter can accept a value of type `R`, which can be any type. It
160
- * can also accept a value of type `KeyOrNodeOrEntry<K, V, NODE>`, which represents a key, node,
160
+ * can also accept a value of type `BTNKeyOrNodeOrEntry<K, V, NODE>`, which represents a key, node,
161
161
  * entry, or raw element
162
162
  * @param {V} [value] - The `value` parameter represents the value associated with the key in the
163
163
  * data structure. It is an optional parameter, so it can be omitted if not needed.
@@ -6,10 +6,10 @@
6
6
  * @license MIT License
7
7
  */
8
8
  import { BST, BSTNode } from './bst';
9
- import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, Comparable, KeyOrNodeOrEntry } from '../../types';
9
+ import type { AVLTreeNested, AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, BTNKeyOrNodeOrEntry } from '../../types';
10
10
  import { BTNEntry } from '../../types';
11
11
  import { IBinaryTree } from '../../interfaces';
12
- export declare class AVLTreeNode<K extends Comparable, V = any, NODE extends AVLTreeNode<K, V, NODE> = AVLTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
12
+ export declare class AVLTreeNode<K = any, V = any, NODE extends AVLTreeNode<K, V, NODE> = AVLTreeNodeNested<K, V>> extends BSTNode<K, V, NODE> {
13
13
  /**
14
14
  * The constructor function initializes a new instance of a class with a key and an optional value,
15
15
  * and sets the height property to 0.
@@ -41,7 +41,7 @@ export declare class AVLTreeNode<K extends Comparable, V = any, NODE extends AVL
41
41
  * 6. Complex Insertions and Deletions: Due to rebalancing, these operations are more complex than in a regular BST.
42
42
  * 7. Path Length: The path length from the root to any leaf is longer compared to an unbalanced BST, but shorter than a linear chain of nodes.
43
43
  */
44
- export declare class AVLTree<K extends Comparable, V = any, R = BTNEntry<K, V>, NODE extends AVLTreeNode<K, V, NODE> = AVLTreeNode<K, V, AVLTreeNodeNested<K, V>>, TREE extends AVLTree<K, V, R, NODE, TREE> = AVLTree<K, V, R, NODE, AVLTreeNested<K, V, R, NODE>>> extends BST<K, V, R, NODE, TREE> implements IBinaryTree<K, V, R, NODE, TREE> {
44
+ export declare class AVLTree<K = any, V = any, R = BTNEntry<K, V>, NODE extends AVLTreeNode<K, V, NODE> = AVLTreeNode<K, V, AVLTreeNodeNested<K, V>>, TREE extends AVLTree<K, V, R, NODE, TREE> = AVLTree<K, V, R, NODE, AVLTreeNested<K, V, R, NODE>>> extends BST<K, V, R, NODE, TREE> implements IBinaryTree<K, V, R, NODE, TREE> {
45
45
  /**
46
46
  * This is a constructor function for an AVLTree class that initializes the tree with keys, nodes,
47
47
  * entries, or raw elements.
@@ -53,7 +53,7 @@ export declare class AVLTree<K extends Comparable, V = any, R = BTNEntry<K, V>,
53
53
  * keys), `allowDuplicates` (a boolean indicating whether duplicate keys are allowed), and
54
54
  * `nodeBuilder` (
55
55
  */
56
- constructor(keysOrNodesOrEntriesOrRawElements?: Iterable<R | KeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeOptions<K, V, R>);
56
+ constructor(keysOrNodesOrEntriesOrRawElements?: Iterable<R | BTNKeyOrNodeOrEntry<K, V, NODE>>, options?: AVLTreeOptions<K, V, R>);
57
57
  /**
58
58
  * The function creates a new AVL tree node with the given key and value.
59
59
  * @param {K} key - The key parameter is of type K, which represents the key of the node being
@@ -74,12 +74,12 @@ export declare class AVLTree<K extends Comparable, V = any, R = BTNEntry<K, V>,
74
74
  createTree(options?: AVLTreeOptions<K, V, R>): TREE;
75
75
  /**
76
76
  * The function checks if the input is an instance of AVLTreeNode.
77
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
78
- * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
77
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
78
+ * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `BTNKeyOrNodeOrEntry<K, V, NODE>`.
79
79
  * @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
80
80
  * an instance of the `AVLTreeNode` class.
81
81
  */
82
- isNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
82
+ isNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
83
83
  /**
84
84
  * Time Complexity: O(log n)
85
85
  * Space Complexity: O(1)
@@ -91,14 +91,14 @@ export declare class AVLTree<K extends Comparable, V = any, R = BTNEntry<K, V>,
91
91
  *
92
92
  * The function overrides the add method of a class and inserts a key-value pair into a data
93
93
  * structure, then balances the path.
94
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
95
- * `keyOrNodeOrEntryOrRawElement` can accept values of type `R`, `KeyOrNodeOrEntry<K, V, NODE>`, or
94
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
95
+ * `keyOrNodeOrEntryOrRawElement` can accept values of type `R`, `BTNKeyOrNodeOrEntry<K, V, NODE>`, or
96
96
  * `RawElement`.
97
97
  * @param {V} [value] - The `value` parameter is an optional value that you want to associate with
98
98
  * the key or node being added to the data structure.
99
99
  * @returns The method is returning a boolean value.
100
100
  */
101
- add(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
101
+ add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V): boolean;
102
102
  /**
103
103
  * Time Complexity: O(log n)
104
104
  * Space Complexity: O(1)
@@ -222,10 +222,10 @@ export declare class AVLTree<K extends Comparable, V = any, R = BTNEntry<K, V>,
222
222
  *
223
223
  * The `_balancePath` function is used to update the heights of nodes and perform rotation operations
224
224
  * to restore balance in an AVL tree after inserting a node.
225
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} node - The `node` parameter can be of type `R` or
226
- * `KeyOrNodeOrEntry<K, V, NODE>`.
225
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} node - The `node` parameter can be of type `R` or
226
+ * `BTNKeyOrNodeOrEntry<K, V, NODE>`.
227
227
  */
228
- protected _balancePath(node: R | KeyOrNodeOrEntry<K, V, NODE>): void;
228
+ protected _balancePath(node: R | BTNKeyOrNodeOrEntry<K, V, NODE>): void;
229
229
  /**
230
230
  * Time Complexity: O(1)
231
231
  * Space Complexity: O(1)
@@ -89,8 +89,8 @@ class AVLTree extends bst_1.BST {
89
89
  }
90
90
  /**
91
91
  * The function checks if the input is an instance of AVLTreeNode.
92
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
93
- * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
92
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
93
+ * `keyOrNodeOrEntryOrRawElement` can be of type `R` or `BTNKeyOrNodeOrEntry<K, V, NODE>`.
94
94
  * @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
95
95
  * an instance of the `AVLTreeNode` class.
96
96
  */
@@ -108,8 +108,8 @@ class AVLTree extends bst_1.BST {
108
108
  *
109
109
  * The function overrides the add method of a class and inserts a key-value pair into a data
110
110
  * structure, then balances the path.
111
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
112
- * `keyOrNodeOrEntryOrRawElement` can accept values of type `R`, `KeyOrNodeOrEntry<K, V, NODE>`, or
111
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
112
+ * `keyOrNodeOrEntryOrRawElement` can accept values of type `R`, `BTNKeyOrNodeOrEntry<K, V, NODE>`, or
113
113
  * `RawElement`.
114
114
  * @param {V} [value] - The `value` parameter is an optional value that you want to associate with
115
115
  * the key or node being added to the data structure.
@@ -439,8 +439,8 @@ class AVLTree extends bst_1.BST {
439
439
  *
440
440
  * The `_balancePath` function is used to update the heights of nodes and perform rotation operations
441
441
  * to restore balance in an AVL tree after inserting a node.
442
- * @param {R | KeyOrNodeOrEntry<K, V, NODE>} node - The `node` parameter can be of type `R` or
443
- * `KeyOrNodeOrEntry<K, V, NODE>`.
442
+ * @param {R | BTNKeyOrNodeOrEntry<K, V, NODE>} node - The `node` parameter can be of type `R` or
443
+ * `BTNKeyOrNodeOrEntry<K, V, NODE>`.
444
444
  */
445
445
  _balancePath(node) {
446
446
  node = this.ensureNode(node);