data-structure-typed 1.52.4 → 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/CHANGELOG.md +1 -1
- package/README.md +13 -13
- package/README_zh-CN.md +216 -26
- package/benchmark/report.html +13 -13
- package/benchmark/report.json +158 -158
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/cjs/data-structures/base/iterable-element-base.js +1 -37
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
- package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/cjs/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +299 -331
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/cjs/data-structures/binary-tree/bst.js +12 -44
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/cjs/data-structures/graph/abstract-graph.js +0 -75
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/cjs/data-structures/graph/directed-graph.js +0 -98
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/cjs/data-structures/graph/undirected-graph.js +0 -50
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/cjs/data-structures/hash/hash-map.js +27 -111
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +0 -32
- package/dist/cjs/data-structures/heap/heap.js +0 -32
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +1 -98
- package/dist/cjs/data-structures/queue/deque.js +3 -99
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +1 -54
- package/dist/cjs/data-structures/queue/queue.js +0 -53
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +1 -34
- package/dist/cjs/data-structures/stack/stack.js +1 -34
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/tree/tree.js +0 -1
- package/dist/cjs/data-structures/tree/tree.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +0 -64
- package/dist/cjs/data-structures/trie/trie.js +0 -64
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +6 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/types/utils/utils.d.ts +13 -12
- package/dist/cjs/utils/number.d.ts +13 -0
- package/dist/cjs/utils/number.js +13 -0
- package/dist/cjs/utils/number.js.map +1 -1
- package/dist/cjs/utils/utils.d.ts +125 -3
- package/dist/cjs/utils/utils.js +177 -21
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/mjs/data-structures/base/iterable-element-base.d.ts +1 -37
- package/dist/mjs/data-structures/base/iterable-element-base.js +1 -37
- package/dist/mjs/data-structures/base/iterable-entry-base.d.ts +2 -54
- package/dist/mjs/data-structures/base/iterable-entry-base.js +1 -49
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +0 -46
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +298 -332
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +1 -40
- package/dist/mjs/data-structures/binary-tree/bst.js +12 -44
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +2 -50
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +9 -41
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +0 -75
- package/dist/mjs/data-structures/graph/abstract-graph.js +0 -75
- package/dist/mjs/data-structures/graph/directed-graph.d.ts +0 -98
- package/dist/mjs/data-structures/graph/directed-graph.js +0 -98
- package/dist/mjs/data-structures/graph/undirected-graph.d.ts +0 -50
- package/dist/mjs/data-structures/graph/undirected-graph.js +0 -50
- package/dist/mjs/data-structures/hash/hash-map.d.ts +5 -92
- package/dist/mjs/data-structures/hash/hash-map.js +27 -111
- package/dist/mjs/data-structures/heap/heap.d.ts +0 -32
- package/dist/mjs/data-structures/heap/heap.js +0 -32
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +5 -88
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -84
- package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +1 -35
- package/dist/mjs/data-structures/queue/deque.d.ts +1 -98
- package/dist/mjs/data-structures/queue/deque.js +3 -99
- package/dist/mjs/data-structures/queue/queue.d.ts +1 -54
- package/dist/mjs/data-structures/queue/queue.js +0 -53
- package/dist/mjs/data-structures/stack/stack.d.ts +1 -34
- package/dist/mjs/data-structures/stack/stack.js +1 -34
- package/dist/mjs/data-structures/tree/tree.js +0 -1
- package/dist/mjs/data-structures/trie/trie.d.ts +0 -64
- package/dist/mjs/data-structures/trie/trie.js +0 -64
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +5 -1
- package/dist/mjs/types/utils/utils.d.ts +13 -12
- package/dist/mjs/utils/number.d.ts +13 -0
- package/dist/mjs/utils/number.js +13 -0
- package/dist/mjs/utils/utils.d.ts +125 -3
- package/dist/mjs/utils/utils.js +177 -21
- package/dist/umd/data-structure-typed.js +408 -1474
- package/dist/umd/data-structure-typed.min.js +5 -4
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +6 -6
- 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 +29 -133
- 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 +1 -68
- 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
- package/test/config.ts +8 -0
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +13 -13
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +18 -13
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +471 -64
- package/test/unit/data-structures/binary-tree/bst.test.ts +167 -23
- package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +136 -13
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +18 -13
- package/test/unit/data-structures/graph/directed-graph.test.ts +46 -32
- package/test/unit/data-structures/graph/map-graph.test.ts +24 -2
- package/test/unit/data-structures/graph/undirected-graph.test.ts +24 -24
- package/test/unit/data-structures/hash/hash-map.test.ts +225 -35
- package/test/unit/data-structures/heap/heap.test.ts +47 -39
- package/test/unit/data-structures/heap/min-heap.test.ts +5 -5
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +34 -4
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +32 -0
- package/test/unit/data-structures/matrix/matrix.test.ts +35 -5
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +31 -0
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +18 -0
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +17 -0
- package/test/unit/data-structures/queue/deque.test.ts +288 -47
- package/test/unit/data-structures/queue/queue.test.ts +62 -37
- package/test/unit/data-structures/stack/stack.test.ts +30 -5
- package/test/unit/data-structures/tree/tree.test.ts +58 -0
- package/test/unit/data-structures/trie/trie.test.ts +46 -5
- package/test/unit/utils/utils.test.ts +169 -0
|
@@ -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)
|
|
@@ -514,10 +514,6 @@ export class FibonacciHeap {
|
|
|
514
514
|
peek() {
|
|
515
515
|
return this.min ? this.min.element : undefined;
|
|
516
516
|
}
|
|
517
|
-
/**
|
|
518
|
-
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
519
|
-
* Space Complexity: O(1)
|
|
520
|
-
*/
|
|
521
517
|
/**
|
|
522
518
|
* Time Complexity: O(n), where n is the number of elements in the linked list.
|
|
523
519
|
* Space Complexity: O(1)
|
|
@@ -563,10 +559,6 @@ export class FibonacciHeap {
|
|
|
563
559
|
parent.child.right = node;
|
|
564
560
|
}
|
|
565
561
|
}
|
|
566
|
-
/**
|
|
567
|
-
* Time Complexity: O(log n)
|
|
568
|
-
* Space Complexity: O(1)
|
|
569
|
-
*/
|
|
570
562
|
/**
|
|
571
563
|
* Time Complexity: O(log n)
|
|
572
564
|
* Space Complexity: O(1)
|
|
@@ -577,10 +569,6 @@ export class FibonacciHeap {
|
|
|
577
569
|
poll() {
|
|
578
570
|
return this.pop();
|
|
579
571
|
}
|
|
580
|
-
/**
|
|
581
|
-
* Time Complexity: O(log n)
|
|
582
|
-
* Space Complexity: O(1)
|
|
583
|
-
*/
|
|
584
572
|
/**
|
|
585
573
|
* Time Complexity: O(log n)
|
|
586
574
|
* Space Complexity: O(1)
|
|
@@ -611,10 +599,6 @@ export class FibonacciHeap {
|
|
|
611
599
|
this._size--;
|
|
612
600
|
return z.element;
|
|
613
601
|
}
|
|
614
|
-
/**
|
|
615
|
-
* Time Complexity: O(1)
|
|
616
|
-
* Space Complexity: O(1)
|
|
617
|
-
*/
|
|
618
602
|
/**
|
|
619
603
|
* Time Complexity: O(1)
|
|
620
604
|
* Space Complexity: O(1)
|
|
@@ -667,10 +651,6 @@ export class FibonacciHeap {
|
|
|
667
651
|
return 1;
|
|
668
652
|
return 0;
|
|
669
653
|
}
|
|
670
|
-
/**
|
|
671
|
-
* Time Complexity: O(1)
|
|
672
|
-
* Space Complexity: O(1)
|
|
673
|
-
*/
|
|
674
654
|
/**
|
|
675
655
|
* Time Complexity: O(1)
|
|
676
656
|
* Space Complexity: O(1)
|
|
@@ -689,10 +669,6 @@ export class FibonacciHeap {
|
|
|
689
669
|
this.root.right = node;
|
|
690
670
|
}
|
|
691
671
|
}
|
|
692
|
-
/**
|
|
693
|
-
* Time Complexity: O(1)
|
|
694
|
-
* Space Complexity: O(1)
|
|
695
|
-
*/
|
|
696
672
|
/**
|
|
697
673
|
* Time Complexity: O(1)
|
|
698
674
|
* Space Complexity: O(1)
|
|
@@ -709,10 +685,6 @@ export class FibonacciHeap {
|
|
|
709
685
|
if (node.right)
|
|
710
686
|
node.right.left = node.left;
|
|
711
687
|
}
|
|
712
|
-
/**
|
|
713
|
-
* Time Complexity: O(1)
|
|
714
|
-
* Space Complexity: O(1)
|
|
715
|
-
*/
|
|
716
688
|
/**
|
|
717
689
|
* Time Complexity: O(1)
|
|
718
690
|
* Space Complexity: O(1)
|
|
@@ -730,10 +702,6 @@ export class FibonacciHeap {
|
|
|
730
702
|
x.degree++;
|
|
731
703
|
y.parent = x;
|
|
732
704
|
}
|
|
733
|
-
/**
|
|
734
|
-
* Time Complexity: O(n log n)
|
|
735
|
-
* Space Complexity: O(n)
|
|
736
|
-
*/
|
|
737
705
|
/**
|
|
738
706
|
* Time Complexity: O(n log n)
|
|
739
707
|
* 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
|
|
@@ -109,11 +109,6 @@ export class DoublyLinkedList extends IterableElementBase {
|
|
|
109
109
|
get size() {
|
|
110
110
|
return this._size;
|
|
111
111
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Time Complexity: O(1)
|
|
114
|
-
* Space Complexity: O(1)
|
|
115
|
-
* where n is the number of elements in the linked list.
|
|
116
|
-
*/
|
|
117
112
|
/**
|
|
118
113
|
* Time Complexity: O(1)
|
|
119
114
|
* Space Complexity: O(1)
|
|
@@ -124,10 +119,6 @@ export class DoublyLinkedList extends IterableElementBase {
|
|
|
124
119
|
get first() {
|
|
125
120
|
return this.head?.value;
|
|
126
121
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Time Complexity: O(1)
|
|
129
|
-
* Space Complexity: O(1)
|
|
130
|
-
*/
|
|
131
122
|
/**
|
|
132
123
|
* Time Complexity: O(1)
|
|
133
124
|
* Space Complexity: O(1)
|
|
@@ -138,10 +129,6 @@ export class DoublyLinkedList extends IterableElementBase {
|
|
|
138
129
|
get last() {
|
|
139
130
|
return this.tail?.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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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 @@ export class DoublyLinkedList extends 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
|