data-structure-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.
- package/CHANGELOG.md +1 -1
- package/README.md +13 -13
- package/benchmark/report.html +13 -13
- package/benchmark/report.json +152 -152
- package/dist/cjs/data-structures/base/index.d.ts +2 -1
- package/dist/cjs/data-structures/base/index.js +2 -1
- package/dist/cjs/data-structures/base/index.js.map +1 -1
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +171 -0
- package/dist/cjs/data-structures/base/iterable-element-base.js +226 -0
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -0
- package/dist/cjs/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
- package/dist/cjs/data-structures/base/{iterable-base.js → iterable-entry-base.js} +13 -190
- package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +106 -68
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +119 -87
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +82 -62
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +78 -59
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +318 -226
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +475 -363
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +192 -202
- package/dist/cjs/data-structures/binary-tree/bst.js +207 -249
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +73 -74
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +107 -98
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +92 -75
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +105 -93
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +10 -15
- package/dist/cjs/data-structures/graph/abstract-graph.js +10 -15
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +33 -40
- package/dist/cjs/data-structures/hash/hash-map.js +40 -55
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +43 -114
- package/dist/cjs/data-structures/heap/heap.js +59 -127
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/max-heap.d.ts +50 -4
- package/dist/cjs/data-structures/heap/max-heap.js +76 -10
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/min-heap.d.ts +51 -5
- package/dist/cjs/data-structures/heap/min-heap.js +68 -11
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +26 -28
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +22 -25
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +29 -26
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +79 -10
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +71 -11
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +50 -4
- package/dist/cjs/data-structures/priority-queue/priority-queue.js +70 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +21 -20
- package/dist/cjs/data-structures/queue/deque.js +29 -23
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +8 -28
- package/dist/cjs/data-structures/queue/queue.js +15 -31
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +17 -22
- package/dist/cjs/data-structures/stack/stack.js +25 -24
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +19 -14
- package/dist/cjs/data-structures/trie/trie.js +27 -16
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/interfaces/binary-tree.d.ts +7 -7
- package/dist/cjs/types/common.d.ts +1 -2
- package/dist/cjs/types/data-structures/base/base.d.ts +5 -2
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -4
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +3 -4
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +5 -5
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +4 -5
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +3 -4
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
- package/dist/cjs/types/data-structures/heap/heap.d.ts +3 -2
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/cjs/types/data-structures/queue/deque.d.ts +3 -2
- package/dist/cjs/types/data-structures/queue/queue.d.ts +2 -1
- package/dist/cjs/types/data-structures/stack/stack.d.ts +2 -1
- package/dist/cjs/types/data-structures/trie/trie.d.ts +3 -2
- package/dist/cjs/utils/utils.js +3 -5
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/mjs/data-structures/base/index.d.ts +2 -1
- package/dist/mjs/data-structures/base/index.js +2 -1
- package/dist/mjs/data-structures/base/iterable-element-base.d.ts +171 -0
- package/dist/mjs/data-structures/base/iterable-element-base.js +222 -0
- package/dist/mjs/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
- package/dist/mjs/data-structures/base/{iterable-base.js → iterable-entry-base.js} +10 -186
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +106 -68
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +119 -87
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +82 -62
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +78 -59
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +318 -226
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +476 -364
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +192 -202
- package/dist/mjs/data-structures/binary-tree/bst.js +211 -255
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +73 -74
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +107 -98
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +92 -75
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +105 -93
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +10 -15
- package/dist/mjs/data-structures/graph/abstract-graph.js +10 -15
- package/dist/mjs/data-structures/hash/hash-map.d.ts +33 -40
- package/dist/mjs/data-structures/hash/hash-map.js +41 -55
- package/dist/mjs/data-structures/heap/heap.d.ts +43 -114
- package/dist/mjs/data-structures/heap/heap.js +60 -128
- package/dist/mjs/data-structures/heap/max-heap.d.ts +50 -4
- package/dist/mjs/data-structures/heap/max-heap.js +79 -10
- package/dist/mjs/data-structures/heap/min-heap.d.ts +51 -5
- package/dist/mjs/data-structures/heap/min-heap.js +68 -11
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +26 -28
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +22 -25
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +29 -26
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +82 -10
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +71 -11
- package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +50 -4
- package/dist/mjs/data-structures/priority-queue/priority-queue.js +70 -1
- package/dist/mjs/data-structures/queue/deque.d.ts +21 -20
- package/dist/mjs/data-structures/queue/deque.js +29 -23
- package/dist/mjs/data-structures/queue/queue.d.ts +8 -28
- package/dist/mjs/data-structures/queue/queue.js +15 -31
- package/dist/mjs/data-structures/stack/stack.d.ts +17 -22
- package/dist/mjs/data-structures/stack/stack.js +25 -24
- package/dist/mjs/data-structures/trie/trie.d.ts +19 -14
- package/dist/mjs/data-structures/trie/trie.js +27 -16
- package/dist/mjs/interfaces/binary-tree.d.ts +7 -7
- package/dist/mjs/types/common.d.ts +1 -2
- package/dist/mjs/types/data-structures/base/base.d.ts +5 -2
- package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -4
- package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +3 -4
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +5 -5
- package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +4 -5
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +3 -4
- package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +3 -4
- package/dist/mjs/types/data-structures/heap/heap.d.ts +3 -2
- package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
- package/dist/mjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/mjs/types/data-structures/queue/deque.d.ts +3 -2
- package/dist/mjs/types/data-structures/queue/queue.d.ts +2 -1
- package/dist/mjs/types/data-structures/stack/stack.d.ts +2 -1
- package/dist/mjs/types/data-structures/trie/trie.d.ts +3 -2
- package/dist/mjs/utils/utils.js +3 -5
- package/dist/umd/data-structure-typed.js +1949 -1481
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +6 -6
- package/src/data-structures/base/index.ts +2 -1
- package/src/data-structures/base/iterable-element-base.ts +250 -0
- package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +22 -213
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +144 -95
- package/src/data-structures/binary-tree/avl-tree.ts +96 -69
- package/src/data-structures/binary-tree/binary-tree.ts +535 -403
- package/src/data-structures/binary-tree/bst.ts +247 -277
- package/src/data-structures/binary-tree/rb-tree.ts +123 -103
- package/src/data-structures/binary-tree/tree-multi-map.ts +127 -102
- package/src/data-structures/graph/abstract-graph.ts +10 -10
- package/src/data-structures/hash/hash-map.ts +46 -53
- package/src/data-structures/heap/heap.ts +71 -152
- package/src/data-structures/heap/max-heap.ts +88 -13
- package/src/data-structures/heap/min-heap.ts +78 -15
- package/src/data-structures/linked-list/doubly-linked-list.ts +32 -32
- package/src/data-structures/linked-list/singly-linked-list.ts +37 -29
- package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
- package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
- package/src/data-structures/priority-queue/priority-queue.ts +81 -4
- package/src/data-structures/queue/deque.ts +37 -26
- package/src/data-structures/queue/queue.ts +23 -36
- package/src/data-structures/stack/stack.ts +31 -26
- package/src/data-structures/trie/trie.ts +35 -20
- package/src/interfaces/binary-tree.ts +9 -9
- package/src/types/common.ts +1 -2
- package/src/types/data-structures/base/base.ts +14 -6
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +3 -4
- package/src/types/data-structures/binary-tree/avl-tree.ts +3 -4
- package/src/types/data-structures/binary-tree/binary-tree.ts +6 -6
- package/src/types/data-structures/binary-tree/bst.ts +4 -5
- package/src/types/data-structures/binary-tree/rb-tree.ts +3 -4
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +3 -4
- package/src/types/data-structures/heap/heap.ts +4 -1
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -1
- package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -1
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
- package/src/types/data-structures/queue/deque.ts +3 -1
- package/src/types/data-structures/queue/queue.ts +3 -1
- package/src/types/data-structures/stack/stack.ts +3 -1
- package/src/types/data-structures/trie/trie.ts +3 -1
- package/src/utils/utils.ts +3 -3
- package/test/integration/avl-tree.test.ts +2 -2
- package/test/integration/bst.test.ts +3 -3
- package/test/integration/index.html +25 -11
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +68 -0
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +56 -0
- package/test/unit/data-structures/graph/directed-graph.test.ts +2 -2
- package/test/unit/data-structures/heap/heap.test.ts +80 -0
- package/test/unit/data-structures/heap/max-heap.test.ts +44 -1
- package/test/unit/data-structures/heap/min-heap.test.ts +18 -1
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +42 -0
- package/test/unit/data-structures/queue/deque.test.ts +30 -0
- package/test/unit/data-structures/queue/queue.test.ts +56 -0
- package/test/utils/big-o.ts +12 -6
- package/tsconfig-base.json +1 -0
- package/dist/cjs/data-structures/base/iterable-base.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rb-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/rb-tree.ts"],"names":[],"mappings":";;;AAWA,+BAAqC;AAGrC,MAAa,g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YACN,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;QACrB,CAAC;QAED,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACf,CAAC;CACF;AAnnBD,oCAmnBC"}
|
|
@@ -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 { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback,
|
|
8
|
+
import type { BinaryTreeDeleteResult, BSTNKeyOrNode, BTNCallback, IterationType, KeyOrNodeOrEntry, RBTNColor, TreeMultiMapNested, TreeMultiMapNodeNested, TreeMultiMapOptions } from '../../types';
|
|
9
|
+
import { BTNEntry } from '../../types';
|
|
9
10
|
import { IBinaryTree } from '../../interfaces';
|
|
10
11
|
import { RedBlackTree, RedBlackTreeNode } from './rb-tree';
|
|
11
|
-
export declare class TreeMultiMapNode<K
|
|
12
|
+
export declare class TreeMultiMapNode<K = any, V = any, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNodeNested<K, V>> extends RedBlackTreeNode<K, V, NODE> {
|
|
12
13
|
/**
|
|
13
14
|
* The constructor function initializes a Red-Black Tree node with a key, value, count, and color.
|
|
14
15
|
* @param {K} key - The key parameter represents the key of the node in the Red-Black Tree. It is
|
|
@@ -35,17 +36,17 @@ export declare class TreeMultiMapNode<K extends Comparable, V = any, NODE extend
|
|
|
35
36
|
*/
|
|
36
37
|
set count(value: number);
|
|
37
38
|
}
|
|
38
|
-
export declare class TreeMultiMap<K
|
|
39
|
+
export declare class TreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE extends TreeMultiMapNode<K, V, NODE> = TreeMultiMapNode<K, V, TreeMultiMapNodeNested<K, V>>, TREE extends TreeMultiMap<K, V, R, NODE, TREE> = TreeMultiMap<K, V, R, NODE, TreeMultiMapNested<K, V, R, NODE>>> extends RedBlackTree<K, V, R, NODE, TREE> implements IBinaryTree<K, V, R, NODE, TREE> {
|
|
39
40
|
/**
|
|
40
|
-
* The constructor function initializes a
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* The constructor function initializes a TreeMultiMap object with optional initial data.
|
|
42
|
+
* @param keysOrNodesOrEntriesOrRawElements - The parameter `keysOrNodesOrEntriesOrRawElements` is an
|
|
43
|
+
* iterable that can contain keys, nodes, entries, or raw elements. It is used to initialize the
|
|
44
|
+
* TreeMultiMap with initial data.
|
|
45
|
+
* @param [options] - The `options` parameter is an optional object that can be used to customize the
|
|
46
|
+
* behavior of the `TreeMultiMap` constructor. It can include properties such as `compareKeys` and
|
|
47
|
+
* `compareValues`, which are functions used to compare keys and values respectively.
|
|
47
48
|
*/
|
|
48
|
-
constructor(
|
|
49
|
+
constructor(keysOrNodesOrEntriesOrRawElements?: Iterable<KeyOrNodeOrEntry<K, V, NODE>>, options?: TreeMultiMapOptions<K, V, R>);
|
|
49
50
|
protected _count: number;
|
|
50
51
|
/**
|
|
51
52
|
* The function calculates the sum of the count property of all nodes in a tree structure.
|
|
@@ -68,48 +69,47 @@ export declare class TreeMultiMap<K extends Comparable, V = any, NODE extends Tr
|
|
|
68
69
|
/**
|
|
69
70
|
* The function creates a new TreeMultiMapNode with the specified key, value, color, and count.
|
|
70
71
|
* @param {K} key - The key parameter represents the key of the node being created. It is of type K,
|
|
71
|
-
* which is a generic type representing the
|
|
72
|
-
* @param {V} [value] - The `value` parameter
|
|
73
|
-
* node. It is
|
|
74
|
-
* function. If provided, it should be of type `V`.
|
|
72
|
+
* which is a generic type representing the type of keys in the tree.
|
|
73
|
+
* @param {V} [value] - The `value` parameter is an optional parameter that represents the value
|
|
74
|
+
* associated with the key in the node. It is of type `V`, which can be any data type.
|
|
75
75
|
* @param {RBTNColor} [color=BLACK] - The color parameter is used to specify the color of the node in
|
|
76
76
|
* a Red-Black Tree. It can have two possible values: 'RED' or 'BLACK'. The default value is 'BLACK'.
|
|
77
77
|
* @param {number} [count] - The `count` parameter represents the number of occurrences of a key in
|
|
78
78
|
* the tree. It is an optional parameter and is used to keep track of the number of values associated
|
|
79
79
|
* with a key in the tree.
|
|
80
|
-
* @returns A new instance of the TreeMultiMapNode class
|
|
80
|
+
* @returns A new instance of the TreeMultiMapNode class, casted as NODE.
|
|
81
81
|
*/
|
|
82
82
|
createNode(key: K, value?: V, color?: RBTNColor, count?: number): NODE;
|
|
83
83
|
/**
|
|
84
84
|
* The function creates a new instance of a TreeMultiMap with the specified options and returns it.
|
|
85
85
|
* @param [options] - The `options` parameter is an optional object that contains additional
|
|
86
|
-
* configuration options for creating the `TreeMultiMap`. It
|
|
87
|
-
*
|
|
86
|
+
* configuration options for creating the `TreeMultiMap`. It is of type `TreeMultiMapOptions<K, V,
|
|
87
|
+
* R>`.
|
|
88
88
|
* @returns a new instance of the `TreeMultiMap` class, with the provided options merged with the
|
|
89
|
-
* existing `iterationType`
|
|
89
|
+
* existing `iterationType` property. The returned value is casted as `TREE`.
|
|
90
90
|
*/
|
|
91
|
-
createTree(options?: TreeMultiMapOptions<K>): TREE;
|
|
91
|
+
createTree(options?: TreeMultiMapOptions<K, V, R>): TREE;
|
|
92
92
|
/**
|
|
93
|
-
* The function `
|
|
94
|
-
*
|
|
95
|
-
* @param
|
|
96
|
-
*
|
|
97
|
-
* @param {V} [value] - The `value` parameter is an optional value
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
93
|
+
* The function `keyValueOrEntryOrRawElementToNode` takes in a key, value, and count and returns a
|
|
94
|
+
* node based on the input.
|
|
95
|
+
* @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
|
|
96
|
+
* `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
|
|
97
|
+
* @param {V} [value] - The `value` parameter is an optional value that represents the value
|
|
98
|
+
* associated with the key in the node. It is used when creating a new node or updating the value of
|
|
99
|
+
* an existing node.
|
|
100
|
+
* @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
|
|
101
|
+
* times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
|
|
102
|
+
* @returns either a NODE object or undefined.
|
|
102
103
|
*/
|
|
103
|
-
|
|
104
|
+
keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
|
|
104
105
|
/**
|
|
105
|
-
* The function
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* of the `TreeMultiMapNode` class.
|
|
106
|
+
* The function checks if the input is an instance of the TreeMultiMapNode class.
|
|
107
|
+
* @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
|
|
108
|
+
* `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
|
|
109
|
+
* @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
|
|
110
|
+
* an instance of the `TreeMultiMapNode` class.
|
|
111
111
|
*/
|
|
112
|
-
isNode(
|
|
112
|
+
isNode(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>): keyOrNodeOrEntryOrRawElement is NODE;
|
|
113
113
|
/**
|
|
114
114
|
* Time Complexity: O(log n)
|
|
115
115
|
* Space Complexity: O(1)
|
|
@@ -118,16 +118,19 @@ export declare class TreeMultiMap<K extends Comparable, V = any, NODE extends Tr
|
|
|
118
118
|
* Time Complexity: O(log n)
|
|
119
119
|
* Space Complexity: O(1)
|
|
120
120
|
*
|
|
121
|
-
* The function overrides the add method
|
|
122
|
-
*
|
|
121
|
+
* The function overrides the add method of a class and adds a new node to a data structure, updating
|
|
122
|
+
* the count and returning a boolean indicating success.
|
|
123
|
+
* @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
|
|
124
|
+
* `keyOrNodeOrEntryOrRawElement` parameter can accept one of the following types:
|
|
123
125
|
* @param {V} [value] - The `value` parameter represents the value associated with the key in the
|
|
124
|
-
* data structure.
|
|
126
|
+
* data structure. It is an optional parameter, so it can be omitted if not needed.
|
|
125
127
|
* @param [count=1] - The `count` parameter represents the number of times the key-value pair should
|
|
126
|
-
* be added to the data structure. By default, it is set to 1, meaning that
|
|
127
|
-
*
|
|
128
|
-
* @returns a boolean value.
|
|
128
|
+
* be added to the data structure. By default, it is set to 1, meaning that if no value is provided
|
|
129
|
+
* for `count`, the key-value pair will be added once.
|
|
130
|
+
* @returns The method is returning a boolean value. It returns true if the addition of the new node
|
|
131
|
+
* was successful, and false otherwise.
|
|
129
132
|
*/
|
|
130
|
-
add(
|
|
133
|
+
add(keyOrNodeOrEntryOrRawElement: R | KeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
|
|
131
134
|
/**
|
|
132
135
|
* Time Complexity: O(log n)
|
|
133
136
|
* Space Complexity: O(1)
|
|
@@ -136,20 +139,18 @@ export declare class TreeMultiMap<K extends Comparable, V = any, NODE extends Tr
|
|
|
136
139
|
* Time Complexity: O(log n)
|
|
137
140
|
* Space Complexity: O(1)
|
|
138
141
|
*
|
|
139
|
-
* The `delete`
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* and the node will be deleted regardless of its count. If set to false (default), the count of the
|
|
152
|
-
* target node will be decremented
|
|
142
|
+
* The function `delete` is used to remove a node from a binary tree and fix the tree if necessary.
|
|
143
|
+
* @param {ReturnType<C> | null | undefined} identifier - The `identifier` parameter is the value or
|
|
144
|
+
* key that is used to identify the node that needs to be deleted from the binary tree. It can be of
|
|
145
|
+
* any type that is returned by the callback function `C`. It can also be `null` or `undefined` if
|
|
146
|
+
* the node to be deleted
|
|
147
|
+
* @param {C} callback - The `callback` parameter is a function that is used to determine the
|
|
148
|
+
* equality of nodes in the binary tree. It is optional and has a default value of
|
|
149
|
+
* `this._DEFAULT_CALLBACK`. The `callback` function is used to compare nodes when searching for a
|
|
150
|
+
* specific node or when performing other operations on the
|
|
151
|
+
* @param [ignoreCount=false] - A boolean flag indicating whether to ignore the count of the node
|
|
152
|
+
* being deleted. If set to true, the count of the node will not be taken into account when deleting
|
|
153
|
+
* it. If set to false, the count of the node will be decremented by 1 before deleting it.
|
|
153
154
|
* @returns an array of BinaryTreeDeleteResult<NODE> objects.
|
|
154
155
|
*/
|
|
155
156
|
delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C> | null | undefined, callback?: C, ignoreCount?: boolean): BinaryTreeDeleteResult<NODE>[];
|
|
@@ -175,10 +176,12 @@ export declare class TreeMultiMap<K extends Comparable, V = any, NODE extends Tr
|
|
|
175
176
|
*
|
|
176
177
|
* The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
|
|
177
178
|
* tree using either a recursive or iterative approach.
|
|
178
|
-
* @param iterationType - The `iterationType` parameter is an optional parameter that
|
|
179
|
-
* type of iteration to use when building the balanced binary search tree. It
|
|
180
|
-
*
|
|
181
|
-
*
|
|
179
|
+
* @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
|
|
180
|
+
* specifies the type of iteration to use when building the balanced binary search tree. It has a
|
|
181
|
+
* default value of `this.iterationType`, which means it will use the iteration type specified by the
|
|
182
|
+
* `iterationType` property of the current object.
|
|
183
|
+
* @returns The function `perfectlyBalance` returns a boolean value. It returns `true` if the
|
|
184
|
+
* balancing operation is successful, and `false` if there are no nodes to balance.
|
|
182
185
|
*/
|
|
183
186
|
perfectlyBalance(iterationType?: IterationType): boolean;
|
|
184
187
|
/**
|
|
@@ -194,24 +197,38 @@ export declare class TreeMultiMap<K extends Comparable, V = any, NODE extends Tr
|
|
|
194
197
|
*/
|
|
195
198
|
clone(): TREE;
|
|
196
199
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*
|
|
200
|
+
* Time Complexity: O(1)
|
|
201
|
+
* Space Complexity: O(1)
|
|
202
|
+
*/
|
|
203
|
+
/**
|
|
204
|
+
* Time Complexity: O(1)
|
|
205
|
+
* Space Complexity: O(1)
|
|
206
|
+
*
|
|
207
|
+
* The `_swapProperties` function swaps the properties (key, value, count, color) between two nodes
|
|
208
|
+
* in a binary search tree.
|
|
209
|
+
* @param {R | BSTNKeyOrNode<K, NODE>} srcNode - The `srcNode` parameter represents the source node
|
|
210
|
+
* that will be swapped with the `destNode`. It can be either an instance of the `R` class or an
|
|
211
|
+
* instance of the `BSTNKeyOrNode<K, NODE>` class.
|
|
212
|
+
* @param {R | BSTNKeyOrNode<K, NODE>} destNode - The `destNode` parameter represents the destination
|
|
213
|
+
* node where the properties will be swapped with the source node.
|
|
202
214
|
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
203
|
-
* If
|
|
204
|
-
|
|
205
|
-
|
|
215
|
+
* If either `srcNode` or `destNode` is undefined, it returns undefined.
|
|
216
|
+
*/
|
|
217
|
+
protected _swapProperties(srcNode: R | BSTNKeyOrNode<K, NODE>, destNode: R | BSTNKeyOrNode<K, NODE>): NODE | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* Time Complexity: O(1)
|
|
220
|
+
* Space Complexity: O(1)
|
|
206
221
|
*/
|
|
207
|
-
protected _swapProperties(srcNode: BSTNKeyOrNode<K, NODE>, destNode: BSTNKeyOrNode<K, NODE>): NODE | undefined;
|
|
208
222
|
/**
|
|
223
|
+
* Time Complexity: O(1)
|
|
224
|
+
* Space Complexity: O(1)
|
|
225
|
+
*
|
|
209
226
|
* The function replaces an old node with a new node and updates the count property of the new node.
|
|
210
|
-
* @param {NODE} oldNode - The `oldNode` parameter is
|
|
211
|
-
*
|
|
212
|
-
* @param {NODE} newNode - The `newNode` parameter is an
|
|
227
|
+
* @param {NODE} oldNode - The `oldNode` parameter is the node that you want to replace in the data
|
|
228
|
+
* structure.
|
|
229
|
+
* @param {NODE} newNode - The `newNode` parameter is an instance of the `NODE` class.
|
|
213
230
|
* @returns The method is returning the result of calling the `_replaceNode` method from the
|
|
214
|
-
* superclass,
|
|
231
|
+
* superclass, which is of type `NODE`.
|
|
215
232
|
*/
|
|
216
233
|
protected _replaceNode(oldNode: NODE, newNode: NODE): NODE;
|
|
217
234
|
}
|
|
@@ -39,19 +39,19 @@ class TreeMultiMapNode extends rb_tree_1.RedBlackTreeNode {
|
|
|
39
39
|
exports.TreeMultiMapNode = TreeMultiMapNode;
|
|
40
40
|
class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
41
41
|
/**
|
|
42
|
-
* The constructor function initializes a
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
42
|
+
* The constructor function initializes a TreeMultiMap object with optional initial data.
|
|
43
|
+
* @param keysOrNodesOrEntriesOrRawElements - The parameter `keysOrNodesOrEntriesOrRawElements` is an
|
|
44
|
+
* iterable that can contain keys, nodes, entries, or raw elements. It is used to initialize the
|
|
45
|
+
* TreeMultiMap with initial data.
|
|
46
|
+
* @param [options] - The `options` parameter is an optional object that can be used to customize the
|
|
47
|
+
* behavior of the `TreeMultiMap` constructor. It can include properties such as `compareKeys` and
|
|
48
|
+
* `compareValues`, which are functions used to compare keys and values respectively.
|
|
49
49
|
*/
|
|
50
|
-
constructor(
|
|
50
|
+
constructor(keysOrNodesOrEntriesOrRawElements = [], options) {
|
|
51
51
|
super([], options);
|
|
52
52
|
this._count = 0;
|
|
53
|
-
if (
|
|
54
|
-
this.addMany(
|
|
53
|
+
if (keysOrNodesOrEntriesOrRawElements)
|
|
54
|
+
this.addMany(keysOrNodesOrEntriesOrRawElements);
|
|
55
55
|
}
|
|
56
56
|
// TODO the _count is not accurate after nodes count modified
|
|
57
57
|
/**
|
|
@@ -81,16 +81,15 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
81
81
|
/**
|
|
82
82
|
* The function creates a new TreeMultiMapNode with the specified key, value, color, and count.
|
|
83
83
|
* @param {K} key - The key parameter represents the key of the node being created. It is of type K,
|
|
84
|
-
* which is a generic type representing the
|
|
85
|
-
* @param {V} [value] - The `value` parameter
|
|
86
|
-
* node. It is
|
|
87
|
-
* function. If provided, it should be of type `V`.
|
|
84
|
+
* which is a generic type representing the type of keys in the tree.
|
|
85
|
+
* @param {V} [value] - The `value` parameter is an optional parameter that represents the value
|
|
86
|
+
* associated with the key in the node. It is of type `V`, which can be any data type.
|
|
88
87
|
* @param {RBTNColor} [color=BLACK] - The color parameter is used to specify the color of the node in
|
|
89
88
|
* a Red-Black Tree. It can have two possible values: 'RED' or 'BLACK'. The default value is 'BLACK'.
|
|
90
89
|
* @param {number} [count] - The `count` parameter represents the number of occurrences of a key in
|
|
91
90
|
* the tree. It is an optional parameter and is used to keep track of the number of values associated
|
|
92
91
|
* with a key in the tree.
|
|
93
|
-
* @returns A new instance of the TreeMultiMapNode class
|
|
92
|
+
* @returns A new instance of the TreeMultiMapNode class, casted as NODE.
|
|
94
93
|
*/
|
|
95
94
|
createNode(key, value, color = 'BLACK', count) {
|
|
96
95
|
return new TreeMultiMapNode(key, value, count, color);
|
|
@@ -98,60 +97,56 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
98
97
|
/**
|
|
99
98
|
* The function creates a new instance of a TreeMultiMap with the specified options and returns it.
|
|
100
99
|
* @param [options] - The `options` parameter is an optional object that contains additional
|
|
101
|
-
* configuration options for creating the `TreeMultiMap`. It
|
|
102
|
-
*
|
|
100
|
+
* configuration options for creating the `TreeMultiMap`. It is of type `TreeMultiMapOptions<K, V,
|
|
101
|
+
* R>`.
|
|
103
102
|
* @returns a new instance of the `TreeMultiMap` class, with the provided options merged with the
|
|
104
|
-
* existing `iterationType`
|
|
103
|
+
* existing `iterationType` property. The returned value is casted as `TREE`.
|
|
105
104
|
*/
|
|
106
105
|
createTree(options) {
|
|
107
106
|
return new TreeMultiMap([], Object.assign({ iterationType: this.iterationType }, options));
|
|
108
107
|
}
|
|
109
108
|
/**
|
|
110
|
-
* The function `
|
|
111
|
-
*
|
|
112
|
-
* @param
|
|
113
|
-
*
|
|
114
|
-
* @param {V} [value] - The `value` parameter is an optional value
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
109
|
+
* The function `keyValueOrEntryOrRawElementToNode` takes in a key, value, and count and returns a
|
|
110
|
+
* node based on the input.
|
|
111
|
+
* @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
|
|
112
|
+
* `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
|
|
113
|
+
* @param {V} [value] - The `value` parameter is an optional value that represents the value
|
|
114
|
+
* associated with the key in the node. It is used when creating a new node or updating the value of
|
|
115
|
+
* an existing node.
|
|
116
|
+
* @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
|
|
117
|
+
* times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
|
|
118
|
+
* @returns either a NODE object or undefined.
|
|
119
119
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (keyOrNodeOrEntry === undefined || keyOrNodeOrEntry === null) {
|
|
120
|
+
keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement, value, count = 1) {
|
|
121
|
+
if (keyOrNodeOrEntryOrRawElement === undefined || keyOrNodeOrEntryOrRawElement === null)
|
|
123
122
|
return;
|
|
123
|
+
if (this.isNode(keyOrNodeOrEntryOrRawElement))
|
|
124
|
+
return keyOrNodeOrEntryOrRawElement;
|
|
125
|
+
if (this.toEntryFn) {
|
|
126
|
+
const [key] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
|
|
127
|
+
if (key)
|
|
128
|
+
return this.getNodeByKey(key);
|
|
124
129
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else if (this.isEntry(keyOrNodeOrEntry)) {
|
|
129
|
-
const [key, value] = keyOrNodeOrEntry;
|
|
130
|
-
if (key === undefined || key === null) {
|
|
130
|
+
if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
|
|
131
|
+
const [key, value] = keyOrNodeOrEntryOrRawElement;
|
|
132
|
+
if (key === undefined || key === null)
|
|
131
133
|
return;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
node = this.createNode(key, value, 'BLACK', count);
|
|
135
|
-
}
|
|
134
|
+
else
|
|
135
|
+
return this.createNode(key, value, 'BLACK', count);
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
else {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
return node;
|
|
137
|
+
if (this.isKey(keyOrNodeOrEntryOrRawElement))
|
|
138
|
+
return this.createNode(keyOrNodeOrEntryOrRawElement, value, 'BLACK', count);
|
|
139
|
+
return;
|
|
144
140
|
}
|
|
145
141
|
/**
|
|
146
|
-
* The function
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* of the `TreeMultiMapNode` class.
|
|
142
|
+
* The function checks if the input is an instance of the TreeMultiMapNode class.
|
|
143
|
+
* @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The parameter
|
|
144
|
+
* `keyOrNodeOrEntryOrRawElement` can be of type `R` or `KeyOrNodeOrEntry<K, V, NODE>`.
|
|
145
|
+
* @returns a boolean value indicating whether the input parameter `keyOrNodeOrEntryOrRawElement` is
|
|
146
|
+
* an instance of the `TreeMultiMapNode` class.
|
|
152
147
|
*/
|
|
153
|
-
isNode(
|
|
154
|
-
return
|
|
148
|
+
isNode(keyOrNodeOrEntryOrRawElement) {
|
|
149
|
+
return keyOrNodeOrEntryOrRawElement instanceof TreeMultiMapNode;
|
|
155
150
|
}
|
|
156
151
|
/**
|
|
157
152
|
* Time Complexity: O(log n)
|
|
@@ -161,17 +156,20 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
161
156
|
* Time Complexity: O(log n)
|
|
162
157
|
* Space Complexity: O(1)
|
|
163
158
|
*
|
|
164
|
-
* The function overrides the add method
|
|
165
|
-
*
|
|
159
|
+
* The function overrides the add method of a class and adds a new node to a data structure, updating
|
|
160
|
+
* the count and returning a boolean indicating success.
|
|
161
|
+
* @param {R | KeyOrNodeOrEntry<K, V, NODE>} keyOrNodeOrEntryOrRawElement - The
|
|
162
|
+
* `keyOrNodeOrEntryOrRawElement` parameter can accept one of the following types:
|
|
166
163
|
* @param {V} [value] - The `value` parameter represents the value associated with the key in the
|
|
167
|
-
* data structure.
|
|
164
|
+
* data structure. It is an optional parameter, so it can be omitted if not needed.
|
|
168
165
|
* @param [count=1] - The `count` parameter represents the number of times the key-value pair should
|
|
169
|
-
* be added to the data structure. By default, it is set to 1, meaning that
|
|
170
|
-
*
|
|
171
|
-
* @returns a boolean value.
|
|
166
|
+
* be added to the data structure. By default, it is set to 1, meaning that if no value is provided
|
|
167
|
+
* for `count`, the key-value pair will be added once.
|
|
168
|
+
* @returns The method is returning a boolean value. It returns true if the addition of the new node
|
|
169
|
+
* was successful, and false otherwise.
|
|
172
170
|
*/
|
|
173
|
-
add(
|
|
174
|
-
const newNode = this.
|
|
171
|
+
add(keyOrNodeOrEntryOrRawElement, value, count = 1) {
|
|
172
|
+
const newNode = this.keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement, value, count);
|
|
175
173
|
const orgCount = (newNode === null || newNode === void 0 ? void 0 : newNode.count) || 0;
|
|
176
174
|
const isSuccessAdded = super.add(newNode);
|
|
177
175
|
if (isSuccessAdded) {
|
|
@@ -190,20 +188,18 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
190
188
|
* Time Complexity: O(log n)
|
|
191
189
|
* Space Complexity: O(1)
|
|
192
190
|
*
|
|
193
|
-
* The `delete`
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* and the node will be deleted regardless of its count. If set to false (default), the count of the
|
|
206
|
-
* target node will be decremented
|
|
191
|
+
* The function `delete` is used to remove a node from a binary tree and fix the tree if necessary.
|
|
192
|
+
* @param {ReturnType<C> | null | undefined} identifier - The `identifier` parameter is the value or
|
|
193
|
+
* key that is used to identify the node that needs to be deleted from the binary tree. It can be of
|
|
194
|
+
* any type that is returned by the callback function `C`. It can also be `null` or `undefined` if
|
|
195
|
+
* the node to be deleted
|
|
196
|
+
* @param {C} callback - The `callback` parameter is a function that is used to determine the
|
|
197
|
+
* equality of nodes in the binary tree. It is optional and has a default value of
|
|
198
|
+
* `this._DEFAULT_CALLBACK`. The `callback` function is used to compare nodes when searching for a
|
|
199
|
+
* specific node or when performing other operations on the
|
|
200
|
+
* @param [ignoreCount=false] - A boolean flag indicating whether to ignore the count of the node
|
|
201
|
+
* being deleted. If set to true, the count of the node will not be taken into account when deleting
|
|
202
|
+
* it. If set to false, the count of the node will be decremented by 1 before deleting it.
|
|
207
203
|
* @returns an array of BinaryTreeDeleteResult<NODE> objects.
|
|
208
204
|
*/
|
|
209
205
|
delete(identifier, callback = this._DEFAULT_CALLBACK, ignoreCount = false) {
|
|
@@ -319,10 +315,12 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
319
315
|
*
|
|
320
316
|
* The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
|
|
321
317
|
* tree using either a recursive or iterative approach.
|
|
322
|
-
* @param iterationType - The `iterationType` parameter is an optional parameter that
|
|
323
|
-
* type of iteration to use when building the balanced binary search tree. It
|
|
324
|
-
*
|
|
325
|
-
*
|
|
318
|
+
* @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
|
|
319
|
+
* specifies the type of iteration to use when building the balanced binary search tree. It has a
|
|
320
|
+
* default value of `this.iterationType`, which means it will use the iteration type specified by the
|
|
321
|
+
* `iterationType` property of the current object.
|
|
322
|
+
* @returns The function `perfectlyBalance` returns a boolean value. It returns `true` if the
|
|
323
|
+
* balancing operation is successful, and `false` if there are no nodes to balance.
|
|
326
324
|
*/
|
|
327
325
|
perfectlyBalance(iterationType = this.iterationType) {
|
|
328
326
|
const sorted = this.dfs(node => node, 'IN'), n = sorted.length;
|
|
@@ -377,15 +375,22 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
377
375
|
return cloned;
|
|
378
376
|
}
|
|
379
377
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
*
|
|
378
|
+
* Time Complexity: O(1)
|
|
379
|
+
* Space Complexity: O(1)
|
|
380
|
+
*/
|
|
381
|
+
/**
|
|
382
|
+
* Time Complexity: O(1)
|
|
383
|
+
* Space Complexity: O(1)
|
|
384
|
+
*
|
|
385
|
+
* The `_swapProperties` function swaps the properties (key, value, count, color) between two nodes
|
|
386
|
+
* in a binary search tree.
|
|
387
|
+
* @param {R | BSTNKeyOrNode<K, NODE>} srcNode - The `srcNode` parameter represents the source node
|
|
388
|
+
* that will be swapped with the `destNode`. It can be either an instance of the `R` class or an
|
|
389
|
+
* instance of the `BSTNKeyOrNode<K, NODE>` class.
|
|
390
|
+
* @param {R | BSTNKeyOrNode<K, NODE>} destNode - The `destNode` parameter represents the destination
|
|
391
|
+
* node where the properties will be swapped with the source node.
|
|
385
392
|
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
386
|
-
* If
|
|
387
|
-
* and `color` properties. If the swapping is successful, the method returns the modified `destNode`.
|
|
388
|
-
* If either `srcNode` or `destNode` is
|
|
393
|
+
* If either `srcNode` or `destNode` is undefined, it returns undefined.
|
|
389
394
|
*/
|
|
390
395
|
_swapProperties(srcNode, destNode) {
|
|
391
396
|
srcNode = this.ensureNode(srcNode);
|
|
@@ -409,12 +414,19 @@ class TreeMultiMap extends rb_tree_1.RedBlackTree {
|
|
|
409
414
|
return undefined;
|
|
410
415
|
}
|
|
411
416
|
/**
|
|
417
|
+
* Time Complexity: O(1)
|
|
418
|
+
* Space Complexity: O(1)
|
|
419
|
+
*/
|
|
420
|
+
/**
|
|
421
|
+
* Time Complexity: O(1)
|
|
422
|
+
* Space Complexity: O(1)
|
|
423
|
+
*
|
|
412
424
|
* The function replaces an old node with a new node and updates the count property of the new node.
|
|
413
|
-
* @param {NODE} oldNode - The `oldNode` parameter is
|
|
414
|
-
*
|
|
415
|
-
* @param {NODE} newNode - The `newNode` parameter is an
|
|
425
|
+
* @param {NODE} oldNode - The `oldNode` parameter is the node that you want to replace in the data
|
|
426
|
+
* structure.
|
|
427
|
+
* @param {NODE} newNode - The `newNode` parameter is an instance of the `NODE` class.
|
|
416
428
|
* @returns The method is returning the result of calling the `_replaceNode` method from the
|
|
417
|
-
* superclass,
|
|
429
|
+
* superclass, which is of type `NODE`.
|
|
418
430
|
*/
|
|
419
431
|
_replaceNode(oldNode, newNode) {
|
|
420
432
|
newNode.count = oldNode.count + newNode.count;
|