data-structure-typed 1.54.2 → 2.0.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/LICENSE +2 -2
- package/README.md +14 -1
- package/README_zh-CN.md +1 -1
- package/benchmark/report.html +28 -1
- package/benchmark/report.json +327 -18
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +14 -40
- package/dist/cjs/data-structures/base/iterable-element-base.js +14 -11
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/cjs/data-structures/base/linear-base.d.ts +277 -0
- package/dist/cjs/data-structures/base/linear-base.js +553 -0
- package/dist/cjs/data-structures/base/linear-base.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +8 -7
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +51 -38
- 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 +89 -21
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +76 -8
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +173 -225
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +244 -149
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +62 -56
- package/dist/cjs/data-structures/binary-tree/bst.js +89 -133
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +19 -25
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js +7 -13
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-counter.d.ts +19 -19
- package/dist/cjs/data-structures/binary-tree/tree-counter.js +12 -12
- package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +211 -41
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.js +2 -2
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +3 -11
- package/dist/cjs/data-structures/heap/heap.js +0 -10
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/max-heap.d.ts +2 -2
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/min-heap.d.ts +2 -2
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +131 -146
- 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 +79 -75
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +217 -169
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +130 -91
- package/dist/cjs/data-structures/queue/deque.js +269 -169
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +84 -40
- package/dist/cjs/data-structures/queue/queue.js +134 -50
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +3 -11
- package/dist/cjs/data-structures/stack/stack.js +0 -10
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +4 -3
- package/dist/cjs/data-structures/trie/trie.js +3 -0
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/types/data-structures/base/base.d.ts +9 -4
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
- package/dist/cjs/types/data-structures/queue/deque.d.ts +2 -3
- package/dist/cjs/types/data-structures/queue/queue.d.ts +2 -2
- package/dist/cjs/utils/utils.d.ts +2 -2
- package/dist/esm/data-structures/base/iterable-element-base.d.ts +14 -40
- package/dist/esm/data-structures/base/iterable-element-base.js +14 -11
- package/dist/esm/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/esm/data-structures/base/linear-base.d.ts +277 -0
- package/dist/esm/data-structures/base/linear-base.js +549 -0
- package/dist/esm/data-structures/base/linear-base.js.map +1 -0
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +9 -8
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +52 -38
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +89 -21
- package/dist/esm/data-structures/binary-tree/avl-tree.js +77 -9
- package/dist/esm/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/binary-tree.d.ts +173 -225
- package/dist/esm/data-structures/binary-tree/binary-tree.js +248 -153
- package/dist/esm/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/bst.d.ts +62 -56
- package/dist/esm/data-structures/binary-tree/bst.js +90 -132
- package/dist/esm/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/red-black-tree.d.ts +19 -25
- package/dist/esm/data-structures/binary-tree/red-black-tree.js +8 -14
- package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +19 -19
- package/dist/esm/data-structures/binary-tree/tree-counter.js +13 -13
- package/dist/esm/data-structures/binary-tree/tree-counter.js.map +1 -1
- package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js +212 -41
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/esm/data-structures/graph/abstract-graph.js +2 -2
- package/dist/esm/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/esm/data-structures/heap/heap.d.ts +3 -11
- package/dist/esm/data-structures/heap/heap.js +0 -10
- package/dist/esm/data-structures/heap/heap.js.map +1 -1
- package/dist/esm/data-structures/heap/max-heap.d.ts +2 -2
- package/dist/esm/data-structures/heap/max-heap.js.map +1 -1
- package/dist/esm/data-structures/heap/min-heap.d.ts +2 -2
- package/dist/esm/data-structures/heap/min-heap.js.map +1 -1
- package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js +132 -148
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +79 -75
- package/dist/esm/data-structures/linked-list/singly-linked-list.js +217 -170
- package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +2 -2
- package/dist/esm/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/esm/data-structures/queue/deque.d.ts +130 -91
- package/dist/esm/data-structures/queue/deque.js +269 -169
- package/dist/esm/data-structures/queue/deque.js.map +1 -1
- package/dist/esm/data-structures/queue/queue.d.ts +84 -40
- package/dist/esm/data-structures/queue/queue.js +135 -51
- package/dist/esm/data-structures/queue/queue.js.map +1 -1
- package/dist/esm/data-structures/stack/stack.d.ts +3 -11
- package/dist/esm/data-structures/stack/stack.js +0 -10
- package/dist/esm/data-structures/stack/stack.js.map +1 -1
- package/dist/esm/data-structures/trie/trie.d.ts +4 -3
- package/dist/esm/data-structures/trie/trie.js +3 -0
- package/dist/esm/data-structures/trie/trie.js.map +1 -1
- package/dist/esm/types/data-structures/base/base.d.ts +9 -4
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
- package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
- package/dist/esm/types/data-structures/binary-tree/bst.d.ts +1 -1
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
- package/dist/esm/types/data-structures/queue/deque.d.ts +2 -3
- package/dist/esm/types/data-structures/queue/queue.d.ts +2 -2
- package/dist/esm/utils/utils.d.ts +2 -2
- package/dist/umd/data-structure-typed.js +1548 -920
- package/dist/umd/data-structure-typed.min.js +5 -12
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +7 -7
- package/src/data-structures/base/iterable-element-base.ts +29 -20
- package/src/data-structures/base/linear-base.ts +649 -0
- package/src/data-structures/binary-tree/avl-tree-counter.ts +30 -23
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +74 -49
- package/src/data-structures/binary-tree/avl-tree.ts +99 -29
- package/src/data-structures/binary-tree/binary-tree.ts +474 -257
- package/src/data-structures/binary-tree/bst.ts +150 -152
- package/src/data-structures/binary-tree/red-black-tree.ts +27 -35
- package/src/data-structures/binary-tree/tree-counter.ts +33 -27
- package/src/data-structures/binary-tree/tree-multi-map.ts +235 -53
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/heap/heap.ts +3 -14
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/heap/min-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +144 -160
- package/src/data-structures/linked-list/singly-linked-list.ts +241 -185
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -5
- package/src/data-structures/priority-queue/min-priority-queue.ts +2 -5
- package/src/data-structures/priority-queue/priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +286 -183
- package/src/data-structures/queue/queue.ts +149 -63
- package/src/data-structures/stack/stack.ts +3 -18
- package/src/data-structures/trie/trie.ts +7 -3
- package/src/types/data-structures/base/base.ts +17 -8
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -0
- package/src/types/data-structures/binary-tree/bst.ts +1 -1
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -1
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +2 -2
- package/src/types/data-structures/linked-list/singly-linked-list.ts +2 -2
- package/src/types/data-structures/queue/deque.ts +2 -3
- package/src/types/data-structures/queue/queue.ts +2 -2
- package/src/utils/utils.ts +2 -2
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/integration/avl-tree.test.ts +1 -1
- package/test/integration/bst.test.ts +2 -2
- package/test/integration/compile.mjs +21 -21
- package/test/performance/data-structures/binary-tree/avl-tree.test.mjs +71 -0
- package/test/performance/data-structures/binary-tree/red-black-tree.test.mjs +81 -0
- package/test/performance/{reportor.js → reportor.mjs} +264 -8
- package/test/performance/reportor.ts +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +7 -7
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +172 -5
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +72 -4
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +132 -82
- package/test/unit/data-structures/binary-tree/bst.test.ts +12 -12
- package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +5 -13
- package/test/unit/data-structures/binary-tree/tree-counter.test.ts +4 -4
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +168 -10
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +135 -27
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +111 -11
- package/test/unit/data-structures/queue/deque.test.ts +241 -60
- package/test/unit/data-structures/queue/queue.test.ts +118 -19
- package/test/unit/unrestricted-interconversion.test.ts +1 -1
- package/test/utils/json2html.ts +0 -154
- package/test/performance/data-structures/binary-tree/avl-tree.test.js +0 -45
- /package/test/performance/data-structures/binary-tree/{rb-tree.test.ts → red-black-tree.test.ts} +0 -0
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { AVLTreeCounterOptions, BinaryTreeDeleteResult, BSTNOptKeyOrNode,
|
|
8
|
+
import type { AVLTreeCounterOptions, BinaryTreeDeleteResult, BSTNOptKeyOrNode, EntryCallback, IterationType } from '../../types';
|
|
9
9
|
import { IBinaryTree } from '../../interfaces';
|
|
10
10
|
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
11
11
|
export declare class AVLTreeCounterNode<K = any, V = any> extends AVLTreeNode<K, V> {
|
|
12
|
+
parent?: AVLTreeCounterNode<K, V>;
|
|
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
|
|
@@ -20,13 +21,12 @@ export declare class AVLTreeCounterNode<K = any, V = any> extends AVLTreeNode<K,
|
|
|
20
21
|
* parameter when creating a new instance of the `BinaryTreeNode` class.
|
|
21
22
|
*/
|
|
22
23
|
constructor(key: K, value?: V, count?: number);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
set right(v: OptNodeOrNull<AVLTreeCounterNode<K, V>>);
|
|
24
|
+
_left?: AVLTreeCounterNode<K, V> | null | undefined;
|
|
25
|
+
get left(): AVLTreeCounterNode<K, V> | null | undefined;
|
|
26
|
+
set left(v: AVLTreeCounterNode<K, V> | null | undefined);
|
|
27
|
+
_right?: AVLTreeCounterNode<K, V> | null | undefined;
|
|
28
|
+
get right(): AVLTreeCounterNode<K, V> | null | undefined;
|
|
29
|
+
set right(v: AVLTreeCounterNode<K, V> | null | undefined);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* The only distinction between a AVLTreeCounter and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
|
|
@@ -40,7 +40,7 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
40
40
|
* behavior of the AVLTreeCounter. It can include properties such as `compareKeys` and
|
|
41
41
|
* `compareValues` functions to define custom comparison logic for keys and values, respectively.
|
|
42
42
|
*/
|
|
43
|
-
constructor(keysNodesEntriesOrRaws?: Iterable<
|
|
43
|
+
constructor(keysNodesEntriesOrRaws?: Iterable<K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, options?: AVLTreeCounterOptions<K, V, R>);
|
|
44
44
|
protected _count: number;
|
|
45
45
|
/**
|
|
46
46
|
* The function calculates the sum of the count property of all nodes in a tree using depth-first
|
|
@@ -79,21 +79,21 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
79
79
|
createTree(options?: AVLTreeCounterOptions<K, V, R>): AVLTreeCounter<K, V, R, MK, MV, MR>;
|
|
80
80
|
/**
|
|
81
81
|
* The function checks if the input is an instance of AVLTreeCounterNode.
|
|
82
|
-
* @param {
|
|
83
|
-
* `keyNodeOrEntry` can be of type `R` or `
|
|
82
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The parameter
|
|
83
|
+
* `keyNodeOrEntry` can be of type `R` or `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`.
|
|
84
84
|
* @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
|
|
85
85
|
* an instance of the `AVLTreeCounterNode` class.
|
|
86
86
|
*/
|
|
87
|
-
isNode(keyNodeOrEntry:
|
|
87
|
+
isNode(keyNodeOrEntry: K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is AVLTreeCounterNode<K, V>;
|
|
88
88
|
/**
|
|
89
89
|
* Time Complexity: O(log n)
|
|
90
90
|
* Space Complexity: O(1)
|
|
91
91
|
*
|
|
92
92
|
* The function overrides the add method of a TypeScript class to add a new node to a data structure
|
|
93
93
|
* and update the count.
|
|
94
|
-
* @param {
|
|
94
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The
|
|
95
95
|
* `keyNodeOrEntry` parameter can accept a value of type `R`, which can be any type. It
|
|
96
|
-
* can also accept a value of type `
|
|
96
|
+
* can also accept a value of type `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`, which represents a key, node,
|
|
97
97
|
* entry, or raw element
|
|
98
98
|
* @param {V} [value] - The `value` parameter represents the value associated with the key in the
|
|
99
99
|
* data structure. It is an optional parameter, so it can be omitted if not needed.
|
|
@@ -102,14 +102,14 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
102
102
|
* be added once. However, you can specify a different value for `count` if you want to add
|
|
103
103
|
* @returns a boolean value.
|
|
104
104
|
*/
|
|
105
|
-
add(keyNodeOrEntry:
|
|
105
|
+
add(keyNodeOrEntry: K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): boolean;
|
|
106
106
|
/**
|
|
107
107
|
* Time Complexity: O(log n)
|
|
108
108
|
* Space Complexity: O(1)
|
|
109
109
|
*
|
|
110
110
|
* The function overrides the delete method in a binary tree data structure, handling deletion of
|
|
111
111
|
* nodes and maintaining balance in the tree.
|
|
112
|
-
* @param {
|
|
112
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The `predicate`
|
|
113
113
|
* parameter in the `delete` method is used to specify the condition for deleting a node from the
|
|
114
114
|
* binary tree. It can be a key, node, or entry that determines which
|
|
115
115
|
* node(s) should be deleted.
|
|
@@ -122,7 +122,7 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
122
122
|
* method returns an array of `BinaryTreeDeleteResult` objects, each containing information about the
|
|
123
123
|
* deleted node and whether balancing is needed in the tree.
|
|
124
124
|
*/
|
|
125
|
-
delete(keyNodeOrEntry:
|
|
125
|
+
delete(keyNodeOrEntry: K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, ignoreCount?: boolean): BinaryTreeDeleteResult<AVLTreeCounterNode<K, V>>[];
|
|
126
126
|
/**
|
|
127
127
|
* Time Complexity: O(1)
|
|
128
128
|
* Space Complexity: O(1)
|
|
@@ -134,6 +134,7 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
134
134
|
/**
|
|
135
135
|
* Time Complexity: O(n log n)
|
|
136
136
|
* Space Complexity: O(log n)
|
|
137
|
+
*
|
|
137
138
|
* The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
|
|
138
139
|
* tree using either a recursive or iterative approach.
|
|
139
140
|
* @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
|
|
@@ -174,8 +175,8 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
174
175
|
/**
|
|
175
176
|
* The function `keyValueNodeEntryRawToNodeAndValue` converts a key, value, entry, or raw element into
|
|
176
177
|
* a node object.
|
|
177
|
-
* @param {
|
|
178
|
-
* `keyNodeOrEntry` parameter can be of type `R` or `
|
|
178
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The
|
|
179
|
+
* `keyNodeOrEntry` parameter can be of type `R` or `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`.
|
|
179
180
|
* @param {V} [value] - The `value` parameter is an optional value that can be passed to the
|
|
180
181
|
* `override` function. It represents the value associated with the key in the data structure. If no
|
|
181
182
|
* value is provided, it will default to `undefined`.
|
|
@@ -183,7 +184,7 @@ export declare class AVLTreeCounter<K = any, V = any, R = object, MK = any, MV =
|
|
|
183
184
|
* times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
|
|
184
185
|
* @returns either a AVLTreeCounterNode<K, V> object or undefined.
|
|
185
186
|
*/
|
|
186
|
-
protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry:
|
|
187
|
+
protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry: K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): [AVLTreeCounterNode<K, V> | undefined, V | undefined];
|
|
187
188
|
/**
|
|
188
189
|
* Time Complexity: O(1)
|
|
189
190
|
* Space Complexity: O(1)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
2
2
|
export class AVLTreeCounterNode extends AVLTreeNode {
|
|
3
|
+
parent = undefined;
|
|
3
4
|
/**
|
|
4
5
|
* The constructor function initializes a BinaryTreeNode object with a key, value, and count.
|
|
5
6
|
* @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
|
|
@@ -14,7 +15,6 @@ export class AVLTreeCounterNode extends AVLTreeNode {
|
|
|
14
15
|
super(key, value);
|
|
15
16
|
this.count = count;
|
|
16
17
|
}
|
|
17
|
-
parent = undefined;
|
|
18
18
|
_left = undefined;
|
|
19
19
|
get left() {
|
|
20
20
|
return this._left;
|
|
@@ -108,8 +108,8 @@ export class AVLTreeCounter extends AVLTree {
|
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* The function checks if the input is an instance of AVLTreeCounterNode.
|
|
111
|
-
* @param {
|
|
112
|
-
* `keyNodeOrEntry` can be of type `R` or `
|
|
111
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The parameter
|
|
112
|
+
* `keyNodeOrEntry` can be of type `R` or `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`.
|
|
113
113
|
* @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
|
|
114
114
|
* an instance of the `AVLTreeCounterNode` class.
|
|
115
115
|
*/
|
|
@@ -122,9 +122,9 @@ export class AVLTreeCounter extends AVLTree {
|
|
|
122
122
|
*
|
|
123
123
|
* The function overrides the add method of a TypeScript class to add a new node to a data structure
|
|
124
124
|
* and update the count.
|
|
125
|
-
* @param {
|
|
125
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The
|
|
126
126
|
* `keyNodeOrEntry` parameter can accept a value of type `R`, which can be any type. It
|
|
127
|
-
* can also accept a value of type `
|
|
127
|
+
* can also accept a value of type `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`, which represents a key, node,
|
|
128
128
|
* entry, or raw element
|
|
129
129
|
* @param {V} [value] - The `value` parameter represents the value associated with the key in the
|
|
130
130
|
* data structure. It is an optional parameter, so it can be omitted if not needed.
|
|
@@ -150,7 +150,7 @@ export class AVLTreeCounter extends AVLTree {
|
|
|
150
150
|
*
|
|
151
151
|
* The function overrides the delete method in a binary tree data structure, handling deletion of
|
|
152
152
|
* nodes and maintaining balance in the tree.
|
|
153
|
-
* @param {
|
|
153
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The `predicate`
|
|
154
154
|
* parameter in the `delete` method is used to specify the condition for deleting a node from the
|
|
155
155
|
* binary tree. It can be a key, node, or entry that determines which
|
|
156
156
|
* node(s) should be deleted.
|
|
@@ -234,6 +234,7 @@ export class AVLTreeCounter extends AVLTree {
|
|
|
234
234
|
/**
|
|
235
235
|
* Time Complexity: O(n log n)
|
|
236
236
|
* Space Complexity: O(log n)
|
|
237
|
+
*
|
|
237
238
|
* The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
|
|
238
239
|
* tree using either a recursive or iterative approach.
|
|
239
240
|
* @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
|
|
@@ -331,8 +332,8 @@ export class AVLTreeCounter extends AVLTree {
|
|
|
331
332
|
/**
|
|
332
333
|
* The function `keyValueNodeEntryRawToNodeAndValue` converts a key, value, entry, or raw element into
|
|
333
334
|
* a node object.
|
|
334
|
-
* @param {
|
|
335
|
-
* `keyNodeOrEntry` parameter can be of type `R` or `
|
|
335
|
+
* @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The
|
|
336
|
+
* `keyNodeOrEntry` parameter can be of type `R` or `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`.
|
|
336
337
|
* @param {V} [value] - The `value` parameter is an optional value that can be passed to the
|
|
337
338
|
* `override` function. It represents the value associated with the key in the data structure. If no
|
|
338
339
|
* value is provided, it will default to `undefined`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avl-tree-counter.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-counter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"avl-tree-counter.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-counter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,OAAO,kBAAqC,SAAQ,WAAiB;IAChE,MAAM,GAA8B,SAAS,CAAC;IAEvD;;;;;;;;;OASG;IACH,YAAY,GAAM,EAAE,KAAS,EAAE,KAAK,GAAG,CAAC;QACtC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEQ,KAAK,GAAiD,SAAS,CAAC;IAEzE,IAAa,IAAI;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAa,IAAI,CAAC,CAA8C;QAC9D,IAAI,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAEQ,MAAM,GAAiD,SAAS,CAAC;IAE1E,IAAa,KAAK;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAa,KAAK,CAAC,CAA8C;QAC/D,IAAI,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;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AAI,CAAC,UAAU;oBAAE,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;gBACrD,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;gBAC/B,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;gBAEjC,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;gBAC3B,IAAI,CAAC,IAAI,CAAC,UAAU;oBAAE,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;gBACrD,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAC/B,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;YACnC,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;OAUG;IACgB,YAAY,CAC7B,OAAiC,EACjC,OAAiC;QAEjC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9C,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import { AVLTreeMultiMapOptions
|
|
8
|
+
import { AVLTreeMultiMapOptions } from '../../types';
|
|
9
9
|
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
10
10
|
import { IBinaryTree } from '../../interfaces';
|
|
11
11
|
export declare class AVLTreeMultiMapNode<K = any, V = any> extends AVLTreeNode<K, V[]> {
|
|
12
|
+
parent?: AVLTreeMultiMapNode<K, V>;
|
|
12
13
|
/**
|
|
13
14
|
* This TypeScript constructor initializes an object with a key of type K and an array of values of
|
|
14
15
|
* type V.
|
|
@@ -19,13 +20,12 @@ export declare class AVLTreeMultiMapNode<K = any, V = any> extends AVLTreeNode<K
|
|
|
19
20
|
* type `V`.
|
|
20
21
|
*/
|
|
21
22
|
constructor(key: K, value: V[]);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
set right(v: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>);
|
|
23
|
+
_left?: AVLTreeMultiMapNode<K, V> | null | undefined;
|
|
24
|
+
get left(): AVLTreeMultiMapNode<K, V> | null | undefined;
|
|
25
|
+
set left(v: AVLTreeMultiMapNode<K, V> | null | undefined);
|
|
26
|
+
_right?: AVLTreeMultiMapNode<K, V> | null | undefined;
|
|
27
|
+
get right(): AVLTreeMultiMapNode<K, V> | null | undefined;
|
|
28
|
+
set right(v: AVLTreeMultiMapNode<K, V> | null | undefined);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
@@ -42,7 +42,7 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
42
42
|
* `AVLTreeMultiMapOptions<K, V[], R>`. It is an optional parameter that allows you to specify
|
|
43
43
|
* additional options for configuring the AVLTreeMultiMap instance.
|
|
44
44
|
*/
|
|
45
|
-
constructor(keysNodesEntriesOrRaws?: Iterable<
|
|
45
|
+
constructor(keysNodesEntriesOrRaws?: Iterable<K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined | R>, options?: AVLTreeMultiMapOptions<K, V[], R>);
|
|
46
46
|
/**
|
|
47
47
|
* Time Complexity: O(1)
|
|
48
48
|
* Space Complexity: O(1)
|
|
@@ -60,15 +60,19 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
60
60
|
* Time Complexity: O(1)
|
|
61
61
|
* Space Complexity: O(1)
|
|
62
62
|
*
|
|
63
|
-
* The
|
|
64
|
-
* specified key and
|
|
65
|
-
* @param {K} key - The `key` parameter
|
|
66
|
-
*
|
|
67
|
-
* @
|
|
68
|
-
*
|
|
63
|
+
* The `createNode` function in TypeScript overrides the default implementation to create a new
|
|
64
|
+
* AVLTreeMultiMapNode with a specified key and value array.
|
|
65
|
+
* @param {K} key - The `key` parameter represents the key of the node being created in the
|
|
66
|
+
* AVLTreeMultiMap.
|
|
67
|
+
* @param {V[]} value - The `value` parameter in the `createNode` method represents an array of
|
|
68
|
+
* values associated with a specific key in the AVLTreeMultiMapNode. If no value is provided when
|
|
69
|
+
* calling the method, an empty array `[]` is used as the default value.
|
|
70
|
+
* @returns An AVLTreeMultiMapNode object is being returned, with the specified key and value. If the
|
|
71
|
+
* AVLTreeMultiMap is in map mode, an empty array is used as the value, otherwise the provided value
|
|
72
|
+
* array is used.
|
|
69
73
|
*/
|
|
70
|
-
createNode(key: K): AVLTreeMultiMapNode<K, V>;
|
|
71
|
-
add(
|
|
74
|
+
createNode(key: K, value?: V[]): AVLTreeMultiMapNode<K, V>;
|
|
75
|
+
add(keyNodeOrEntry: K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
|
|
72
76
|
add(key: K, value: V): boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Time Complexity: O(log n)
|
|
@@ -76,7 +80,7 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
76
80
|
*
|
|
77
81
|
* The function `deleteValue` removes a specific value from a key in an AVLTreeMultiMap data
|
|
78
82
|
* structure and deletes the entire node if no values are left for that key.
|
|
79
|
-
* @param {
|
|
83
|
+
* @param {K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined | K} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
80
84
|
* parameter in the `deleteValue` function can be either a `BTNRep` object representing a key-value
|
|
81
85
|
* pair in the AVLTreeMultiMapNode, or just the key itself.
|
|
82
86
|
* @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
|
|
@@ -87,7 +91,7 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
87
91
|
* `value` was successfully deleted from the array of values associated with the `keyNodeOrEntry`. If
|
|
88
92
|
* the value was not found in the array, it returns `false`.
|
|
89
93
|
*/
|
|
90
|
-
deleteValue(keyNodeOrEntry:
|
|
94
|
+
deleteValue(keyNodeOrEntry: K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined | K, value: V): boolean;
|
|
91
95
|
/**
|
|
92
96
|
* Time Complexity: O(n)
|
|
93
97
|
* Space Complexity: O(n)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
2
2
|
export class AVLTreeMultiMapNode extends AVLTreeNode {
|
|
3
|
+
parent = undefined;
|
|
3
4
|
/**
|
|
4
5
|
* This TypeScript constructor initializes an object with a key of type K and an array of values of
|
|
5
6
|
* type V.
|
|
@@ -12,7 +13,6 @@ export class AVLTreeMultiMapNode extends AVLTreeNode {
|
|
|
12
13
|
constructor(key, value) {
|
|
13
14
|
super(key, value);
|
|
14
15
|
}
|
|
15
|
-
parent = undefined;
|
|
16
16
|
_left = undefined;
|
|
17
17
|
get left() {
|
|
18
18
|
return this._left;
|
|
@@ -73,6 +73,7 @@ export class AVLTreeMultiMap extends AVLTree {
|
|
|
73
73
|
specifyComparable: this._specifyComparable,
|
|
74
74
|
toEntryFn: this._toEntryFn,
|
|
75
75
|
isReverse: this._isReverse,
|
|
76
|
+
isMapMode: this._isMapMode,
|
|
76
77
|
...options
|
|
77
78
|
});
|
|
78
79
|
}
|
|
@@ -80,31 +81,34 @@ export class AVLTreeMultiMap extends AVLTree {
|
|
|
80
81
|
* Time Complexity: O(1)
|
|
81
82
|
* Space Complexity: O(1)
|
|
82
83
|
*
|
|
83
|
-
* The
|
|
84
|
-
* specified key and
|
|
85
|
-
* @param {K} key - The `key` parameter
|
|
86
|
-
*
|
|
87
|
-
* @
|
|
88
|
-
*
|
|
84
|
+
* The `createNode` function in TypeScript overrides the default implementation to create a new
|
|
85
|
+
* AVLTreeMultiMapNode with a specified key and value array.
|
|
86
|
+
* @param {K} key - The `key` parameter represents the key of the node being created in the
|
|
87
|
+
* AVLTreeMultiMap.
|
|
88
|
+
* @param {V[]} value - The `value` parameter in the `createNode` method represents an array of
|
|
89
|
+
* values associated with a specific key in the AVLTreeMultiMapNode. If no value is provided when
|
|
90
|
+
* calling the method, an empty array `[]` is used as the default value.
|
|
91
|
+
* @returns An AVLTreeMultiMapNode object is being returned, with the specified key and value. If the
|
|
92
|
+
* AVLTreeMultiMap is in map mode, an empty array is used as the value, otherwise the provided value
|
|
93
|
+
* array is used.
|
|
89
94
|
*/
|
|
90
|
-
createNode(key) {
|
|
91
|
-
return new AVLTreeMultiMapNode(key, []);
|
|
95
|
+
createNode(key, value = []) {
|
|
96
|
+
return new AVLTreeMultiMapNode(key, this._isMapMode ? [] : value);
|
|
92
97
|
}
|
|
93
98
|
/**
|
|
94
99
|
* Time Complexity: O(log n)
|
|
95
100
|
* Space Complexity: O(log n)
|
|
96
101
|
*
|
|
97
|
-
* The function `add` in TypeScript overrides the superclass method to add key-value pairs
|
|
98
|
-
*
|
|
99
|
-
* @param
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* `values`
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* addition operation was successful or not.
|
|
102
|
+
* The function `add` in this TypeScript code overrides the superclass method to add key-value pairs
|
|
103
|
+
* to an AVLTreeMultiMap, handling different input types and scenarios.
|
|
104
|
+
* @param [key] - The `key` parameter in the `override add` method represents the key of the entry to
|
|
105
|
+
* be added to the AVLTreeMultiMap. It can be of type `K`, which is the key type of the map. The key
|
|
106
|
+
* can be a single key value, a node of the AVLTree
|
|
107
|
+
* @param {V[]} [values] - The `values` parameter in the `add` method represents an array of values
|
|
108
|
+
* that you want to add to the AVLTreeMultiMap. It can contain one or more values associated with a
|
|
109
|
+
* specific key.
|
|
110
|
+
* @returns The `add` method is returning a boolean value, which indicates whether the operation was
|
|
111
|
+
* successful or not.
|
|
108
112
|
*/
|
|
109
113
|
add(keyNodeOrEntry, value) {
|
|
110
114
|
if (this.isRealNode(keyNodeOrEntry))
|
|
@@ -112,30 +116,40 @@ export class AVLTreeMultiMap extends AVLTree {
|
|
|
112
116
|
const _commonAdd = (key, values) => {
|
|
113
117
|
if (key === undefined || key === null)
|
|
114
118
|
return false;
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
existingValues.push(value);
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
const existingNode = this.getNode(key);
|
|
122
|
-
if (this.isRealNode(existingNode)) {
|
|
123
|
-
if (existingValues === undefined) {
|
|
124
|
-
super.add(key, values);
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
if (values !== undefined) {
|
|
119
|
+
const _addToValues = () => {
|
|
120
|
+
const existingValues = this.get(key);
|
|
121
|
+
if (existingValues !== undefined && values !== undefined) {
|
|
128
122
|
for (const value of values)
|
|
129
123
|
existingValues.push(value);
|
|
130
124
|
return true;
|
|
131
125
|
}
|
|
126
|
+
return false;
|
|
127
|
+
};
|
|
128
|
+
const _addByNode = () => {
|
|
129
|
+
const existingNode = this.getNode(key);
|
|
130
|
+
if (this.isRealNode(existingNode)) {
|
|
131
|
+
const existingValues = this.get(existingNode);
|
|
132
|
+
if (existingValues === undefined) {
|
|
133
|
+
super.add(key, values);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if (values !== undefined) {
|
|
137
|
+
for (const value of values)
|
|
138
|
+
existingValues.push(value);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
132
145
|
else {
|
|
133
|
-
return
|
|
146
|
+
return super.add(key, values);
|
|
134
147
|
}
|
|
148
|
+
};
|
|
149
|
+
if (this._isMapMode) {
|
|
150
|
+
return _addByNode() || _addToValues();
|
|
135
151
|
}
|
|
136
|
-
|
|
137
|
-
return super.add(key, values);
|
|
138
|
-
}
|
|
152
|
+
return _addToValues() || _addByNode();
|
|
139
153
|
};
|
|
140
154
|
if (this.isEntry(keyNodeOrEntry)) {
|
|
141
155
|
const [key, values] = keyNodeOrEntry;
|
|
@@ -149,7 +163,7 @@ export class AVLTreeMultiMap extends AVLTree {
|
|
|
149
163
|
*
|
|
150
164
|
* The function `deleteValue` removes a specific value from a key in an AVLTreeMultiMap data
|
|
151
165
|
* structure and deletes the entire node if no values are left for that key.
|
|
152
|
-
* @param {
|
|
166
|
+
* @param {K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined | K} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
153
167
|
* parameter in the `deleteValue` function can be either a `BTNRep` object representing a key-value
|
|
154
168
|
* pair in the AVLTreeMultiMapNode, or just the key itself.
|
|
155
169
|
* @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avl-tree-multi-map.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-multi-map.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,OAAO,mBAAsC,SAAQ,WAAmB;
|
|
1
|
+
{"version":3,"file":"avl-tree-multi-map.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-multi-map.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,OAAO,mBAAsC,SAAQ,WAAmB;IACnE,MAAM,GAA+B,SAAS,CAAC;IAExD;;;;;;;;OAQG;IACH,YAAY,GAAM,EAAE,KAAU;QAC5B,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;IAEQ,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