undirected-graph-typed 1.52.3 → 1.52.5
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/dist/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/data-structures/base/iterable-element-base.js +1 -37
- package/dist/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/data-structures/binary-tree/binary-tree.js +299 -331
- package/dist/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/data-structures/binary-tree/bst.js +12 -44
- package/dist/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/data-structures/graph/abstract-graph.js +0 -75
- package/dist/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/data-structures/graph/directed-graph.js +0 -98
- package/dist/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/data-structures/graph/undirected-graph.js +0 -50
- package/dist/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/data-structures/hash/hash-map.js +29 -115
- package/dist/data-structures/heap/heap.d.ts +0 -32
- package/dist/data-structures/heap/heap.js +0 -32
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/data-structures/queue/deque.d.ts +1 -98
- package/dist/data-structures/queue/deque.js +3 -99
- package/dist/data-structures/queue/queue.d.ts +5 -58
- package/dist/data-structures/queue/queue.js +4 -57
- package/dist/data-structures/stack/stack.d.ts +1 -34
- package/dist/data-structures/stack/stack.js +1 -34
- package/dist/data-structures/tree/tree.js +2 -1
- package/dist/data-structures/trie/trie.d.ts +0 -64
- package/dist/data-structures/trie/trie.js +0 -64
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/types/data-structures/binary-tree/binary-tree.js +6 -0
- package/dist/types/utils/utils.d.ts +13 -12
- package/dist/utils/number.d.ts +13 -0
- package/dist/utils/number.js +13 -0
- package/dist/utils/utils.d.ts +125 -3
- package/dist/utils/utils.js +177 -21
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +2 -42
- package/src/data-structures/base/iterable-entry-base.ts +3 -62
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +8 -48
- package/src/data-structures/binary-tree/avl-tree.ts +0 -57
- package/src/data-structures/binary-tree/binary-tree.ts +329 -358
- package/src/data-structures/binary-tree/bst.ts +11 -54
- package/src/data-structures/binary-tree/rb-tree.ts +2 -62
- package/src/data-structures/binary-tree/tree-multi-map.ts +8 -48
- package/src/data-structures/graph/abstract-graph.ts +0 -92
- package/src/data-structures/graph/directed-graph.ts +0 -122
- package/src/data-structures/graph/undirected-graph.ts +0 -62
- package/src/data-structures/hash/hash-map.ts +31 -139
- package/src/data-structures/heap/heap.ts +0 -40
- package/src/data-structures/linked-list/doubly-linked-list.ts +5 -112
- package/src/data-structures/linked-list/singly-linked-list.ts +2 -104
- package/src/data-structures/linked-list/skip-linked-list.ts +1 -44
- package/src/data-structures/queue/deque.ts +2 -125
- package/src/data-structures/queue/queue.ts +5 -72
- package/src/data-structures/stack/stack.ts +1 -43
- package/src/data-structures/tree/tree.ts +1 -1
- package/src/data-structures/trie/trie.ts +0 -80
- package/src/types/data-structures/binary-tree/binary-tree.ts +8 -1
- package/src/types/utils/utils.ts +17 -15
- package/src/utils/number.ts +13 -0
- package/src/utils/utils.ts +174 -18
|
@@ -16,10 +16,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
16
16
|
* `_toElementFn`.
|
|
17
17
|
*/
|
|
18
18
|
get toElementFn(): ((rawElement: R) => E) | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Time Complexity: O(n)
|
|
21
|
-
* Space Complexity: O(1)
|
|
22
|
-
*/
|
|
23
19
|
/**
|
|
24
20
|
* Time Complexity: O(n)
|
|
25
21
|
* Space Complexity: O(1)
|
|
@@ -30,10 +26,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
30
26
|
* parameter is used to pass any number of arguments to the `_getIterator` method.
|
|
31
27
|
*/
|
|
32
28
|
[Symbol.iterator](...args: any[]): IterableIterator<E>;
|
|
33
|
-
/**
|
|
34
|
-
* Time Complexity: O(n)
|
|
35
|
-
* Space Complexity: O(n)
|
|
36
|
-
*/
|
|
37
29
|
/**
|
|
38
30
|
* Time Complexity: O(n)
|
|
39
31
|
* Space Complexity: O(n)
|
|
@@ -41,10 +33,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
41
33
|
* The function returns an iterator that yields all the values in the object.
|
|
42
34
|
*/
|
|
43
35
|
values(): IterableIterator<E>;
|
|
44
|
-
/**
|
|
45
|
-
* Time Complexity: O(n)
|
|
46
|
-
* Space Complexity: O(1)
|
|
47
|
-
*/
|
|
48
36
|
/**
|
|
49
37
|
* Time Complexity: O(n)
|
|
50
38
|
* Space Complexity: O(1)
|
|
@@ -60,14 +48,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
60
48
|
* the array satisfies the provided predicate function, and `false` otherwise.
|
|
61
49
|
*/
|
|
62
50
|
every(predicate: ElementCallback<E, R, boolean, C>, thisArg?: any): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Time Complexity: O(n)
|
|
65
|
-
* Space Complexity: O(1)
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* Time Complexity: O(n)
|
|
69
|
-
* Space Complexity: O(1)
|
|
70
|
-
*/
|
|
71
51
|
/**
|
|
72
52
|
* Time Complexity: O(n)
|
|
73
53
|
* Space Complexity: O(1)
|
|
@@ -83,10 +63,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
83
63
|
* in the collection, and false otherwise.
|
|
84
64
|
*/
|
|
85
65
|
some(predicate: ElementCallback<E, R, boolean, C>, thisArg?: any): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Time Complexity: O(n)
|
|
88
|
-
* Space Complexity: O(1)
|
|
89
|
-
*/
|
|
90
66
|
/**
|
|
91
67
|
* Time Complexity: O(n)
|
|
92
68
|
* Space Complexity: O(1)
|
|
@@ -101,10 +77,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
101
77
|
* be passed as the `this` value to the `callbackfn` function. If `thisArg
|
|
102
78
|
*/
|
|
103
79
|
forEach(callbackfn: ElementCallback<E, R, void, C>, thisArg?: any): void;
|
|
104
|
-
/**
|
|
105
|
-
* Time Complexity: O(n)
|
|
106
|
-
* Space Complexity: O(1)
|
|
107
|
-
*/
|
|
108
80
|
/**
|
|
109
81
|
* Time Complexity: O(n)
|
|
110
82
|
* Space Complexity: O(1)
|
|
@@ -133,10 +105,6 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
133
105
|
* otherwise.
|
|
134
106
|
*/
|
|
135
107
|
has(element: E): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Time Complexity: O(n)
|
|
138
|
-
* Space Complexity: O(1)
|
|
139
|
-
*/
|
|
140
108
|
/**
|
|
141
109
|
* Time Complexity: O(n)
|
|
142
110
|
* Space Complexity: O(1)
|
|
@@ -151,17 +119,13 @@ export declare abstract class IterableElementBase<E, R, C> {
|
|
|
151
119
|
* all the elements in the array and applying the callback function to each element.
|
|
152
120
|
*/
|
|
153
121
|
reduce<U>(callbackfn: ReduceElementCallback<E, R, U, C>, initialValue: U): U;
|
|
154
|
-
/**
|
|
155
|
-
* Time Complexity: O(n)
|
|
156
|
-
* Space Complexity: O(n)
|
|
157
|
-
*/
|
|
158
122
|
/**
|
|
159
123
|
* Time Complexity: O(n)
|
|
160
124
|
* Space Complexity: O(n)
|
|
161
125
|
*
|
|
162
126
|
* The print function logs the elements of an array to the console.
|
|
163
127
|
*/
|
|
164
|
-
print():
|
|
128
|
+
print(): E[];
|
|
165
129
|
abstract isEmpty(): boolean;
|
|
166
130
|
abstract clear(): void;
|
|
167
131
|
abstract clone(): C;
|
|
@@ -26,10 +26,6 @@ class IterableElementBase {
|
|
|
26
26
|
get toElementFn() {
|
|
27
27
|
return this._toElementFn;
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Time Complexity: O(n)
|
|
31
|
-
* Space Complexity: O(1)
|
|
32
|
-
*/
|
|
33
29
|
/**
|
|
34
30
|
* Time Complexity: O(n)
|
|
35
31
|
* Space Complexity: O(1)
|
|
@@ -42,10 +38,6 @@ class IterableElementBase {
|
|
|
42
38
|
*[Symbol.iterator](...args) {
|
|
43
39
|
yield* this._getIterator(...args);
|
|
44
40
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Time Complexity: O(n)
|
|
47
|
-
* Space Complexity: O(n)
|
|
48
|
-
*/
|
|
49
41
|
/**
|
|
50
42
|
* Time Complexity: O(n)
|
|
51
43
|
* Space Complexity: O(n)
|
|
@@ -57,10 +49,6 @@ class IterableElementBase {
|
|
|
57
49
|
yield item;
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Time Complexity: O(n)
|
|
62
|
-
* Space Complexity: O(1)
|
|
63
|
-
*/
|
|
64
52
|
/**
|
|
65
53
|
* Time Complexity: O(n)
|
|
66
54
|
* Space Complexity: O(1)
|
|
@@ -84,14 +72,6 @@ class IterableElementBase {
|
|
|
84
72
|
}
|
|
85
73
|
return true;
|
|
86
74
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Time Complexity: O(n)
|
|
89
|
-
* Space Complexity: O(1)
|
|
90
|
-
*/
|
|
91
|
-
/**
|
|
92
|
-
* Time Complexity: O(n)
|
|
93
|
-
* Space Complexity: O(1)
|
|
94
|
-
*/
|
|
95
75
|
/**
|
|
96
76
|
* Time Complexity: O(n)
|
|
97
77
|
* Space Complexity: O(1)
|
|
@@ -115,10 +95,6 @@ class IterableElementBase {
|
|
|
115
95
|
}
|
|
116
96
|
return false;
|
|
117
97
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Time Complexity: O(n)
|
|
120
|
-
* Space Complexity: O(1)
|
|
121
|
-
*/
|
|
122
98
|
/**
|
|
123
99
|
* Time Complexity: O(n)
|
|
124
100
|
* Space Complexity: O(1)
|
|
@@ -138,10 +114,6 @@ class IterableElementBase {
|
|
|
138
114
|
callbackfn.call(thisArg, item, index++, this);
|
|
139
115
|
}
|
|
140
116
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Time Complexity: O(n)
|
|
143
|
-
* Space Complexity: O(1)
|
|
144
|
-
*/
|
|
145
117
|
/**
|
|
146
118
|
* Time Complexity: O(n)
|
|
147
119
|
* Space Complexity: O(1)
|
|
@@ -183,10 +155,6 @@ class IterableElementBase {
|
|
|
183
155
|
}
|
|
184
156
|
return false;
|
|
185
157
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Time Complexity: O(n)
|
|
188
|
-
* Space Complexity: O(1)
|
|
189
|
-
*/
|
|
190
158
|
/**
|
|
191
159
|
* Time Complexity: O(n)
|
|
192
160
|
* Space Complexity: O(1)
|
|
@@ -208,10 +176,6 @@ class IterableElementBase {
|
|
|
208
176
|
}
|
|
209
177
|
return accumulator;
|
|
210
178
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Time Complexity: O(n)
|
|
213
|
-
* Space Complexity: O(n)
|
|
214
|
-
*/
|
|
215
179
|
/**
|
|
216
180
|
* Time Complexity: O(n)
|
|
217
181
|
* Space Complexity: O(n)
|
|
@@ -219,7 +183,7 @@ class IterableElementBase {
|
|
|
219
183
|
* The print function logs the elements of an array to the console.
|
|
220
184
|
*/
|
|
221
185
|
print() {
|
|
222
|
-
|
|
186
|
+
return [...this];
|
|
223
187
|
}
|
|
224
188
|
}
|
|
225
189
|
exports.IterableElementBase = IterableElementBase;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { EntryCallback, ReduceEntryCallback } from '../../types';
|
|
2
2
|
export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
3
|
-
/**
|
|
4
|
-
* Time Complexity: O(n)
|
|
5
|
-
* Space Complexity: O(1)
|
|
6
|
-
*/
|
|
7
3
|
abstract get size(): number;
|
|
8
4
|
/**
|
|
9
5
|
* Time Complexity: O(n)
|
|
@@ -15,10 +11,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
15
11
|
* parameter is used to pass any additional arguments to the `_getIterator` method.
|
|
16
12
|
*/
|
|
17
13
|
[Symbol.iterator](...args: any[]): IterableIterator<[K, V]>;
|
|
18
|
-
/**
|
|
19
|
-
* Time Complexity: O(n)
|
|
20
|
-
* Space Complexity: O(n)
|
|
21
|
-
*/
|
|
22
14
|
/**
|
|
23
15
|
* Time Complexity: O(n)
|
|
24
16
|
* Space Complexity: O(n)
|
|
@@ -27,10 +19,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
27
19
|
* be undefined.
|
|
28
20
|
*/
|
|
29
21
|
entries(): IterableIterator<[K, V | undefined]>;
|
|
30
|
-
/**
|
|
31
|
-
* Time Complexity: O(n)
|
|
32
|
-
* Space Complexity: O(n)
|
|
33
|
-
*/
|
|
34
22
|
/**
|
|
35
23
|
* Time Complexity: O(n)
|
|
36
24
|
* Space Complexity: O(n)
|
|
@@ -38,10 +26,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
38
26
|
* The function returns an iterator that yields the keys of a data structure.
|
|
39
27
|
*/
|
|
40
28
|
keys(): IterableIterator<K>;
|
|
41
|
-
/**
|
|
42
|
-
* Time Complexity: O(n)
|
|
43
|
-
* Space Complexity: O(n)
|
|
44
|
-
*/
|
|
45
29
|
/**
|
|
46
30
|
* Time Complexity: O(n)
|
|
47
31
|
* Space Complexity: O(n)
|
|
@@ -49,10 +33,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
49
33
|
* The function returns an iterator that yields the values of a collection.
|
|
50
34
|
*/
|
|
51
35
|
values(): IterableIterator<V>;
|
|
52
|
-
/**
|
|
53
|
-
* Time Complexity: O(n)
|
|
54
|
-
* Space Complexity: O(1)
|
|
55
|
-
*/
|
|
56
36
|
/**
|
|
57
37
|
* Time Complexity: O(n)
|
|
58
38
|
* Space Complexity: O(1)
|
|
@@ -68,10 +48,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
68
48
|
* the collection satisfies the provided predicate function, and `false` otherwise.
|
|
69
49
|
*/
|
|
70
50
|
every(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Time Complexity: O(n)
|
|
73
|
-
* Space Complexity: O(1)
|
|
74
|
-
*/
|
|
75
51
|
/**
|
|
76
52
|
* Time Complexity: O(n)
|
|
77
53
|
* Space Complexity: O(1)
|
|
@@ -88,14 +64,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
88
64
|
* the collection, and false otherwise.
|
|
89
65
|
*/
|
|
90
66
|
some(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Time Complexity: O(n)
|
|
93
|
-
* Space Complexity: O(1)
|
|
94
|
-
*/
|
|
95
|
-
/**
|
|
96
|
-
* Time Complexity: O(n)
|
|
97
|
-
* Space Complexity: O(1)
|
|
98
|
-
*/
|
|
99
67
|
/**
|
|
100
68
|
* Time Complexity: O(n)
|
|
101
69
|
* Space Complexity: O(1)
|
|
@@ -110,10 +78,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
110
78
|
* used as the `this` value when calling the callback function. If `thisArg` is not provided, `
|
|
111
79
|
*/
|
|
112
80
|
forEach(callbackfn: EntryCallback<K, V, void>, thisArg?: any): void;
|
|
113
|
-
/**
|
|
114
|
-
* Time Complexity: O(n)
|
|
115
|
-
* Space Complexity: O(1)
|
|
116
|
-
*/
|
|
117
81
|
/**
|
|
118
82
|
* Time Complexity: O(n)
|
|
119
83
|
* Space Complexity: O(1)
|
|
@@ -131,11 +95,7 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
131
95
|
* the provided callback function. If no element satisfies the callback function, `undefined` is
|
|
132
96
|
* returned.
|
|
133
97
|
*/
|
|
134
|
-
find(callbackfn: EntryCallback<K, V,
|
|
135
|
-
/**
|
|
136
|
-
* Time Complexity: O(n)
|
|
137
|
-
* Space Complexity: O(1)
|
|
138
|
-
*/
|
|
98
|
+
find(callbackfn: EntryCallback<K, V, boolean>, thisArg?: any): [K, V] | undefined;
|
|
139
99
|
/**
|
|
140
100
|
* Time Complexity: O(n)
|
|
141
101
|
* Space Complexity: O(1)
|
|
@@ -147,10 +107,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
147
107
|
* otherwise.
|
|
148
108
|
*/
|
|
149
109
|
has(key: K): boolean;
|
|
150
|
-
/**
|
|
151
|
-
* Time Complexity: O(n)
|
|
152
|
-
* Space Complexity: O(1)
|
|
153
|
-
*/
|
|
154
110
|
/**
|
|
155
111
|
* Time Complexity: O(n)
|
|
156
112
|
* Space Complexity: O(1)
|
|
@@ -161,10 +117,6 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
161
117
|
* @returns a boolean value, either true or false.
|
|
162
118
|
*/
|
|
163
119
|
hasValue(value: V): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Time Complexity: O(n)
|
|
166
|
-
* Space Complexity: O(1)
|
|
167
|
-
*/
|
|
168
120
|
/**
|
|
169
121
|
* Time Complexity: O(n)
|
|
170
122
|
* Space Complexity: O(1)
|
|
@@ -193,17 +145,13 @@ export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
|
193
145
|
* all the elements in the collection.
|
|
194
146
|
*/
|
|
195
147
|
reduce<U>(callbackfn: ReduceEntryCallback<K, V, U>, initialValue: U): U;
|
|
196
|
-
/**
|
|
197
|
-
* Time Complexity: O(n)
|
|
198
|
-
* Space Complexity: O(n)
|
|
199
|
-
*/
|
|
200
148
|
/**
|
|
201
149
|
* Time Complexity: O(n)
|
|
202
150
|
* Space Complexity: O(n)
|
|
203
151
|
*
|
|
204
152
|
* The print function logs the elements of an array to the console.
|
|
205
153
|
*/
|
|
206
|
-
print():
|
|
154
|
+
print(): [K, V][] | string;
|
|
207
155
|
abstract isEmpty(): boolean;
|
|
208
156
|
abstract clear(): void;
|
|
209
157
|
abstract clone(): any;
|
|
@@ -23,10 +23,6 @@ class IterableEntryBase {
|
|
|
23
23
|
*[Symbol.iterator](...args) {
|
|
24
24
|
yield* this._getIterator(...args);
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Time Complexity: O(n)
|
|
28
|
-
* Space Complexity: O(n)
|
|
29
|
-
*/
|
|
30
26
|
/**
|
|
31
27
|
* Time Complexity: O(n)
|
|
32
28
|
* Space Complexity: O(n)
|
|
@@ -39,10 +35,6 @@ class IterableEntryBase {
|
|
|
39
35
|
yield item;
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Time Complexity: O(n)
|
|
44
|
-
* Space Complexity: O(n)
|
|
45
|
-
*/
|
|
46
38
|
/**
|
|
47
39
|
* Time Complexity: O(n)
|
|
48
40
|
* Space Complexity: O(n)
|
|
@@ -54,10 +46,6 @@ class IterableEntryBase {
|
|
|
54
46
|
yield item[0];
|
|
55
47
|
}
|
|
56
48
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Time Complexity: O(n)
|
|
59
|
-
* Space Complexity: O(n)
|
|
60
|
-
*/
|
|
61
49
|
/**
|
|
62
50
|
* Time Complexity: O(n)
|
|
63
51
|
* Space Complexity: O(n)
|
|
@@ -69,10 +57,6 @@ class IterableEntryBase {
|
|
|
69
57
|
yield item[1];
|
|
70
58
|
}
|
|
71
59
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Time Complexity: O(n)
|
|
74
|
-
* Space Complexity: O(1)
|
|
75
|
-
*/
|
|
76
60
|
/**
|
|
77
61
|
* Time Complexity: O(n)
|
|
78
62
|
* Space Complexity: O(1)
|
|
@@ -96,10 +80,6 @@ class IterableEntryBase {
|
|
|
96
80
|
}
|
|
97
81
|
return true;
|
|
98
82
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Time Complexity: O(n)
|
|
101
|
-
* Space Complexity: O(1)
|
|
102
|
-
*/
|
|
103
83
|
/**
|
|
104
84
|
* Time Complexity: O(n)
|
|
105
85
|
* Space Complexity: O(1)
|
|
@@ -124,14 +104,6 @@ class IterableEntryBase {
|
|
|
124
104
|
}
|
|
125
105
|
return false;
|
|
126
106
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Time Complexity: O(n)
|
|
129
|
-
* Space Complexity: O(1)
|
|
130
|
-
*/
|
|
131
|
-
/**
|
|
132
|
-
* Time Complexity: O(n)
|
|
133
|
-
* Space Complexity: O(1)
|
|
134
|
-
*/
|
|
135
107
|
/**
|
|
136
108
|
* Time Complexity: O(n)
|
|
137
109
|
* Space Complexity: O(1)
|
|
@@ -152,10 +124,6 @@ class IterableEntryBase {
|
|
|
152
124
|
callbackfn.call(thisArg, value, key, index++, this);
|
|
153
125
|
}
|
|
154
126
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Time Complexity: O(n)
|
|
157
|
-
* Space Complexity: O(1)
|
|
158
|
-
*/
|
|
159
127
|
/**
|
|
160
128
|
* Time Complexity: O(n)
|
|
161
129
|
* Space Complexity: O(1)
|
|
@@ -182,10 +150,6 @@ class IterableEntryBase {
|
|
|
182
150
|
}
|
|
183
151
|
return;
|
|
184
152
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Time Complexity: O(n)
|
|
187
|
-
* Space Complexity: O(1)
|
|
188
|
-
*/
|
|
189
153
|
/**
|
|
190
154
|
* Time Complexity: O(n)
|
|
191
155
|
* Space Complexity: O(1)
|
|
@@ -204,10 +168,6 @@ class IterableEntryBase {
|
|
|
204
168
|
}
|
|
205
169
|
return false;
|
|
206
170
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Time Complexity: O(n)
|
|
209
|
-
* Space Complexity: O(1)
|
|
210
|
-
*/
|
|
211
171
|
/**
|
|
212
172
|
* Time Complexity: O(n)
|
|
213
173
|
* Space Complexity: O(1)
|
|
@@ -224,10 +184,6 @@ class IterableEntryBase {
|
|
|
224
184
|
}
|
|
225
185
|
return false;
|
|
226
186
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Time Complexity: O(n)
|
|
229
|
-
* Space Complexity: O(1)
|
|
230
|
-
*/
|
|
231
187
|
/**
|
|
232
188
|
* Time Complexity: O(n)
|
|
233
189
|
* Space Complexity: O(1)
|
|
@@ -271,10 +227,6 @@ class IterableEntryBase {
|
|
|
271
227
|
}
|
|
272
228
|
return accumulator;
|
|
273
229
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Time Complexity: O(n)
|
|
276
|
-
* Space Complexity: O(n)
|
|
277
|
-
*/
|
|
278
230
|
/**
|
|
279
231
|
* Time Complexity: O(n)
|
|
280
232
|
* Space Complexity: O(n)
|
|
@@ -282,7 +234,7 @@ class IterableEntryBase {
|
|
|
282
234
|
* The print function logs the elements of an array to the console.
|
|
283
235
|
*/
|
|
284
236
|
print() {
|
|
285
|
-
|
|
237
|
+
return [...this];
|
|
286
238
|
}
|
|
287
239
|
}
|
|
288
240
|
exports.IterableEntryBase = IterableEntryBase;
|
|
@@ -54,10 +54,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
54
54
|
* @returns the sum of the count property of all nodes in the tree.
|
|
55
55
|
*/
|
|
56
56
|
get count(): number;
|
|
57
|
-
/**
|
|
58
|
-
* Time Complexity: O(n)
|
|
59
|
-
* Space Complexity: O(1)
|
|
60
|
-
*/
|
|
61
57
|
/**
|
|
62
58
|
* Time Complexity: O(n)
|
|
63
59
|
* Space Complexity: O(1)
|
|
@@ -108,10 +104,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
108
104
|
* @returns either a NODE object or undefined.
|
|
109
105
|
*/
|
|
110
106
|
keyValueOrEntryOrRawElementToNode(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): NODE | undefined;
|
|
111
|
-
/**
|
|
112
|
-
* Time Complexity: O(log n)
|
|
113
|
-
* Space Complexity: O(1)
|
|
114
|
-
*/
|
|
115
107
|
/**
|
|
116
108
|
* Time Complexity: O(log n)
|
|
117
109
|
* Space Complexity: O(1)
|
|
@@ -130,10 +122,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
130
122
|
* @returns a boolean value.
|
|
131
123
|
*/
|
|
132
124
|
add(keyOrNodeOrEntryOrRawElement: R | BTNKeyOrNodeOrEntry<K, V, NODE>, value?: V, count?: number): boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Time Complexity: O(log n)
|
|
135
|
-
* Space Complexity: O(1)
|
|
136
|
-
*/
|
|
137
125
|
/**
|
|
138
126
|
* Time Complexity: O(log n)
|
|
139
127
|
* Space Complexity: O(1)
|
|
@@ -154,10 +142,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
154
142
|
* @returns an array of `BinaryTreeDeleteResult<NODE>`.
|
|
155
143
|
*/
|
|
156
144
|
delete<C extends BTNCallback<NODE>>(identifier: ReturnType<C>, callback?: C, ignoreCount?: boolean): BinaryTreeDeleteResult<NODE>[];
|
|
157
|
-
/**
|
|
158
|
-
* Time Complexity: O(1)
|
|
159
|
-
* Space Complexity: O(1)
|
|
160
|
-
*/
|
|
161
145
|
/**
|
|
162
146
|
* Time Complexity: O(1)
|
|
163
147
|
* Space Complexity: O(1)
|
|
@@ -166,10 +150,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
166
150
|
* zero.
|
|
167
151
|
*/
|
|
168
152
|
clear(): void;
|
|
169
|
-
/**
|
|
170
|
-
* Time Complexity: O(n log n)
|
|
171
|
-
* Space Complexity: O(log n)
|
|
172
|
-
*/
|
|
173
153
|
/**
|
|
174
154
|
* Time Complexity: O(n log n)
|
|
175
155
|
* Space Complexity: O(log n)
|
|
@@ -183,10 +163,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
183
163
|
* balancing operation is successful, and `false` if there are no nodes to balance.
|
|
184
164
|
*/
|
|
185
165
|
perfectlyBalance(iterationType?: IterationType): boolean;
|
|
186
|
-
/**
|
|
187
|
-
* Time complexity: O(n)
|
|
188
|
-
* Space complexity: O(n)
|
|
189
|
-
*/
|
|
190
166
|
/**
|
|
191
167
|
* Time complexity: O(n)
|
|
192
168
|
* Space complexity: O(n)
|
|
@@ -195,10 +171,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
195
171
|
* @returns The `clone()` method is returning a cloned instance of the `TREE` object.
|
|
196
172
|
*/
|
|
197
173
|
clone(): TREE;
|
|
198
|
-
/**
|
|
199
|
-
* Time Complexity: O(1)
|
|
200
|
-
* Space Complexity: O(1)
|
|
201
|
-
*/
|
|
202
174
|
/**
|
|
203
175
|
* Time Complexity: O(1)
|
|
204
176
|
* Space Complexity: O(1)
|
|
@@ -213,10 +185,6 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = BTNEntry<K, V>, NODE
|
|
|
213
185
|
* If either `srcNode` or `destNode` is undefined, it returns `undefined`.
|
|
214
186
|
*/
|
|
215
187
|
protected _swapProperties(srcNode: R | BSTNKeyOrNode<K, NODE>, destNode: R | BSTNKeyOrNode<K, NODE>): NODE | undefined;
|
|
216
|
-
/**
|
|
217
|
-
* Time Complexity: O(1)
|
|
218
|
-
* Space Complexity: O(1)
|
|
219
|
-
*/
|
|
220
188
|
/**
|
|
221
189
|
* Time Complexity: O(1)
|
|
222
190
|
* Space Complexity: O(1)
|
|
@@ -61,10 +61,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
61
61
|
get count() {
|
|
62
62
|
return this._count;
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Time Complexity: O(n)
|
|
66
|
-
* Space Complexity: O(1)
|
|
67
|
-
*/
|
|
68
64
|
/**
|
|
69
65
|
* Time Complexity: O(n)
|
|
70
66
|
* Space Complexity: O(1)
|
|
@@ -129,26 +125,22 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
129
125
|
return;
|
|
130
126
|
if (this.isNode(keyOrNodeOrEntryOrRawElement))
|
|
131
127
|
return keyOrNodeOrEntryOrRawElement;
|
|
132
|
-
if (this.toEntryFn) {
|
|
133
|
-
const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
|
|
134
|
-
if (key)
|
|
135
|
-
return this.createNode(key, entryValue !== null && entryValue !== void 0 ? entryValue : value, count);
|
|
136
|
-
}
|
|
137
128
|
if (this.isEntry(keyOrNodeOrEntryOrRawElement)) {
|
|
138
|
-
const [key,
|
|
129
|
+
const [key, entryValue] = keyOrNodeOrEntryOrRawElement;
|
|
139
130
|
if (key === undefined || key === null)
|
|
140
131
|
return;
|
|
141
|
-
|
|
142
|
-
return this.createNode(key, value, count);
|
|
132
|
+
if (this.isKey(key))
|
|
133
|
+
return this.createNode(key, value !== null && value !== void 0 ? value : entryValue, count);
|
|
134
|
+
}
|
|
135
|
+
if (this.toEntryFn) {
|
|
136
|
+
const [key, entryValue] = this.toEntryFn(keyOrNodeOrEntryOrRawElement);
|
|
137
|
+
if (this.isKey(key))
|
|
138
|
+
return this.createNode(key, value !== null && value !== void 0 ? value : entryValue, count);
|
|
143
139
|
}
|
|
144
140
|
if (this.isKey(keyOrNodeOrEntryOrRawElement))
|
|
145
141
|
return this.createNode(keyOrNodeOrEntryOrRawElement, value, count);
|
|
146
142
|
return;
|
|
147
143
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Time Complexity: O(log n)
|
|
150
|
-
* Space Complexity: O(1)
|
|
151
|
-
*/
|
|
152
144
|
/**
|
|
153
145
|
* Time Complexity: O(log n)
|
|
154
146
|
* Space Complexity: O(1)
|
|
@@ -177,10 +169,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
177
169
|
}
|
|
178
170
|
return true;
|
|
179
171
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Time Complexity: O(log n)
|
|
182
|
-
* Space Complexity: O(1)
|
|
183
|
-
*/
|
|
184
172
|
/**
|
|
185
173
|
* Time Complexity: O(log n)
|
|
186
174
|
* Space Complexity: O(1)
|
|
@@ -233,7 +221,7 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
233
221
|
}
|
|
234
222
|
}
|
|
235
223
|
else {
|
|
236
|
-
const leftSubTreeRightMost = curr.left ? this.getRightMost(curr.left) : undefined;
|
|
224
|
+
const leftSubTreeRightMost = curr.left ? this.getRightMost(node => node, curr.left) : undefined;
|
|
237
225
|
if (leftSubTreeRightMost) {
|
|
238
226
|
const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
|
|
239
227
|
orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
|
|
@@ -259,10 +247,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
259
247
|
}
|
|
260
248
|
return deletedResult;
|
|
261
249
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Time Complexity: O(1)
|
|
264
|
-
* Space Complexity: O(1)
|
|
265
|
-
*/
|
|
266
250
|
/**
|
|
267
251
|
* Time Complexity: O(1)
|
|
268
252
|
* Space Complexity: O(1)
|
|
@@ -274,10 +258,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
274
258
|
super.clear();
|
|
275
259
|
this._count = 0;
|
|
276
260
|
}
|
|
277
|
-
/**
|
|
278
|
-
* Time Complexity: O(n log n)
|
|
279
|
-
* Space Complexity: O(log n)
|
|
280
|
-
*/
|
|
281
261
|
/**
|
|
282
262
|
* Time Complexity: O(n log n)
|
|
283
263
|
* Space Complexity: O(log n)
|
|
@@ -326,10 +306,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
326
306
|
return true;
|
|
327
307
|
}
|
|
328
308
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Time complexity: O(n)
|
|
331
|
-
* Space complexity: O(n)
|
|
332
|
-
*/
|
|
333
309
|
/**
|
|
334
310
|
* Time complexity: O(n)
|
|
335
311
|
* Space complexity: O(n)
|
|
@@ -342,10 +318,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
342
318
|
this.bfs(node => cloned.add(node.key, node.value, node.count));
|
|
343
319
|
return cloned;
|
|
344
320
|
}
|
|
345
|
-
/**
|
|
346
|
-
* Time Complexity: O(1)
|
|
347
|
-
* Space Complexity: O(1)
|
|
348
|
-
*/
|
|
349
321
|
/**
|
|
350
322
|
* Time Complexity: O(1)
|
|
351
323
|
* Space Complexity: O(1)
|
|
@@ -380,10 +352,6 @@ class AVLTreeMultiMap extends avl_tree_1.AVLTree {
|
|
|
380
352
|
}
|
|
381
353
|
return undefined;
|
|
382
354
|
}
|
|
383
|
-
/**
|
|
384
|
-
* Time Complexity: O(1)
|
|
385
|
-
* Space Complexity: O(1)
|
|
386
|
-
*/
|
|
387
355
|
/**
|
|
388
356
|
* Time Complexity: O(1)
|
|
389
357
|
* Space Complexity: O(1)
|