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.
Files changed (85) hide show
  1. package/dist/data-structures/base/iterable-base.d.ts +120 -9
  2. package/dist/data-structures/base/iterable-base.js +143 -7
  3. package/dist/data-structures/binary-tree/avl-tree.d.ts +72 -47
  4. package/dist/data-structures/binary-tree/avl-tree.js +101 -72
  5. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +22 -0
  6. package/dist/data-structures/binary-tree/binary-indexed-tree.js +22 -0
  7. package/dist/data-structures/binary-tree/binary-tree.d.ts +244 -199
  8. package/dist/data-structures/binary-tree/binary-tree.js +484 -376
  9. package/dist/data-structures/binary-tree/bst.d.ts +92 -79
  10. package/dist/data-structures/binary-tree/bst.js +68 -76
  11. package/dist/data-structures/binary-tree/rb-tree.d.ts +127 -57
  12. package/dist/data-structures/binary-tree/rb-tree.js +152 -99
  13. package/dist/data-structures/binary-tree/segment-tree.d.ts +99 -6
  14. package/dist/data-structures/binary-tree/segment-tree.js +127 -10
  15. package/dist/data-structures/binary-tree/tree-multimap.d.ts +72 -58
  16. package/dist/data-structures/binary-tree/tree-multimap.js +102 -85
  17. package/dist/data-structures/graph/abstract-graph.d.ts +1 -78
  18. package/dist/data-structures/graph/abstract-graph.js +3 -189
  19. package/dist/data-structures/graph/directed-graph.d.ts +73 -0
  20. package/dist/data-structures/graph/directed-graph.js +131 -0
  21. package/dist/data-structures/graph/map-graph.d.ts +8 -0
  22. package/dist/data-structures/graph/map-graph.js +14 -0
  23. package/dist/data-structures/graph/undirected-graph.d.ts +76 -7
  24. package/dist/data-structures/graph/undirected-graph.js +151 -18
  25. package/dist/data-structures/hash/hash-map.d.ts +254 -28
  26. package/dist/data-structures/hash/hash-map.js +347 -78
  27. package/dist/data-structures/heap/heap.d.ts +95 -25
  28. package/dist/data-structures/heap/heap.js +95 -26
  29. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +126 -63
  30. package/dist/data-structures/linked-list/doubly-linked-list.js +141 -77
  31. package/dist/data-structures/linked-list/singly-linked-list.d.ts +154 -106
  32. package/dist/data-structures/linked-list/singly-linked-list.js +164 -115
  33. package/dist/data-structures/linked-list/skip-linked-list.d.ts +63 -36
  34. package/dist/data-structures/linked-list/skip-linked-list.js +63 -36
  35. package/dist/data-structures/matrix/matrix.d.ts +35 -4
  36. package/dist/data-structures/matrix/matrix.js +50 -11
  37. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +10 -0
  38. package/dist/data-structures/priority-queue/max-priority-queue.js +10 -0
  39. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -0
  40. package/dist/data-structures/priority-queue/min-priority-queue.js +11 -0
  41. package/dist/data-structures/priority-queue/priority-queue.d.ts +8 -0
  42. package/dist/data-structures/priority-queue/priority-queue.js +8 -0
  43. package/dist/data-structures/queue/deque.d.ts +139 -35
  44. package/dist/data-structures/queue/deque.js +200 -62
  45. package/dist/data-structures/queue/queue.d.ts +103 -49
  46. package/dist/data-structures/queue/queue.js +111 -49
  47. package/dist/data-structures/stack/stack.d.ts +51 -21
  48. package/dist/data-structures/stack/stack.js +58 -22
  49. package/dist/data-structures/tree/tree.d.ts +57 -3
  50. package/dist/data-structures/tree/tree.js +77 -11
  51. package/dist/data-structures/trie/trie.d.ts +135 -34
  52. package/dist/data-structures/trie/trie.js +153 -33
  53. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
  54. package/dist/types/data-structures/hash/hash-map.d.ts +4 -3
  55. package/dist/types/utils/utils.d.ts +1 -0
  56. package/package.json +2 -2
  57. package/src/data-structures/base/iterable-base.ts +184 -19
  58. package/src/data-structures/binary-tree/avl-tree.ts +134 -100
  59. package/src/data-structures/binary-tree/binary-indexed-tree.ts +22 -0
  60. package/src/data-structures/binary-tree/binary-tree.ts +674 -671
  61. package/src/data-structures/binary-tree/bst.ts +127 -136
  62. package/src/data-structures/binary-tree/rb-tree.ts +199 -166
  63. package/src/data-structures/binary-tree/segment-tree.ts +145 -11
  64. package/src/data-structures/binary-tree/tree-multimap.ts +138 -115
  65. package/src/data-structures/graph/abstract-graph.ts +4 -211
  66. package/src/data-structures/graph/directed-graph.ts +152 -0
  67. package/src/data-structures/graph/map-graph.ts +15 -0
  68. package/src/data-structures/graph/undirected-graph.ts +171 -19
  69. package/src/data-structures/hash/hash-map.ts +389 -96
  70. package/src/data-structures/heap/heap.ts +97 -26
  71. package/src/data-structures/linked-list/doubly-linked-list.ts +156 -83
  72. package/src/data-structures/linked-list/singly-linked-list.ts +174 -120
  73. package/src/data-structures/linked-list/skip-linked-list.ts +63 -37
  74. package/src/data-structures/matrix/matrix.ts +52 -12
  75. package/src/data-structures/priority-queue/max-priority-queue.ts +10 -0
  76. package/src/data-structures/priority-queue/min-priority-queue.ts +11 -0
  77. package/src/data-structures/priority-queue/priority-queue.ts +8 -0
  78. package/src/data-structures/queue/deque.ts +225 -70
  79. package/src/data-structures/queue/queue.ts +118 -49
  80. package/src/data-structures/stack/stack.ts +63 -23
  81. package/src/data-structures/tree/tree.ts +89 -15
  82. package/src/data-structures/trie/trie.ts +173 -38
  83. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
  84. package/src/types/data-structures/hash/hash-map.ts +4 -3
  85. package/src/types/utils/utils.ts +2 -0
@@ -9,9 +9,57 @@ class DoublyLinkedListNode {
9
9
  * is defined as a generic type "E".
10
10
  */
11
11
  constructor(value) {
12
- this.value = value;
13
- this.next = undefined;
14
- this.prev = undefined;
12
+ this._value = value;
13
+ this._next = undefined;
14
+ this._prev = undefined;
15
+ }
16
+ /**
17
+ * The function returns the value of a protected variable.
18
+ * @returns The value of the variable `_value` is being returned.
19
+ */
20
+ get value() {
21
+ return this._value;
22
+ }
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) {
28
+ this._value = value;
29
+ }
30
+ /**
31
+ * The "next" function returns the next node in a doubly linked list.
32
+ * @returns The `next` property is being returned. It can be either a `DoublyLinkedListNode<E>`
33
+ * object or `undefined`.
34
+ */
35
+ get next() {
36
+ return this._next;
37
+ }
38
+ /**
39
+ * The "next" property of a DoublyLinkedListNode is set to the provided value.
40
+ * @param {DoublyLinkedListNode<E> | undefined} value - The `value` parameter is of type
41
+ * `DoublyLinkedListNode<E> | undefined`. This means that it can accept either a
42
+ * `DoublyLinkedListNode` object or `undefined` as its value.
43
+ */
44
+ set next(value) {
45
+ this._next = value;
46
+ }
47
+ /**
48
+ * The `prev` function returns the previous node in a doubly linked list.
49
+ * @returns The `prev` property of the `DoublyLinkedListNode` class is being returned. It can either
50
+ * be a `DoublyLinkedListNode` object or `undefined`.
51
+ */
52
+ get prev() {
53
+ return this._prev;
54
+ }
55
+ /**
56
+ * The function sets the previous node of a doubly linked list node.
57
+ * @param {DoublyLinkedListNode<E> | undefined} value - The `value` parameter is of type
58
+ * `DoublyLinkedListNode<E> | undefined`. This means that it can accept either a
59
+ * `DoublyLinkedListNode` object or `undefined` as its value.
60
+ */
61
+ set prev(value) {
62
+ this._prev = value;
15
63
  }
16
64
  }
17
65
  exports.DoublyLinkedListNode = DoublyLinkedListNode;
@@ -23,7 +71,10 @@ exports.DoublyLinkedListNode = DoublyLinkedListNode;
23
71
  */
24
72
  class DoublyLinkedList extends base_1.IterableElementBase {
25
73
  /**
26
- * The constructor initializes the linked list with an empty head, tail, and size.
74
+ * The constructor initializes a linked list with optional elements.
75
+ * @param elements - The `elements` parameter is an optional iterable object that contains the
76
+ * initial elements to be added to the data structure. It defaults to an empty array if no elements
77
+ * are provided.
27
78
  */
28
79
  constructor(elements = []) {
29
80
  super();
@@ -36,21 +87,35 @@ class DoublyLinkedList extends base_1.IterableElementBase {
36
87
  }
37
88
  }
38
89
  }
90
+ /**
91
+ * The `head` function returns the first node of a doubly linked list.
92
+ * @returns The method `getHead()` returns either a `DoublyLinkedListNode<E>` object or `undefined`.
93
+ */
39
94
  get head() {
40
95
  return this._head;
41
96
  }
97
+ /**
98
+ * The `tail` function returns the last node of a doubly linked list.
99
+ * @returns The `get tail()` method is returning either a `DoublyLinkedListNode<E>` object or
100
+ * `undefined`.
101
+ */
42
102
  get tail() {
43
103
  return this._tail;
44
104
  }
105
+ /**
106
+ * The function returns the size of an object.
107
+ * @returns The size of the object, which is a number.
108
+ */
45
109
  get size() {
46
110
  return this._size;
47
111
  }
48
112
  /**
49
- * Time Complexity: O(n), where n is the size of the input array.
50
- * Space Complexity: O(n)
113
+ * Time Complexity: O(1)
114
+ * Space Complexity: O(1)
115
+ * where n is the number of elements in the linked list.
51
116
  */
52
117
  /**
53
- * Time Complexity: O(n), where n is the number of elements in the linked list.
118
+ * Time Complexity: O(1)
54
119
  * Space Complexity: O(1)
55
120
  *
56
121
  * The `get first` function returns the first node in a doubly linked list, or undefined if the list is empty.
@@ -65,7 +130,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
65
130
  * Space Complexity: O(1)
66
131
  */
67
132
  /**
68
- * Time Complexity: O(n), where n is the number of elements in the linked list.
133
+ * Time Complexity: O(1)
69
134
  * Space Complexity: O(1)
70
135
  *
71
136
  * The `get last` function returns the last node in a doubly linked list, or undefined if the list is empty.
@@ -76,11 +141,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
76
141
  return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
77
142
  }
78
143
  /**
79
- * Time Complexity: O(1)
80
- * Space Complexity: O(1)
144
+ * Time Complexity: O(n)
145
+ * Space Complexity: O(n)
81
146
  */
82
147
  /**
83
- * Time Complexity: O(n), where n is the size of the input array.
148
+ * Time Complexity: O(n)
84
149
  * Space Complexity: O(n)
85
150
  *
86
151
  * The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
@@ -89,11 +154,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
89
154
  * @returns The `fromArray` function returns a DoublyLinkedList object.
90
155
  */
91
156
  static fromArray(data) {
92
- const doublyLinkedList = new DoublyLinkedList();
93
- for (const item of data) {
94
- doublyLinkedList.push(item);
95
- }
96
- return doublyLinkedList;
157
+ return new DoublyLinkedList(data);
97
158
  }
98
159
  /**
99
160
  * Time Complexity: O(1)
@@ -148,7 +209,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
148
209
  return removedNode.value;
149
210
  }
150
211
  /**
151
- * Time Complexity: O(n), where n is the number of elements in the linked list.
212
+ * Time Complexity: O(1)
152
213
  * Space Complexity: O(1)
153
214
  */
154
215
  /**
@@ -175,7 +236,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
175
236
  return removedNode.value;
176
237
  }
177
238
  /**
178
- * Time Complexity: O(n), where n is the number of elements in the linked list.
239
+ * Time Complexity: O(1)
179
240
  * Space Complexity: O(1)
180
241
  */
181
242
  /**
@@ -201,20 +262,20 @@ class DoublyLinkedList extends base_1.IterableElementBase {
201
262
  return true;
202
263
  }
203
264
  /**
204
- * Time Complexity: O(n), where n is the number of elements in the linked list.
265
+ * Time Complexity: O(n)
205
266
  * Space Complexity: O(1)
206
267
  */
207
268
  /**
208
- * Time Complexity: O(n), where n is the number of elements in the linked list.
269
+ * Time Complexity: O(n)
209
270
  * Space Complexity: O(1)
210
271
  *
211
- * The `getAt` function returns the value at a specified index in a linked list, or undefined if the index is out of bounds.
272
+ * The `at` function returns the value at a specified index in a linked list, or undefined if the index is out of bounds.
212
273
  * @param {number} index - The index parameter is a number that represents the position of the element we want to
213
274
  * retrieve from the list.
214
275
  * @returns The method is returning the value at the specified index in the linked list. If the index is out of bounds
215
276
  * or the linked list is empty, it will return undefined.
216
277
  */
217
- getAt(index) {
278
+ at(index) {
218
279
  if (index < 0 || index >= this.size)
219
280
  return undefined;
220
281
  let current = this.head;
@@ -224,11 +285,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
224
285
  return current.value;
225
286
  }
226
287
  /**
227
- * Time Complexity: O(n), where n is the number of elements in the linked list.
288
+ * Time Complexity: O(n)
228
289
  * Space Complexity: O(1)
229
290
  */
230
291
  /**
231
- * Time Complexity: O(n), where n is the number of elements in the linked list.
292
+ * Time Complexity: O(n)
232
293
  * Space Complexity: O(1)
233
294
  *
234
295
  * The function `getNodeAt` returns the node at a given index in a doubly linked list, or undefined if the index is out of
@@ -248,11 +309,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
248
309
  return current;
249
310
  }
250
311
  /**
251
- * Time Complexity: O(n), where n is the number of elements in the linked list.
312
+ * Time Complexity: O(n)
252
313
  * Space Complexity: O(1)
253
314
  */
254
315
  /**
255
- * Time Complexity: O(n), where n is the number of elements in the linked list.
316
+ * Time Complexity: O(n)
256
317
  * Space Complexity: O(1)
257
318
  *
258
319
  * The function `findNodeByValue` searches for a node with a specific value in a doubly linked list and returns the
@@ -272,11 +333,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
272
333
  return undefined;
273
334
  }
274
335
  /**
275
- * Time Complexity: O(n), where n is the number of elements in the linked list.
336
+ * Time Complexity: O(n)
276
337
  * Space Complexity: O(1)
277
338
  */
278
339
  /**
279
- * Time Complexity: O(n), where n is the number of elements in the linked list.
340
+ * Time Complexity: O(n)
280
341
  * Space Complexity: O(1)
281
342
  *
282
343
  * The `insert` function inserts a value at a specified index in a doubly linked list.
@@ -309,11 +370,12 @@ class DoublyLinkedList extends base_1.IterableElementBase {
309
370
  return true;
310
371
  }
311
372
  /**
312
- * Time Complexity: O(n), where n is the number of elements in the linked list.
373
+ * Time Complexity: O(1) or O(n)
313
374
  * Space Complexity: O(1)
375
+ * where n is the number of elements in the linked list.
314
376
  */
315
377
  /**
316
- * Time Complexity: O(n), where n is the number of elements in the linked list.
378
+ * Time Complexity: O(1) or O(n)
317
379
  * Space Complexity: O(1)
318
380
  *
319
381
  * The `addBefore` function inserts a new value before an existing value or node in a doubly linked list.
@@ -350,11 +412,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
350
412
  return false;
351
413
  }
352
414
  /**
353
- * Time Complexity: O(n), where n is the number of elements in the linked list.
415
+ * Time Complexity: O(1) or O(n)
354
416
  * Space Complexity: O(1)
355
417
  */
356
418
  /**
357
- * Time Complexity: O(n), where n is the number of elements in the linked list.
419
+ * Time Complexity: O(1) or O(n)
358
420
  * Space Complexity: O(1)
359
421
  *
360
422
  * The `addAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
@@ -390,7 +452,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
390
452
  return false;
391
453
  }
392
454
  /**
393
- * Time Complexity: O(n), where n is the number of elements in the linked list.
455
+ * Time Complexity: O(n)
394
456
  * Space Complexity: O(1)
395
457
  *
396
458
  * The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.
@@ -419,7 +481,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
419
481
  return true;
420
482
  }
421
483
  /**
422
- * Time Complexity: O(n), where n is the number of elements in the linked list.
484
+ * Time Complexity: O(1) or O(n)
485
+ * Space Complexity: O(1)
486
+ */
487
+ /**
488
+ * Time Complexity: O(1) or O(n)
423
489
  * Space Complexity: O(1)
424
490
  *
425
491
  * The `delete` function removes a node from a doubly linked list based on either the node itself or its value.
@@ -455,10 +521,13 @@ class DoublyLinkedList extends base_1.IterableElementBase {
455
521
  return false;
456
522
  }
457
523
  /**
458
- * Time Complexity: O(n), where n is the number of elements in the linked list.
524
+ * Time Complexity: O(1)
459
525
  * Space Complexity: O(1)
460
526
  */
461
527
  /**
528
+ * Time Complexity: O(1)
529
+ * Space Complexity: O(1)
530
+ *
462
531
  * The function checks if a variable has a size greater than zero and returns a boolean value.
463
532
  * @returns A boolean value is being returned.
464
533
  */
@@ -466,10 +535,13 @@ class DoublyLinkedList extends base_1.IterableElementBase {
466
535
  return this.size === 0;
467
536
  }
468
537
  /**
469
- * Time Complexity: O(n), where n is the number of elements in the linked list.
538
+ * Time Complexity: O(1)
470
539
  * Space Complexity: O(1)
471
540
  */
472
541
  /**
542
+ * Time Complexity: O(1)
543
+ * Space Complexity: O(1)
544
+ *
473
545
  * The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
474
546
  */
475
547
  clear() {
@@ -478,35 +550,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
478
550
  this._size = 0;
479
551
  }
480
552
  /**
481
- * Time Complexity: O(n), where n is the number of elements in the linked list.
482
- * Space Complexity: O(1)
483
- */
484
- /**
485
- * Time Complexity: O(n), where n is the number of elements in the linked list.
486
- * Space Complexity: O(1)
487
- *
488
- * The `find` function iterates through a linked list and returns the first element that satisfies a given condition.
489
- * @param callback - A function that takes a value of type E as its parameter and returns a boolean value. This
490
- * function is used to determine whether a particular value in the linked list satisfies a certain condition.
491
- * @returns The method `find` returns the first element in the linked list that satisfies the condition specified by
492
- * the callback function. If no element satisfies the condition, it returns `undefined`.
493
- */
494
- find(callback) {
495
- let current = this.head;
496
- while (current) {
497
- if (callback(current.value)) {
498
- return current.value;
499
- }
500
- current = current.next;
501
- }
502
- return undefined;
503
- }
504
- /**
505
- * Time Complexity: O(n), where n is the number of elements in the linked list.
553
+ * Time Complexity: O(n)
506
554
  * Space Complexity: O(1)
507
555
  */
508
556
  /**
509
- * Time Complexity: O(n), where n is the number of elements in the linked list.
557
+ * Time Complexity: O(n)
510
558
  * Space Complexity: O(1)
511
559
  *
512
560
  * The function returns the index of the first occurrence of a given value in a linked list.
@@ -528,11 +576,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
528
576
  return -1;
529
577
  }
530
578
  /**
531
- * Time Complexity: O(n), where n is the number of elements in the linked list.
532
- * Space Complexity: O(n)
579
+ * Time Complexity: O(n)
580
+ * Space Complexity: O(1)
533
581
  */
534
582
  /**
535
- * Time Complexity: O(n), where n is the number of elements in the linked list.
583
+ * Time Complexity: O(n)
536
584
  * Space Complexity: O(1)
537
585
  *
538
586
  * The `findBackward` function iterates through a linked list from the last node to the first node and returns the last
@@ -553,11 +601,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
553
601
  return undefined;
554
602
  }
555
603
  /**
556
- * Time Complexity: O(n), where n is the number of elements in the linked list.
557
- * Space Complexity: O(n)
604
+ * Time Complexity: O(n)
605
+ * Space Complexity: O(1)
558
606
  */
559
607
  /**
560
- * Time Complexity: O(n), where n is the number of elements in the linked list.
608
+ * Time Complexity: O(n)
561
609
  * Space Complexity: O(1)
562
610
  *
563
611
  * The `reverse` function reverses the order of the elements in a doubly linked list.
@@ -577,7 +625,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
577
625
  * Space Complexity: O(n)
578
626
  */
579
627
  /**
580
- * Time Complexity: O(n), where n is the number of elements in the linked list.
628
+ * Time Complexity: O(n)
581
629
  * Space Complexity: O(n)
582
630
  *
583
631
  * The `toArray` function converts a linked list into an array.
@@ -593,11 +641,11 @@ class DoublyLinkedList extends base_1.IterableElementBase {
593
641
  return array;
594
642
  }
595
643
  /**
596
- * Time Complexity: O(n), where n is the number of elements in the linked list.
644
+ * Time Complexity: O(n)
597
645
  * Space Complexity: O(n)
598
646
  */
599
647
  /**
600
- * Time Complexity: O(n), where n is the number of elements in the linked list.
648
+ * Time Complexity: O(n)
601
649
  * Space Complexity: O(n)
602
650
  *
603
651
  * The `toReversedArray` function converts a doubly linked list into an array in reverse order.
@@ -613,8 +661,24 @@ class DoublyLinkedList extends base_1.IterableElementBase {
613
661
  return array;
614
662
  }
615
663
  /**
616
- * Time Complexity: O(1)
617
- * Space Complexity: O(1)
664
+ * Time Complexity: O(n)
665
+ * Space Complexity: O(n)
666
+ */
667
+ /**
668
+ * Time Complexity: O(n)
669
+ * Space Complexity: O(n)
670
+ *
671
+ * The `clone` function creates a new instance of the `DoublyLinkedList` class with the same values
672
+ * as the original list.
673
+ * @returns The `clone()` method is returning a new instance of the `DoublyLinkedList` class, which
674
+ * is a copy of the original list.
675
+ */
676
+ clone() {
677
+ return new DoublyLinkedList(this.values());
678
+ }
679
+ /**
680
+ * Time Complexity: O(n)
681
+ * Space Complexity: O(n)
618
682
  */
619
683
  /**
620
684
  * Time Complexity: O(n)
@@ -645,8 +709,8 @@ class DoublyLinkedList extends base_1.IterableElementBase {
645
709
  return filteredList;
646
710
  }
647
711
  /**
648
- * Time Complexity: O(1)
649
- * Space Complexity: O(1)
712
+ * Time Complexity: O(n)
713
+ * Space Complexity: O(n)
650
714
  */
651
715
  /**
652
716
  * Time Complexity: O(n)
@@ -704,7 +768,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
704
768
  return this.pop();
705
769
  }
706
770
  /**
707
- * Time Complexity: O(n), where n is the number of elements in the linked list.
771
+ * Time Complexity: O(1)
708
772
  * Space Complexity: O(1)
709
773
  */
710
774
  /**
@@ -719,7 +783,7 @@ class DoublyLinkedList extends base_1.IterableElementBase {
719
783
  return this.shift();
720
784
  }
721
785
  /**
722
- * Time Complexity: O(n), where n is the number of elements in the linked list.
786
+ * Time Complexity: O(1)
723
787
  * Space Complexity: O(1)
724
788
  */
725
789
  /**