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
|
@@ -8,15 +8,51 @@
|
|
|
8
8
|
import type { ElementCallback } from '../../types';
|
|
9
9
|
import { IterableElementBase } from '../base';
|
|
10
10
|
export declare class DoublyLinkedListNode<E = any> {
|
|
11
|
-
value: E;
|
|
12
|
-
next: DoublyLinkedListNode<E> | undefined;
|
|
13
|
-
prev: DoublyLinkedListNode<E> | undefined;
|
|
14
11
|
/**
|
|
15
12
|
* The constructor function initializes the value, next, and previous properties of an object.
|
|
16
13
|
* @param {E} value - The "value" parameter is the value that will be stored in the node. It can be of any data type, as it
|
|
17
14
|
* is defined as a generic type "E".
|
|
18
15
|
*/
|
|
19
16
|
constructor(value: E);
|
|
17
|
+
protected _value: E;
|
|
18
|
+
/**
|
|
19
|
+
* The function returns the value of a protected variable.
|
|
20
|
+
* @returns The value of the variable `_value` is being returned.
|
|
21
|
+
*/
|
|
22
|
+
get value(): E;
|
|
23
|
+
/**
|
|
24
|
+
* The above function sets the value of a variable.
|
|
25
|
+
* @param {E} value - The parameter "value" is of type E, which means it can be any type.
|
|
26
|
+
*/
|
|
27
|
+
set value(value: E);
|
|
28
|
+
protected _next: DoublyLinkedListNode<E> | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The "next" function returns the next node in a doubly linked list.
|
|
31
|
+
* @returns The `next` property is being returned. It can be either a `DoublyLinkedListNode<E>`
|
|
32
|
+
* object or `undefined`.
|
|
33
|
+
*/
|
|
34
|
+
get next(): DoublyLinkedListNode<E> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The "next" property of a DoublyLinkedListNode is set to the provided value.
|
|
37
|
+
* @param {DoublyLinkedListNode<E> | undefined} value - The `value` parameter is of type
|
|
38
|
+
* `DoublyLinkedListNode<E> | undefined`. This means that it can accept either a
|
|
39
|
+
* `DoublyLinkedListNode` object or `undefined` as its value.
|
|
40
|
+
*/
|
|
41
|
+
set next(value: DoublyLinkedListNode<E> | undefined);
|
|
42
|
+
protected _prev: DoublyLinkedListNode<E> | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The `prev` function returns the previous node in a doubly linked list.
|
|
45
|
+
* @returns The `prev` property of the `DoublyLinkedListNode` class is being returned. It can either
|
|
46
|
+
* be a `DoublyLinkedListNode` object or `undefined`.
|
|
47
|
+
*/
|
|
48
|
+
get prev(): DoublyLinkedListNode<E> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The function sets the previous node of a doubly linked list node.
|
|
51
|
+
* @param {DoublyLinkedListNode<E> | undefined} value - The `value` parameter is of type
|
|
52
|
+
* `DoublyLinkedListNode<E> | undefined`. This means that it can accept either a
|
|
53
|
+
* `DoublyLinkedListNode` object or `undefined` as its value.
|
|
54
|
+
*/
|
|
55
|
+
set prev(value: DoublyLinkedListNode<E> | undefined);
|
|
20
56
|
}
|
|
21
57
|
/**
|
|
22
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.
|
|
@@ -26,21 +62,38 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
26
62
|
*/
|
|
27
63
|
export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
28
64
|
/**
|
|
29
|
-
* The constructor initializes
|
|
65
|
+
* The constructor initializes a linked list with optional elements.
|
|
66
|
+
* @param elements - The `elements` parameter is an optional iterable object that contains the
|
|
67
|
+
* initial elements to be added to the data structure. It defaults to an empty array if no elements
|
|
68
|
+
* are provided.
|
|
30
69
|
*/
|
|
31
70
|
constructor(elements?: Iterable<E>);
|
|
32
71
|
protected _head: DoublyLinkedListNode<E> | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The `head` function returns the first node of a doubly linked list.
|
|
74
|
+
* @returns The method `getHead()` returns either a `DoublyLinkedListNode<E>` object or `undefined`.
|
|
75
|
+
*/
|
|
33
76
|
get head(): DoublyLinkedListNode<E> | undefined;
|
|
34
77
|
protected _tail: DoublyLinkedListNode<E> | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The `tail` function returns the last node of a doubly linked list.
|
|
80
|
+
* @returns The `get tail()` method is returning either a `DoublyLinkedListNode<E>` object or
|
|
81
|
+
* `undefined`.
|
|
82
|
+
*/
|
|
35
83
|
get tail(): DoublyLinkedListNode<E> | undefined;
|
|
36
84
|
protected _size: number;
|
|
85
|
+
/**
|
|
86
|
+
* The function returns the size of an object.
|
|
87
|
+
* @returns The size of the object, which is a number.
|
|
88
|
+
*/
|
|
37
89
|
get size(): number;
|
|
38
90
|
/**
|
|
39
|
-
* Time Complexity: O(
|
|
40
|
-
* Space Complexity: O(
|
|
91
|
+
* Time Complexity: O(1)
|
|
92
|
+
* Space Complexity: O(1)
|
|
93
|
+
* where n is the number of elements in the linked list.
|
|
41
94
|
*/
|
|
42
95
|
/**
|
|
43
|
-
* Time Complexity: O(
|
|
96
|
+
* Time Complexity: O(1)
|
|
44
97
|
* Space Complexity: O(1)
|
|
45
98
|
*
|
|
46
99
|
* The `get first` function returns the first node in a doubly linked list, or undefined if the list is empty.
|
|
@@ -52,7 +105,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
52
105
|
* Space Complexity: O(1)
|
|
53
106
|
*/
|
|
54
107
|
/**
|
|
55
|
-
* Time Complexity: O(
|
|
108
|
+
* Time Complexity: O(1)
|
|
56
109
|
* Space Complexity: O(1)
|
|
57
110
|
*
|
|
58
111
|
* The `get last` function returns the last node in a doubly linked list, or undefined if the list is empty.
|
|
@@ -60,11 +113,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
60
113
|
*/
|
|
61
114
|
get last(): E | undefined;
|
|
62
115
|
/**
|
|
63
|
-
* Time Complexity: O(
|
|
64
|
-
* Space Complexity: O(
|
|
116
|
+
* Time Complexity: O(n)
|
|
117
|
+
* Space Complexity: O(n)
|
|
65
118
|
*/
|
|
66
119
|
/**
|
|
67
|
-
* Time Complexity: O(n)
|
|
120
|
+
* Time Complexity: O(n)
|
|
68
121
|
* Space Complexity: O(n)
|
|
69
122
|
*
|
|
70
123
|
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
@@ -99,7 +152,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
99
152
|
*/
|
|
100
153
|
pop(): E | undefined;
|
|
101
154
|
/**
|
|
102
|
-
* Time Complexity: O(
|
|
155
|
+
* Time Complexity: O(1)
|
|
103
156
|
* Space Complexity: O(1)
|
|
104
157
|
*/
|
|
105
158
|
/**
|
|
@@ -112,7 +165,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
112
165
|
*/
|
|
113
166
|
shift(): E | undefined;
|
|
114
167
|
/**
|
|
115
|
-
* Time Complexity: O(
|
|
168
|
+
* Time Complexity: O(1)
|
|
116
169
|
* Space Complexity: O(1)
|
|
117
170
|
*/
|
|
118
171
|
/**
|
|
@@ -125,26 +178,26 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
125
178
|
*/
|
|
126
179
|
unshift(value: E): boolean;
|
|
127
180
|
/**
|
|
128
|
-
* Time Complexity: O(n)
|
|
181
|
+
* Time Complexity: O(n)
|
|
129
182
|
* Space Complexity: O(1)
|
|
130
183
|
*/
|
|
131
184
|
/**
|
|
132
|
-
* Time Complexity: O(n)
|
|
185
|
+
* Time Complexity: O(n)
|
|
133
186
|
* Space Complexity: O(1)
|
|
134
187
|
*
|
|
135
|
-
* The `
|
|
188
|
+
* The `at` function returns the value at a specified index in a linked list, or undefined if the index is out of bounds.
|
|
136
189
|
* @param {number} index - The index parameter is a number that represents the position of the element we want to
|
|
137
190
|
* retrieve from the list.
|
|
138
191
|
* @returns The method is returning the value at the specified index in the linked list. If the index is out of bounds
|
|
139
192
|
* or the linked list is empty, it will return undefined.
|
|
140
193
|
*/
|
|
141
|
-
|
|
194
|
+
at(index: number): E | undefined;
|
|
142
195
|
/**
|
|
143
|
-
* Time Complexity: O(n)
|
|
196
|
+
* Time Complexity: O(n)
|
|
144
197
|
* Space Complexity: O(1)
|
|
145
198
|
*/
|
|
146
199
|
/**
|
|
147
|
-
* Time Complexity: O(n)
|
|
200
|
+
* Time Complexity: O(n)
|
|
148
201
|
* Space Complexity: O(1)
|
|
149
202
|
*
|
|
150
203
|
* The function `getNodeAt` returns the node at a given index in a doubly linked list, or undefined if the index is out of
|
|
@@ -156,11 +209,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
156
209
|
*/
|
|
157
210
|
getNodeAt(index: number): DoublyLinkedListNode<E> | undefined;
|
|
158
211
|
/**
|
|
159
|
-
* Time Complexity: O(n)
|
|
212
|
+
* Time Complexity: O(n)
|
|
160
213
|
* Space Complexity: O(1)
|
|
161
214
|
*/
|
|
162
215
|
/**
|
|
163
|
-
* Time Complexity: O(n)
|
|
216
|
+
* Time Complexity: O(n)
|
|
164
217
|
* Space Complexity: O(1)
|
|
165
218
|
*
|
|
166
219
|
* The function `findNodeByValue` searches for a node with a specific value in a doubly linked list and returns the
|
|
@@ -171,11 +224,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
171
224
|
*/
|
|
172
225
|
getNode(value: E | undefined): DoublyLinkedListNode<E> | undefined;
|
|
173
226
|
/**
|
|
174
|
-
* Time Complexity: O(n)
|
|
227
|
+
* Time Complexity: O(n)
|
|
175
228
|
* Space Complexity: O(1)
|
|
176
229
|
*/
|
|
177
230
|
/**
|
|
178
|
-
* Time Complexity: O(n)
|
|
231
|
+
* Time Complexity: O(n)
|
|
179
232
|
* Space Complexity: O(1)
|
|
180
233
|
*
|
|
181
234
|
* The `insert` function inserts a value at a specified index in a doubly linked list.
|
|
@@ -188,11 +241,12 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
188
241
|
*/
|
|
189
242
|
addAt(index: number, value: E): boolean;
|
|
190
243
|
/**
|
|
191
|
-
* Time Complexity: O(
|
|
244
|
+
* Time Complexity: O(1) or O(n)
|
|
192
245
|
* Space Complexity: O(1)
|
|
246
|
+
* where n is the number of elements in the linked list.
|
|
193
247
|
*/
|
|
194
248
|
/**
|
|
195
|
-
* Time Complexity: O(
|
|
249
|
+
* Time Complexity: O(1) or O(n)
|
|
196
250
|
* Space Complexity: O(1)
|
|
197
251
|
*
|
|
198
252
|
* The `addBefore` function inserts a new value before an existing value or node in a doubly linked list.
|
|
@@ -206,11 +260,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
206
260
|
*/
|
|
207
261
|
addBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
|
|
208
262
|
/**
|
|
209
|
-
* Time Complexity: O(
|
|
263
|
+
* Time Complexity: O(1) or O(n)
|
|
210
264
|
* Space Complexity: O(1)
|
|
211
265
|
*/
|
|
212
266
|
/**
|
|
213
|
-
* Time Complexity: O(
|
|
267
|
+
* Time Complexity: O(1) or O(n)
|
|
214
268
|
* Space Complexity: O(1)
|
|
215
269
|
*
|
|
216
270
|
* The `addAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
|
|
@@ -223,7 +277,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
223
277
|
*/
|
|
224
278
|
addAfter(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
|
|
225
279
|
/**
|
|
226
|
-
* Time Complexity: O(n)
|
|
280
|
+
* Time Complexity: O(n)
|
|
227
281
|
* Space Complexity: O(1)
|
|
228
282
|
*
|
|
229
283
|
* The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.
|
|
@@ -234,7 +288,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
234
288
|
*/
|
|
235
289
|
deleteAt(index: number): boolean;
|
|
236
290
|
/**
|
|
237
|
-
* Time Complexity: O(
|
|
291
|
+
* Time Complexity: O(1) or O(n)
|
|
292
|
+
* Space Complexity: O(1)
|
|
293
|
+
*/
|
|
294
|
+
/**
|
|
295
|
+
* Time Complexity: O(1) or O(n)
|
|
238
296
|
* Space Complexity: O(1)
|
|
239
297
|
*
|
|
240
298
|
* The `delete` function removes a node from a doubly linked list based on either the node itself or its value.
|
|
@@ -245,43 +303,34 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
245
303
|
*/
|
|
246
304
|
delete(valOrNode: E | DoublyLinkedListNode<E> | undefined): boolean;
|
|
247
305
|
/**
|
|
248
|
-
* Time Complexity: O(
|
|
306
|
+
* Time Complexity: O(1)
|
|
249
307
|
* Space Complexity: O(1)
|
|
250
308
|
*/
|
|
251
309
|
/**
|
|
310
|
+
* Time Complexity: O(1)
|
|
311
|
+
* Space Complexity: O(1)
|
|
312
|
+
*
|
|
252
313
|
* The function checks if a variable has a size greater than zero and returns a boolean value.
|
|
253
314
|
* @returns A boolean value is being returned.
|
|
254
315
|
*/
|
|
255
316
|
isEmpty(): boolean;
|
|
256
317
|
/**
|
|
257
|
-
* Time Complexity: O(
|
|
258
|
-
* Space Complexity: O(1)
|
|
259
|
-
*/
|
|
260
|
-
/**
|
|
261
|
-
* The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
|
|
262
|
-
*/
|
|
263
|
-
clear(): void;
|
|
264
|
-
/**
|
|
265
|
-
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
318
|
+
* Time Complexity: O(1)
|
|
266
319
|
* Space Complexity: O(1)
|
|
267
320
|
*/
|
|
268
321
|
/**
|
|
269
|
-
* Time Complexity: O(
|
|
322
|
+
* Time Complexity: O(1)
|
|
270
323
|
* Space Complexity: O(1)
|
|
271
324
|
*
|
|
272
|
-
* The `
|
|
273
|
-
* @param callback - A function that takes a value of type E as its parameter and returns a boolean value. This
|
|
274
|
-
* function is used to determine whether a particular value in the linked list satisfies a certain condition.
|
|
275
|
-
* @returns The method `find` returns the first element in the linked list that satisfies the condition specified by
|
|
276
|
-
* the callback function. If no element satisfies the condition, it returns `undefined`.
|
|
325
|
+
* The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
|
|
277
326
|
*/
|
|
278
|
-
|
|
327
|
+
clear(): void;
|
|
279
328
|
/**
|
|
280
|
-
* Time Complexity: O(n)
|
|
329
|
+
* Time Complexity: O(n)
|
|
281
330
|
* Space Complexity: O(1)
|
|
282
331
|
*/
|
|
283
332
|
/**
|
|
284
|
-
* Time Complexity: O(n)
|
|
333
|
+
* Time Complexity: O(n)
|
|
285
334
|
* Space Complexity: O(1)
|
|
286
335
|
*
|
|
287
336
|
* The function returns the index of the first occurrence of a given value in a linked list.
|
|
@@ -292,11 +341,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
292
341
|
*/
|
|
293
342
|
indexOf(value: E): number;
|
|
294
343
|
/**
|
|
295
|
-
* Time Complexity: O(n)
|
|
296
|
-
* Space Complexity: O(
|
|
344
|
+
* Time Complexity: O(n)
|
|
345
|
+
* Space Complexity: O(1)
|
|
297
346
|
*/
|
|
298
347
|
/**
|
|
299
|
-
* Time Complexity: O(n)
|
|
348
|
+
* Time Complexity: O(n)
|
|
300
349
|
* Space Complexity: O(1)
|
|
301
350
|
*
|
|
302
351
|
* The `findBackward` function iterates through a linked list from the last node to the first node and returns the last
|
|
@@ -308,11 +357,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
308
357
|
*/
|
|
309
358
|
findBackward(callback: (value: E) => boolean): E | undefined;
|
|
310
359
|
/**
|
|
311
|
-
* Time Complexity: O(n)
|
|
312
|
-
* Space Complexity: O(
|
|
360
|
+
* Time Complexity: O(n)
|
|
361
|
+
* Space Complexity: O(1)
|
|
313
362
|
*/
|
|
314
363
|
/**
|
|
315
|
-
* Time Complexity: O(n)
|
|
364
|
+
* Time Complexity: O(n)
|
|
316
365
|
* Space Complexity: O(1)
|
|
317
366
|
*
|
|
318
367
|
* The `reverse` function reverses the order of the elements in a doubly linked list.
|
|
@@ -323,7 +372,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
323
372
|
* Space Complexity: O(n)
|
|
324
373
|
*/
|
|
325
374
|
/**
|
|
326
|
-
* Time Complexity: O(n)
|
|
375
|
+
* Time Complexity: O(n)
|
|
327
376
|
* Space Complexity: O(n)
|
|
328
377
|
*
|
|
329
378
|
* The `toArray` function converts a linked list into an array.
|
|
@@ -331,11 +380,11 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
331
380
|
*/
|
|
332
381
|
toArray(): E[];
|
|
333
382
|
/**
|
|
334
|
-
* Time Complexity: O(n)
|
|
383
|
+
* Time Complexity: O(n)
|
|
335
384
|
* Space Complexity: O(n)
|
|
336
385
|
*/
|
|
337
386
|
/**
|
|
338
|
-
* Time Complexity: O(n)
|
|
387
|
+
* Time Complexity: O(n)
|
|
339
388
|
* Space Complexity: O(n)
|
|
340
389
|
*
|
|
341
390
|
* The `toReversedArray` function converts a doubly linked list into an array in reverse order.
|
|
@@ -343,8 +392,22 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
343
392
|
*/
|
|
344
393
|
toReversedArray(): E[];
|
|
345
394
|
/**
|
|
346
|
-
* Time Complexity: O(
|
|
347
|
-
* Space Complexity: O(
|
|
395
|
+
* Time Complexity: O(n)
|
|
396
|
+
* Space Complexity: O(n)
|
|
397
|
+
*/
|
|
398
|
+
/**
|
|
399
|
+
* Time Complexity: O(n)
|
|
400
|
+
* Space Complexity: O(n)
|
|
401
|
+
*
|
|
402
|
+
* The `clone` function creates a new instance of the `DoublyLinkedList` class with the same values
|
|
403
|
+
* as the original list.
|
|
404
|
+
* @returns The `clone()` method is returning a new instance of the `DoublyLinkedList` class, which
|
|
405
|
+
* is a copy of the original list.
|
|
406
|
+
*/
|
|
407
|
+
clone(): DoublyLinkedList<E>;
|
|
408
|
+
/**
|
|
409
|
+
* Time Complexity: O(n)
|
|
410
|
+
* Space Complexity: O(n)
|
|
348
411
|
*/
|
|
349
412
|
/**
|
|
350
413
|
* Time Complexity: O(n)
|
|
@@ -365,8 +428,8 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
365
428
|
*/
|
|
366
429
|
filter(callback: ElementCallback<E, boolean>, thisArg?: any): DoublyLinkedList<E>;
|
|
367
430
|
/**
|
|
368
|
-
* Time Complexity: O(
|
|
369
|
-
* Space Complexity: O(
|
|
431
|
+
* Time Complexity: O(n)
|
|
432
|
+
* Space Complexity: O(n)
|
|
370
433
|
*/
|
|
371
434
|
/**
|
|
372
435
|
* Time Complexity: O(n)
|
|
@@ -412,7 +475,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
412
475
|
*/
|
|
413
476
|
pollLast(): E | undefined;
|
|
414
477
|
/**
|
|
415
|
-
* Time Complexity: O(
|
|
478
|
+
* Time Complexity: O(1)
|
|
416
479
|
* Space Complexity: O(1)
|
|
417
480
|
*/
|
|
418
481
|
/**
|
|
@@ -425,7 +488,7 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
|
|
|
425
488
|
*/
|
|
426
489
|
pollFirst(): E | undefined;
|
|
427
490
|
/**
|
|
428
|
-
* Time Complexity: O(
|
|
491
|
+
* Time Complexity: O(1)
|
|
429
492
|
* Space Complexity: O(1)
|
|
430
493
|
*/
|
|
431
494
|
/**
|