deque-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
|
@@ -311,10 +311,6 @@ export declare class FibonacciHeap<E> {
|
|
|
311
311
|
* @protected
|
|
312
312
|
*/
|
|
313
313
|
peek(): E | undefined;
|
|
314
|
-
/**
|
|
315
|
-
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
316
|
-
* Space Complexity: O(1)
|
|
317
|
-
*/
|
|
318
314
|
/**
|
|
319
315
|
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
320
316
|
* Space Complexity: O(1)
|
|
@@ -333,10 +329,6 @@ export declare class FibonacciHeap<E> {
|
|
|
333
329
|
* @param node
|
|
334
330
|
*/
|
|
335
331
|
mergeWithChild(parent: FibonacciHeapNode<E>, node: FibonacciHeapNode<E>): void;
|
|
336
|
-
/**
|
|
337
|
-
* Time Complexity: O(log n)
|
|
338
|
-
* Space Complexity: O(1)
|
|
339
|
-
*/
|
|
340
332
|
/**
|
|
341
333
|
* Time Complexity: O(log n)
|
|
342
334
|
* Space Complexity: O(1)
|
|
@@ -345,10 +337,6 @@ export declare class FibonacciHeap<E> {
|
|
|
345
337
|
* @returns The top element or undefined if the heap is empty.
|
|
346
338
|
*/
|
|
347
339
|
poll(): E | undefined;
|
|
348
|
-
/**
|
|
349
|
-
* Time Complexity: O(log n)
|
|
350
|
-
* Space Complexity: O(1)
|
|
351
|
-
*/
|
|
352
340
|
/**
|
|
353
341
|
* Time Complexity: O(log n)
|
|
354
342
|
* Space Complexity: O(1)
|
|
@@ -357,10 +345,6 @@ export declare class FibonacciHeap<E> {
|
|
|
357
345
|
* @returns The top element or undefined if the heap is empty.
|
|
358
346
|
*/
|
|
359
347
|
pop(): E | undefined;
|
|
360
|
-
/**
|
|
361
|
-
* Time Complexity: O(1)
|
|
362
|
-
* Space Complexity: O(1)
|
|
363
|
-
*/
|
|
364
348
|
/**
|
|
365
349
|
* Time Complexity: O(1)
|
|
366
350
|
* Space Complexity: O(1)
|
|
@@ -382,10 +366,6 @@ export declare class FibonacciHeap<E> {
|
|
|
382
366
|
* @protected
|
|
383
367
|
*/
|
|
384
368
|
protected _defaultComparator(a: E, b: E): number;
|
|
385
|
-
/**
|
|
386
|
-
* Time Complexity: O(1)
|
|
387
|
-
* Space Complexity: O(1)
|
|
388
|
-
*/
|
|
389
369
|
/**
|
|
390
370
|
* Time Complexity: O(1)
|
|
391
371
|
* Space Complexity: O(1)
|
|
@@ -394,10 +374,6 @@ export declare class FibonacciHeap<E> {
|
|
|
394
374
|
* @param node - The node to be merged.
|
|
395
375
|
*/
|
|
396
376
|
protected mergeWithRoot(node: FibonacciHeapNode<E>): void;
|
|
397
|
-
/**
|
|
398
|
-
* Time Complexity: O(1)
|
|
399
|
-
* Space Complexity: O(1)
|
|
400
|
-
*/
|
|
401
377
|
/**
|
|
402
378
|
* Time Complexity: O(1)
|
|
403
379
|
* Space Complexity: O(1)
|
|
@@ -407,10 +383,6 @@ export declare class FibonacciHeap<E> {
|
|
|
407
383
|
* @protected
|
|
408
384
|
*/
|
|
409
385
|
protected removeFromRoot(node: FibonacciHeapNode<E>): void;
|
|
410
|
-
/**
|
|
411
|
-
* Time Complexity: O(1)
|
|
412
|
-
* Space Complexity: O(1)
|
|
413
|
-
*/
|
|
414
386
|
/**
|
|
415
387
|
* Time Complexity: O(1)
|
|
416
388
|
* Space Complexity: O(1)
|
|
@@ -421,10 +393,6 @@ export declare class FibonacciHeap<E> {
|
|
|
421
393
|
* @protected
|
|
422
394
|
*/
|
|
423
395
|
protected _link(y: FibonacciHeapNode<E>, x: FibonacciHeapNode<E>): void;
|
|
424
|
-
/**
|
|
425
|
-
* Time Complexity: O(n log n)
|
|
426
|
-
* Space Complexity: O(n)
|
|
427
|
-
*/
|
|
428
396
|
/**
|
|
429
397
|
* Time Complexity: O(n log n)
|
|
430
398
|
* Space Complexity: O(n)
|
|
@@ -510,10 +510,6 @@ class FibonacciHeap {
|
|
|
510
510
|
peek() {
|
|
511
511
|
return this.min ? this.min.element : undefined;
|
|
512
512
|
}
|
|
513
|
-
/**
|
|
514
|
-
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
515
|
-
* Space Complexity: O(1)
|
|
516
|
-
*/
|
|
517
513
|
/**
|
|
518
514
|
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
519
515
|
* Space Complexity: O(1)
|
|
@@ -559,10 +555,6 @@ class FibonacciHeap {
|
|
|
559
555
|
parent.child.right = node;
|
|
560
556
|
}
|
|
561
557
|
}
|
|
562
|
-
/**
|
|
563
|
-
* Time Complexity: O(log n)
|
|
564
|
-
* Space Complexity: O(1)
|
|
565
|
-
*/
|
|
566
558
|
/**
|
|
567
559
|
* Time Complexity: O(log n)
|
|
568
560
|
* Space Complexity: O(1)
|
|
@@ -573,10 +565,6 @@ class FibonacciHeap {
|
|
|
573
565
|
poll() {
|
|
574
566
|
return this.pop();
|
|
575
567
|
}
|
|
576
|
-
/**
|
|
577
|
-
* Time Complexity: O(log n)
|
|
578
|
-
* Space Complexity: O(1)
|
|
579
|
-
*/
|
|
580
568
|
/**
|
|
581
569
|
* Time Complexity: O(log n)
|
|
582
570
|
* Space Complexity: O(1)
|
|
@@ -607,10 +595,6 @@ class FibonacciHeap {
|
|
|
607
595
|
this._size--;
|
|
608
596
|
return z.element;
|
|
609
597
|
}
|
|
610
|
-
/**
|
|
611
|
-
* Time Complexity: O(1)
|
|
612
|
-
* Space Complexity: O(1)
|
|
613
|
-
*/
|
|
614
598
|
/**
|
|
615
599
|
* Time Complexity: O(1)
|
|
616
600
|
* Space Complexity: O(1)
|
|
@@ -663,10 +647,6 @@ class FibonacciHeap {
|
|
|
663
647
|
return 1;
|
|
664
648
|
return 0;
|
|
665
649
|
}
|
|
666
|
-
/**
|
|
667
|
-
* Time Complexity: O(1)
|
|
668
|
-
* Space Complexity: O(1)
|
|
669
|
-
*/
|
|
670
650
|
/**
|
|
671
651
|
* Time Complexity: O(1)
|
|
672
652
|
* Space Complexity: O(1)
|
|
@@ -685,10 +665,6 @@ class FibonacciHeap {
|
|
|
685
665
|
this.root.right = node;
|
|
686
666
|
}
|
|
687
667
|
}
|
|
688
|
-
/**
|
|
689
|
-
* Time Complexity: O(1)
|
|
690
|
-
* Space Complexity: O(1)
|
|
691
|
-
*/
|
|
692
668
|
/**
|
|
693
669
|
* Time Complexity: O(1)
|
|
694
670
|
* Space Complexity: O(1)
|
|
@@ -705,10 +681,6 @@ class FibonacciHeap {
|
|
|
705
681
|
if (node.right)
|
|
706
682
|
node.right.left = node.left;
|
|
707
683
|
}
|
|
708
|
-
/**
|
|
709
|
-
* Time Complexity: O(1)
|
|
710
|
-
* Space Complexity: O(1)
|
|
711
|
-
*/
|
|
712
684
|
/**
|
|
713
685
|
* Time Complexity: O(1)
|
|
714
686
|
* Space Complexity: O(1)
|
|
@@ -726,10 +698,6 @@ class FibonacciHeap {
|
|
|
726
698
|
x.degree++;
|
|
727
699
|
y.parent = x;
|
|
728
700
|
}
|
|
729
|
-
/**
|
|
730
|
-
* Time Complexity: O(n log n)
|
|
731
|
-
* Space Complexity: O(n)
|
|
732
|
-
*/
|
|
733
701
|
/**
|
|
734
702
|
* Time Complexity: O(n log n)
|
|
735
703
|
* Space Complexity: O(n)
|
|
@@ -81,11 +81,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
81
81
|
* @returns The size of the object, which is a number.
|
|
82
82
|
*/
|
|
83
83
|
get size(): number;
|
|
84
|
-
/**
|
|
85
|
-
* Time Complexity: O(1)
|
|
86
|
-
* Space Complexity: O(1)
|
|
87
|
-
* where n is the number of elements in the linked list.
|
|
88
|
-
*/
|
|
89
84
|
/**
|
|
90
85
|
* Time Complexity: O(1)
|
|
91
86
|
* Space Complexity: O(1)
|
|
@@ -94,10 +89,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
94
89
|
* @returns The method `get first()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
|
|
95
90
|
*/
|
|
96
91
|
get first(): E | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* Time Complexity: O(1)
|
|
99
|
-
* Space Complexity: O(1)
|
|
100
|
-
*/
|
|
101
92
|
/**
|
|
102
93
|
* Time Complexity: O(1)
|
|
103
94
|
* Space Complexity: O(1)
|
|
@@ -106,10 +97,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
106
97
|
* @returns The method `get last()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
|
|
107
98
|
*/
|
|
108
99
|
get last(): E | undefined;
|
|
109
|
-
/**
|
|
110
|
-
* Time Complexity: O(n)
|
|
111
|
-
* Space Complexity: O(n)
|
|
112
|
-
*/
|
|
113
100
|
/**
|
|
114
101
|
* Time Complexity: O(n)
|
|
115
102
|
* Space Complexity: O(n)
|
|
@@ -123,8 +110,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
123
110
|
/**
|
|
124
111
|
* Time Complexity: O(1)
|
|
125
112
|
* Space Complexity: O(1)
|
|
126
|
-
|
|
127
|
-
/**
|
|
113
|
+
*
|
|
128
114
|
* The push function adds a new element to the end of a doubly linked list.
|
|
129
115
|
* @param {E} element - The "element" parameter represents the value that you want to add to the
|
|
130
116
|
* doubly linked list.
|
|
@@ -134,8 +120,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
134
120
|
/**
|
|
135
121
|
* Time Complexity: O(1)
|
|
136
122
|
* Space Complexity: O(1)
|
|
137
|
-
|
|
138
|
-
/**
|
|
123
|
+
*
|
|
139
124
|
* The `pop()` function removes and returns the value of the last element in a linked list.
|
|
140
125
|
* @returns The method is returning the value of the removed node.
|
|
141
126
|
*/
|
|
@@ -143,8 +128,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
143
128
|
/**
|
|
144
129
|
* Time Complexity: O(1)
|
|
145
130
|
* Space Complexity: O(1)
|
|
146
|
-
|
|
147
|
-
/**
|
|
131
|
+
*
|
|
148
132
|
* The `shift()` function removes and returns the value of the first element in a doubly linked list.
|
|
149
133
|
* @returns The value of the removed node.
|
|
150
134
|
*/
|
|
@@ -152,18 +136,13 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
152
136
|
/**
|
|
153
137
|
* Time Complexity: O(1)
|
|
154
138
|
* Space Complexity: O(1)
|
|
155
|
-
|
|
156
|
-
/**
|
|
139
|
+
*
|
|
157
140
|
* The unshift function adds a new element to the beginning of a doubly linked list.
|
|
158
141
|
* @param {E} element - The "element" parameter represents the value of the element that you want to
|
|
159
142
|
* add to the beginning of the doubly linked list.
|
|
160
143
|
* @returns The `unshift` method is returning a boolean value, `true`.
|
|
161
144
|
*/
|
|
162
145
|
unshift(element: E): boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Time Complexity: O(n)
|
|
165
|
-
* Space Complexity: O(1)
|
|
166
|
-
*/
|
|
167
146
|
/**
|
|
168
147
|
* Time Complexity: O(n)
|
|
169
148
|
* Space Complexity: O(1)
|
|
@@ -175,10 +154,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
175
154
|
* or the linked list is empty, it will return undefined.
|
|
176
155
|
*/
|
|
177
156
|
at(index: number): E | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* Time Complexity: O(n)
|
|
180
|
-
* Space Complexity: O(1)
|
|
181
|
-
*/
|
|
182
157
|
/**
|
|
183
158
|
* Time Complexity: O(n)
|
|
184
159
|
* Space Complexity: O(1)
|
|
@@ -191,10 +166,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
191
166
|
* valid range of the linked list, otherwise it returns `undefined`.
|
|
192
167
|
*/
|
|
193
168
|
getNodeAt(index: number): DoublyLinkedListNode<E> | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* Time Complexity: O(n)
|
|
196
|
-
* Space Complexity: O(1)
|
|
197
|
-
*/
|
|
198
169
|
/**
|
|
199
170
|
* Time Complexity: O(n)
|
|
200
171
|
* Space Complexity: O(1)
|
|
@@ -206,10 +177,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
206
177
|
* is found in the linked list. If no such node is found, it returns `undefined`.
|
|
207
178
|
*/
|
|
208
179
|
getNode(value: E | undefined): DoublyLinkedListNode<E> | undefined;
|
|
209
|
-
/**
|
|
210
|
-
* Time Complexity: O(n)
|
|
211
|
-
* Space Complexity: O(1)
|
|
212
|
-
*/
|
|
213
180
|
/**
|
|
214
181
|
* Time Complexity: O(n)
|
|
215
182
|
* Space Complexity: O(1)
|
|
@@ -223,11 +190,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
223
190
|
* if the index is out of bounds.
|
|
224
191
|
*/
|
|
225
192
|
addAt(index: number, value: E): boolean;
|
|
226
|
-
/**
|
|
227
|
-
* Time Complexity: O(1) or O(n)
|
|
228
|
-
* Space Complexity: O(1)
|
|
229
|
-
* where n is the number of elements in the linked list.
|
|
230
|
-
*/
|
|
231
193
|
/**
|
|
232
194
|
* Time Complexity: O(1) or O(n)
|
|
233
195
|
* Space Complexity: O(1)
|
|
@@ -242,10 +204,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
242
204
|
* insertion fails.
|
|
243
205
|
*/
|
|
244
206
|
addBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
|
|
245
|
-
/**
|
|
246
|
-
* Time Complexity: O(1) or O(n)
|
|
247
|
-
* Space Complexity: O(1)
|
|
248
|
-
*/
|
|
249
207
|
/**
|
|
250
208
|
* Time Complexity: O(1) or O(n)
|
|
251
209
|
* Space Complexity: O(1)
|
|
@@ -270,10 +228,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
270
228
|
* bounds.
|
|
271
229
|
*/
|
|
272
230
|
deleteAt(index: number): boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Time Complexity: O(1) or O(n)
|
|
275
|
-
* Space Complexity: O(1)
|
|
276
|
-
*/
|
|
277
231
|
/**
|
|
278
232
|
* Time Complexity: O(1) or O(n)
|
|
279
233
|
* Space Complexity: O(1)
|
|
@@ -285,10 +239,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
285
239
|
* deleted from the doubly linked list, and `false` if the value or node was not found in the list.
|
|
286
240
|
*/
|
|
287
241
|
delete(valOrNode: E | DoublyLinkedListNode<E> | undefined): boolean;
|
|
288
|
-
/**
|
|
289
|
-
* Time Complexity: O(1)
|
|
290
|
-
* Space Complexity: O(1)
|
|
291
|
-
*/
|
|
292
242
|
/**
|
|
293
243
|
* Time Complexity: O(1)
|
|
294
244
|
* Space Complexity: O(1)
|
|
@@ -297,10 +247,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
297
247
|
* @returns A boolean value is being returned.
|
|
298
248
|
*/
|
|
299
249
|
isEmpty(): boolean;
|
|
300
|
-
/**
|
|
301
|
-
* Time Complexity: O(1)
|
|
302
|
-
* Space Complexity: O(1)
|
|
303
|
-
*/
|
|
304
250
|
/**
|
|
305
251
|
* Time Complexity: O(1)
|
|
306
252
|
* Space Complexity: O(1)
|
|
@@ -308,10 +254,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
308
254
|
* The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
|
|
309
255
|
*/
|
|
310
256
|
clear(): void;
|
|
311
|
-
/**
|
|
312
|
-
* Time Complexity: O(n)
|
|
313
|
-
* Space Complexity: O(1)
|
|
314
|
-
*/
|
|
315
257
|
/**
|
|
316
258
|
* Time Complexity: O(n)
|
|
317
259
|
* Space Complexity: O(1)
|
|
@@ -323,10 +265,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
323
265
|
* list. If the value is not found, it returns -1.
|
|
324
266
|
*/
|
|
325
267
|
indexOf(value: E): number;
|
|
326
|
-
/**
|
|
327
|
-
* Time Complexity: O(n)
|
|
328
|
-
* Space Complexity: O(1)
|
|
329
|
-
*/
|
|
330
268
|
/**
|
|
331
269
|
* Time Complexity: O(n)
|
|
332
270
|
* Space Complexity: O(1)
|
|
@@ -339,10 +277,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
339
277
|
* the callback function. If no value satisfies the condition, it returns `undefined`.
|
|
340
278
|
*/
|
|
341
279
|
findBackward(callback: (value: E) => boolean): E | undefined;
|
|
342
|
-
/**
|
|
343
|
-
* Time Complexity: O(n)
|
|
344
|
-
* Space Complexity: O(1)
|
|
345
|
-
*/
|
|
346
280
|
/**
|
|
347
281
|
* Time Complexity: O(n)
|
|
348
282
|
* Space Complexity: O(1)
|
|
@@ -350,10 +284,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
350
284
|
* The `reverse` function reverses the order of the elements in a doubly linked list.
|
|
351
285
|
*/
|
|
352
286
|
reverse(): this;
|
|
353
|
-
/**
|
|
354
|
-
* Time Complexity: O(n)
|
|
355
|
-
* Space Complexity: O(n)
|
|
356
|
-
*/
|
|
357
287
|
/**
|
|
358
288
|
* Time Complexity: O(n)
|
|
359
289
|
* Space Complexity: O(n)
|
|
@@ -362,10 +292,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
362
292
|
* @returns The `toArray()` method is returning an array of type `E[]`.
|
|
363
293
|
*/
|
|
364
294
|
toArray(): E[];
|
|
365
|
-
/**
|
|
366
|
-
* Time Complexity: O(n)
|
|
367
|
-
* Space Complexity: O(n)
|
|
368
|
-
*/
|
|
369
295
|
/**
|
|
370
296
|
* Time Complexity: O(n)
|
|
371
297
|
* Space Complexity: O(n)
|
|
@@ -374,10 +300,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
374
300
|
* @returns The `toReversedArray()` function returns an array of type `E[]`.
|
|
375
301
|
*/
|
|
376
302
|
toReversedArray(): E[];
|
|
377
|
-
/**
|
|
378
|
-
* Time Complexity: O(n)
|
|
379
|
-
* Space Complexity: O(n)
|
|
380
|
-
*/
|
|
381
303
|
/**
|
|
382
304
|
* Time Complexity: O(n)
|
|
383
305
|
* Space Complexity: O(n)
|
|
@@ -388,10 +310,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
388
310
|
* is a copy of the original list.
|
|
389
311
|
*/
|
|
390
312
|
clone(): DoublyLinkedList<E, R>;
|
|
391
|
-
/**
|
|
392
|
-
* Time Complexity: O(n)
|
|
393
|
-
* Space Complexity: O(n)
|
|
394
|
-
*/
|
|
395
313
|
/**
|
|
396
314
|
* Time Complexity: O(n)
|
|
397
315
|
* Space Complexity: O(n)
|
|
@@ -413,8 +331,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
413
331
|
/**
|
|
414
332
|
* Time Complexity: O(n)
|
|
415
333
|
* Space Complexity: O(n)
|
|
416
|
-
|
|
417
|
-
/**
|
|
334
|
+
*
|
|
418
335
|
* The `map` function takes a callback function and returns a new DoublyLinkedList with the results
|
|
419
336
|
* of applying the callback to each element in the original list.
|
|
420
337
|
* @param callback - The callback parameter is a function that will be called for each element in the
|
|
@@ -107,11 +107,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
107
107
|
get size() {
|
|
108
108
|
return this._size;
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Time Complexity: O(1)
|
|
112
|
-
* Space Complexity: O(1)
|
|
113
|
-
* where n is the number of elements in the linked list.
|
|
114
|
-
*/
|
|
115
110
|
/**
|
|
116
111
|
* Time Complexity: O(1)
|
|
117
112
|
* Space Complexity: O(1)
|
|
@@ -123,10 +118,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
123
118
|
var _a;
|
|
124
119
|
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
|
|
125
120
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Time Complexity: O(1)
|
|
128
|
-
* Space Complexity: O(1)
|
|
129
|
-
*/
|
|
130
121
|
/**
|
|
131
122
|
* Time Complexity: O(1)
|
|
132
123
|
* Space Complexity: O(1)
|
|
@@ -138,10 +129,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
138
129
|
var _a;
|
|
139
130
|
return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
|
|
140
131
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Time Complexity: O(n)
|
|
143
|
-
* Space Complexity: O(n)
|
|
144
|
-
*/
|
|
145
132
|
/**
|
|
146
133
|
* Time Complexity: O(n)
|
|
147
134
|
* Space Complexity: O(n)
|
|
@@ -157,8 +144,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
157
144
|
/**
|
|
158
145
|
* Time Complexity: O(1)
|
|
159
146
|
* Space Complexity: O(1)
|
|
160
|
-
|
|
161
|
-
/**
|
|
147
|
+
*
|
|
162
148
|
* The push function adds a new element to the end of a doubly linked list.
|
|
163
149
|
* @param {E} element - The "element" parameter represents the value that you want to add to the
|
|
164
150
|
* doubly linked list.
|
|
@@ -181,8 +167,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
181
167
|
/**
|
|
182
168
|
* Time Complexity: O(1)
|
|
183
169
|
* Space Complexity: O(1)
|
|
184
|
-
|
|
185
|
-
/**
|
|
170
|
+
*
|
|
186
171
|
* The `pop()` function removes and returns the value of the last element in a linked list.
|
|
187
172
|
* @returns The method is returning the value of the removed node.
|
|
188
173
|
*/
|
|
@@ -204,8 +189,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
204
189
|
/**
|
|
205
190
|
* Time Complexity: O(1)
|
|
206
191
|
* Space Complexity: O(1)
|
|
207
|
-
|
|
208
|
-
/**
|
|
192
|
+
*
|
|
209
193
|
* The `shift()` function removes and returns the value of the first element in a doubly linked list.
|
|
210
194
|
* @returns The value of the removed node.
|
|
211
195
|
*/
|
|
@@ -227,8 +211,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
227
211
|
/**
|
|
228
212
|
* Time Complexity: O(1)
|
|
229
213
|
* Space Complexity: O(1)
|
|
230
|
-
|
|
231
|
-
/**
|
|
214
|
+
*
|
|
232
215
|
* The unshift function adds a new element to the beginning of a doubly linked list.
|
|
233
216
|
* @param {E} element - The "element" parameter represents the value of the element that you want to
|
|
234
217
|
* add to the beginning of the doubly linked list.
|
|
@@ -248,10 +231,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
248
231
|
this._size++;
|
|
249
232
|
return true;
|
|
250
233
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Time Complexity: O(n)
|
|
253
|
-
* Space Complexity: O(1)
|
|
254
|
-
*/
|
|
255
234
|
/**
|
|
256
235
|
* Time Complexity: O(n)
|
|
257
236
|
* Space Complexity: O(1)
|
|
@@ -271,10 +250,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
271
250
|
}
|
|
272
251
|
return current.value;
|
|
273
252
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Time Complexity: O(n)
|
|
276
|
-
* Space Complexity: O(1)
|
|
277
|
-
*/
|
|
278
253
|
/**
|
|
279
254
|
* Time Complexity: O(n)
|
|
280
255
|
* Space Complexity: O(1)
|
|
@@ -295,10 +270,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
295
270
|
}
|
|
296
271
|
return current;
|
|
297
272
|
}
|
|
298
|
-
/**
|
|
299
|
-
* Time Complexity: O(n)
|
|
300
|
-
* Space Complexity: O(1)
|
|
301
|
-
*/
|
|
302
273
|
/**
|
|
303
274
|
* Time Complexity: O(n)
|
|
304
275
|
* Space Complexity: O(1)
|
|
@@ -319,10 +290,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
319
290
|
}
|
|
320
291
|
return undefined;
|
|
321
292
|
}
|
|
322
|
-
/**
|
|
323
|
-
* Time Complexity: O(n)
|
|
324
|
-
* Space Complexity: O(1)
|
|
325
|
-
*/
|
|
326
293
|
/**
|
|
327
294
|
* Time Complexity: O(n)
|
|
328
295
|
* Space Complexity: O(1)
|
|
@@ -356,11 +323,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
356
323
|
this._size++;
|
|
357
324
|
return true;
|
|
358
325
|
}
|
|
359
|
-
/**
|
|
360
|
-
* Time Complexity: O(1) or O(n)
|
|
361
|
-
* Space Complexity: O(1)
|
|
362
|
-
* where n is the number of elements in the linked list.
|
|
363
|
-
*/
|
|
364
326
|
/**
|
|
365
327
|
* Time Complexity: O(1) or O(n)
|
|
366
328
|
* Space Complexity: O(1)
|
|
@@ -398,10 +360,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
398
360
|
}
|
|
399
361
|
return false;
|
|
400
362
|
}
|
|
401
|
-
/**
|
|
402
|
-
* Time Complexity: O(1) or O(n)
|
|
403
|
-
* Space Complexity: O(1)
|
|
404
|
-
*/
|
|
405
363
|
/**
|
|
406
364
|
* Time Complexity: O(1) or O(n)
|
|
407
365
|
* Space Complexity: O(1)
|
|
@@ -467,10 +425,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
467
425
|
this._size--;
|
|
468
426
|
return true;
|
|
469
427
|
}
|
|
470
|
-
/**
|
|
471
|
-
* Time Complexity: O(1) or O(n)
|
|
472
|
-
* Space Complexity: O(1)
|
|
473
|
-
*/
|
|
474
428
|
/**
|
|
475
429
|
* Time Complexity: O(1) or O(n)
|
|
476
430
|
* Space Complexity: O(1)
|
|
@@ -507,10 +461,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
507
461
|
}
|
|
508
462
|
return false;
|
|
509
463
|
}
|
|
510
|
-
/**
|
|
511
|
-
* Time Complexity: O(1)
|
|
512
|
-
* Space Complexity: O(1)
|
|
513
|
-
*/
|
|
514
464
|
/**
|
|
515
465
|
* Time Complexity: O(1)
|
|
516
466
|
* Space Complexity: O(1)
|
|
@@ -521,10 +471,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
521
471
|
isEmpty() {
|
|
522
472
|
return this.size === 0;
|
|
523
473
|
}
|
|
524
|
-
/**
|
|
525
|
-
* Time Complexity: O(1)
|
|
526
|
-
* Space Complexity: O(1)
|
|
527
|
-
*/
|
|
528
474
|
/**
|
|
529
475
|
* Time Complexity: O(1)
|
|
530
476
|
* Space Complexity: O(1)
|
|
@@ -536,10 +482,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
536
482
|
this._tail = undefined;
|
|
537
483
|
this._size = 0;
|
|
538
484
|
}
|
|
539
|
-
/**
|
|
540
|
-
* Time Complexity: O(n)
|
|
541
|
-
* Space Complexity: O(1)
|
|
542
|
-
*/
|
|
543
485
|
/**
|
|
544
486
|
* Time Complexity: O(n)
|
|
545
487
|
* Space Complexity: O(1)
|
|
@@ -562,10 +504,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
562
504
|
}
|
|
563
505
|
return -1;
|
|
564
506
|
}
|
|
565
|
-
/**
|
|
566
|
-
* Time Complexity: O(n)
|
|
567
|
-
* Space Complexity: O(1)
|
|
568
|
-
*/
|
|
569
507
|
/**
|
|
570
508
|
* Time Complexity: O(n)
|
|
571
509
|
* Space Complexity: O(1)
|
|
@@ -587,10 +525,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
587
525
|
}
|
|
588
526
|
return undefined;
|
|
589
527
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Time Complexity: O(n)
|
|
592
|
-
* Space Complexity: O(1)
|
|
593
|
-
*/
|
|
594
528
|
/**
|
|
595
529
|
* Time Complexity: O(n)
|
|
596
530
|
* Space Complexity: O(1)
|
|
@@ -607,10 +541,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
607
541
|
}
|
|
608
542
|
return this;
|
|
609
543
|
}
|
|
610
|
-
/**
|
|
611
|
-
* Time Complexity: O(n)
|
|
612
|
-
* Space Complexity: O(n)
|
|
613
|
-
*/
|
|
614
544
|
/**
|
|
615
545
|
* Time Complexity: O(n)
|
|
616
546
|
* Space Complexity: O(n)
|
|
@@ -627,10 +557,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
627
557
|
}
|
|
628
558
|
return array;
|
|
629
559
|
}
|
|
630
|
-
/**
|
|
631
|
-
* Time Complexity: O(n)
|
|
632
|
-
* Space Complexity: O(n)
|
|
633
|
-
*/
|
|
634
560
|
/**
|
|
635
561
|
* Time Complexity: O(n)
|
|
636
562
|
* Space Complexity: O(n)
|
|
@@ -647,10 +573,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
647
573
|
}
|
|
648
574
|
return array;
|
|
649
575
|
}
|
|
650
|
-
/**
|
|
651
|
-
* Time Complexity: O(n)
|
|
652
|
-
* Space Complexity: O(n)
|
|
653
|
-
*/
|
|
654
576
|
/**
|
|
655
577
|
* Time Complexity: O(n)
|
|
656
578
|
* Space Complexity: O(n)
|
|
@@ -663,10 +585,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
663
585
|
clone() {
|
|
664
586
|
return new DoublyLinkedList(this);
|
|
665
587
|
}
|
|
666
|
-
/**
|
|
667
|
-
* Time Complexity: O(n)
|
|
668
|
-
* Space Complexity: O(n)
|
|
669
|
-
*/
|
|
670
588
|
/**
|
|
671
589
|
* Time Complexity: O(n)
|
|
672
590
|
* Space Complexity: O(n)
|
|
@@ -698,8 +616,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
698
616
|
/**
|
|
699
617
|
* Time Complexity: O(n)
|
|
700
618
|
* Space Complexity: O(n)
|
|
701
|
-
|
|
702
|
-
/**
|
|
619
|
+
*
|
|
703
620
|
* The `map` function takes a callback function and returns a new DoublyLinkedList with the results
|
|
704
621
|
* of applying the callback to each element in the original list.
|
|
705
622
|
* @param callback - The callback parameter is a function that will be called for each element in the
|