min-heap-typed 1.50.1 → 1.50.3
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-base.d.ts +120 -9
- package/dist/data-structures/base/iterable-base.js +143 -7
- package/dist/data-structures/binary-tree/avl-tree.d.ts +72 -47
- package/dist/data-structures/binary-tree/avl-tree.js +101 -72
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +22 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +22 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +244 -199
- package/dist/data-structures/binary-tree/binary-tree.js +484 -376
- package/dist/data-structures/binary-tree/bst.d.ts +92 -79
- package/dist/data-structures/binary-tree/bst.js +68 -76
- package/dist/data-structures/binary-tree/rb-tree.d.ts +127 -57
- package/dist/data-structures/binary-tree/rb-tree.js +152 -99
- package/dist/data-structures/binary-tree/segment-tree.d.ts +99 -6
- package/dist/data-structures/binary-tree/segment-tree.js +127 -10
- package/dist/data-structures/binary-tree/tree-multimap.d.ts +72 -58
- package/dist/data-structures/binary-tree/tree-multimap.js +102 -85
- package/dist/data-structures/graph/abstract-graph.d.ts +1 -78
- package/dist/data-structures/graph/abstract-graph.js +3 -189
- package/dist/data-structures/graph/directed-graph.d.ts +73 -0
- package/dist/data-structures/graph/directed-graph.js +131 -0
- package/dist/data-structures/graph/map-graph.d.ts +8 -0
- package/dist/data-structures/graph/map-graph.js +14 -0
- package/dist/data-structures/graph/undirected-graph.d.ts +76 -7
- package/dist/data-structures/graph/undirected-graph.js +151 -18
- package/dist/data-structures/hash/hash-map.d.ts +254 -28
- package/dist/data-structures/hash/hash-map.js +347 -78
- package/dist/data-structures/heap/heap.d.ts +95 -25
- package/dist/data-structures/heap/heap.js +95 -26
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +126 -63
- package/dist/data-structures/linked-list/doubly-linked-list.js +141 -77
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +154 -106
- package/dist/data-structures/linked-list/singly-linked-list.js +164 -115
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +63 -36
- package/dist/data-structures/linked-list/skip-linked-list.js +63 -36
- package/dist/data-structures/matrix/matrix.d.ts +35 -4
- package/dist/data-structures/matrix/matrix.js +50 -11
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +10 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +10 -0
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +11 -0
- package/dist/data-structures/priority-queue/priority-queue.d.ts +8 -0
- package/dist/data-structures/priority-queue/priority-queue.js +8 -0
- package/dist/data-structures/queue/deque.d.ts +139 -35
- package/dist/data-structures/queue/deque.js +200 -62
- package/dist/data-structures/queue/queue.d.ts +103 -49
- package/dist/data-structures/queue/queue.js +111 -49
- package/dist/data-structures/stack/stack.d.ts +51 -21
- package/dist/data-structures/stack/stack.js +58 -22
- package/dist/data-structures/tree/tree.d.ts +57 -3
- package/dist/data-structures/tree/tree.js +77 -11
- package/dist/data-structures/trie/trie.d.ts +135 -34
- package/dist/data-structures/trie/trie.js +153 -33
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/types/data-structures/hash/hash-map.d.ts +4 -3
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -2
- package/src/data-structures/base/iterable-base.ts +184 -19
- package/src/data-structures/binary-tree/avl-tree.ts +134 -100
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +22 -0
- package/src/data-structures/binary-tree/binary-tree.ts +674 -671
- package/src/data-structures/binary-tree/bst.ts +127 -136
- package/src/data-structures/binary-tree/rb-tree.ts +199 -166
- package/src/data-structures/binary-tree/segment-tree.ts +145 -11
- package/src/data-structures/binary-tree/tree-multimap.ts +138 -115
- package/src/data-structures/graph/abstract-graph.ts +4 -211
- package/src/data-structures/graph/directed-graph.ts +152 -0
- package/src/data-structures/graph/map-graph.ts +15 -0
- package/src/data-structures/graph/undirected-graph.ts +171 -19
- package/src/data-structures/hash/hash-map.ts +389 -96
- package/src/data-structures/heap/heap.ts +97 -26
- package/src/data-structures/linked-list/doubly-linked-list.ts +156 -83
- package/src/data-structures/linked-list/singly-linked-list.ts +174 -120
- package/src/data-structures/linked-list/skip-linked-list.ts +63 -37
- package/src/data-structures/matrix/matrix.ts +52 -12
- package/src/data-structures/priority-queue/max-priority-queue.ts +10 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +11 -0
- package/src/data-structures/priority-queue/priority-queue.ts +8 -0
- package/src/data-structures/queue/deque.ts +225 -70
- package/src/data-structures/queue/queue.ts +118 -49
- package/src/data-structures/stack/stack.ts +63 -23
- package/src/data-structures/tree/tree.ts +89 -15
- package/src/data-structures/trie/trie.ts +173 -38
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
- package/src/types/data-structures/hash/hash-map.ts +4 -3
- package/src/types/utils/utils.ts +2 -0
|
@@ -14,10 +14,6 @@ import { IterableEntryBase } from '../base';
|
|
|
14
14
|
* 4. Unordered Collection: HashMap does not guarantee the order of entries, and the order may change over time.
|
|
15
15
|
*/
|
|
16
16
|
export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntryBase<K, V> {
|
|
17
|
-
protected _store: {
|
|
18
|
-
[key: string]: HashMapStoreItem<K, V>;
|
|
19
|
-
};
|
|
20
|
-
protected _objMap: Map<object, V>;
|
|
21
17
|
/**
|
|
22
18
|
* The constructor function initializes a HashMap object with an optional initial collection and
|
|
23
19
|
* options.
|
|
@@ -25,13 +21,61 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
25
21
|
* `T`. It is an optional parameter and its default value is an empty array `[]`.
|
|
26
22
|
* @param [options] - The `options` parameter is an optional object that can contain two properties:
|
|
27
23
|
*/
|
|
28
|
-
constructor(rawCollection?: Iterable<R>, options?: HashMapOptions<K, V, R>);
|
|
24
|
+
constructor(rawCollection?: Iterable<R | [K, V]>, options?: HashMapOptions<K, V, R>);
|
|
25
|
+
protected _store: {
|
|
26
|
+
[key: string]: HashMapStoreItem<K, V>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The function returns the store object, which is a dictionary of HashMapStoreItem objects.
|
|
30
|
+
* @returns The store property is being returned. It is a dictionary-like object with string keys and
|
|
31
|
+
* values of type HashMapStoreItem<K, V>.
|
|
32
|
+
*/
|
|
33
|
+
get store(): {
|
|
34
|
+
[p: string]: HashMapStoreItem<K, V>;
|
|
35
|
+
};
|
|
36
|
+
protected _objMap: Map<object, V>;
|
|
37
|
+
/**
|
|
38
|
+
* The function returns the object map.
|
|
39
|
+
* @returns The `objMap` property is being returned, which is a `Map` object with keys of type
|
|
40
|
+
* `object` and values of type `V`.
|
|
41
|
+
*/
|
|
42
|
+
get objMap(): Map<object, V>;
|
|
29
43
|
protected _toEntryFn: (rawElement: R) => [K, V];
|
|
44
|
+
/**
|
|
45
|
+
* The function returns the value of the _toEntryFn property.
|
|
46
|
+
* @returns The function being returned is `this._toEntryFn`.
|
|
47
|
+
*/
|
|
30
48
|
get toEntryFn(): (rawElement: R) => [K, V];
|
|
31
49
|
protected _size: number;
|
|
50
|
+
/**
|
|
51
|
+
* The function returns the size of an object.
|
|
52
|
+
* @returns The size of the object, which is a number.
|
|
53
|
+
*/
|
|
32
54
|
get size(): number;
|
|
55
|
+
protected _hashFn: (key: K) => string;
|
|
56
|
+
/**
|
|
57
|
+
* The hasFn function is a function that takes in an item and returns a boolean
|
|
58
|
+
* indicating whether the item is contained within the hash table.
|
|
59
|
+
*
|
|
60
|
+
* @return The hash function
|
|
61
|
+
*/
|
|
62
|
+
get hashFn(): (key: K) => string;
|
|
63
|
+
/**
|
|
64
|
+
* The function checks if a given element is an array with exactly two elements.
|
|
65
|
+
* @param {any} rawElement - The `rawElement` parameter is of type `any`, which means it can be any
|
|
66
|
+
* data type.
|
|
67
|
+
* @returns a boolean value.
|
|
68
|
+
*/
|
|
33
69
|
isEntry(rawElement: any): rawElement is [K, V];
|
|
70
|
+
/**
|
|
71
|
+
* The function checks if the size of an object is equal to zero and returns a boolean value.
|
|
72
|
+
* @returns A boolean value indicating whether the size of the object is 0 or not.
|
|
73
|
+
*/
|
|
34
74
|
isEmpty(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The clear() function resets the state of an object by clearing its internal store, object map, and
|
|
77
|
+
* size.
|
|
78
|
+
*/
|
|
35
79
|
clear(): void;
|
|
36
80
|
/**
|
|
37
81
|
* The `set` function adds a key-value pair to a map-like data structure, incrementing the size if
|
|
@@ -50,7 +94,7 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
50
94
|
* `T`.
|
|
51
95
|
* @returns The `setMany` function is returning an array of booleans.
|
|
52
96
|
*/
|
|
53
|
-
setMany(rawCollection: Iterable<R>): boolean[];
|
|
97
|
+
setMany(rawCollection: Iterable<R | [K, V]>): boolean[];
|
|
54
98
|
/**
|
|
55
99
|
* The `get` function retrieves a value from a map based on a given key, either from an object map or
|
|
56
100
|
* a string map.
|
|
@@ -75,6 +119,18 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
75
119
|
* successfully deleted from the map, and `false` if the key was not found in the map.
|
|
76
120
|
*/
|
|
77
121
|
delete(key: K): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Time Complexity: O(n)
|
|
124
|
+
* Space Complexity: O(n)
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* The clone function creates a new HashMap with the same key-value pairs as
|
|
128
|
+
* this one. The clone function is useful for creating a copy of an existing
|
|
129
|
+
* HashMap, and then modifying that copy without affecting the original.
|
|
130
|
+
*
|
|
131
|
+
* @return A new hashmap with the same values as this one
|
|
132
|
+
*/
|
|
133
|
+
clone(): HashMap<K, V, R>;
|
|
78
134
|
/**
|
|
79
135
|
* Time Complexity: O(n)
|
|
80
136
|
* Space Complexity: O(n)
|
|
@@ -94,10 +150,6 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
94
150
|
* the provided callback function.
|
|
95
151
|
*/
|
|
96
152
|
map<U>(callbackfn: EntryCallback<K, V, U>, thisArg?: any): HashMap<K, U>;
|
|
97
|
-
/**
|
|
98
|
-
* Time Complexity: O(n)
|
|
99
|
-
* Space Complexity: O(n)
|
|
100
|
-
*/
|
|
101
153
|
/**
|
|
102
154
|
* Time Complexity: O(n)
|
|
103
155
|
* Space Complexity: O(n)
|
|
@@ -115,14 +167,33 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
115
167
|
* from the original `HashMap` that pass the provided `predicate` function.
|
|
116
168
|
*/
|
|
117
169
|
filter(predicate: EntryCallback<K, V, boolean>, thisArg?: any): HashMap<K, V>;
|
|
170
|
+
/**
|
|
171
|
+
* The put function sets a value in a data structure using a specified key.
|
|
172
|
+
* @param {K} key - The key parameter is of type K, which represents the type of the key being passed
|
|
173
|
+
* to the function.
|
|
174
|
+
* @param {V} value - The value parameter represents the value that you want to associate with the
|
|
175
|
+
* specified key in the data structure.
|
|
176
|
+
* @returns The method is returning a boolean value.
|
|
177
|
+
*/
|
|
118
178
|
put(key: K, value: V): boolean;
|
|
119
179
|
/**
|
|
120
180
|
* The function returns an iterator that yields key-value pairs from both an object store and an
|
|
121
181
|
* object map.
|
|
122
182
|
*/
|
|
123
183
|
protected _getIterator(): IterableIterator<[K, V]>;
|
|
124
|
-
|
|
184
|
+
/**
|
|
185
|
+
* The function checks if a given key is an object or a function.
|
|
186
|
+
* @param {any} key - The parameter "key" can be of any type.
|
|
187
|
+
* @returns a boolean value.
|
|
188
|
+
*/
|
|
125
189
|
protected _isObjKey(key: any): key is object | ((...args: any[]) => any);
|
|
190
|
+
/**
|
|
191
|
+
* The function `_getNoObjKey` takes a key and returns a string representation of the key, handling
|
|
192
|
+
* different types of keys.
|
|
193
|
+
* @param {K} key - The `key` parameter is of type `K`, which represents the type of the key being
|
|
194
|
+
* passed to the `_getNoObjKey` function.
|
|
195
|
+
* @returns a string value.
|
|
196
|
+
*/
|
|
126
197
|
protected _getNoObjKey(key: K): string;
|
|
127
198
|
}
|
|
128
199
|
/**
|
|
@@ -130,15 +201,73 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
130
201
|
* 2. Based on Hash Table and Linked List: It combines the structures of a hash table and a linked list, using the hash table to ensure fast access, while maintaining the order of entries through the linked list.
|
|
131
202
|
* 3. Time Complexity: Similar to HashMap, LinkedHashMap offers constant-time performance for get and put operations in most cases.
|
|
132
203
|
*/
|
|
133
|
-
export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K, V> {
|
|
204
|
+
export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends IterableEntryBase<K, V> {
|
|
205
|
+
protected readonly _sentinel: HashMapLinkedNode<K, V | undefined>;
|
|
206
|
+
/**
|
|
207
|
+
* The constructor initializes a LinkedHashMap object with an optional raw collection and options.
|
|
208
|
+
* @param rawCollection - The `rawCollection` parameter is an iterable collection of elements. It is
|
|
209
|
+
* used to initialize the HashMapLinked instance with key-value pairs. Each element in the
|
|
210
|
+
* `rawCollection` is converted to a key-value pair using the `toEntryFn` function (if provided) and
|
|
211
|
+
* then added to the HashMap
|
|
212
|
+
* @param [options] - The `options` parameter is an optional object that can contain the following
|
|
213
|
+
* properties:
|
|
214
|
+
*/
|
|
215
|
+
constructor(rawCollection?: Iterable<R>, options?: LinkedHashMapOptions<K, V, R>);
|
|
216
|
+
protected _hashFn: (key: K) => string;
|
|
217
|
+
/**
|
|
218
|
+
* The function returns the hash function used for generating a hash value for a given key.
|
|
219
|
+
* @returns The hash function that takes a key of type K and returns a string.
|
|
220
|
+
*/
|
|
221
|
+
get hashFn(): (key: K) => string;
|
|
222
|
+
protected _objHashFn: (key: K) => object;
|
|
223
|
+
/**
|
|
224
|
+
* The function returns the object hash function.
|
|
225
|
+
* @returns The function `objHashFn` is being returned.
|
|
226
|
+
*/
|
|
227
|
+
get objHashFn(): (key: K) => object;
|
|
134
228
|
protected _noObjMap: Record<string, HashMapLinkedNode<K, V | undefined>>;
|
|
229
|
+
/**
|
|
230
|
+
* The function returns a record of HashMapLinkedNode objects with string keys.
|
|
231
|
+
* @returns The method is returning a Record object, which is a TypeScript type that represents an
|
|
232
|
+
* object with string keys and values that are HashMapLinkedNode objects with keys of type K and
|
|
233
|
+
* values of type V or undefined.
|
|
234
|
+
*/
|
|
235
|
+
get noObjMap(): Record<string, HashMapLinkedNode<K, V | undefined>>;
|
|
135
236
|
protected _objMap: WeakMap<object, HashMapLinkedNode<K, V | undefined>>;
|
|
237
|
+
/**
|
|
238
|
+
* The function returns the WeakMap object used to map objects to HashMapLinkedNode instances.
|
|
239
|
+
* @returns The `objMap` property is being returned.
|
|
240
|
+
*/
|
|
241
|
+
get objMap(): WeakMap<object, HashMapLinkedNode<K, V | undefined>>;
|
|
136
242
|
protected _head: HashMapLinkedNode<K, V | undefined>;
|
|
243
|
+
/**
|
|
244
|
+
* The function returns the head node of a HashMapLinkedNode.
|
|
245
|
+
* @returns The method `getHead()` is returning a `HashMapLinkedNode` object with key type `K` and
|
|
246
|
+
* value type `V | undefined`.
|
|
247
|
+
*/
|
|
248
|
+
get head(): HashMapLinkedNode<K, V | undefined>;
|
|
137
249
|
protected _tail: HashMapLinkedNode<K, V | undefined>;
|
|
138
|
-
|
|
139
|
-
|
|
250
|
+
/**
|
|
251
|
+
* The function returns the tail node of a HashMapLinkedNode.
|
|
252
|
+
* @returns The `_tail` property of type `HashMapLinkedNode<K, V | undefined>` is being returned.
|
|
253
|
+
*/
|
|
254
|
+
get tail(): HashMapLinkedNode<K, V | undefined>;
|
|
255
|
+
protected _toEntryFn: (rawElement: R) => [K, V];
|
|
256
|
+
/**
|
|
257
|
+
* The function returns the value of the _toEntryFn property.
|
|
258
|
+
* @returns The function being returned is `this._toEntryFn`.
|
|
259
|
+
*/
|
|
260
|
+
get toEntryFn(): (rawElement: R) => [K, V];
|
|
140
261
|
protected _size: number;
|
|
262
|
+
/**
|
|
263
|
+
* The function returns the size of an object.
|
|
264
|
+
* @returns The size of the object.
|
|
265
|
+
*/
|
|
141
266
|
get size(): number;
|
|
267
|
+
/**
|
|
268
|
+
* Time Complexity: O(1)
|
|
269
|
+
* Space Complexity: O(1)
|
|
270
|
+
*/
|
|
142
271
|
/**
|
|
143
272
|
* Time Complexity: O(1)
|
|
144
273
|
* Space Complexity: O(1)
|
|
@@ -148,6 +277,10 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
148
277
|
* value (V).
|
|
149
278
|
*/
|
|
150
279
|
get first(): [K, V] | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Time Complexity: O(1)
|
|
282
|
+
* Space Complexity: O(1)
|
|
283
|
+
*/
|
|
151
284
|
/**
|
|
152
285
|
* Time Complexity: O(1)
|
|
153
286
|
* Space Complexity: O(1)
|
|
@@ -166,6 +299,10 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
166
299
|
* key and value.
|
|
167
300
|
*/
|
|
168
301
|
reverseBegin(): Generator<(K | V | undefined)[], void, unknown>;
|
|
302
|
+
/**
|
|
303
|
+
* Time Complexity: O(1)
|
|
304
|
+
* Space Complexity: O(1)
|
|
305
|
+
*/
|
|
169
306
|
/**
|
|
170
307
|
* Time Complexity: O(1)
|
|
171
308
|
* Space Complexity: O(1)
|
|
@@ -179,8 +316,26 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
179
316
|
* @returns the size of the data structure after the key-value pair has been set.
|
|
180
317
|
*/
|
|
181
318
|
set(key: K, value?: V): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* The function `setMany` takes an iterable collection, converts each element into a key-value pair
|
|
321
|
+
* using a provided function, and sets each key-value pair in the current object, returning an array
|
|
322
|
+
* of booleans indicating the success of each set operation.
|
|
323
|
+
* @param rawCollection - The rawCollection parameter is an iterable collection of elements of type
|
|
324
|
+
* R.
|
|
325
|
+
* @returns The `setMany` function returns an array of booleans.
|
|
326
|
+
*/
|
|
327
|
+
setMany(rawCollection: Iterable<R>): boolean[];
|
|
328
|
+
/**
|
|
329
|
+
* The function checks if a given key exists in a map, using different logic depending on whether the
|
|
330
|
+
* key is a weak key or not.
|
|
331
|
+
* @param {K} key - The `key` parameter is the key that is being checked for existence in the map.
|
|
332
|
+
* @returns The method `has` is returning a boolean value.
|
|
333
|
+
*/
|
|
182
334
|
has(key: K): boolean;
|
|
183
|
-
|
|
335
|
+
/**
|
|
336
|
+
* Time Complexity: O(1)
|
|
337
|
+
* Space Complexity: O(1)
|
|
338
|
+
*/
|
|
184
339
|
/**
|
|
185
340
|
* Time Complexity: O(1)
|
|
186
341
|
* Space Complexity: O(1)
|
|
@@ -196,18 +351,28 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
196
351
|
*/
|
|
197
352
|
get(key: K): V | undefined;
|
|
198
353
|
/**
|
|
199
|
-
* Time Complexity: O(n)
|
|
354
|
+
* Time Complexity: O(n)
|
|
355
|
+
* Space Complexity: O(1)
|
|
356
|
+
* /
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Time Complexity: O(n)
|
|
200
360
|
* Space Complexity: O(1)
|
|
201
361
|
*
|
|
202
|
-
* The function `
|
|
362
|
+
* The function `at` retrieves the key-value pair at a specified index in a linked list.
|
|
203
363
|
* @param {number} index - The index parameter is a number that represents the position of the
|
|
204
364
|
* element we want to retrieve from the data structure.
|
|
205
|
-
* @returns The method `
|
|
365
|
+
* @returns The method `at(index: number)` is returning an array containing the key-value pair at
|
|
206
366
|
* the specified index in the data structure. The key-value pair is represented as a tuple `[K, V]`,
|
|
207
367
|
* where `K` is the key and `V` is the value.
|
|
208
368
|
*/
|
|
209
|
-
|
|
369
|
+
at(index: number): V | undefined;
|
|
210
370
|
/**
|
|
371
|
+
* Time Complexity: O(1)
|
|
372
|
+
* Space Complexity: O(1)
|
|
373
|
+
* /
|
|
374
|
+
|
|
375
|
+
/**
|
|
211
376
|
* Time Complexity: O(1)
|
|
212
377
|
* Space Complexity: O(1)
|
|
213
378
|
*
|
|
@@ -219,7 +384,12 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
219
384
|
*/
|
|
220
385
|
delete(key: K): boolean;
|
|
221
386
|
/**
|
|
222
|
-
* Time Complexity: O(n)
|
|
387
|
+
* Time Complexity: O(n)
|
|
388
|
+
* Space Complexity: O(1)
|
|
389
|
+
* /
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Time Complexity: O(n)
|
|
223
393
|
* Space Complexity: O(1)
|
|
224
394
|
*
|
|
225
395
|
* The `deleteAt` function deletes a node at a specified index in a linked list.
|
|
@@ -229,6 +399,11 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
229
399
|
*/
|
|
230
400
|
deleteAt(index: number): boolean;
|
|
231
401
|
/**
|
|
402
|
+
* Time Complexity: O(1)
|
|
403
|
+
* Space Complexity: O(1)
|
|
404
|
+
* /
|
|
405
|
+
|
|
406
|
+
/**
|
|
232
407
|
* Time Complexity: O(1)
|
|
233
408
|
* Space Complexity: O(1)
|
|
234
409
|
*
|
|
@@ -238,14 +413,44 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
238
413
|
*/
|
|
239
414
|
isEmpty(): boolean;
|
|
240
415
|
/**
|
|
416
|
+
* The function checks if a given element is an array with exactly two elements.
|
|
417
|
+
* @param {any} rawElement - The `rawElement` parameter is of type `any`, which means it can be any
|
|
418
|
+
* data type.
|
|
419
|
+
* @returns a boolean value.
|
|
420
|
+
*/
|
|
421
|
+
isEntry(rawElement: any): rawElement is [K, V];
|
|
422
|
+
/**
|
|
423
|
+
* Time Complexity: O(1)
|
|
424
|
+
* Space Complexity: O(1)
|
|
425
|
+
* /
|
|
426
|
+
|
|
427
|
+
/**
|
|
241
428
|
* Time Complexity: O(1)
|
|
242
429
|
* Space Complexity: O(1)
|
|
243
430
|
*
|
|
244
431
|
* The `clear` function clears all the entries in a data structure and resets its properties.
|
|
245
432
|
*/
|
|
246
433
|
clear(): void;
|
|
434
|
+
/**
|
|
435
|
+
* Time Complexity: O(n)
|
|
436
|
+
* Space Complexity: O(n)
|
|
437
|
+
*/
|
|
438
|
+
/**
|
|
439
|
+
* Time Complexity: O(n)
|
|
440
|
+
* Space Complexity: O(n)
|
|
441
|
+
*
|
|
442
|
+
* The `clone` function creates a new instance of a `LinkedHashMap` with the same key-value pairs as
|
|
443
|
+
* the original.
|
|
444
|
+
* @returns The `clone()` method is returning a new instance of `LinkedHashMap<K, V>` that is a clone
|
|
445
|
+
* of the original `LinkedHashMap` object.
|
|
446
|
+
*/
|
|
247
447
|
clone(): LinkedHashMap<K, V>;
|
|
248
448
|
/**
|
|
449
|
+
* Time Complexity: O(n)
|
|
450
|
+
* Space Complexity: O(n)
|
|
451
|
+
* /
|
|
452
|
+
|
|
453
|
+
/**
|
|
249
454
|
* Time Complexity: O(n)
|
|
250
455
|
* Space Complexity: O(n)
|
|
251
456
|
*
|
|
@@ -262,6 +467,11 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
262
467
|
*/
|
|
263
468
|
filter(predicate: EntryCallback<K, V, boolean>, thisArg?: any): LinkedHashMap<K, V>;
|
|
264
469
|
/**
|
|
470
|
+
* Time Complexity: O(n)
|
|
471
|
+
* Space Complexity: O(n)
|
|
472
|
+
* /
|
|
473
|
+
|
|
474
|
+
/**
|
|
265
475
|
* Time Complexity: O(n)
|
|
266
476
|
* Space Complexity: O(n)
|
|
267
477
|
*
|
|
@@ -280,23 +490,39 @@ export declare class LinkedHashMap<K = any, V = any> extends IterableEntryBase<K
|
|
|
280
490
|
*/
|
|
281
491
|
map<NV>(callback: EntryCallback<K, V, NV>, thisArg?: any): LinkedHashMap<K, NV>;
|
|
282
492
|
/**
|
|
283
|
-
* Time Complexity: O(
|
|
284
|
-
* Space Complexity: O(
|
|
493
|
+
* Time Complexity: O(1)
|
|
494
|
+
* Space Complexity: O(1)
|
|
285
495
|
*/
|
|
286
|
-
put(key: K, value: V): boolean;
|
|
287
496
|
/**
|
|
288
|
-
* Time Complexity: O(
|
|
289
|
-
* Space Complexity: O(
|
|
497
|
+
* Time Complexity: O(1)
|
|
498
|
+
* Space Complexity: O(1)
|
|
499
|
+
*
|
|
500
|
+
* The put function sets a value in a data structure using a specified key.
|
|
501
|
+
* @param {K} key - The key parameter is of type K, which represents the type of the key being passed
|
|
502
|
+
* to the function.
|
|
503
|
+
* @param {V} value - The value parameter represents the value that you want to associate with the
|
|
504
|
+
* specified key in the data structure.
|
|
505
|
+
* @returns The method is returning a boolean value.
|
|
290
506
|
*/
|
|
291
|
-
|
|
292
|
-
protected _objHashFn: (key: K) => object;
|
|
507
|
+
put(key: K, value: V): boolean;
|
|
293
508
|
/**
|
|
294
|
-
* Time Complexity: O(n)
|
|
509
|
+
* Time Complexity: O(n)
|
|
510
|
+
* Space Complexity: O(1)
|
|
511
|
+
* where n is the number of entries in the LinkedHashMap.
|
|
512
|
+
* /
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Time Complexity: O(n)
|
|
295
516
|
* Space Complexity: O(1)
|
|
517
|
+
* where n is the number of entries in the LinkedHashMap.
|
|
296
518
|
*
|
|
297
519
|
* The above function is an iterator that yields key-value pairs from a linked list.
|
|
298
520
|
*/
|
|
299
521
|
protected _getIterator(): Generator<[K, V], void, unknown>;
|
|
522
|
+
/**
|
|
523
|
+
* Time Complexity: O(1)
|
|
524
|
+
* Space Complexity: O(1)
|
|
525
|
+
*/
|
|
300
526
|
/**
|
|
301
527
|
* Time Complexity: O(1)
|
|
302
528
|
* Space Complexity: O(1)
|