data-structure-typed 1.50.4 → 1.50.6

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 (82) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +116 -55
  3. package/SPECIFICATION.md +2 -2
  4. package/SPECIFICATION_zh-CN.md +81 -0
  5. package/{SPONSOR-zh-CN.md → SPONSOR_zh-CN.md} +1 -1
  6. package/benchmark/report.html +24 -24
  7. package/benchmark/report.json +261 -237
  8. package/dist/cjs/data-structures/base/iterable-base.d.ts +10 -8
  9. package/dist/cjs/data-structures/base/iterable-base.js +8 -12
  10. package/dist/cjs/data-structures/base/iterable-base.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/binary-tree.js +19 -19
  12. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  13. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +158 -135
  14. package/dist/cjs/data-structures/binary-tree/rb-tree.js +415 -386
  15. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  16. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +1 -0
  17. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +84 -76
  18. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  19. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +1 -0
  20. package/dist/cjs/data-structures/graph/abstract-graph.js +3 -0
  21. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  22. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  23. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +14 -76
  24. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +16 -86
  25. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  26. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +27 -69
  27. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +35 -79
  28. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  29. package/dist/cjs/data-structures/queue/deque.d.ts +0 -53
  30. package/dist/cjs/data-structures/queue/deque.js +0 -61
  31. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  32. package/dist/cjs/data-structures/queue/queue.d.ts +0 -70
  33. package/dist/cjs/data-structures/queue/queue.js +0 -87
  34. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  35. package/dist/mjs/data-structures/base/iterable-base.d.ts +10 -8
  36. package/dist/mjs/data-structures/base/iterable-base.js +8 -12
  37. package/dist/mjs/data-structures/binary-tree/binary-tree.js +19 -19
  38. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +158 -135
  39. package/dist/mjs/data-structures/binary-tree/rb-tree.js +412 -386
  40. package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +1 -0
  41. package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +84 -76
  42. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +1 -0
  43. package/dist/mjs/data-structures/graph/abstract-graph.js +3 -0
  44. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +14 -76
  45. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +16 -86
  46. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +27 -69
  47. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +33 -79
  48. package/dist/mjs/data-structures/queue/deque.d.ts +0 -53
  49. package/dist/mjs/data-structures/queue/deque.js +0 -61
  50. package/dist/mjs/data-structures/queue/queue.d.ts +0 -70
  51. package/dist/mjs/data-structures/queue/queue.js +0 -86
  52. package/dist/umd/data-structure-typed.js +539 -756
  53. package/dist/umd/data-structure-typed.min.js +2 -2
  54. package/dist/umd/data-structure-typed.min.js.map +1 -1
  55. package/package.json +1 -1
  56. package/src/data-structures/base/iterable-base.ts +14 -10
  57. package/src/data-structures/binary-tree/binary-tree.ts +19 -19
  58. package/src/data-structures/binary-tree/rb-tree.ts +437 -395
  59. package/src/data-structures/binary-tree/tree-multi-map.ts +85 -82
  60. package/src/data-structures/graph/abstract-graph.ts +4 -0
  61. package/src/data-structures/heap/heap.ts +1 -1
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +16 -94
  63. package/src/data-structures/linked-list/singly-linked-list.ts +35 -87
  64. package/src/data-structures/queue/deque.ts +0 -67
  65. package/src/data-structures/queue/queue.ts +0 -98
  66. package/test/performance/data-structures/binary-tree/avl-tree.test.ts +3 -3
  67. package/test/performance/data-structures/binary-tree/binary-tree-overall.test.ts +3 -3
  68. package/test/performance/data-structures/binary-tree/rb-tree.test.ts +26 -16
  69. package/test/performance/data-structures/hash/hash-map.test.ts +6 -6
  70. package/test/performance/data-structures/heap/heap.test.ts +14 -14
  71. package/test/performance/data-structures/priority-queue/priority-queue.test.ts +11 -6
  72. package/test/performance/data-structures/queue/deque.test.ts +8 -8
  73. package/test/performance/data-structures/queue/queue.test.ts +5 -12
  74. package/test/performance/reportor.ts +43 -1
  75. package/test/unit/data-structures/binary-tree/overall.test.ts +23 -21
  76. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +168 -105
  77. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +311 -192
  78. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +6 -6
  79. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +10 -10
  80. package/test/unit/data-structures/linked-list/skip-list.test.ts +4 -4
  81. package/test/unit/data-structures/queue/deque.test.ts +26 -26
  82. package/test/unit/data-structures/queue/queue.test.ts +20 -20
@@ -131,24 +131,19 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
131
131
  * Space Complexity: O(1)
132
132
  */
133
133
  /**
134
- * Time Complexity: O(1)
135
- * Space Complexity: O(1)
136
- *
137
- * The push function adds a new node with the given value to the end of the doubly linked list.
138
- * @param {E} value - The value to be added to the linked list.
134
+ * The push function adds a new element to the end of a doubly linked list.
135
+ * @param {E} element - The "element" parameter represents the value that you want to add to the
136
+ * doubly linked list.
137
+ * @returns The `push` method is returning a boolean value, `true`.
139
138
  */
140
- push(value: E): boolean;
139
+ push(element: E): boolean;
141
140
  /**
142
141
  * Time Complexity: O(1)
143
142
  * Space Complexity: O(1)
144
143
  */
145
144
  /**
146
- * Time Complexity: O(1)
147
- * Space Complexity: O(1)
148
- *
149
- * The `pop()` function removes and returns the value of the last node in a doubly linked list.
150
- * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
151
- * list is empty, it returns undefined.
145
+ * The `pop()` function removes and returns the value of the last element in a linked list.
146
+ * @returns The method is returning the value of the removed node.
152
147
  */
153
148
  pop(): E | undefined;
154
149
  /**
@@ -156,12 +151,8 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
156
151
  * Space Complexity: O(1)
157
152
  */
158
153
  /**
159
- * Time Complexity: O(1)
160
- * Space Complexity: O(1)
161
- *
162
- * The `shift()` function removes and returns the value of the first node in a doubly linked list.
163
- * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
164
- * list.
154
+ * The `shift()` function removes and returns the value of the first element in a doubly linked list.
155
+ * @returns The value of the removed node.
165
156
  */
166
157
  shift(): E | undefined;
167
158
  /**
@@ -169,14 +160,12 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
169
160
  * Space Complexity: O(1)
170
161
  */
171
162
  /**
172
- * Time Complexity: O(1)
173
- * Space Complexity: O(1)
174
- *
175
- * The unshift function adds a new node with the given value to the beginning of a doubly linked list.
176
- * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
177
- * doubly linked list.
163
+ * The unshift function adds a new element to the beginning of a doubly linked list.
164
+ * @param {E} element - The "element" parameter represents the value of the element that you want to
165
+ * add to the beginning of the doubly linked list.
166
+ * @returns The `unshift` method is returning a boolean value, `true`.
178
167
  */
179
- unshift(value: E): boolean;
168
+ unshift(element: E): boolean;
180
169
  /**
181
170
  * Time Complexity: O(n)
182
171
  * Space Complexity: O(1)
@@ -449,57 +438,6 @@ export declare class DoublyLinkedList<E = any> extends IterableElementBase<E> {
449
438
  * object.
450
439
  */
451
440
  map<T>(callback: ElementCallback<E, T>, thisArg?: any): DoublyLinkedList<T>;
452
- /**
453
- * Time Complexity: O(1)
454
- * Space Complexity: O(1)
455
- */
456
- /**
457
- * Time Complexity: O(1)
458
- * Space Complexity: O(1)
459
- *
460
- * The addLast function adds a new node with the given value to the end of the doubly linked list.
461
- * @param {E} value - The value to be added to the linked list.
462
- */
463
- addLast(value: E): boolean;
464
- /**
465
- * Time Complexity: O(1)
466
- * Space Complexity: O(1)
467
- */
468
- /**
469
- * Time Complexity: O(1)
470
- * Space Complexity: O(1)
471
- *
472
- * The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
473
- * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
474
- * list is empty, it returns undefined.
475
- */
476
- pollLast(): E | undefined;
477
- /**
478
- * Time Complexity: O(1)
479
- * Space Complexity: O(1)
480
- */
481
- /**
482
- * Time Complexity: O(1)
483
- * Space Complexity: O(1)
484
- *
485
- * The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
486
- * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
487
- * list.
488
- */
489
- pollFirst(): E | undefined;
490
- /**
491
- * Time Complexity: O(1)
492
- * Space Complexity: O(1)
493
- */
494
- /**
495
- * Time Complexity: O(1)
496
- * Space Complexity: O(1)
497
- *
498
- * The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
499
- * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
500
- * doubly linked list.
501
- */
502
- addFirst(value: E): void;
503
441
  /**
504
442
  * The function returns an iterator that iterates over the values of a linked list.
505
443
  */
@@ -161,14 +161,13 @@ class DoublyLinkedList extends base_1.IterableElementBase {
161
161
  * Space Complexity: O(1)
162
162
  */
163
163
  /**
164
- * Time Complexity: O(1)
165
- * Space Complexity: O(1)
166
- *
167
- * The push function adds a new node with the given value to the end of the doubly linked list.
168
- * @param {E} value - The value to be added to the linked list.
164
+ * The push function adds a new element to the end of a doubly linked list.
165
+ * @param {E} element - The "element" parameter represents the value that you want to add to the
166
+ * doubly linked list.
167
+ * @returns The `push` method is returning a boolean value, `true`.
169
168
  */
170
- push(value) {
171
- const newNode = new DoublyLinkedListNode(value);
169
+ push(element) {
170
+ const newNode = new DoublyLinkedListNode(element);
172
171
  if (!this.head) {
173
172
  this._head = newNode;
174
173
  this._tail = newNode;
@@ -186,12 +185,8 @@ class DoublyLinkedList extends base_1.IterableElementBase {
186
185
  * Space Complexity: O(1)
187
186
  */
188
187
  /**
189
- * Time Complexity: O(1)
190
- * Space Complexity: O(1)
191
- *
192
- * The `pop()` function removes and returns the value of the last node in a doubly linked list.
193
- * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
194
- * list is empty, it returns undefined.
188
+ * The `pop()` function removes and returns the value of the last element in a linked list.
189
+ * @returns The method is returning the value of the removed node.
195
190
  */
196
191
  pop() {
197
192
  if (!this.tail)
@@ -213,12 +208,8 @@ class DoublyLinkedList extends base_1.IterableElementBase {
213
208
  * Space Complexity: O(1)
214
209
  */
215
210
  /**
216
- * Time Complexity: O(1)
217
- * Space Complexity: O(1)
218
- *
219
- * The `shift()` function removes and returns the value of the first node in a doubly linked list.
220
- * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
221
- * list.
211
+ * The `shift()` function removes and returns the value of the first element in a doubly linked list.
212
+ * @returns The value of the removed node.
222
213
  */
223
214
  shift() {
224
215
  if (!this.head)
@@ -240,15 +231,13 @@ class DoublyLinkedList extends base_1.IterableElementBase {
240
231
  * Space Complexity: O(1)
241
232
  */
242
233
  /**
243
- * Time Complexity: O(1)
244
- * Space Complexity: O(1)
245
- *
246
- * The unshift function adds a new node with the given value to the beginning of a doubly linked list.
247
- * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
248
- * doubly linked list.
234
+ * The unshift function adds a new element to the beginning of a doubly linked list.
235
+ * @param {E} element - The "element" parameter represents the value of the element that you want to
236
+ * add to the beginning of the doubly linked list.
237
+ * @returns The `unshift` method is returning a boolean value, `true`.
249
238
  */
250
- unshift(value) {
251
- const newNode = new DoublyLinkedListNode(value);
239
+ unshift(element) {
240
+ const newNode = new DoublyLinkedListNode(element);
252
241
  if (!this.head) {
253
242
  this._head = newNode;
254
243
  this._tail = newNode;
@@ -738,65 +727,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
738
727
  }
739
728
  return mappedList;
740
729
  }
741
- /**
742
- * Time Complexity: O(1)
743
- * Space Complexity: O(1)
744
- */
745
- /**
746
- * Time Complexity: O(1)
747
- * Space Complexity: O(1)
748
- *
749
- * The addLast function adds a new node with the given value to the end of the doubly linked list.
750
- * @param {E} value - The value to be added to the linked list.
751
- */
752
- addLast(value) {
753
- return this.push(value);
754
- }
755
- /**
756
- * Time Complexity: O(1)
757
- * Space Complexity: O(1)
758
- */
759
- /**
760
- * Time Complexity: O(1)
761
- * Space Complexity: O(1)
762
- *
763
- * The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
764
- * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
765
- * list is empty, it returns undefined.
766
- */
767
- pollLast() {
768
- return this.pop();
769
- }
770
- /**
771
- * Time Complexity: O(1)
772
- * Space Complexity: O(1)
773
- */
774
- /**
775
- * Time Complexity: O(1)
776
- * Space Complexity: O(1)
777
- *
778
- * The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
779
- * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
780
- * list.
781
- */
782
- pollFirst() {
783
- return this.shift();
784
- }
785
- /**
786
- * Time Complexity: O(1)
787
- * Space Complexity: O(1)
788
- */
789
- /**
790
- * Time Complexity: O(1)
791
- * Space Complexity: O(1)
792
- *
793
- * The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
794
- * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
795
- * doubly linked list.
796
- */
797
- addFirst(value) {
798
- this.unshift(value);
799
- }
800
730
  /**
801
731
  * The function returns an iterator that iterates over the values of a linked list.
802
732
  */
@@ -1 +1 @@
1
- {"version":3,"file":"doubly-linked-list.js","sourceRoot":"","sources":["../../../../src/data-structures/linked-list/doubly-linked-list.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C,MAAa,oBAAoB;IAC/B;;;;OAIG;IACH,YAAY,KAAQ;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAID;;;OAGG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK,CAAC,KAAQ;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAID;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,IAAI,IAAI,CAAC,KAA0C;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAID;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,IAAI,IAAI,CAAC,KAA0C;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAvED,oDAuEC;AAED;;;;;GAKG;AACH,MAAa,gBAA0B,SAAQ,0BAAsB;IACnE;;;;;OAKG;IACH,YAAY,WAAwB,EAAE;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAC1B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;;;;;OAOG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IAEH;;;;;;;OAOG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IAEH;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAQ;QACf,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED;;OAEG;IACM,CAAE,YAAY;QACrB,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;QAExB,OAAO,OAAO,EAAE,CAAC;YACf,MAAM,OAAO,CAAC,KAAK,CAAC;YACpB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AAlyBD,4CAkyBC"}
1
+ {"version":3,"file":"doubly-linked-list.js","sourceRoot":"","sources":["../../../../src/data-structures/linked-list/doubly-linked-list.ts"],"names":[],"mappings":";;;AAQA,kCAA8C;AAE9C,MAAa,oBAAoB;IAC/B;;;;OAIG;IACH,YAAY,KAAQ;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAID;;;OAGG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK,CAAC,KAAQ;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAID;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,IAAI,IAAI,CAAC,KAA0C;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAID;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAA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AAM,UAAU,GAAG,IAAI,gBAAgB,EAAK,CAAC;QAC7C,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YAC9D,KAAK,EAAE,CAAC;QACV,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;OAEG;IACM,CAAE,YAAY;QACrB,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;QAExB,OAAO,OAAO,EAAE,CAAC;YACf,MAAM,OAAO,CAAC,KAAK,CAAC;YACpB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AAptBD,4CAotBC"}
@@ -60,6 +60,18 @@ export declare class SinglyLinkedList<E = any> extends IterableElementBase<E> {
60
60
  * @returns The method is returning either a SinglyLinkedListNode object or undefined.
61
61
  */
62
62
  get tail(): SinglyLinkedListNode<E> | undefined;
63
+ /**
64
+ * The above function returns the value of the first element in a linked list, or undefined if the
65
+ * list is empty.
66
+ * @returns The value of the first node in the linked list, or undefined if the linked list is empty.
67
+ */
68
+ get first(): E | undefined;
69
+ /**
70
+ * The function returns the value of the last element in a linked list, or undefined if the list is
71
+ * empty.
72
+ * @returns The value of the last node in the linked list, or undefined if the linked list is empty.
73
+ */
74
+ get last(): E | undefined;
63
75
  protected _size: number;
64
76
  /**
65
77
  * The function returns the size of an object.
@@ -82,21 +94,6 @@ export declare class SinglyLinkedList<E = any> extends IterableElementBase<E> {
82
94
  * @returns The `fromArray` function returns a `SinglyLinkedList` object.
83
95
  */
84
96
  static fromArray<E>(data: E[]): SinglyLinkedList<E>;
85
- /**
86
- * Time Complexity: O(1)
87
- * Space Complexity: O(1)
88
- * Constant time, as it involves basic pointer adjustments.
89
- * Constant space, as it only creates a new node.
90
- */
91
- /**
92
- * Time Complexity: O(1)
93
- * Space Complexity: O(1)
94
- *
95
- * The `push` function adds a new node with the given value to the end of a singly linked list.
96
- * @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
97
- * any type (E) as specified in the generic type declaration of the class or function.
98
- */
99
- push(value: E): boolean;
100
97
  /**
101
98
  * Time Complexity: O(1)
102
99
  * Space Complexity: O(1)
@@ -105,11 +102,12 @@ export declare class SinglyLinkedList<E = any> extends IterableElementBase<E> {
105
102
  * Time Complexity: O(1)
106
103
  * Space Complexity: O(1)
107
104
  *
108
- * The `push` function adds a new node with the given value to the end of a singly linked list.
109
- * @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
110
- * any type (E) as specified in the generic type declaration of the class or function.
105
+ * The push function adds a new element to the end of a singly linked list.
106
+ * @param {E} element - The "element" parameter represents the value of the element that you want to
107
+ * add to the linked list.
108
+ * @returns The `push` method is returning a boolean value, `true`.
111
109
  */
112
- addLast(value: E): boolean;
110
+ push(element: E): boolean;
113
111
  /**
114
112
  * Time Complexity: O(n)
115
113
  * Space Complexity: O(1)
@@ -119,26 +117,11 @@ export declare class SinglyLinkedList<E = any> extends IterableElementBase<E> {
119
117
  * Time Complexity: O(n)
120
118
  * Space Complexity: O(1)
121
119
  *
122
- * The `pop()` function removes and returns the value of the last element in a linked list, updating the head and tail
123
- * pointers accordingly.
124
- * @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
125
- * the linked list is empty, it returns `undefined`.
120
+ * The `pop` function removes and returns the value of the last element in a linked list.
121
+ * @returns The method is returning the value of the element that is being popped from the end of the
122
+ * list.
126
123
  */
127
124
  pop(): E | undefined;
128
- /**
129
- * Time Complexity: O(n)
130
- * Space Complexity: O(1)
131
- */
132
- /**
133
- * Time Complexity: O(n)
134
- * Space Complexity: O(1)
135
- *
136
- * The `pollLast()` function removes and returns the value of the last element in a linked list, updating the head and tail
137
- * pointers accordingly.
138
- * @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
139
- * the linked list is empty, it returns `undefined`.
140
- */
141
- pollLast(): E | undefined;
142
125
  /**
143
126
  * Time Complexity: O(1)
144
127
  * Space Complexity: O(1)
@@ -147,8 +130,8 @@ export declare class SinglyLinkedList<E = any> extends IterableElementBase<E> {
147
130
  * Time Complexity: O(1)
148
131
  * Space Complexity: O(1)
149
132
  *
150
- * The `shift()` function removes and returns the value of the first node in a linked list.
151
- * @returns The value of the node that is being removed from the beginning of the linked list.
133
+ * The `shift()` function removes and returns the value of the first element in a linked list.
134
+ * @returns The value of the removed node.
152
135
  */
153
136
  shift(): E | undefined;
154
137
  /**
@@ -159,40 +142,15 @@ export declare class SinglyLinkedList<E = any> extends IterableElementBase<E> {
159
142
  * Time Complexity: O(1)
160
143
  * Space Complexity: O(1)
161
144
  *
162
- * The `pollFirst()` function removes and returns the value of the first node in a linked list.
163
- * @returns The value of the node that is being removed from the beginning of the linked list.
164
- */
165
- pollFirst(): E | undefined;
166
- /**
167
- * Time Complexity: O(1)
168
- * Space Complexity: O(1)
169
- */
170
- /**
171
- * Time Complexity: O(1)
172
- * Space Complexity: O(1)
173
- *
174
- * The unshift function adds a new node with the given value to the beginning of a singly linked list.
175
- * @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
176
- * linked list.
177
- */
178
- unshift(value: E): boolean;
179
- /**
180
- * Time Complexity: O(1)
181
- * Space Complexity: O(1)
182
- */
183
- /**
184
- * Time Complexity: O(1)
185
- * Space Complexity: O(1)
186
- *
187
- * The addFirst function adds a new node with the given value to the beginning of a singly linked list.
188
- * @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
189
- * linked list.
145
+ * The unshift function adds a new element to the beginning of a singly linked list.
146
+ * @param {E} element - The "element" parameter represents the value of the element that you want to
147
+ * add to the beginning of the singly linked list.
148
+ * @returns The `unshift` method is returning a boolean value, `true`.
190
149
  */
191
- addFirst(value: E): boolean;
150
+ unshift(element: E): boolean;
192
151
  /**
193
152
  * Time Complexity: O(n)
194
153
  * Space Complexity: O(1)
195
- * Linear time, where n is the index, as it may need to traverse the list to find the desired node.
196
154
  */
197
155
  /**
198
156
  * Time Complexity: O(n)
@@ -74,6 +74,24 @@ class SinglyLinkedList extends base_1.IterableElementBase {
74
74
  get tail() {
75
75
  return this._tail;
76
76
  }
77
+ /**
78
+ * The above function returns the value of the first element in a linked list, or undefined if the
79
+ * list is empty.
80
+ * @returns The value of the first node in the linked list, or undefined if the linked list is empty.
81
+ */
82
+ get first() {
83
+ var _a;
84
+ return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
85
+ }
86
+ /**
87
+ * The function returns the value of the last element in a linked list, or undefined if the list is
88
+ * empty.
89
+ * @returns The value of the last node in the linked list, or undefined if the linked list is empty.
90
+ */
91
+ get last() {
92
+ var _a;
93
+ return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
94
+ }
77
95
  /**
78
96
  * The function returns the size of an object.
79
97
  * @returns The size of the object, which is a number.
@@ -106,19 +124,18 @@ class SinglyLinkedList extends base_1.IterableElementBase {
106
124
  /**
107
125
  * Time Complexity: O(1)
108
126
  * Space Complexity: O(1)
109
- * Constant time, as it involves basic pointer adjustments.
110
- * Constant space, as it only creates a new node.
111
127
  */
112
128
  /**
113
129
  * Time Complexity: O(1)
114
130
  * Space Complexity: O(1)
115
131
  *
116
- * The `push` function adds a new node with the given value to the end of a singly linked list.
117
- * @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
118
- * any type (E) as specified in the generic type declaration of the class or function.
132
+ * The push function adds a new element to the end of a singly linked list.
133
+ * @param {E} element - The "element" parameter represents the value of the element that you want to
134
+ * add to the linked list.
135
+ * @returns The `push` method is returning a boolean value, `true`.
119
136
  */
120
- push(value) {
121
- const newNode = new SinglyLinkedListNode(value);
137
+ push(element) {
138
+ const newNode = new SinglyLinkedListNode(element);
122
139
  if (!this.head) {
123
140
  this._head = newNode;
124
141
  this._tail = newNode;
@@ -130,21 +147,6 @@ class SinglyLinkedList extends base_1.IterableElementBase {
130
147
  this._size++;
131
148
  return true;
132
149
  }
133
- /**
134
- * Time Complexity: O(1)
135
- * Space Complexity: O(1)
136
- */
137
- /**
138
- * Time Complexity: O(1)
139
- * Space Complexity: O(1)
140
- *
141
- * The `push` function adds a new node with the given value to the end of a singly linked list.
142
- * @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
143
- * any type (E) as specified in the generic type declaration of the class or function.
144
- */
145
- addLast(value) {
146
- return this.push(value);
147
- }
148
150
  /**
149
151
  * Time Complexity: O(n)
150
152
  * Space Complexity: O(1)
@@ -154,10 +156,9 @@ class SinglyLinkedList extends base_1.IterableElementBase {
154
156
  * Time Complexity: O(n)
155
157
  * Space Complexity: O(1)
156
158
  *
157
- * The `pop()` function removes and returns the value of the last element in a linked list, updating the head and tail
158
- * pointers accordingly.
159
- * @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
160
- * the linked list is empty, it returns `undefined`.
159
+ * The `pop` function removes and returns the value of the last element in a linked list.
160
+ * @returns The method is returning the value of the element that is being popped from the end of the
161
+ * list.
161
162
  */
162
163
  pop() {
163
164
  if (!this.head)
@@ -179,22 +180,6 @@ class SinglyLinkedList extends base_1.IterableElementBase {
179
180
  this._size--;
180
181
  return value;
181
182
  }
182
- /**
183
- * Time Complexity: O(n)
184
- * Space Complexity: O(1)
185
- */
186
- /**
187
- * Time Complexity: O(n)
188
- * Space Complexity: O(1)
189
- *
190
- * The `pollLast()` function removes and returns the value of the last element in a linked list, updating the head and tail
191
- * pointers accordingly.
192
- * @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
193
- * the linked list is empty, it returns `undefined`.
194
- */
195
- pollLast() {
196
- return this.pop();
197
- }
198
183
  /**
199
184
  * Time Complexity: O(1)
200
185
  * Space Complexity: O(1)
@@ -203,8 +188,8 @@ class SinglyLinkedList extends base_1.IterableElementBase {
203
188
  * Time Complexity: O(1)
204
189
  * Space Complexity: O(1)
205
190
  *
206
- * The `shift()` function removes and returns the value of the first node in a linked list.
207
- * @returns The value of the node that is being removed from the beginning of the linked list.
191
+ * The `shift()` function removes and returns the value of the first element in a linked list.
192
+ * @returns The value of the removed node.
208
193
  */
209
194
  shift() {
210
195
  if (!this.head)
@@ -222,26 +207,13 @@ class SinglyLinkedList extends base_1.IterableElementBase {
222
207
  * Time Complexity: O(1)
223
208
  * Space Complexity: O(1)
224
209
  *
225
- * The `pollFirst()` function removes and returns the value of the first node in a linked list.
226
- * @returns The value of the node that is being removed from the beginning of the linked list.
227
- */
228
- pollFirst() {
229
- return this.shift();
230
- }
231
- /**
232
- * Time Complexity: O(1)
233
- * Space Complexity: O(1)
234
- */
235
- /**
236
- * Time Complexity: O(1)
237
- * Space Complexity: O(1)
238
- *
239
- * The unshift function adds a new node with the given value to the beginning of a singly linked list.
240
- * @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
241
- * linked list.
210
+ * The unshift function adds a new element to the beginning of a singly linked list.
211
+ * @param {E} element - The "element" parameter represents the value of the element that you want to
212
+ * add to the beginning of the singly linked list.
213
+ * @returns The `unshift` method is returning a boolean value, `true`.
242
214
  */
243
- unshift(value) {
244
- const newNode = new SinglyLinkedListNode(value);
215
+ unshift(element) {
216
+ const newNode = new SinglyLinkedListNode(element);
245
217
  if (!this.head) {
246
218
  this._head = newNode;
247
219
  this._tail = newNode;
@@ -253,25 +225,9 @@ class SinglyLinkedList extends base_1.IterableElementBase {
253
225
  this._size++;
254
226
  return true;
255
227
  }
256
- /**
257
- * Time Complexity: O(1)
258
- * Space Complexity: O(1)
259
- */
260
- /**
261
- * Time Complexity: O(1)
262
- * Space Complexity: O(1)
263
- *
264
- * The addFirst function adds a new node with the given value to the beginning of a singly linked list.
265
- * @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
266
- * linked list.
267
- */
268
- addFirst(value) {
269
- return this.unshift(value);
270
- }
271
228
  /**
272
229
  * Time Complexity: O(n)
273
230
  * Space Complexity: O(1)
274
- * Linear time, where n is the index, as it may need to traverse the list to find the desired node.
275
231
  */
276
232
  /**
277
233
  * Time Complexity: O(n)