data-structure-typed 1.17.0 → 1.17.4

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 (98) hide show
  1. package/README.md +9 -0
  2. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +7 -26
  3. package/dist/data-structures/linked-list/doubly-linked-list.js +59 -40
  4. package/dist/data-structures/linked-list/index.d.ts +1 -0
  5. package/dist/data-structures/linked-list/index.js +1 -0
  6. package/dist/data-structures/linked-list/singly-linked-list.d.ts +7 -29
  7. package/dist/data-structures/linked-list/singly-linked-list.js +42 -26
  8. package/dist/data-structures/linked-list/skip-linked-list.d.ts +2 -1
  9. package/dist/data-structures/linked-list/skip-linked-list.js +7 -0
  10. package/dist/data-structures/matrix/vector2d.js +2 -2
  11. package/docs/assets/search.js +1 -1
  12. package/docs/classes/AVLTree.html +94 -93
  13. package/docs/classes/AVLTreeNode.html +37 -36
  14. package/docs/classes/AaTree.html +2 -1
  15. package/docs/classes/AbstractEdge.html +12 -11
  16. package/docs/classes/AbstractGraph.html +30 -29
  17. package/docs/classes/AbstractVertex.html +7 -6
  18. package/docs/classes/ArrayDeque.html +15 -14
  19. package/docs/classes/BST.html +87 -86
  20. package/docs/classes/BSTNode.html +37 -36
  21. package/docs/classes/BTree.html +2 -1
  22. package/docs/classes/BinaryIndexedTree.html +8 -7
  23. package/docs/classes/BinaryTree.html +83 -82
  24. package/docs/classes/BinaryTreeNode.html +37 -36
  25. package/docs/classes/Character.html +5 -4
  26. package/docs/classes/CoordinateMap.html +11 -10
  27. package/docs/classes/CoordinateSet.html +10 -9
  28. package/docs/classes/Deque.html +145 -67
  29. package/docs/classes/DirectedEdge.html +18 -17
  30. package/docs/classes/DirectedGraph.html +42 -41
  31. package/docs/classes/DirectedVertex.html +7 -6
  32. package/docs/classes/DoublyLinkedList.html +143 -68
  33. package/docs/classes/DoublyLinkedListNode.html +12 -11
  34. package/docs/classes/Heap.html +21 -20
  35. package/docs/classes/HeapItem.html +9 -8
  36. package/docs/classes/Matrix2D.html +17 -16
  37. package/docs/classes/MatrixNTI2D.html +5 -4
  38. package/docs/classes/MaxHeap.html +21 -20
  39. package/docs/classes/MaxPriorityQueue.html +35 -34
  40. package/docs/classes/MinHeap.html +21 -20
  41. package/docs/classes/MinPriorityQueue.html +35 -34
  42. package/docs/classes/Navigator.html +11 -10
  43. package/docs/classes/ObjectDeque.html +26 -25
  44. package/docs/classes/PriorityQueue.html +33 -32
  45. package/docs/classes/Queue.html +15 -14
  46. package/docs/classes/RBTree.html +2 -1
  47. package/docs/classes/SegmentTree.html +13 -12
  48. package/docs/classes/SegmentTreeNode.html +27 -26
  49. package/docs/classes/SinglyLinkedList.html +128 -70
  50. package/docs/classes/SinglyLinkedListNode.html +9 -8
  51. package/docs/classes/SkipLinkedList.html +150 -0
  52. package/docs/classes/SplayTree.html +2 -1
  53. package/docs/classes/Stack.html +13 -12
  54. package/docs/classes/TreeMultiSet.html +87 -86
  55. package/docs/classes/TreeNode.html +9 -8
  56. package/docs/classes/Trie.html +14 -13
  57. package/docs/classes/TrieNode.html +12 -11
  58. package/docs/classes/TwoThreeTree.html +2 -1
  59. package/docs/classes/UndirectedEdge.html +14 -13
  60. package/docs/classes/UndirectedGraph.html +36 -35
  61. package/docs/classes/UndirectedVertex.html +7 -6
  62. package/docs/classes/Vector2D.html +29 -28
  63. package/docs/enums/CP.html +5 -4
  64. package/docs/enums/FamilyPosition.html +5 -4
  65. package/docs/enums/LoopType.html +4 -3
  66. package/docs/index.html +1 -0
  67. package/docs/interfaces/AVLTreeDeleted.html +4 -3
  68. package/docs/interfaces/HeapOptions.html +3 -2
  69. package/docs/interfaces/IDirectedGraph.html +8 -7
  70. package/docs/interfaces/IGraph.html +20 -19
  71. package/docs/interfaces/NavigatorParams.html +6 -5
  72. package/docs/interfaces/PriorityQueueOptions.html +5 -4
  73. package/docs/modules.html +2 -0
  74. package/docs/types/BSTComparator.html +2 -1
  75. package/docs/types/BSTDeletedResult.html +2 -1
  76. package/docs/types/BinaryTreeDeleted.html +2 -1
  77. package/docs/types/BinaryTreeNodeId.html +2 -1
  78. package/docs/types/BinaryTreeNodePropertyName.html +2 -1
  79. package/docs/types/DFSOrderPattern.html +2 -1
  80. package/docs/types/DijkstraResult.html +2 -1
  81. package/docs/types/Direction.html +2 -1
  82. package/docs/types/DoublyLinkedListGetBy.html +2 -1
  83. package/docs/types/NodeOrPropertyName.html +2 -1
  84. package/docs/types/PriorityQueueComparator.html +2 -1
  85. package/docs/types/PriorityQueueDFSOrderPattern.html +2 -1
  86. package/docs/types/ResultByProperty.html +2 -1
  87. package/docs/types/ResultsByProperty.html +2 -1
  88. package/docs/types/SegmentTreeNodeVal.html +2 -1
  89. package/docs/types/SpecifyOptional.html +2 -1
  90. package/docs/types/Thunk.html +2 -1
  91. package/docs/types/ToThunkFn.html +2 -1
  92. package/docs/types/TopologicalStatus.html +2 -1
  93. package/docs/types/TreeMultiSetDeletedResult.html +2 -1
  94. package/docs/types/TrlAsyncFn.html +2 -1
  95. package/docs/types/TrlFn.html +2 -1
  96. package/docs/types/Turning.html +2 -1
  97. package/docs/types/VertexId.html +2 -1
  98. package/package.json +1 -1
package/README.md CHANGED
@@ -19,6 +19,15 @@ Hash, Coordinate Set, Coordinate Map, Heap, Priority Queue, Max Priority Queue,
19
19
 
20
20
  [Live Examples](https://data-structure-typed-examples.vercel.app)
21
21
 
22
+
23
+ ![](https://github.com/zrwusa/assets/blob/master/images/data-structure-typed/examples/dfs-pre-order.webp)
24
+
25
+ ![](https://github.com/zrwusa/assets/blob/master/images/data-structure-typed/examples/test-graphs.webp)
26
+
27
+ ![](https://github.com/zrwusa/assets/blob/master/images/data-structure-typed/examples/cut-off-trees-for-golf.webp)
28
+
29
+ ![](https://github.com/zrwusa/assets/blob/master/images/data-structure-typed/examples/parenthesis-check.webp)
30
+
22
31
  <a href="https://data-structure-typed-examples.vercel.app" target="_blank">Live Examples</a>
23
32
 
24
33
  ## install
@@ -101,7 +101,7 @@ export declare class DoublyLinkedList<T> {
101
101
  * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
102
102
  * if the index is out of bounds.
103
103
  */
104
- insert(index: number, val: T): boolean;
104
+ insertAt(index: number, val: T): boolean;
105
105
  /**
106
106
  * The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.
107
107
  * @param {number} index - The index parameter represents the position of the element that needs to be deleted in the
@@ -110,13 +110,8 @@ export declare class DoublyLinkedList<T> {
110
110
  * bounds.
111
111
  */
112
112
  deleteAt(index: number): T | null;
113
- /**
114
- * The `delete` function removes a node with a specific value from a doubly linked list.
115
- * @param {T} val - The `val` parameter represents the value that you want to delete from the linked list.
116
- * @returns The `delete` method returns a boolean value. It returns `true` if the value `val` is found and deleted from
117
- * the linked list, and `false` if the value is not found in the linked list.
118
- */
119
- delete(val: T): boolean;
113
+ delete(valOrNode: T): boolean;
114
+ delete(valOrNode: DoublyLinkedListNode<T>): boolean;
120
115
  /**
121
116
  * The `toArray` function converts a linked list into an array.
122
117
  * @returns The `toArray()` method is returning an array of type `T[]`.
@@ -195,22 +190,8 @@ export declare class DoublyLinkedList<T> {
195
190
  * elements in the linked list.
196
191
  */
197
192
  reduce<U>(callback: (accumulator: U, val: T) => U, initialValue: U): U;
198
- /**
199
- * The function inserts a new value after an existing value in a doubly linked list.
200
- * @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
201
- * @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert after
202
- * the existing node.
203
- * @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
204
- * existing value is not found in the linked list.
205
- */
206
- insertAfter(existingValue: T, newValue: T): boolean;
207
- /**
208
- * The `insertBefore` function inserts a new value before an existing value in a doubly linked list.
209
- * @param {T} existingValue - The existing value is the value of the node that you want to insert the new value before.
210
- * @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert before
211
- * the existing node.
212
- * @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
213
- * existing value is not found in the linked list.
214
- */
215
- insertBefore(existingValue: T, newValue: T): boolean;
193
+ insertAfter(existingValueOrNode: T, newValue: T): boolean;
194
+ insertAfter(existingValueOrNode: DoublyLinkedListNode<T>, newValue: T): boolean;
195
+ insertBefore(existingValueOrNode: T, newValue: T): boolean;
196
+ insertBefore(existingValueOrNode: DoublyLinkedListNode<T>, newValue: T): boolean;
216
197
  }
@@ -279,7 +279,7 @@ var DoublyLinkedList = /** @class */ (function () {
279
279
  * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
280
280
  * if the index is out of bounds.
281
281
  */
282
- DoublyLinkedList.prototype.insert = function (index, val) {
282
+ DoublyLinkedList.prototype.insertAt = function (index, val) {
283
283
  if (index < 0 || index > this.length)
284
284
  return false;
285
285
  if (index === 0) {
@@ -323,31 +323,35 @@ var DoublyLinkedList = /** @class */ (function () {
323
323
  return removedNode.val;
324
324
  };
325
325
  /**
326
- * The `delete` function removes a node with a specific value from a doubly linked list.
327
- * @param {T} val - The `val` parameter represents the value that you want to delete from the linked list.
328
- * @returns The `delete` method returns a boolean value. It returns `true` if the value `val` is found and deleted from
329
- * the linked list, and `false` if the value is not found in the linked list.
326
+ * The `delete` function removes a node from a doubly linked list based on either the node itself or its value.
327
+ * @param {T | DoublyLinkedListNode<T>} valOrNode - The `valOrNode` parameter can accept either a value of type `T` or
328
+ * a `DoublyLinkedListNode<T>` object.
329
+ * @returns The `delete` method returns a boolean value. It returns `true` if the value or node was successfully
330
+ * deleted from the doubly linked list, and `false` if the value or node was not found in the list.
330
331
  */
331
- DoublyLinkedList.prototype.delete = function (val) {
332
- var current = this.head;
333
- while (current) {
334
- if (current.val === val) {
335
- if (current === this.head) {
336
- this.shift();
337
- }
338
- else if (current === this.tail) {
339
- this.pop();
340
- }
341
- else {
342
- var prevNode = current.prev;
343
- var nextNode = current.next;
344
- prevNode.next = nextNode;
345
- nextNode.prev = prevNode;
346
- this.length--;
347
- }
348
- return true;
332
+ DoublyLinkedList.prototype.delete = function (valOrNode) {
333
+ var node;
334
+ if (valOrNode instanceof (DoublyLinkedListNode)) {
335
+ node = valOrNode;
336
+ }
337
+ else {
338
+ node = this.findNode(valOrNode);
339
+ }
340
+ if (node) {
341
+ if (node === this.head) {
342
+ this.shift();
349
343
  }
350
- current = current.next;
344
+ else if (node === this.tail) {
345
+ this.pop();
346
+ }
347
+ else {
348
+ var prevNode = node.prev;
349
+ var nextNode = node.next;
350
+ prevNode.next = nextNode;
351
+ nextNode.prev = prevNode;
352
+ this.length--;
353
+ }
354
+ return true;
351
355
  }
352
356
  return false;
353
357
  };
@@ -522,15 +526,22 @@ var DoublyLinkedList = /** @class */ (function () {
522
526
  return accumulator;
523
527
  };
524
528
  /**
525
- * The function inserts a new value after an existing value in a doubly linked list.
526
- * @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
527
- * @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert after
528
- * the existing node.
529
- * @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
530
- * existing value is not found in the linked list.
529
+ * The `insertAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
530
+ * @param {T | DoublyLinkedListNode<T>} existingValueOrNode - The existing value or node in the doubly linked list
531
+ * after which the new value will be inserted. It can be either the value of the existing node or the existing node
532
+ * itself.
533
+ * @param {T} newValue - The value that you want to insert into the doubly linked list.
534
+ * @returns The method returns a boolean value. It returns true if the insertion is successful, and false if the
535
+ * existing value or node is not found in the doubly linked list.
531
536
  */
532
- DoublyLinkedList.prototype.insertAfter = function (existingValue, newValue) {
533
- var existingNode = this.findNode(existingValue);
537
+ DoublyLinkedList.prototype.insertAfter = function (existingValueOrNode, newValue) {
538
+ var existingNode;
539
+ if (existingValueOrNode instanceof (DoublyLinkedListNode)) {
540
+ existingNode = existingValueOrNode;
541
+ }
542
+ else {
543
+ existingNode = this.findNode(existingValueOrNode);
544
+ }
534
545
  if (existingNode) {
535
546
  var newNode = new DoublyLinkedListNode(newValue);
536
547
  newNode.next = existingNode.next;
@@ -548,15 +559,23 @@ var DoublyLinkedList = /** @class */ (function () {
548
559
  return false;
549
560
  };
550
561
  /**
551
- * The `insertBefore` function inserts a new value before an existing value in a doubly linked list.
552
- * @param {T} existingValue - The existing value is the value of the node that you want to insert the new value before.
553
- * @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert before
554
- * the existing node.
555
- * @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
556
- * existing value is not found in the linked list.
562
+ * The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
563
+ * @param {T | DoublyLinkedListNode<T>} existingValueOrNode - The existing value or node in the doubly linked list
564
+ * before which the new value will be inserted. It can be either the value of the existing node or the existing node
565
+ * itself.
566
+ * @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the doubly linked
567
+ * list.
568
+ * @returns The method returns a boolean value. It returns `true` if the insertion is successful, and `false` if the
569
+ * insertion fails.
557
570
  */
558
- DoublyLinkedList.prototype.insertBefore = function (existingValue, newValue) {
559
- var existingNode = this.findNode(existingValue);
571
+ DoublyLinkedList.prototype.insertBefore = function (existingValueOrNode, newValue) {
572
+ var existingNode;
573
+ if (existingValueOrNode instanceof (DoublyLinkedListNode)) {
574
+ existingNode = existingValueOrNode;
575
+ }
576
+ else {
577
+ existingNode = this.findNode(existingValueOrNode);
578
+ }
560
579
  if (existingNode) {
561
580
  var newNode = new DoublyLinkedListNode(newValue);
562
581
  newNode.prev = existingNode.prev;
@@ -1,2 +1,3 @@
1
1
  export * from './singly-linked-list';
2
2
  export * from './doubly-linked-list';
3
+ export * from './skip-linked-list';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./singly-linked-list"), exports);
18
18
  __exportStar(require("./doubly-linked-list"), exports);
19
+ __exportStar(require("./skip-linked-list"), exports);
@@ -89,17 +89,10 @@ export declare class SinglyLinkedList<T> {
89
89
  * bounds.
90
90
  */
91
91
  deleteAt(index: number): T | null;
92
+ delete(valueOrNode: T): boolean;
93
+ delete(valueOrNode: SinglyLinkedListNode<T>): boolean;
92
94
  /**
93
- * The `delete` function removes a specified value from a linked list and returns true if the value was found and
94
- * removed, otherwise it returns false.
95
- * @param {T} value - The value parameter represents the value of the node that needs to be deleted from the linked
96
- * list.
97
- * @returns The `delete` method returns a boolean value. It returns `true` if the value was successfully deleted from
98
- * the linked list, and `false` if the value was not found in the linked list.
99
- */
100
- delete(value: T): boolean;
101
- /**
102
- * The `insert` function inserts a value at a specified index in a singly linked list.
95
+ * The `insertAt` function inserts a value at a specified index in a singly linked list.
103
96
  * @param {number} index - The index parameter represents the position at which the new value should be inserted in the
104
97
  * linked list. It is of type number.
105
98
  * @param {T} val - The `val` parameter represents the value that you want to insert into the linked list at the
@@ -107,7 +100,7 @@ export declare class SinglyLinkedList<T> {
107
100
  * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
108
101
  * if the index is out of bounds.
109
102
  */
110
- insert(index: number, val: T): boolean;
103
+ insertAt(index: number, val: T): boolean;
111
104
  /**
112
105
  * The function checks if the length of a data structure is equal to zero and returns a boolean value indicating
113
106
  * whether it is empty or not.
@@ -151,25 +144,10 @@ export declare class SinglyLinkedList<T> {
151
144
  * the specified value is found, the function returns `null`.
152
145
  */
153
146
  findNode(value: T): SinglyLinkedListNode<T> | null;
154
- /**
155
- * The `insertBefore` function inserts a new value before an existing value in a singly linked list.
156
- * @param {T} existingValue - The existing value is the value that already exists in the linked list and before which
157
- * we want to insert a new value.
158
- * @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
159
- * @returns The `insertBefore` function returns a boolean value. It returns `true` if the `newValue` is successfully
160
- * inserted before the first occurrence of `existingValue` in the linked list. It returns `false` if the
161
- * `existingValue` is not found in the linked list.
162
- */
163
147
  insertBefore(existingValue: T, newValue: T): boolean;
164
- /**
165
- * The function inserts a new value after an existing value in a singly linked list.
166
- * @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
167
- * @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list
168
- * after the node with the `existingValue`.
169
- * @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
170
- * existing value is not found in the linked list.
171
- */
172
- insertAfter(existingValue: T, newValue: T): boolean;
148
+ insertBefore(existingValue: SinglyLinkedListNode<T>, newValue: T): boolean;
149
+ insertAfter(existingValueOrNode: T, newValue: T): boolean;
150
+ insertAfter(existingValueOrNode: SinglyLinkedListNode<T>, newValue: T): boolean;
173
151
  /**
174
152
  * The function counts the number of occurrences of a given value in a linked list.
175
153
  * @param {T} value - The value parameter is the value that you want to count the occurrences of in the linked list.
@@ -257,16 +257,21 @@ var SinglyLinkedList = /** @class */ (function () {
257
257
  return removedNode.val;
258
258
  };
259
259
  /**
260
- * The `delete` function removes a specified value from a linked list and returns true if the value was found and
261
- * removed, otherwise it returns false.
262
- * @param {T} value - The value parameter represents the value of the node that needs to be deleted from the linked
263
- * list.
264
- * @returns The `delete` method returns a boolean value. It returns `true` if the value was successfully deleted from
265
- * the linked list, and `false` if the value was not found in the linked list.
260
+ * The delete function removes a node with a specific value from a singly linked list.
261
+ * @param {T | SinglyLinkedListNode<T>} valueOrNode - The `valueOrNode` parameter can accept either a value of type `T`
262
+ * or a `SinglyLinkedListNode<T>` object.
263
+ * @returns The `delete` method returns a boolean value. It returns `true` if the value or node is found and
264
+ * successfully deleted from the linked list, and `false` if the value or node is not found in the linked list.
266
265
  */
267
- SinglyLinkedList.prototype.delete = function (value) {
268
- var current = this.head;
269
- var prev = null;
266
+ SinglyLinkedList.prototype.delete = function (valueOrNode) {
267
+ var value;
268
+ if (valueOrNode instanceof (SinglyLinkedListNode)) {
269
+ value = valueOrNode.val;
270
+ }
271
+ else {
272
+ value = valueOrNode;
273
+ }
274
+ var current = this.head, prev = null;
270
275
  while (current) {
271
276
  if (current.val === value) {
272
277
  if (prev === null) {
@@ -290,7 +295,7 @@ var SinglyLinkedList = /** @class */ (function () {
290
295
  return false;
291
296
  };
292
297
  /**
293
- * The `insert` function inserts a value at a specified index in a singly linked list.
298
+ * The `insertAt` function inserts a value at a specified index in a singly linked list.
294
299
  * @param {number} index - The index parameter represents the position at which the new value should be inserted in the
295
300
  * linked list. It is of type number.
296
301
  * @param {T} val - The `val` parameter represents the value that you want to insert into the linked list at the
@@ -298,7 +303,7 @@ var SinglyLinkedList = /** @class */ (function () {
298
303
  * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
299
304
  * if the index is out of bounds.
300
305
  */
301
- SinglyLinkedList.prototype.insert = function (index, val) {
306
+ SinglyLinkedList.prototype.insertAt = function (index, val) {
302
307
  if (index < 0 || index > this.length)
303
308
  return false;
304
309
  if (index === 0) {
@@ -418,16 +423,21 @@ var SinglyLinkedList = /** @class */ (function () {
418
423
  };
419
424
  /**
420
425
  * The `insertBefore` function inserts a new value before an existing value in a singly linked list.
421
- * @param {T} existingValue - The existing value is the value that already exists in the linked list and before which
422
- * we want to insert a new value.
426
+ * @param {T | SinglyLinkedListNode<T>} existingValueOrNode - The existing value or node that you want to insert the
427
+ * new value before. It can be either the value itself or a node containing the value in the linked list.
423
428
  * @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
424
- * @returns The `insertBefore` function returns a boolean value. It returns `true` if the `newValue` is successfully
425
- * inserted before the first occurrence of `existingValue` in the linked list. It returns `false` if the
426
- * `existingValue` is not found in the linked list.
429
+ * @returns The method `insertBefore` returns a boolean value. It returns `true` if the new value was successfully
430
+ * inserted before the existing value, and `false` otherwise.
427
431
  */
428
- SinglyLinkedList.prototype.insertBefore = function (existingValue, newValue) {
429
- if (!this.head) {
432
+ SinglyLinkedList.prototype.insertBefore = function (existingValueOrNode, newValue) {
433
+ if (!this.head)
430
434
  return false;
435
+ var existingValue;
436
+ if (existingValueOrNode instanceof (SinglyLinkedListNode)) {
437
+ existingValue = existingValueOrNode.val;
438
+ }
439
+ else {
440
+ existingValue = existingValueOrNode;
431
441
  }
432
442
  if (this.head.val === existingValue) {
433
443
  this.unshift(newValue);
@@ -447,15 +457,21 @@ var SinglyLinkedList = /** @class */ (function () {
447
457
  return false;
448
458
  };
449
459
  /**
450
- * The function inserts a new value after an existing value in a singly linked list.
451
- * @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
452
- * @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list
453
- * after the node with the `existingValue`.
454
- * @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
455
- * existing value is not found in the linked list.
460
+ * The `insertAfter` function inserts a new node with a given value after an existing node in a singly linked list.
461
+ * @param {T | SinglyLinkedListNode<T>} existingValueOrNode - The existing value or node in the linked list after which
462
+ * the new value will be inserted. It can be either the value of the existing node or the existing node itself.
463
+ * @param {T} newValue - The value that you want to insert into the linked list after the existing value or node.
464
+ * @returns The method returns a boolean value. It returns true if the new value was successfully inserted after the
465
+ * existing value or node, and false if the existing value or node was not found in the linked list.
456
466
  */
457
- SinglyLinkedList.prototype.insertAfter = function (existingValue, newValue) {
458
- var existingNode = this.findNode(existingValue);
467
+ SinglyLinkedList.prototype.insertAfter = function (existingValueOrNode, newValue) {
468
+ var existingNode;
469
+ if (existingValueOrNode instanceof SinglyLinkedListNode) {
470
+ existingNode = existingValueOrNode;
471
+ }
472
+ else {
473
+ existingNode = this.findNode(existingValueOrNode);
474
+ }
459
475
  if (existingNode) {
460
476
  var newNode = new SinglyLinkedListNode(newValue);
461
477
  newNode.next = existingNode.next;
@@ -1 +1,2 @@
1
- export {};
1
+ export declare class SkipLinkedList {
2
+ }
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SkipLinkedList = void 0;
4
+ var SkipLinkedList = /** @class */ (function () {
5
+ function SkipLinkedList() {
6
+ }
7
+ return SkipLinkedList;
8
+ }());
9
+ exports.SkipLinkedList = SkipLinkedList;
@@ -221,14 +221,14 @@ var Vector2D = /** @class */ (function () {
221
221
  // * Transform vectors based on the current tranformation matrices: translation, rotation and scale
222
222
  // * @param vectors The vectors to transform
223
223
  // */
224
- // public static transform(vector: Vector2D, transformation: Matrix2D): Vector2D {
224
+ // static transform(vector: Vector2D, transformation: Matrix2D): Vector2D {
225
225
  // return Matrix2D.multiplyByVector(transformation, vector)
226
226
  // }
227
227
  // /**
228
228
  // * Transform vectors based on the current tranformation matrices: translation, rotation and scale
229
229
  // * @param vectors The vectors to transform
230
230
  // */
231
- // public static transformList(vectors: Vector2D[], transformation: Matrix2D): Vector2D[] {
231
+ // static transformList(vectors: Vector2D[], transformation: Matrix2D): Vector2D[] {
232
232
  // return vectors.map(vector => Matrix2D.multiplyByVector(transformation, vector))
233
233
  // }
234
234
  /**