data-structure-typed 1.39.4 → 1.39.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 (111) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +6 -6
  3. package/dist/cjs/data-structures/binary-tree/avl-tree.js +13 -13
  4. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  5. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +7 -7
  6. package/dist/cjs/data-structures/binary-tree/binary-tree.js +17 -17
  7. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  8. package/dist/cjs/data-structures/binary-tree/bst.d.ts +6 -6
  9. package/dist/cjs/data-structures/binary-tree/bst.js +13 -13
  10. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +2 -2
  12. package/dist/cjs/data-structures/binary-tree/rb-tree.js +4 -4
  13. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  14. package/dist/cjs/data-structures/binary-tree/segment-tree.d.ts +7 -7
  15. package/dist/cjs/data-structures/binary-tree/segment-tree.js +16 -16
  16. package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -1
  17. package/dist/cjs/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  18. package/dist/cjs/data-structures/binary-tree/tree-multiset.js +18 -18
  19. package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -1
  20. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +96 -96
  21. package/dist/cjs/data-structures/graph/abstract-graph.js +64 -64
  22. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  23. package/dist/cjs/data-structures/graph/directed-graph.d.ts +68 -68
  24. package/dist/cjs/data-structures/graph/directed-graph.js +48 -48
  25. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  26. package/dist/cjs/data-structures/graph/map-graph.d.ts +13 -13
  27. package/dist/cjs/data-structures/graph/map-graph.js +15 -15
  28. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
  29. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +42 -42
  30. package/dist/cjs/data-structures/graph/undirected-graph.js +32 -32
  31. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  32. package/dist/cjs/data-structures/hash/hash-table.d.ts +4 -4
  33. package/dist/cjs/data-structures/hash/hash-table.js +8 -8
  34. package/dist/cjs/data-structures/hash/hash-table.js.map +1 -1
  35. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +31 -31
  36. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +54 -54
  37. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  38. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +24 -24
  39. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +52 -52
  40. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  41. package/dist/cjs/data-structures/queue/queue.d.ts +1 -1
  42. package/dist/cjs/data-structures/queue/queue.js +4 -4
  43. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  44. package/dist/cjs/interfaces/binary-tree.d.ts +2 -2
  45. package/dist/cjs/interfaces/graph.d.ts +3 -3
  46. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +6 -6
  47. package/dist/mjs/data-structures/binary-tree/avl-tree.js +13 -13
  48. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +7 -7
  49. package/dist/mjs/data-structures/binary-tree/binary-tree.js +18 -18
  50. package/dist/mjs/data-structures/binary-tree/bst.d.ts +6 -6
  51. package/dist/mjs/data-structures/binary-tree/bst.js +13 -13
  52. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +2 -2
  53. package/dist/mjs/data-structures/binary-tree/rb-tree.js +4 -4
  54. package/dist/mjs/data-structures/binary-tree/segment-tree.d.ts +7 -7
  55. package/dist/mjs/data-structures/binary-tree/segment-tree.js +16 -16
  56. package/dist/mjs/data-structures/binary-tree/tree-multiset.d.ts +6 -6
  57. package/dist/mjs/data-structures/binary-tree/tree-multiset.js +18 -18
  58. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +96 -96
  59. package/dist/mjs/data-structures/graph/abstract-graph.js +66 -66
  60. package/dist/mjs/data-structures/graph/directed-graph.d.ts +68 -68
  61. package/dist/mjs/data-structures/graph/directed-graph.js +48 -48
  62. package/dist/mjs/data-structures/graph/map-graph.d.ts +13 -13
  63. package/dist/mjs/data-structures/graph/map-graph.js +15 -15
  64. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +42 -42
  65. package/dist/mjs/data-structures/graph/undirected-graph.js +32 -32
  66. package/dist/mjs/data-structures/hash/hash-table.d.ts +4 -4
  67. package/dist/mjs/data-structures/hash/hash-table.js +9 -9
  68. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +31 -31
  69. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +55 -55
  70. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +24 -24
  71. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +53 -53
  72. package/dist/mjs/data-structures/queue/queue.d.ts +1 -1
  73. package/dist/mjs/data-structures/queue/queue.js +4 -4
  74. package/dist/mjs/interfaces/binary-tree.d.ts +2 -2
  75. package/dist/mjs/interfaces/graph.d.ts +3 -3
  76. package/dist/umd/data-structure-typed.min.js +1 -1
  77. package/dist/umd/data-structure-typed.min.js.map +1 -1
  78. package/package.json +5 -5
  79. package/src/data-structures/binary-tree/avl-tree.ts +13 -13
  80. package/src/data-structures/binary-tree/binary-tree.ts +18 -18
  81. package/src/data-structures/binary-tree/bst.ts +16 -16
  82. package/src/data-structures/binary-tree/rb-tree.ts +6 -6
  83. package/src/data-structures/binary-tree/segment-tree.ts +15 -15
  84. package/src/data-structures/binary-tree/tree-multiset.ts +18 -18
  85. package/src/data-structures/graph/abstract-graph.ts +156 -154
  86. package/src/data-structures/graph/directed-graph.ts +99 -94
  87. package/src/data-structures/graph/map-graph.ts +22 -25
  88. package/src/data-structures/graph/undirected-graph.ts +62 -60
  89. package/src/data-structures/hash/hash-table.ts +9 -9
  90. package/src/data-structures/linked-list/doubly-linked-list.ts +61 -61
  91. package/src/data-structures/linked-list/singly-linked-list.ts +58 -58
  92. package/src/data-structures/queue/queue.ts +2 -2
  93. package/src/interfaces/binary-tree.ts +2 -2
  94. package/src/interfaces/graph.ts +3 -3
  95. package/test/integration/bst.test.ts +2 -2
  96. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +2 -2
  97. package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +3 -3
  98. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +8 -8
  99. package/test/unit/data-structures/binary-tree/bst.test.ts +4 -4
  100. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +3 -3
  101. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +2 -2
  102. package/test/unit/data-structures/graph/abstract-graph.test.ts +99 -2
  103. package/test/unit/data-structures/graph/directed-graph.test.ts +38 -23
  104. package/test/unit/data-structures/graph/map-graph.test.ts +23 -23
  105. package/test/unit/data-structures/graph/undirected-graph.test.ts +10 -2
  106. package/test/unit/data-structures/hash/hash-table.test.ts +1 -1
  107. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +30 -30
  108. package/test/unit/data-structures/linked-list/linked-list.test.ts +1 -1
  109. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +15 -15
  110. package/test/unit/data-structures/queue/queue.test.ts +8 -8
  111. package/test/utils/big-o.ts +7 -7
@@ -11,20 +11,20 @@ exports.DoublyLinkedList = exports.DoublyLinkedListNode = void 0;
11
11
  class DoublyLinkedListNode {
12
12
  /**
13
13
  * The constructor function initializes the value, next, and previous properties of an object.
14
- * @param {E} val - The "val" parameter is the value that will be stored in the node. It can be of any data type, as it
14
+ * @param {E} value - The "value" parameter is the value that will be stored in the node. It can be of any data type, as it
15
15
  * is defined as a generic type "E".
16
16
  */
17
- constructor(val) {
18
- this._val = val;
17
+ constructor(value) {
18
+ this._value = value;
19
19
  this._next = null;
20
20
  this._prev = null;
21
21
  }
22
- _val;
23
- get val() {
24
- return this._val;
22
+ _value;
23
+ get value() {
24
+ return this._value;
25
25
  }
26
- set val(value) {
27
- this._val = value;
26
+ set value(value) {
27
+ this._value = value;
28
28
  }
29
29
  _next;
30
30
  get next() {
@@ -87,10 +87,10 @@ class DoublyLinkedList {
87
87
  }
88
88
  /**
89
89
  * The push function adds a new node with the given value to the end of the doubly linked list.
90
- * @param {E} val - The value to be added to the linked list.
90
+ * @param {E} value - The value to be added to the linked list.
91
91
  */
92
- push(val) {
93
- const newNode = new DoublyLinkedListNode(val);
92
+ push(value) {
93
+ const newNode = new DoublyLinkedListNode(value);
94
94
  if (!this.head) {
95
95
  this.head = newNode;
96
96
  this.tail = newNode;
@@ -104,14 +104,14 @@ class DoublyLinkedList {
104
104
  }
105
105
  /**
106
106
  * The addLast function adds a new node with the given value to the end of the doubly linked list.
107
- * @param {E} val - The value to be added to the linked list.
107
+ * @param {E} value - The value to be added to the linked list.
108
108
  */
109
- addLast(val) {
110
- this.push(val);
109
+ addLast(value) {
110
+ this.push(value);
111
111
  }
112
112
  /**
113
113
  * The `pop()` function removes and returns the value of the last node in a doubly linked list.
114
- * @returns The method is returning the value of the removed node (removedNode.val) if the list is not empty. If the
114
+ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
115
115
  * list is empty, it returns null.
116
116
  */
117
117
  pop() {
@@ -127,11 +127,11 @@ class DoublyLinkedList {
127
127
  this.tail.next = null;
128
128
  }
129
129
  this._length--;
130
- return removedNode.val;
130
+ return removedNode.value;
131
131
  }
132
132
  /**
133
133
  * The `popLast()` function removes and returns the value of the last node in a doubly linked list.
134
- * @returns The method is returning the value of the removed node (removedNode.val) if the list is not empty. If the
134
+ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
135
135
  * list is empty, it returns null.
136
136
  */
137
137
  popLast() {
@@ -155,7 +155,7 @@ class DoublyLinkedList {
155
155
  this.head.prev = null;
156
156
  }
157
157
  this._length--;
158
- return removedNode.val;
158
+ return removedNode.value;
159
159
  }
160
160
  /**
161
161
  * The `popFirst()` function removes and returns the value of the first node in a doubly linked list.
@@ -167,11 +167,11 @@ class DoublyLinkedList {
167
167
  }
168
168
  /**
169
169
  * The unshift function adds a new node with the given value to the beginning of a doubly linked list.
170
- * @param {E} val - The `val` parameter represents the value of the new node that will be added to the beginning of the
170
+ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
171
171
  * doubly linked list.
172
172
  */
173
- unshift(val) {
174
- const newNode = new DoublyLinkedListNode(val);
173
+ unshift(value) {
174
+ const newNode = new DoublyLinkedListNode(value);
175
175
  if (!this.head) {
176
176
  this.head = newNode;
177
177
  this.tail = newNode;
@@ -185,25 +185,25 @@ class DoublyLinkedList {
185
185
  }
186
186
  /**
187
187
  * The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
188
- * @param {E} val - The `val` parameter represents the value of the new node that will be added to the beginning of the
188
+ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
189
189
  * doubly linked list.
190
190
  */
191
- addFirst(val) {
192
- this.unshift(val);
191
+ addFirst(value) {
192
+ this.unshift(value);
193
193
  }
194
194
  /**
195
195
  * The `getFirst` function returns the first node in a doubly linked list, or null if the list is empty.
196
196
  * @returns The method `getFirst()` returns the first node of the doubly linked list, or `null` if the list is empty.
197
197
  */
198
198
  getFirst() {
199
- return this.head?.val;
199
+ return this.head?.value;
200
200
  }
201
201
  /**
202
202
  * The `getLast` function returns the last node in a doubly linked list, or null if the list is empty.
203
203
  * @returns The method `getLast()` returns the last node of the doubly linked list, or `null` if the list is empty.
204
204
  */
205
205
  getLast() {
206
- return this.tail?.val;
206
+ return this.tail?.value;
207
207
  }
208
208
  /**
209
209
  * The `getAt` function returns the value at a specified index in a linked list, or null if the index is out of bounds.
@@ -219,7 +219,7 @@ class DoublyLinkedList {
219
219
  for (let i = 0; i < index; i++) {
220
220
  current = current.next;
221
221
  }
222
- return current.val;
222
+ return current.value;
223
223
  }
224
224
  /**
225
225
  * The function `getNodeAt` returns the node at a given index in a doubly linked list, or null if the index is out of
@@ -241,14 +241,14 @@ class DoublyLinkedList {
241
241
  /**
242
242
  * The function `findNodeByValue` searches for a node with a specific value in a doubly linked list and returns the
243
243
  * node if found, otherwise it returns null.
244
- * @param {E} val - The `val` parameter is the value that we want to search for in the doubly linked list.
245
- * @returns The function `findNodeByValue` returns a `DoublyLinkedListNode<E>` if a node with the specified value `val`
244
+ * @param {E} value - The `value` parameter is the value that we want to search for in the doubly linked list.
245
+ * @returns The function `findNodeByValue` returns a `DoublyLinkedListNode<E>` if a node with the specified value `value`
246
246
  * is found in the linked list. If no such node is found, it returns `null`.
247
247
  */
248
- getNode(val) {
248
+ getNode(value) {
249
249
  let current = this.head;
250
250
  while (current) {
251
- if (current.val === val) {
251
+ if (current.value === value) {
252
252
  return current;
253
253
  }
254
254
  current = current.next;
@@ -259,23 +259,23 @@ class DoublyLinkedList {
259
259
  * The `insert` function inserts a value at a specified index in a doubly linked list.
260
260
  * @param {number} index - The index parameter represents the position at which the new value should be inserted in the
261
261
  * DoublyLinkedList. It is of type number.
262
- * @param {E} val - The `val` parameter represents the value that you want to insert into the Doubly Linked List at the
262
+ * @param {E} value - The `value` parameter represents the value that you want to insert into the Doubly Linked List at the
263
263
  * specified index.
264
264
  * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
265
265
  * if the index is out of bounds.
266
266
  */
267
- insertAt(index, val) {
267
+ insertAt(index, value) {
268
268
  if (index < 0 || index > this.length)
269
269
  return false;
270
270
  if (index === 0) {
271
- this.unshift(val);
271
+ this.unshift(value);
272
272
  return true;
273
273
  }
274
274
  if (index === this.length) {
275
- this.push(val);
275
+ this.push(value);
276
276
  return true;
277
277
  }
278
- const newNode = new DoublyLinkedListNode(val);
278
+ const newNode = new DoublyLinkedListNode(value);
279
279
  const prevNode = this.getNodeAt(index - 1);
280
280
  const nextNode = prevNode.next;
281
281
  newNode.prev = prevNode;
@@ -339,7 +339,7 @@ class DoublyLinkedList {
339
339
  prevNode.next = nextNode;
340
340
  nextNode.prev = prevNode;
341
341
  this._length--;
342
- return removedNode.val;
342
+ return removedNode.value;
343
343
  }
344
344
  /**
345
345
  * The `delete` function removes a node from a doubly linked list based on either the node itself or its value.
@@ -382,7 +382,7 @@ class DoublyLinkedList {
382
382
  const array = [];
383
383
  let current = this.head;
384
384
  while (current) {
385
- array.push(current.val);
385
+ array.push(current.value);
386
386
  current = current.next;
387
387
  }
388
388
  return array;
@@ -412,8 +412,8 @@ class DoublyLinkedList {
412
412
  find(callback) {
413
413
  let current = this.head;
414
414
  while (current) {
415
- if (callback(current.val)) {
416
- return current.val;
415
+ if (callback(current.value)) {
416
+ return current.value;
417
417
  }
418
418
  current = current.next;
419
419
  }
@@ -421,16 +421,16 @@ class DoublyLinkedList {
421
421
  }
422
422
  /**
423
423
  * The function returns the index of the first occurrence of a given value in a linked list.
424
- * @param {E} val - The parameter `val` is of type `E`, which means it can be any data type. It represents the value
424
+ * @param {E} value - The parameter `value` is of type `E`, which means it can be any data type. It represents the value
425
425
  * that we are searching for in the linked list.
426
- * @returns The method `indexOf` returns the index of the first occurrence of the specified value `val` in the linked
426
+ * @returns The method `indexOf` returns the index of the first occurrence of the specified value `value` in the linked
427
427
  * list. If the value is not found, it returns -1.
428
428
  */
429
- indexOf(val) {
429
+ indexOf(value) {
430
430
  let index = 0;
431
431
  let current = this.head;
432
432
  while (current) {
433
- if (current.val === val) {
433
+ if (current.value === value) {
434
434
  return index;
435
435
  }
436
436
  index++;
@@ -449,8 +449,8 @@ class DoublyLinkedList {
449
449
  findBackward(callback) {
450
450
  let current = this.tail;
451
451
  while (current) {
452
- if (callback(current.val)) {
453
- return current.val;
452
+ if (callback(current.value)) {
453
+ return current.value;
454
454
  }
455
455
  current = current.prev;
456
456
  }
@@ -464,7 +464,7 @@ class DoublyLinkedList {
464
464
  const array = [];
465
465
  let current = this.tail;
466
466
  while (current) {
467
- array.push(current.val);
467
+ array.push(current.value);
468
468
  current = current.prev;
469
469
  }
470
470
  return array;
@@ -483,7 +483,7 @@ class DoublyLinkedList {
483
483
  }
484
484
  /**
485
485
  * The `forEach` function iterates over each element in a linked list and applies a callback function to each element.
486
- * @param callback - The callback parameter is a function that takes two arguments: val and index. The val argument
486
+ * @param callback - The callback parameter is a function that takes two arguments: value and index. The value argument
487
487
  * represents the value of the current node in the linked list, and the index argument represents the index of the
488
488
  * current node in the linked list.
489
489
  */
@@ -491,7 +491,7 @@ class DoublyLinkedList {
491
491
  let current = this.head;
492
492
  let index = 0;
493
493
  while (current) {
494
- callback(current.val, index);
494
+ callback(current.value, index);
495
495
  current = current.next;
496
496
  index++;
497
497
  }
@@ -508,7 +508,7 @@ class DoublyLinkedList {
508
508
  const mappedList = new DoublyLinkedList();
509
509
  let current = this.head;
510
510
  while (current) {
511
- mappedList.push(callback(current.val));
511
+ mappedList.push(callback(current.value));
512
512
  current = current.next;
513
513
  }
514
514
  return mappedList;
@@ -524,8 +524,8 @@ class DoublyLinkedList {
524
524
  const filteredList = new DoublyLinkedList();
525
525
  let current = this.head;
526
526
  while (current) {
527
- if (callback(current.val)) {
528
- filteredList.push(current.val);
527
+ if (callback(current.value)) {
528
+ filteredList.push(current.value);
529
529
  }
530
530
  current = current.next;
531
531
  }
@@ -534,7 +534,7 @@ class DoublyLinkedList {
534
534
  /**
535
535
  * The `reduce` function iterates over a linked list and applies a callback function to each element, accumulating a
536
536
  * single value.
537
- * @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `val`. It is
537
+ * @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `value`. It is
538
538
  * used to perform a specific operation on each element of the linked list.
539
539
  * @param {U} initialValue - The `initialValue` parameter is the initial value of the accumulator. It is the starting
540
540
  * point for the reduction operation.
@@ -545,7 +545,7 @@ class DoublyLinkedList {
545
545
  let accumulator = initialValue;
546
546
  let current = this.head;
547
547
  while (current) {
548
- accumulator = callback(accumulator, current.val);
548
+ accumulator = callback(accumulator, current.value);
549
549
  current = current.next;
550
550
  }
551
551
  return accumulator;
@@ -589,7 +589,7 @@ class DoublyLinkedList {
589
589
  *[Symbol.iterator]() {
590
590
  let current = this.head;
591
591
  while (current) {
592
- yield current.val;
592
+ yield current.value;
593
593
  current = current.next;
594
594
  }
595
595
  }
@@ -8,13 +8,13 @@
8
8
  export declare class SinglyLinkedListNode<E = any> {
9
9
  /**
10
10
  * The constructor function initializes an instance of a class with a given value and sets the next property to null.
11
- * @param {E} val - The "val" parameter is of type E, which means it can be any data type. It represents the value that
11
+ * @param {E} value - The "value" parameter is of type E, which means it can be any data type. It represents the value that
12
12
  * will be stored in the node of a linked list.
13
13
  */
14
- constructor(val: E);
15
- private _val;
16
- get val(): E;
17
- set val(value: E);
14
+ constructor(value: E);
15
+ private _value;
16
+ get value(): E;
17
+ set value(value: E);
18
18
  private _next;
19
19
  get next(): SinglyLinkedListNode<E> | null;
20
20
  set next(value: SinglyLinkedListNode<E> | null);
@@ -40,17 +40,17 @@ export declare class SinglyLinkedList<E = any> {
40
40
  */
41
41
  static fromArray<E>(data: E[]): SinglyLinkedList<E>;
42
42
  /**
43
- * The `push` function adds a new node with the given val to the end of a singly linked list.
44
- * @param {E} val - The "val" parameter represents the value that you want to add to the linked list. It can be of
43
+ * The `push` function adds a new node with the given value to the end of a singly linked list.
44
+ * @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
45
45
  * any type (E) as specified in the generic type declaration of the class or function.
46
46
  */
47
- push(val: E): void;
47
+ push(value: E): void;
48
48
  /**
49
- * The `push` function adds a new node with the given val to the end of a singly linked list.
50
- * @param {E} val - The "val" parameter represents the value that you want to add to the linked list. It can be of
49
+ * The `push` function adds a new node with the given value to the end of a singly linked list.
50
+ * @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
51
51
  * any type (E) as specified in the generic type declaration of the class or function.
52
52
  */
53
- addLast(val: E): void;
53
+ addLast(value: E): void;
54
54
  /**
55
55
  * The `pop()` function removes and returns the value of the last element in a linked list, updating the head and tail
56
56
  * pointers accordingly.
@@ -77,16 +77,16 @@ export declare class SinglyLinkedList<E = any> {
77
77
  popFirst(): E | undefined;
78
78
  /**
79
79
  * The unshift function adds a new node with the given value to the beginning of a singly linked list.
80
- * @param {E} val - The parameter "val" represents the value of the new node that will be added to the beginning of the
80
+ * @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
81
81
  * linked list.
82
82
  */
83
- unshift(val: E): void;
83
+ unshift(value: E): void;
84
84
  /**
85
85
  * The addFirst function adds a new node with the given value to the beginning of a singly linked list.
86
- * @param {E} val - The parameter "val" represents the value of the new node that will be added to the beginning of the
86
+ * @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
87
87
  * linked list.
88
88
  */
89
- addFirst(val: E): void;
89
+ addFirst(value: E): void;
90
90
  /**
91
91
  * The function `getAt` returns the value at a specified index in a linked list, or null if the index is out of range.
92
92
  * @param {number} index - The index parameter is a number that represents the position of the element we want to
@@ -123,12 +123,12 @@ export declare class SinglyLinkedList<E = any> {
123
123
  * The `insertAt` function inserts a value at a specified index in a singly linked list.
124
124
  * @param {number} index - The index parameter represents the position at which the new value should be inserted in the
125
125
  * linked list. It is of type number.
126
- * @param {E} val - The `val` parameter represents the value that you want to insert into the linked list at the
126
+ * @param {E} value - The `value` parameter represents the value that you want to insert into the linked list at the
127
127
  * specified index.
128
128
  * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
129
129
  * if the index is out of bounds.
130
130
  */
131
- insertAt(index: number, val: E): boolean;
131
+ insertAt(index: number, value: E): boolean;
132
132
  /**
133
133
  * The function checks if the length of a data structure is equal to zero and returns a boolean value indicating
134
134
  * whether it is empty or not.
@@ -156,7 +156,7 @@ export declare class SinglyLinkedList<E = any> {
156
156
  * @returns The method `find` returns the first element in the linked list that satisfies the condition specified by
157
157
  * the callback function. If no element satisfies the condition, it returns `null`.
158
158
  */
159
- find(callback: (val: E) => boolean): E | null;
159
+ find(callback: (value: E) => boolean): E | null;
160
160
  /**
161
161
  * The `indexOf` function returns the index of the first occurrence of a given value in a linked list.
162
162
  * @param {E} value - The value parameter is the value that you want to find the index of in the linked list.
@@ -198,11 +198,11 @@ export declare class SinglyLinkedList<E = any> {
198
198
  countOccurrences(value: E): number;
199
199
  /**
200
200
  * The `forEach` function iterates over each element in a linked list and applies a callback function to each element.
201
- * @param callback - The callback parameter is a function that takes two arguments: val and index. The val argument
201
+ * @param callback - The callback parameter is a function that takes two arguments: value and index. The value argument
202
202
  * represents the value of the current node in the linked list, and the index argument represents the index of the
203
203
  * current node in the linked list.
204
204
  */
205
- forEach(callback: (val: E, index: number) => void): void;
205
+ forEach(callback: (value: E, index: number) => void): void;
206
206
  /**
207
207
  * The `map` function takes a callback function and applies it to each element in the SinglyLinkedList, returning a new
208
208
  * SinglyLinkedList with the transformed values.
@@ -211,7 +211,7 @@ export declare class SinglyLinkedList<E = any> {
211
211
  * SinglyLinkedList).
212
212
  * @returns The `map` function is returning a new instance of `SinglyLinkedList<U>` that contains the mapped values.
213
213
  */
214
- map<U>(callback: (val: E) => U): SinglyLinkedList<U>;
214
+ map<U>(callback: (value: E) => U): SinglyLinkedList<U>;
215
215
  /**
216
216
  * The `filter` function iterates through a SinglyLinkedList and returns a new SinglyLinkedList containing only the
217
217
  * elements that satisfy the given callback function.
@@ -219,18 +219,18 @@ export declare class SinglyLinkedList<E = any> {
219
219
  * It is used to determine whether a value should be included in the filtered list or not.
220
220
  * @returns The filtered list, which is an instance of the SinglyLinkedList class.
221
221
  */
222
- filter(callback: (val: E) => boolean): SinglyLinkedList<E>;
222
+ filter(callback: (value: E) => boolean): SinglyLinkedList<E>;
223
223
  /**
224
224
  * The `reduce` function iterates over a linked list and applies a callback function to each element, accumulating a
225
225
  * single value.
226
- * @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `val`. It is
226
+ * @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `value`. It is
227
227
  * used to perform a specific operation on each element of the linked list.
228
228
  * @param {U} initialValue - The `initialValue` parameter is the initial value of the accumulator. It is the starting
229
229
  * point for the reduction operation.
230
230
  * @returns The `reduce` method is returning the final value of the accumulator after iterating through all the
231
231
  * elements in the linked list.
232
232
  */
233
- reduce<U>(callback: (accumulator: U, val: E) => U, initialValue: U): U;
233
+ reduce<U>(callback: (accumulator: U, value: E) => U, initialValue: U): U;
234
234
  /**
235
235
  * The function returns an iterator that iterates over the values of a linked list.
236
236
  */