red-black-tree-typed 1.53.6 → 1.54.1
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/README.md +52 -0
- package/dist/common/index.d.ts +12 -0
- package/dist/common/index.js +28 -0
- package/dist/data-structures/base/iterable-entry-base.js +4 -4
- package/dist/data-structures/binary-tree/avl-tree-counter.d.ts +213 -0
- package/dist/data-structures/binary-tree/avl-tree-counter.js +407 -0
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +71 -170
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +133 -331
- package/dist/data-structures/binary-tree/avl-tree.d.ts +103 -69
- package/dist/data-structures/binary-tree/avl-tree.js +131 -71
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +3 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +309 -208
- package/dist/data-structures/binary-tree/binary-tree.js +382 -300
- package/dist/data-structures/binary-tree/bst.d.ts +245 -127
- package/dist/data-structures/binary-tree/bst.js +366 -163
- package/dist/data-structures/binary-tree/index.d.ts +3 -1
- package/dist/data-structures/binary-tree/index.js +3 -1
- package/dist/data-structures/binary-tree/red-black-tree.d.ts +286 -0
- package/dist/data-structures/binary-tree/{rb-tree.js → red-black-tree.js} +181 -108
- package/dist/data-structures/binary-tree/tree-counter.d.ts +212 -0
- package/dist/data-structures/binary-tree/tree-counter.js +444 -0
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +78 -170
- package/dist/data-structures/binary-tree/tree-multi-map.js +145 -367
- package/dist/data-structures/graph/abstract-graph.js +2 -2
- package/dist/data-structures/graph/directed-graph.d.ts +3 -0
- package/dist/data-structures/graph/directed-graph.js +3 -0
- package/dist/data-structures/graph/map-graph.d.ts +3 -0
- package/dist/data-structures/graph/map-graph.js +3 -0
- package/dist/data-structures/graph/undirected-graph.d.ts +3 -0
- package/dist/data-structures/graph/undirected-graph.js +3 -0
- package/dist/data-structures/hash/hash-map.d.ts +31 -1
- package/dist/data-structures/hash/hash-map.js +35 -5
- package/dist/data-structures/heap/heap.d.ts +26 -9
- package/dist/data-structures/heap/heap.js +37 -17
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +64 -19
- package/dist/data-structures/linked-list/doubly-linked-list.js +92 -31
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +48 -12
- package/dist/data-structures/linked-list/singly-linked-list.js +74 -27
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +3 -0
- package/dist/data-structures/linked-list/skip-linked-list.js +3 -0
- package/dist/data-structures/matrix/matrix.d.ts +3 -0
- package/dist/data-structures/matrix/matrix.js +3 -0
- package/dist/data-structures/matrix/navigator.d.ts +3 -0
- package/dist/data-structures/matrix/navigator.js +3 -0
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +3 -0
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +3 -0
- package/dist/data-structures/queue/deque.d.ts +37 -8
- package/dist/data-structures/queue/deque.js +73 -29
- package/dist/data-structures/queue/queue.d.ts +41 -1
- package/dist/data-structures/queue/queue.js +51 -9
- package/dist/data-structures/stack/stack.d.ts +27 -10
- package/dist/data-structures/stack/stack.js +39 -20
- package/dist/data-structures/trie/trie.d.ts +111 -10
- package/dist/data-structures/trie/trie.js +123 -18
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/interfaces/binary-tree.d.ts +8 -8
- package/dist/types/data-structures/base/base.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.js +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -4
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -3
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -4
- package/dist/types/data-structures/binary-tree/bst.d.ts +6 -5
- package/dist/types/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/index.js +2 -0
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +2 -5
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/tree-counter.js +2 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -5
- package/dist/types/utils/utils.d.ts +10 -6
- package/dist/utils/utils.js +4 -2
- package/package.json +2 -2
- package/src/common/index.ts +25 -0
- package/src/data-structures/base/iterable-entry-base.ts +4 -4
- package/src/data-structures/binary-tree/avl-tree-counter.ts +463 -0
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +152 -373
- package/src/data-structures/binary-tree/avl-tree.ts +164 -106
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -0
- package/src/data-structures/binary-tree/binary-tree.ts +563 -447
- package/src/data-structures/binary-tree/bst.ts +433 -237
- package/src/data-structures/binary-tree/index.ts +3 -1
- package/src/data-structures/binary-tree/{rb-tree.ts → red-black-tree.ts} +224 -146
- package/src/data-structures/binary-tree/tree-counter.ts +504 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +159 -401
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +3 -0
- package/src/data-structures/graph/map-graph.ts +3 -0
- package/src/data-structures/graph/undirected-graph.ts +3 -0
- package/src/data-structures/hash/hash-map.ts +37 -7
- package/src/data-structures/heap/heap.ts +72 -49
- package/src/data-structures/linked-list/doubly-linked-list.ts +186 -118
- package/src/data-structures/linked-list/singly-linked-list.ts +81 -28
- package/src/data-structures/linked-list/skip-linked-list.ts +3 -0
- package/src/data-structures/matrix/matrix.ts +3 -0
- package/src/data-structures/matrix/navigator.ts +3 -0
- package/src/data-structures/priority-queue/max-priority-queue.ts +3 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +3 -0
- package/src/data-structures/queue/deque.ts +72 -28
- package/src/data-structures/queue/queue.ts +50 -7
- package/src/data-structures/stack/stack.ts +39 -20
- package/src/data-structures/trie/trie.ts +123 -17
- package/src/index.ts +4 -3
- package/src/interfaces/binary-tree.ts +10 -21
- package/src/types/data-structures/base/base.ts +1 -1
- package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -6
- package/src/types/data-structures/binary-tree/avl-tree.ts +0 -5
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -6
- package/src/types/data-structures/binary-tree/bst.ts +8 -7
- package/src/types/data-structures/binary-tree/index.ts +3 -1
- package/src/types/data-structures/binary-tree/red-black-tree.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -7
- package/src/types/utils/utils.ts +16 -10
- package/src/utils/utils.ts +4 -2
- package/dist/data-structures/binary-tree/rb-tree.d.ts +0 -205
- package/src/types/data-structures/binary-tree/rb-tree.ts +0 -10
|
@@ -33,6 +33,9 @@ class UndirectedEdge extends abstract_graph_1.AbstractEdge {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.UndirectedEdge = UndirectedEdge;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
36
39
|
class UndirectedGraph extends abstract_graph_1.AbstractGraph {
|
|
37
40
|
/**
|
|
38
41
|
* The constructor initializes a new Map object to store edgeMap.
|
|
@@ -62,6 +62,9 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
62
62
|
*/
|
|
63
63
|
get hashFn(): (key: K) => string;
|
|
64
64
|
/**
|
|
65
|
+
* Time Complexity: O(1)
|
|
66
|
+
* Space Complexity: O(1)
|
|
67
|
+
*
|
|
65
68
|
* The function checks if a given element is an array with exactly two elements.
|
|
66
69
|
* @param {any} rawElement - The `rawElement` parameter is of type `any`, which means it can be any
|
|
67
70
|
* data type.
|
|
@@ -69,16 +72,25 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
69
72
|
*/
|
|
70
73
|
isEntry(rawElement: any): rawElement is [K, V];
|
|
71
74
|
/**
|
|
75
|
+
* Time Complexity: O(1)
|
|
76
|
+
* Space Complexity: O(1)
|
|
77
|
+
*
|
|
72
78
|
* The function checks if the size of an object is equal to zero and returns a boolean value.
|
|
73
79
|
* @returns A boolean value indicating whether the size of the object is 0 or not.
|
|
74
80
|
*/
|
|
75
81
|
isEmpty(): boolean;
|
|
76
82
|
/**
|
|
83
|
+
* Time Complexity: O(1)
|
|
84
|
+
* Space Complexity: O(1)
|
|
85
|
+
*
|
|
77
86
|
* The clear() function resets the state of an object by clearing its internal store, object map, and
|
|
78
87
|
* size.
|
|
79
88
|
*/
|
|
80
89
|
clear(): void;
|
|
81
90
|
/**
|
|
91
|
+
* Time Complexity: O(1)
|
|
92
|
+
* Space Complexity: O(1)
|
|
93
|
+
*
|
|
82
94
|
* The `set` function adds a key-value pair to a map-like data structure, incrementing the size if
|
|
83
95
|
* the key is not already present.
|
|
84
96
|
* @param {K} key - The key parameter is the key used to identify the value in the data structure. It
|
|
@@ -89,6 +101,9 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
89
101
|
*/
|
|
90
102
|
set(key: K, value: V): boolean;
|
|
91
103
|
/**
|
|
104
|
+
* Time Complexity: O(k)
|
|
105
|
+
* Space Complexity: O(k)
|
|
106
|
+
*
|
|
92
107
|
* The function `setMany` takes an iterable collection of objects, maps each object to a key-value
|
|
93
108
|
* pair using a mapping function, and sets each key-value pair in the current object.
|
|
94
109
|
* @param entryOrRawElements - The `entryOrRawElements` parameter is an iterable collection of elements of a type
|
|
@@ -97,6 +112,9 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
97
112
|
*/
|
|
98
113
|
setMany(entryOrRawElements: Iterable<R | [K, V]>): boolean[];
|
|
99
114
|
/**
|
|
115
|
+
* Time Complexity: O(1)
|
|
116
|
+
* Space Complexity: O(1)
|
|
117
|
+
*
|
|
100
118
|
* The `get` function retrieves a value from a map based on a given key, either from an object map or
|
|
101
119
|
* a string map.
|
|
102
120
|
* @param {K} key - The `key` parameter is the key used to retrieve a value from the map. It can be
|
|
@@ -106,6 +124,9 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
106
124
|
*/
|
|
107
125
|
get(key: K): V | undefined;
|
|
108
126
|
/**
|
|
127
|
+
* Time Complexity: O(1)
|
|
128
|
+
* Space Complexity: O(1)
|
|
129
|
+
*
|
|
109
130
|
* The `has` function checks if a given key exists in the `_objMap` or `_store` based on whether it
|
|
110
131
|
* is an object key or not.
|
|
111
132
|
* @param {K} key - The parameter "key" is of type K, which means it can be any type.
|
|
@@ -113,6 +134,9 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
|
|
|
113
134
|
*/
|
|
114
135
|
has(key: K): boolean;
|
|
115
136
|
/**
|
|
137
|
+
* Time Complexity: O(1)
|
|
138
|
+
* Space Complexity: O(1)
|
|
139
|
+
*
|
|
116
140
|
* The `delete` function removes an element from a map-like data structure based on the provided key.
|
|
117
141
|
* @param {K} key - The `key` parameter is the key of the element that you want to delete from the
|
|
118
142
|
* data structure.
|
|
@@ -292,6 +316,9 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
292
316
|
*/
|
|
293
317
|
set(key: K, value?: V): boolean;
|
|
294
318
|
/**
|
|
319
|
+
* Time Complexity: O(k)
|
|
320
|
+
* Space Complexity: O(k)
|
|
321
|
+
*
|
|
295
322
|
* The function `setMany` takes an iterable collection, converts each element into a key-value pair
|
|
296
323
|
* using a provided function, and sets each key-value pair in the current object, returning an array
|
|
297
324
|
* of booleans indicating the success of each set operation.
|
|
@@ -301,6 +328,9 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
301
328
|
*/
|
|
302
329
|
setMany(entryOrRawElements: Iterable<R | [K, V]>): boolean[];
|
|
303
330
|
/**
|
|
331
|
+
* Time Complexity: O(1)
|
|
332
|
+
* Space Complexity: O(1)
|
|
333
|
+
*
|
|
304
334
|
* The function checks if a given key exists in a map, using different logic depending on whether the
|
|
305
335
|
* key is a weak key or not.
|
|
306
336
|
* @param {K} key - The `key` parameter is the key that is being checked for existence in the map.
|
|
@@ -420,7 +450,7 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
420
450
|
* @returns a new `LinkedHashMap` object with the values mapped according to the provided callback
|
|
421
451
|
* function.
|
|
422
452
|
*/
|
|
423
|
-
map<
|
|
453
|
+
map<MK, MV>(callback: EntryCallback<K, V, [MK, MV]>, thisArg?: any): LinkedHashMap<MK, MV>;
|
|
424
454
|
/**
|
|
425
455
|
* Time Complexity: O(n)
|
|
426
456
|
* Space Complexity: O(1)
|
|
@@ -75,6 +75,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
75
75
|
return this._hashFn;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
+
* Time Complexity: O(1)
|
|
79
|
+
* Space Complexity: O(1)
|
|
80
|
+
*
|
|
78
81
|
* The function checks if a given element is an array with exactly two elements.
|
|
79
82
|
* @param {any} rawElement - The `rawElement` parameter is of type `any`, which means it can be any
|
|
80
83
|
* data type.
|
|
@@ -84,6 +87,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
84
87
|
return Array.isArray(rawElement) && rawElement.length === 2;
|
|
85
88
|
}
|
|
86
89
|
/**
|
|
90
|
+
* Time Complexity: O(1)
|
|
91
|
+
* Space Complexity: O(1)
|
|
92
|
+
*
|
|
87
93
|
* The function checks if the size of an object is equal to zero and returns a boolean value.
|
|
88
94
|
* @returns A boolean value indicating whether the size of the object is 0 or not.
|
|
89
95
|
*/
|
|
@@ -91,6 +97,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
91
97
|
return this._size === 0;
|
|
92
98
|
}
|
|
93
99
|
/**
|
|
100
|
+
* Time Complexity: O(1)
|
|
101
|
+
* Space Complexity: O(1)
|
|
102
|
+
*
|
|
94
103
|
* The clear() function resets the state of an object by clearing its internal store, object map, and
|
|
95
104
|
* size.
|
|
96
105
|
*/
|
|
@@ -100,6 +109,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
100
109
|
this._size = 0;
|
|
101
110
|
}
|
|
102
111
|
/**
|
|
112
|
+
* Time Complexity: O(1)
|
|
113
|
+
* Space Complexity: O(1)
|
|
114
|
+
*
|
|
103
115
|
* The `set` function adds a key-value pair to a map-like data structure, incrementing the size if
|
|
104
116
|
* the key is not already present.
|
|
105
117
|
* @param {K} key - The key parameter is the key used to identify the value in the data structure. It
|
|
@@ -125,6 +137,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
125
137
|
return true;
|
|
126
138
|
}
|
|
127
139
|
/**
|
|
140
|
+
* Time Complexity: O(k)
|
|
141
|
+
* Space Complexity: O(k)
|
|
142
|
+
*
|
|
128
143
|
* The function `setMany` takes an iterable collection of objects, maps each object to a key-value
|
|
129
144
|
* pair using a mapping function, and sets each key-value pair in the current object.
|
|
130
145
|
* @param entryOrRawElements - The `entryOrRawElements` parameter is an iterable collection of elements of a type
|
|
@@ -150,6 +165,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
150
165
|
return results;
|
|
151
166
|
}
|
|
152
167
|
/**
|
|
168
|
+
* Time Complexity: O(1)
|
|
169
|
+
* Space Complexity: O(1)
|
|
170
|
+
*
|
|
153
171
|
* The `get` function retrieves a value from a map based on a given key, either from an object map or
|
|
154
172
|
* a string map.
|
|
155
173
|
* @param {K} key - The `key` parameter is the key used to retrieve a value from the map. It can be
|
|
@@ -168,6 +186,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
168
186
|
}
|
|
169
187
|
}
|
|
170
188
|
/**
|
|
189
|
+
* Time Complexity: O(1)
|
|
190
|
+
* Space Complexity: O(1)
|
|
191
|
+
*
|
|
171
192
|
* The `has` function checks if a given key exists in the `_objMap` or `_store` based on whether it
|
|
172
193
|
* is an object key or not.
|
|
173
194
|
* @param {K} key - The parameter "key" is of type K, which means it can be any type.
|
|
@@ -183,6 +204,9 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
183
204
|
}
|
|
184
205
|
}
|
|
185
206
|
/**
|
|
207
|
+
* Time Complexity: O(1)
|
|
208
|
+
* Space Complexity: O(1)
|
|
209
|
+
*
|
|
186
210
|
* The `delete` function removes an element from a map-like data structure based on the provided key.
|
|
187
211
|
* @param {K} key - The `key` parameter is the key of the element that you want to delete from the
|
|
188
212
|
* data structure.
|
|
@@ -237,7 +261,7 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
237
261
|
const resultMap = new HashMap();
|
|
238
262
|
let index = 0;
|
|
239
263
|
for (const [key, value] of this) {
|
|
240
|
-
resultMap.set(key, callbackfn.call(thisArg,
|
|
264
|
+
resultMap.set(key, callbackfn.call(thisArg, key, value, index++, this));
|
|
241
265
|
}
|
|
242
266
|
return resultMap;
|
|
243
267
|
}
|
|
@@ -261,7 +285,7 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
261
285
|
const filteredMap = new HashMap();
|
|
262
286
|
let index = 0;
|
|
263
287
|
for (const [key, value] of this) {
|
|
264
|
-
if (predicate.call(thisArg,
|
|
288
|
+
if (predicate.call(thisArg, key, value, index++, this)) {
|
|
265
289
|
filteredMap.set(key, value);
|
|
266
290
|
}
|
|
267
291
|
}
|
|
@@ -523,6 +547,9 @@ class LinkedHashMap extends base_1.IterableEntryBase {
|
|
|
523
547
|
return true;
|
|
524
548
|
}
|
|
525
549
|
/**
|
|
550
|
+
* Time Complexity: O(k)
|
|
551
|
+
* Space Complexity: O(k)
|
|
552
|
+
*
|
|
526
553
|
* The function `setMany` takes an iterable collection, converts each element into a key-value pair
|
|
527
554
|
* using a provided function, and sets each key-value pair in the current object, returning an array
|
|
528
555
|
* of booleans indicating the success of each set operation.
|
|
@@ -549,6 +576,9 @@ class LinkedHashMap extends base_1.IterableEntryBase {
|
|
|
549
576
|
return results;
|
|
550
577
|
}
|
|
551
578
|
/**
|
|
579
|
+
* Time Complexity: O(1)
|
|
580
|
+
* Space Complexity: O(1)
|
|
581
|
+
*
|
|
552
582
|
* The function checks if a given key exists in a map, using different logic depending on whether the
|
|
553
583
|
* key is a weak key or not.
|
|
554
584
|
* @param {K} key - The `key` parameter is the key that is being checked for existence in the map.
|
|
@@ -728,7 +758,7 @@ class LinkedHashMap extends base_1.IterableEntryBase {
|
|
|
728
758
|
const filteredMap = new LinkedHashMap();
|
|
729
759
|
let index = 0;
|
|
730
760
|
for (const [key, value] of this) {
|
|
731
|
-
if (predicate.call(thisArg,
|
|
761
|
+
if (predicate.call(thisArg, key, value, index, this)) {
|
|
732
762
|
filteredMap.set(key, value);
|
|
733
763
|
}
|
|
734
764
|
index++;
|
|
@@ -756,8 +786,8 @@ class LinkedHashMap extends base_1.IterableEntryBase {
|
|
|
756
786
|
const mappedMap = new LinkedHashMap();
|
|
757
787
|
let index = 0;
|
|
758
788
|
for (const [key, value] of this) {
|
|
759
|
-
const newValue = callback.call(thisArg,
|
|
760
|
-
mappedMap.set(
|
|
789
|
+
const [newKey, newValue] = callback.call(thisArg, key, value, index, this);
|
|
790
|
+
mappedMap.set(newKey, newValue);
|
|
761
791
|
index++;
|
|
762
792
|
}
|
|
763
793
|
return mappedMap;
|
|
@@ -19,7 +19,7 @@ import { IterableElementBase } from '../base';
|
|
|
19
19
|
* 8. Graph Algorithms: Such as Dijkstra's shortest path algorithm and Prime's minimum-spanning tree algorithm, which use heaps to improve performance.
|
|
20
20
|
* @example
|
|
21
21
|
* // Use Heap to sort an array
|
|
22
|
-
*
|
|
22
|
+
* function heapSort(arr: number[]): number[] {
|
|
23
23
|
* const heap = new Heap<number>(arr, { comparator: (a, b) => a - b });
|
|
24
24
|
* const sorted: number[] = [];
|
|
25
25
|
* while (!heap.isEmpty()) {
|
|
@@ -32,7 +32,7 @@ import { IterableElementBase } from '../base';
|
|
|
32
32
|
* console.log(heapSort(array)); // [1, 2, 3, 4, 5, 8]
|
|
33
33
|
* @example
|
|
34
34
|
* // Use Heap to solve top k problems
|
|
35
|
-
*
|
|
35
|
+
* function topKElements(arr: number[], k: number): number[] {
|
|
36
36
|
* const heap = new Heap<number>([], { comparator: (a, b) => b - a }); // Max heap
|
|
37
37
|
* arr.forEach(num => {
|
|
38
38
|
* heap.add(num);
|
|
@@ -45,7 +45,7 @@ import { IterableElementBase } from '../base';
|
|
|
45
45
|
* console.log(topKElements(numbers, 3)); // [15, 10, 5]
|
|
46
46
|
* @example
|
|
47
47
|
* // Use Heap to merge sorted sequences
|
|
48
|
-
*
|
|
48
|
+
* function mergeSortedSequences(sequences: number[][]): number[] {
|
|
49
49
|
* const heap = new Heap<{ value: number; seqIndex: number; itemIndex: number }>([], {
|
|
50
50
|
* comparator: (a, b) => a.value - b.value // Min heap
|
|
51
51
|
* });
|
|
@@ -82,7 +82,7 @@ import { IterableElementBase } from '../base';
|
|
|
82
82
|
* console.log(mergeSortedSequences(sequences)); // [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
83
83
|
* @example
|
|
84
84
|
* // Use Heap to dynamically maintain the median
|
|
85
|
-
*
|
|
85
|
+
* class MedianFinder {
|
|
86
86
|
* private low: MaxHeap<number>; // Max heap, stores the smaller half
|
|
87
87
|
* private high: MinHeap<number>; // Min heap, stores the larger half
|
|
88
88
|
*
|
|
@@ -119,7 +119,7 @@ import { IterableElementBase } from '../base';
|
|
|
119
119
|
* console.log(medianFinder.findMedian()); // 30
|
|
120
120
|
* @example
|
|
121
121
|
* // Use Heap for load balancing
|
|
122
|
-
*
|
|
122
|
+
* function loadBalance(requests: number[], servers: number): number[] {
|
|
123
123
|
* const serverHeap = new Heap<{ id: number; load: number }>([], { comparator: (a, b) => a.load - b.load }); // min heap
|
|
124
124
|
* const serverLoads = new Array(servers).fill(0);
|
|
125
125
|
*
|
|
@@ -141,7 +141,7 @@ import { IterableElementBase } from '../base';
|
|
|
141
141
|
* console.log(loadBalance(requests, 3)); // [12, 8, 5]
|
|
142
142
|
* @example
|
|
143
143
|
* // Use Heap to schedule tasks
|
|
144
|
-
*
|
|
144
|
+
* type Task = [string, number];
|
|
145
145
|
*
|
|
146
146
|
* function scheduleTasks(tasks: Task[], machines: number): Map<number, Task[]> {
|
|
147
147
|
* const machineHeap = new Heap<{ id: number; load: number }>([], { comparator: (a, b) => a.load - b.load }); // Min heap
|
|
@@ -224,10 +224,27 @@ export declare class Heap<E = any, R = any> extends IterableElementBase<E, R, He
|
|
|
224
224
|
* Time Complexity: O(log n)
|
|
225
225
|
* Space Complexity: O(1)
|
|
226
226
|
*
|
|
227
|
-
*
|
|
228
|
-
* @param element - The element to
|
|
227
|
+
* The add function pushes an element into an array and then triggers a bubble-up operation.
|
|
228
|
+
* @param {E} element - The `element` parameter represents the element that you want to add to the
|
|
229
|
+
* data structure.
|
|
230
|
+
* @returns The `add` method is returning a boolean value, which is the result of calling the
|
|
231
|
+
* `_bubbleUp` method with the index `this.elements.length - 1` as an argument.
|
|
229
232
|
*/
|
|
230
233
|
add(element: E): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Time Complexity: O(k log n)
|
|
236
|
+
* Space Complexity: O(1)
|
|
237
|
+
*
|
|
238
|
+
* The `addMany` function iterates over elements and adds them to a collection, returning an array of
|
|
239
|
+
* boolean values indicating success or failure.
|
|
240
|
+
* @param {Iterable<E> | Iterable<R>} elements - The `elements` parameter in the `addMany` method is
|
|
241
|
+
* an iterable containing elements of type `E` or `R`. The method iterates over each element in the
|
|
242
|
+
* iterable and adds them to the data structure. If a transformation function `_toElementFn` is
|
|
243
|
+
* provided, it transforms the element
|
|
244
|
+
* @returns The `addMany` method returns an array of boolean values indicating whether each element
|
|
245
|
+
* in the input iterable was successfully added to the data structure.
|
|
246
|
+
*/
|
|
247
|
+
addMany(elements: Iterable<E> | Iterable<R>): boolean[];
|
|
231
248
|
/**
|
|
232
249
|
* Time Complexity: O(log n)
|
|
233
250
|
* Space Complexity: O(1)
|
|
@@ -340,7 +357,7 @@ export declare class Heap<E = any, R = any> extends IterableElementBase<E, R, He
|
|
|
340
357
|
*/
|
|
341
358
|
filter(callback: ElementCallback<E, R, boolean, Heap<E, R>>, thisArg?: any): Heap<E, R>;
|
|
342
359
|
/**
|
|
343
|
-
* Time Complexity: O(n
|
|
360
|
+
* Time Complexity: O(n)
|
|
344
361
|
* Space Complexity: O(n)
|
|
345
362
|
*
|
|
346
363
|
* The `map` function creates a new heap by applying a callback function to each element of the
|
|
@@ -21,7 +21,7 @@ const base_1 = require("../base");
|
|
|
21
21
|
* 8. Graph Algorithms: Such as Dijkstra's shortest path algorithm and Prime's minimum-spanning tree algorithm, which use heaps to improve performance.
|
|
22
22
|
* @example
|
|
23
23
|
* // Use Heap to sort an array
|
|
24
|
-
*
|
|
24
|
+
* function heapSort(arr: number[]): number[] {
|
|
25
25
|
* const heap = new Heap<number>(arr, { comparator: (a, b) => a - b });
|
|
26
26
|
* const sorted: number[] = [];
|
|
27
27
|
* while (!heap.isEmpty()) {
|
|
@@ -34,7 +34,7 @@ const base_1 = require("../base");
|
|
|
34
34
|
* console.log(heapSort(array)); // [1, 2, 3, 4, 5, 8]
|
|
35
35
|
* @example
|
|
36
36
|
* // Use Heap to solve top k problems
|
|
37
|
-
*
|
|
37
|
+
* function topKElements(arr: number[], k: number): number[] {
|
|
38
38
|
* const heap = new Heap<number>([], { comparator: (a, b) => b - a }); // Max heap
|
|
39
39
|
* arr.forEach(num => {
|
|
40
40
|
* heap.add(num);
|
|
@@ -47,7 +47,7 @@ const base_1 = require("../base");
|
|
|
47
47
|
* console.log(topKElements(numbers, 3)); // [15, 10, 5]
|
|
48
48
|
* @example
|
|
49
49
|
* // Use Heap to merge sorted sequences
|
|
50
|
-
*
|
|
50
|
+
* function mergeSortedSequences(sequences: number[][]): number[] {
|
|
51
51
|
* const heap = new Heap<{ value: number; seqIndex: number; itemIndex: number }>([], {
|
|
52
52
|
* comparator: (a, b) => a.value - b.value // Min heap
|
|
53
53
|
* });
|
|
@@ -84,7 +84,7 @@ const base_1 = require("../base");
|
|
|
84
84
|
* console.log(mergeSortedSequences(sequences)); // [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
85
85
|
* @example
|
|
86
86
|
* // Use Heap to dynamically maintain the median
|
|
87
|
-
*
|
|
87
|
+
* class MedianFinder {
|
|
88
88
|
* private low: MaxHeap<number>; // Max heap, stores the smaller half
|
|
89
89
|
* private high: MinHeap<number>; // Min heap, stores the larger half
|
|
90
90
|
*
|
|
@@ -121,7 +121,7 @@ const base_1 = require("../base");
|
|
|
121
121
|
* console.log(medianFinder.findMedian()); // 30
|
|
122
122
|
* @example
|
|
123
123
|
* // Use Heap for load balancing
|
|
124
|
-
*
|
|
124
|
+
* function loadBalance(requests: number[], servers: number): number[] {
|
|
125
125
|
* const serverHeap = new Heap<{ id: number; load: number }>([], { comparator: (a, b) => a.load - b.load }); // min heap
|
|
126
126
|
* const serverLoads = new Array(servers).fill(0);
|
|
127
127
|
*
|
|
@@ -143,7 +143,7 @@ const base_1 = require("../base");
|
|
|
143
143
|
* console.log(loadBalance(requests, 3)); // [12, 8, 5]
|
|
144
144
|
* @example
|
|
145
145
|
* // Use Heap to schedule tasks
|
|
146
|
-
*
|
|
146
|
+
* type Task = [string, number];
|
|
147
147
|
*
|
|
148
148
|
* function scheduleTasks(tasks: Task[], machines: number): Map<number, Task[]> {
|
|
149
149
|
* const machineHeap = new Heap<{ id: number; load: number }>([], { comparator: (a, b) => a.load - b.load }); // Min heap
|
|
@@ -218,14 +218,7 @@ class Heap extends base_1.IterableElementBase {
|
|
|
218
218
|
if (comparator)
|
|
219
219
|
this._comparator = comparator;
|
|
220
220
|
}
|
|
221
|
-
|
|
222
|
-
for (const el of elements) {
|
|
223
|
-
if (this.toElementFn)
|
|
224
|
-
this.add(this.toElementFn(el));
|
|
225
|
-
else
|
|
226
|
-
this.add(el);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
221
|
+
this.addMany(elements);
|
|
229
222
|
}
|
|
230
223
|
/**
|
|
231
224
|
* The function returns an array of elements.
|
|
@@ -261,13 +254,40 @@ class Heap extends base_1.IterableElementBase {
|
|
|
261
254
|
* Time Complexity: O(log n)
|
|
262
255
|
* Space Complexity: O(1)
|
|
263
256
|
*
|
|
264
|
-
*
|
|
265
|
-
* @param element - The element to
|
|
257
|
+
* The add function pushes an element into an array and then triggers a bubble-up operation.
|
|
258
|
+
* @param {E} element - The `element` parameter represents the element that you want to add to the
|
|
259
|
+
* data structure.
|
|
260
|
+
* @returns The `add` method is returning a boolean value, which is the result of calling the
|
|
261
|
+
* `_bubbleUp` method with the index `this.elements.length - 1` as an argument.
|
|
266
262
|
*/
|
|
267
263
|
add(element) {
|
|
268
264
|
this._elements.push(element);
|
|
269
265
|
return this._bubbleUp(this.elements.length - 1);
|
|
270
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Time Complexity: O(k log n)
|
|
269
|
+
* Space Complexity: O(1)
|
|
270
|
+
*
|
|
271
|
+
* The `addMany` function iterates over elements and adds them to a collection, returning an array of
|
|
272
|
+
* boolean values indicating success or failure.
|
|
273
|
+
* @param {Iterable<E> | Iterable<R>} elements - The `elements` parameter in the `addMany` method is
|
|
274
|
+
* an iterable containing elements of type `E` or `R`. The method iterates over each element in the
|
|
275
|
+
* iterable and adds them to the data structure. If a transformation function `_toElementFn` is
|
|
276
|
+
* provided, it transforms the element
|
|
277
|
+
* @returns The `addMany` method returns an array of boolean values indicating whether each element
|
|
278
|
+
* in the input iterable was successfully added to the data structure.
|
|
279
|
+
*/
|
|
280
|
+
addMany(elements) {
|
|
281
|
+
const ans = [];
|
|
282
|
+
for (const el of elements) {
|
|
283
|
+
if (this._toElementFn) {
|
|
284
|
+
ans.push(this.add(this._toElementFn(el)));
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
ans.push(this.add(el));
|
|
288
|
+
}
|
|
289
|
+
return ans;
|
|
290
|
+
}
|
|
271
291
|
/**
|
|
272
292
|
* Time Complexity: O(log n)
|
|
273
293
|
* Space Complexity: O(1)
|
|
@@ -470,7 +490,7 @@ class Heap extends base_1.IterableElementBase {
|
|
|
470
490
|
return filteredList;
|
|
471
491
|
}
|
|
472
492
|
/**
|
|
473
|
-
* Time Complexity: O(n
|
|
493
|
+
* Time Complexity: O(n)
|
|
474
494
|
* Space Complexity: O(n)
|
|
475
495
|
*
|
|
476
496
|
* The `map` function creates a new heap by applying a callback function to each element of the
|
|
@@ -55,13 +55,13 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
55
55
|
set prev(value: DoublyLinkedListNode<E> | undefined);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
*1. Node Structure: Each node contains three parts: a data field, a pointer (or reference) to the previous node, and a pointer to the next node. This structure allows traversal of the linked list in both directions.
|
|
59
59
|
* 2. Bidirectional Traversal: Unlike singly linked lists, doubly linked lists can be easily traversed forwards or backwards. This makes insertions and deletions in the list more flexible and efficient.
|
|
60
60
|
* 3. No Centralized Index: Unlike arrays, elements in a linked list are not stored contiguously, so there is no centralized index. Accessing elements in a linked list typically requires traversing from the head or tail node.
|
|
61
61
|
* 4. High Efficiency in Insertion and Deletion: Adding or removing elements in a linked list does not require moving other elements, making these operations more efficient than in arrays.
|
|
62
62
|
* @example
|
|
63
63
|
* // text editor operation history
|
|
64
|
-
*
|
|
64
|
+
* const actions = [
|
|
65
65
|
* { type: 'insert', content: 'first line of text' },
|
|
66
66
|
* { type: 'insert', content: 'second line of text' },
|
|
67
67
|
* { type: 'delete', content: 'delete the first line' }
|
|
@@ -73,7 +73,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
73
73
|
* console.log(editorHistory.last?.type); // 'insert'
|
|
74
74
|
* @example
|
|
75
75
|
* // Browser history
|
|
76
|
-
*
|
|
76
|
+
* const browserHistory = new DoublyLinkedList<string>();
|
|
77
77
|
*
|
|
78
78
|
* browserHistory.push('home page');
|
|
79
79
|
* browserHistory.push('search page');
|
|
@@ -84,7 +84,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
84
84
|
* console.log(browserHistory.last); // 'search page'
|
|
85
85
|
* @example
|
|
86
86
|
* // Use DoublyLinkedList to implement music player
|
|
87
|
-
*
|
|
87
|
+
* // Define the Song interface
|
|
88
88
|
* interface Song {
|
|
89
89
|
* title: string;
|
|
90
90
|
* artist: string;
|
|
@@ -209,7 +209,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
209
209
|
* // ]
|
|
210
210
|
* @example
|
|
211
211
|
* // Use DoublyLinkedList to implement LRU cache
|
|
212
|
-
*
|
|
212
|
+
* interface CacheEntry<K, V> {
|
|
213
213
|
* key: K;
|
|
214
214
|
* value: V;
|
|
215
215
|
* }
|
|
@@ -371,7 +371,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
371
371
|
* console.log(cache.isEmpty); // true
|
|
372
372
|
* @example
|
|
373
373
|
* // finding lyrics by timestamp in Coldplay's "Fix You"
|
|
374
|
-
*
|
|
374
|
+
* // Create a DoublyLinkedList to store song lyrics with timestamps
|
|
375
375
|
* const lyricsList = new DoublyLinkedList<{ time: number; text: string }>();
|
|
376
376
|
*
|
|
377
377
|
* // Detailed lyrics with precise timestamps (in milliseconds)
|
|
@@ -411,7 +411,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
411
411
|
* console.log(lateTimeLyric?.text); // 'And I will try to fix you'
|
|
412
412
|
* @example
|
|
413
413
|
* // cpu process schedules
|
|
414
|
-
*
|
|
414
|
+
* class Process {
|
|
415
415
|
* constructor(
|
|
416
416
|
* public id: number,
|
|
417
417
|
* public priority: number
|
|
@@ -487,7 +487,17 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
487
487
|
* console.log(scheduler.listProcesses()); // []
|
|
488
488
|
*/
|
|
489
489
|
export declare class DoublyLinkedList<E = any, R = any> extends IterableElementBase<E, R, DoublyLinkedList<E, R>> {
|
|
490
|
-
|
|
490
|
+
/**
|
|
491
|
+
* This TypeScript constructor initializes a DoublyLinkedList with optional elements and options.
|
|
492
|
+
* @param {Iterable<E> | Iterable<R>} elements - The `elements` parameter in the constructor is an
|
|
493
|
+
* iterable collection of elements of type `E` or `R`. It is used to initialize the DoublyLinkedList
|
|
494
|
+
* with the elements provided in the iterable. If no elements are provided, the default value is an
|
|
495
|
+
* empty iterable.
|
|
496
|
+
* @param [options] - The `options` parameter in the constructor is of type
|
|
497
|
+
* `DoublyLinkedListOptions<E, R>`. It is an optional parameter that allows you to pass additional
|
|
498
|
+
* configuration options to customize the behavior of the DoublyLinkedList.
|
|
499
|
+
*/
|
|
500
|
+
constructor(elements?: Iterable<E> | Iterable<R> | Iterable<DoublyLinkedListNode<E>>, options?: DoublyLinkedListOptions<E, R>);
|
|
491
501
|
protected _head: DoublyLinkedListNode<E> | undefined;
|
|
492
502
|
/**
|
|
493
503
|
* The `head` function returns the first node of a doubly linked list.
|
|
@@ -523,6 +533,16 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
523
533
|
* @returns The method `get last()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
|
|
524
534
|
*/
|
|
525
535
|
get last(): E | undefined;
|
|
536
|
+
/**
|
|
537
|
+
* Time Complexity: O(n)
|
|
538
|
+
* Space Complexity: O(n)
|
|
539
|
+
*
|
|
540
|
+
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
541
|
+
* given array.
|
|
542
|
+
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
543
|
+
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
544
|
+
*/
|
|
545
|
+
static fromArray<E>(data: E[]): DoublyLinkedList<E, any>;
|
|
526
546
|
/**
|
|
527
547
|
* Time Complexity: O(1)
|
|
528
548
|
* Space Complexity: O(1)
|
|
@@ -575,6 +595,35 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
575
595
|
* @returns The `unshift` method is returning a boolean value, specifically `true`.
|
|
576
596
|
*/
|
|
577
597
|
unshift(elementOrNode: E | DoublyLinkedListNode<E>): boolean;
|
|
598
|
+
/**
|
|
599
|
+
* Time Complexity: O(k)
|
|
600
|
+
* Space Complexity: O(k)
|
|
601
|
+
*
|
|
602
|
+
* The function `pushMany` iterates over elements and pushes them into a data structure, applying a
|
|
603
|
+
* transformation function if provided.
|
|
604
|
+
* @param {Iterable<E> | Iterable<R> | Iterable<DoublyLinkedListNode<E>>} elements - The `elements`
|
|
605
|
+
* parameter in the `pushMany` function can accept an iterable containing elements of type `E`, `R`,
|
|
606
|
+
* or `DoublyLinkedListNode<E>`. The function iterates over each element in the iterable and pushes
|
|
607
|
+
* it onto the linked list. If a transformation function `to
|
|
608
|
+
* @returns The `pushMany` function is returning an array of boolean values (`ans`) which indicate
|
|
609
|
+
* the success or failure of pushing each element into the data structure.
|
|
610
|
+
*/
|
|
611
|
+
pushMany(elements: Iterable<E> | Iterable<R> | Iterable<DoublyLinkedListNode<E>>): boolean[];
|
|
612
|
+
/**
|
|
613
|
+
* Time Complexity: O(k)
|
|
614
|
+
* Space Complexity: O(k)
|
|
615
|
+
*
|
|
616
|
+
* The function `unshiftMany` iterates through a collection of elements and adds them to the
|
|
617
|
+
* beginning of a Doubly Linked List, returning an array of boolean values indicating the success of
|
|
618
|
+
* each insertion.
|
|
619
|
+
* @param {Iterable<E> | Iterable<R> | Iterable<DoublyLinkedListNode<E>>} elements - The `elements`
|
|
620
|
+
* parameter in the `unshiftMany` function can accept an iterable containing elements of type `E`,
|
|
621
|
+
* `R`, or `DoublyLinkedListNode<E>`. The function iterates over each element in the iterable and
|
|
622
|
+
* performs an `unshift` operation on the doubly linked list
|
|
623
|
+
* @returns The `unshiftMany` function returns an array of boolean values indicating the success of
|
|
624
|
+
* each unshift operation performed on the elements passed as input.
|
|
625
|
+
*/
|
|
626
|
+
unshiftMany(elements: Iterable<E> | Iterable<R> | Iterable<DoublyLinkedListNode<E>>): boolean[];
|
|
578
627
|
/**
|
|
579
628
|
* Time Complexity: O(n)
|
|
580
629
|
* Space Complexity: O(1)
|
|
@@ -729,7 +778,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
729
778
|
* @returns The `get` method returns the value of the first node in the doubly linked list that
|
|
730
779
|
* satisfies the provided predicate function. If no such node is found, it returns `undefined`.
|
|
731
780
|
*/
|
|
732
|
-
|
|
781
|
+
search(elementNodeOrPredicate: E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)): E | undefined;
|
|
733
782
|
/**
|
|
734
783
|
* Time Complexity: O(n)
|
|
735
784
|
* Space Complexity: O(1)
|
|
@@ -820,18 +869,14 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
820
869
|
* Time Complexity: O(n)
|
|
821
870
|
* Space Complexity: O(1)
|
|
822
871
|
*
|
|
872
|
+
* The function `countOccurrences` iterates through a doubly linked list and counts the occurrences
|
|
873
|
+
* of a specified element or nodes that satisfy a given predicate.
|
|
874
|
+
* @param {E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)} elementOrNode
|
|
875
|
+
* - The `elementOrNode` parameter in the `countOccurrences` method can accept three types of values:
|
|
876
|
+
* @returns The `countOccurrences` method returns the number of occurrences of the specified element,
|
|
877
|
+
* node, or predicate function in the doubly linked list.
|
|
823
878
|
*/
|
|
824
879
|
countOccurrences(elementOrNode: E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)): number;
|
|
825
|
-
/**
|
|
826
|
-
* Time Complexity: O(n)
|
|
827
|
-
* Space Complexity: O(n)
|
|
828
|
-
*
|
|
829
|
-
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
830
|
-
* given array.
|
|
831
|
-
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
832
|
-
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
833
|
-
*/
|
|
834
|
-
static fromArray<E>(data: E[]): DoublyLinkedList<E, any>;
|
|
835
880
|
/**
|
|
836
881
|
* The function returns an iterator that iterates over the values of a linked list.
|
|
837
882
|
*/
|