data-structure-typed 1.54.2 → 2.0.0

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 (213) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/LICENSE +2 -2
  3. package/README.md +14 -1
  4. package/README_zh-CN.md +1 -1
  5. package/benchmark/report.html +28 -1
  6. package/benchmark/report.json +327 -18
  7. package/dist/cjs/data-structures/base/iterable-element-base.d.ts +14 -40
  8. package/dist/cjs/data-structures/base/iterable-element-base.js +14 -11
  9. package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
  10. package/dist/cjs/data-structures/base/linear-base.d.ts +277 -0
  11. package/dist/cjs/data-structures/base/linear-base.js +553 -0
  12. package/dist/cjs/data-structures/base/linear-base.js.map +1 -0
  13. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
  14. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +8 -7
  15. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
  16. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
  17. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +51 -38
  18. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  19. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +89 -21
  20. package/dist/cjs/data-structures/binary-tree/avl-tree.js +76 -8
  21. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  22. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +173 -225
  23. package/dist/cjs/data-structures/binary-tree/binary-tree.js +244 -149
  24. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  25. package/dist/cjs/data-structures/binary-tree/bst.d.ts +62 -56
  26. package/dist/cjs/data-structures/binary-tree/bst.js +89 -133
  27. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  28. package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +19 -25
  29. package/dist/cjs/data-structures/binary-tree/red-black-tree.js +7 -13
  30. package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +1 -1
  31. package/dist/cjs/data-structures/binary-tree/tree-counter.d.ts +19 -19
  32. package/dist/cjs/data-structures/binary-tree/tree-counter.js +12 -12
  33. package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +1 -1
  34. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
  35. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +211 -41
  36. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  37. package/dist/cjs/data-structures/graph/abstract-graph.js +2 -2
  38. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  39. package/dist/cjs/data-structures/heap/heap.d.ts +3 -11
  40. package/dist/cjs/data-structures/heap/heap.js +0 -10
  41. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  42. package/dist/cjs/data-structures/heap/max-heap.d.ts +2 -2
  43. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
  44. package/dist/cjs/data-structures/heap/min-heap.d.ts +2 -2
  45. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
  46. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
  47. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +131 -146
  48. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  49. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +79 -75
  50. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +217 -169
  51. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  52. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
  53. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  54. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
  55. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  56. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +2 -2
  57. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  58. package/dist/cjs/data-structures/queue/deque.d.ts +130 -91
  59. package/dist/cjs/data-structures/queue/deque.js +269 -169
  60. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  61. package/dist/cjs/data-structures/queue/queue.d.ts +84 -40
  62. package/dist/cjs/data-structures/queue/queue.js +134 -50
  63. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  64. package/dist/cjs/data-structures/stack/stack.d.ts +3 -11
  65. package/dist/cjs/data-structures/stack/stack.js +0 -10
  66. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  67. package/dist/cjs/data-structures/trie/trie.d.ts +4 -3
  68. package/dist/cjs/data-structures/trie/trie.js +3 -0
  69. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  70. package/dist/cjs/types/data-structures/base/base.d.ts +9 -4
  71. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
  72. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
  73. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +1 -1
  74. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
  75. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
  76. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
  77. package/dist/cjs/types/data-structures/queue/deque.d.ts +2 -3
  78. package/dist/cjs/types/data-structures/queue/queue.d.ts +2 -2
  79. package/dist/cjs/utils/utils.d.ts +2 -2
  80. package/dist/esm/data-structures/base/iterable-element-base.d.ts +14 -40
  81. package/dist/esm/data-structures/base/iterable-element-base.js +14 -11
  82. package/dist/esm/data-structures/base/iterable-element-base.js.map +1 -1
  83. package/dist/esm/data-structures/base/linear-base.d.ts +277 -0
  84. package/dist/esm/data-structures/base/linear-base.js +549 -0
  85. package/dist/esm/data-structures/base/linear-base.js.map +1 -0
  86. package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
  87. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +9 -8
  88. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
  89. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
  90. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +52 -38
  91. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  92. package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +89 -21
  93. package/dist/esm/data-structures/binary-tree/avl-tree.js +77 -9
  94. package/dist/esm/data-structures/binary-tree/avl-tree.js.map +1 -1
  95. package/dist/esm/data-structures/binary-tree/binary-tree.d.ts +173 -225
  96. package/dist/esm/data-structures/binary-tree/binary-tree.js +248 -153
  97. package/dist/esm/data-structures/binary-tree/binary-tree.js.map +1 -1
  98. package/dist/esm/data-structures/binary-tree/bst.d.ts +62 -56
  99. package/dist/esm/data-structures/binary-tree/bst.js +90 -132
  100. package/dist/esm/data-structures/binary-tree/bst.js.map +1 -1
  101. package/dist/esm/data-structures/binary-tree/red-black-tree.d.ts +19 -25
  102. package/dist/esm/data-structures/binary-tree/red-black-tree.js +8 -14
  103. package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +1 -1
  104. package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +19 -19
  105. package/dist/esm/data-structures/binary-tree/tree-counter.js +13 -13
  106. package/dist/esm/data-structures/binary-tree/tree-counter.js.map +1 -1
  107. package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
  108. package/dist/esm/data-structures/binary-tree/tree-multi-map.js +212 -41
  109. package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  110. package/dist/esm/data-structures/graph/abstract-graph.js +2 -2
  111. package/dist/esm/data-structures/graph/abstract-graph.js.map +1 -1
  112. package/dist/esm/data-structures/heap/heap.d.ts +3 -11
  113. package/dist/esm/data-structures/heap/heap.js +0 -10
  114. package/dist/esm/data-structures/heap/heap.js.map +1 -1
  115. package/dist/esm/data-structures/heap/max-heap.d.ts +2 -2
  116. package/dist/esm/data-structures/heap/max-heap.js.map +1 -1
  117. package/dist/esm/data-structures/heap/min-heap.d.ts +2 -2
  118. package/dist/esm/data-structures/heap/min-heap.js.map +1 -1
  119. package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
  120. package/dist/esm/data-structures/linked-list/doubly-linked-list.js +132 -148
  121. package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  122. package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +79 -75
  123. package/dist/esm/data-structures/linked-list/singly-linked-list.js +217 -170
  124. package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +1 -1
  125. package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
  126. package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  127. package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
  128. package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  129. package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +2 -2
  130. package/dist/esm/data-structures/priority-queue/priority-queue.js.map +1 -1
  131. package/dist/esm/data-structures/queue/deque.d.ts +130 -91
  132. package/dist/esm/data-structures/queue/deque.js +269 -169
  133. package/dist/esm/data-structures/queue/deque.js.map +1 -1
  134. package/dist/esm/data-structures/queue/queue.d.ts +84 -40
  135. package/dist/esm/data-structures/queue/queue.js +135 -51
  136. package/dist/esm/data-structures/queue/queue.js.map +1 -1
  137. package/dist/esm/data-structures/stack/stack.d.ts +3 -11
  138. package/dist/esm/data-structures/stack/stack.js +0 -10
  139. package/dist/esm/data-structures/stack/stack.js.map +1 -1
  140. package/dist/esm/data-structures/trie/trie.d.ts +4 -3
  141. package/dist/esm/data-structures/trie/trie.js +3 -0
  142. package/dist/esm/data-structures/trie/trie.js.map +1 -1
  143. package/dist/esm/types/data-structures/base/base.d.ts +9 -4
  144. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
  145. package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
  146. package/dist/esm/types/data-structures/binary-tree/bst.d.ts +1 -1
  147. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
  148. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
  149. package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
  150. package/dist/esm/types/data-structures/queue/deque.d.ts +2 -3
  151. package/dist/esm/types/data-structures/queue/queue.d.ts +2 -2
  152. package/dist/esm/utils/utils.d.ts +2 -2
  153. package/dist/umd/data-structure-typed.js +1548 -920
  154. package/dist/umd/data-structure-typed.min.js +5 -12
  155. package/dist/umd/data-structure-typed.min.js.map +1 -1
  156. package/package.json +7 -7
  157. package/src/data-structures/base/iterable-element-base.ts +29 -20
  158. package/src/data-structures/base/linear-base.ts +649 -0
  159. package/src/data-structures/binary-tree/avl-tree-counter.ts +30 -23
  160. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +74 -49
  161. package/src/data-structures/binary-tree/avl-tree.ts +99 -29
  162. package/src/data-structures/binary-tree/binary-tree.ts +474 -257
  163. package/src/data-structures/binary-tree/bst.ts +150 -152
  164. package/src/data-structures/binary-tree/red-black-tree.ts +27 -35
  165. package/src/data-structures/binary-tree/tree-counter.ts +33 -27
  166. package/src/data-structures/binary-tree/tree-multi-map.ts +235 -53
  167. package/src/data-structures/graph/abstract-graph.ts +2 -2
  168. package/src/data-structures/heap/heap.ts +3 -14
  169. package/src/data-structures/heap/max-heap.ts +2 -2
  170. package/src/data-structures/heap/min-heap.ts +2 -2
  171. package/src/data-structures/linked-list/doubly-linked-list.ts +144 -160
  172. package/src/data-structures/linked-list/singly-linked-list.ts +241 -185
  173. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -5
  174. package/src/data-structures/priority-queue/min-priority-queue.ts +2 -5
  175. package/src/data-structures/priority-queue/priority-queue.ts +2 -2
  176. package/src/data-structures/queue/deque.ts +286 -183
  177. package/src/data-structures/queue/queue.ts +149 -63
  178. package/src/data-structures/stack/stack.ts +3 -18
  179. package/src/data-structures/trie/trie.ts +7 -3
  180. package/src/types/data-structures/base/base.ts +17 -8
  181. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
  182. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -0
  183. package/src/types/data-structures/binary-tree/bst.ts +1 -1
  184. package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -1
  185. package/src/types/data-structures/linked-list/doubly-linked-list.ts +2 -2
  186. package/src/types/data-structures/linked-list/singly-linked-list.ts +2 -2
  187. package/src/types/data-structures/queue/deque.ts +2 -3
  188. package/src/types/data-structures/queue/queue.ts +2 -2
  189. package/src/utils/utils.ts +2 -2
  190. package/test/integration/all-in-one.test.ts +1 -1
  191. package/test/integration/avl-tree.test.ts +1 -1
  192. package/test/integration/bst.test.ts +2 -2
  193. package/test/integration/compile.mjs +21 -21
  194. package/test/performance/data-structures/binary-tree/avl-tree.test.mjs +71 -0
  195. package/test/performance/data-structures/binary-tree/red-black-tree.test.mjs +81 -0
  196. package/test/performance/{reportor.js → reportor.mjs} +264 -8
  197. package/test/performance/reportor.ts +1 -1
  198. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +7 -7
  199. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +172 -5
  200. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +72 -4
  201. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +132 -82
  202. package/test/unit/data-structures/binary-tree/bst.test.ts +12 -12
  203. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +5 -13
  204. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +4 -4
  205. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +168 -10
  206. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +135 -27
  207. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +111 -11
  208. package/test/unit/data-structures/queue/deque.test.ts +241 -60
  209. package/test/unit/data-structures/queue/queue.test.ts +118 -19
  210. package/test/unit/unrestricted-interconversion.test.ts +1 -1
  211. package/test/utils/json2html.ts +0 -154
  212. package/test/performance/data-structures/binary-tree/avl-tree.test.js +0 -45
  213. /package/test/performance/data-structures/binary-tree/{rb-tree.test.ts → red-black-tree.test.ts} +0 -0
@@ -0,0 +1,277 @@
1
+ import { ElementCallback, LinearBaseOptions, ReduceLinearCallback } from '../../types';
2
+ import { IterableElementBase } from './iterable-element-base';
3
+ export declare class LinkedListNode<E = any> {
4
+ constructor(value: E);
5
+ protected _value: E;
6
+ get value(): E;
7
+ set value(value: E);
8
+ protected _next: LinkedListNode<E> | undefined;
9
+ get next(): LinkedListNode<E> | undefined;
10
+ set next(value: LinkedListNode<E> | undefined);
11
+ }
12
+ export declare abstract class LinearBase<E, R = any, NODE extends LinkedListNode<E> = LinkedListNode<E>> extends IterableElementBase<E, R> {
13
+ /**
14
+ * The constructor initializes the LinearBase class with optional options, setting the maximum length
15
+ * if provided.
16
+ * @param [options] - The `options` parameter is an optional object that can be passed to the
17
+ * constructor. It is of type `LinearBaseOptions<E, R>`. The constructor checks if the `options`
18
+ * object is provided and then extracts the `maxLen` property from it. If `maxLen` is a
19
+ */
20
+ protected constructor(options?: LinearBaseOptions<E, R>);
21
+ abstract get length(): number;
22
+ protected _maxLen: number;
23
+ get maxLen(): number;
24
+ /**
25
+ * Time Complexity: O(n)
26
+ * Space Complexity: O(1)
27
+ *
28
+ * The function indexOf searches for a specified element starting from a given index in an array-like
29
+ * object and returns the index of the first occurrence, or -1 if not found.
30
+ * @param {E} searchElement - The `searchElement` parameter in the `indexOf` function represents the
31
+ * element that you want to find within the array. The function will search for this element starting
32
+ * from the `fromIndex` (if provided) up to the end of the array. If the `searchElement` is found
33
+ * within the
34
+ * @param {number} [fromIndex=0] - The `fromIndex` parameter in the `indexOf` function represents the
35
+ * index at which to start searching for the `searchElement` within the array. If provided, the
36
+ * search will begin at this index and continue to the end of the array. If `fromIndex` is not
37
+ * specified, the default
38
+ * @returns The `indexOf` method is returning the index of the `searchElement` if it is found in the
39
+ * array starting from the `fromIndex`. If the `searchElement` is not found, it returns -1.
40
+ */
41
+ indexOf(searchElement: E, fromIndex?: number): number;
42
+ /**
43
+ * Time Complexity: O(n)
44
+ * Space Complexity: O(1)
45
+ *
46
+ * The function `lastIndexOf` in TypeScript returns the index of the last occurrence of a specified
47
+ * element in an array.
48
+ * @param {E} searchElement - The `searchElement` parameter is the element that you want to find the
49
+ * last index of within the array. The `lastIndexOf` method will search the array starting from the
50
+ * `fromIndex` (or the end of the array if not specified) and return the index of the last occurrence
51
+ * of the
52
+ * @param {number} fromIndex - The `fromIndex` parameter in the `lastIndexOf` method specifies the
53
+ * index at which to start searching for the `searchElement` in the array. By default, it starts
54
+ * searching from the last element of the array (`this.length - 1`). If a specific `fromIndex` is
55
+ * provided
56
+ * @returns The last index of the `searchElement` in the array is being returned. If the
57
+ * `searchElement` is not found in the array, -1 is returned.
58
+ */
59
+ lastIndexOf(searchElement: E, fromIndex?: number): number;
60
+ /**
61
+ * Time Complexity: O(n)
62
+ * Space Complexity: O(1)
63
+ *
64
+ * The `findIndex` function iterates over an array and returns the index of the first element that
65
+ * satisfies the provided predicate function.
66
+ * @param predicate - The `predicate` parameter in the `findIndex` function is a callback function
67
+ * that takes three arguments: `item`, `index`, and the array `this`. It should return a boolean
68
+ * value indicating whether the current element satisfies the condition being checked for.
69
+ * @param {any} [thisArg] - The `thisArg` parameter in the `findIndex` function is an optional
70
+ * parameter that specifies the value to use as `this` when executing the `predicate` function. If
71
+ * provided, the `predicate` function will be called with `thisArg` as its `this` value. If `
72
+ * @returns The `findIndex` method is returning the index of the first element in the array that
73
+ * satisfies the provided predicate function. If no such element is found, it returns -1.
74
+ */
75
+ findIndex(predicate: ElementCallback<E, R, boolean>, thisArg?: any): number;
76
+ concat(...items: this[]): this;
77
+ /**
78
+ * Time Complexity: O(n log n)
79
+ * Space Complexity: O(n)
80
+ *
81
+ * The `sort` function in TypeScript sorts the elements of a collection using a specified comparison
82
+ * function.
83
+ * @param [compareFn] - The `compareFn` parameter is a function that defines the sort order. It takes
84
+ * two elements `a` and `b` as input and returns a number indicating their relative order. If the
85
+ * returned value is negative, `a` comes before `b`. If the returned value is positive, `
86
+ * @returns The `sort` method is returning the instance of the object on which it is called (this),
87
+ * after sorting the elements based on the provided comparison function (compareFn).
88
+ */
89
+ sort(compareFn?: (a: E, b: E) => number): this;
90
+ /**
91
+ * Time Complexity: O(n + m)
92
+ * Space Complexity: O(m)
93
+ *
94
+ * The `splice` function in TypeScript removes elements from an array and optionally inserts new
95
+ * elements at the specified index.
96
+ * @param {number} start - The `start` parameter in the `splice` method indicates the index at which
97
+ * to start modifying the array. If `start` is a negative number, it will count from the end of the
98
+ * array.
99
+ * @param {number} [deleteCount=0] - The `deleteCount` parameter in the `splice` method specifies the
100
+ * number of elements to remove from the array starting at the specified `start` index. If
101
+ * `deleteCount` is not provided or is 0, no elements are removed, and only new elements are inserted
102
+ * at the `start`
103
+ * @param {E[]} items - The `items` parameter in the `splice` method represents the elements that
104
+ * will be inserted into the array at the specified `start` index. These elements can be of any type
105
+ * and you can pass multiple elements separated by commas. The `splice` method will insert these
106
+ * items into the array at the
107
+ * @returns The `splice` method returns a list of elements that were removed from the original list
108
+ * during the operation.
109
+ */
110
+ splice(start: number, deleteCount?: number, ...items: E[]): this;
111
+ /**
112
+ * Time Complexity: O(n)
113
+ * Space Complexity: O(1)
114
+ *
115
+ * The `join` function in TypeScript returns a string by joining the elements of an array with a
116
+ * specified separator.
117
+ * @param {string} [separator=,] - The `separator` parameter is a string that specifies the character
118
+ * or characters that will be used to separate each element when joining them into a single string.
119
+ * By default, the separator is set to a comma (`,`), but you can provide a different separator if
120
+ * needed.
121
+ * @returns The `join` method is being returned, which takes an optional `separator` parameter
122
+ * (defaulting to a comma) and returns a string created by joining all elements of the array after
123
+ * converting it to an array.
124
+ */
125
+ join(separator?: string): string;
126
+ /**
127
+ * Time Complexity: O(n)
128
+ * Space Complexity: O(n)
129
+ *
130
+ * The function `toReversedArray` takes an array and returns a new array with its elements in reverse
131
+ * order.
132
+ * @returns The `toReversedArray()` function returns an array of elements of type `E` in reverse
133
+ * order.
134
+ */
135
+ toReversedArray(): E[];
136
+ reduceRight(callbackfn: ReduceLinearCallback<E>): E;
137
+ reduceRight(callbackfn: ReduceLinearCallback<E>, initialValue: E): E;
138
+ reduceRight<U>(callbackfn: ReduceLinearCallback<E, U>, initialValue: U): U;
139
+ /**
140
+ * Time Complexity: O(m)
141
+ * Space Complexity: O(m)
142
+ *
143
+ * The `slice` function in TypeScript creates a new instance by extracting a portion of elements from
144
+ * the original instance based on the specified start and end indices.
145
+ * @param {number} [start=0] - The `start` parameter in the `slice` method represents the index at
146
+ * which to begin extracting elements from an array-like object. If no `start` parameter is provided,
147
+ * the default value is 0, meaning the extraction will start from the beginning of the array.
148
+ * @param {number} end - The `end` parameter in the `slice` method represents the index at which to
149
+ * end the slicing. By default, if no `end` parameter is provided, it will slice until the end of the
150
+ * array (i.e., `this.length`).
151
+ * @returns The `slice` method is returning a new instance of the object with elements sliced from
152
+ * the specified start index (default is 0) to the specified end index (default is the length of the
153
+ * object).
154
+ */
155
+ slice(start?: number, end?: number): this;
156
+ /**
157
+ * Time Complexity: O(n)
158
+ * Space Complexity: O(1)
159
+ *
160
+ * The `fill` function in TypeScript fills a specified range in an array-like object with a given
161
+ * value.
162
+ * @param {E} value - The `value` parameter in the `fill` method represents the element that will be
163
+ * used to fill the specified range in the array.
164
+ * @param [start=0] - The `start` parameter specifies the index at which to start filling the array
165
+ * with the specified value. If not provided, it defaults to 0, indicating the beginning of the
166
+ * array.
167
+ * @param end - The `end` parameter in the `fill` function represents the index at which the filling
168
+ * of values should stop. It specifies the end of the range within the array where the `value` should
169
+ * be filled.
170
+ * @returns The `fill` method is returning the modified object (`this`) after filling the specified
171
+ * range with the provided value.
172
+ */
173
+ fill(value: E, start?: number, end?: number): this;
174
+ abstract setAt(index: number, value: E): boolean;
175
+ abstract clone(): this;
176
+ abstract reverse(): this;
177
+ abstract push(elementOrNode: E | NODE): boolean;
178
+ abstract pushMany(elements: Iterable<E> | Iterable<R> | Iterable<NODE>): boolean[];
179
+ abstract delete(elementOrNode: E | NODE | undefined): boolean;
180
+ abstract at(index: number): E | undefined;
181
+ abstract deleteAt(pos: number): E | undefined;
182
+ abstract addAt(index: number, newElementOrNode: E | NODE): boolean;
183
+ protected abstract _createInstance(options?: LinearBaseOptions<E, R>): this;
184
+ protected abstract _getReverseIterator(...args: any[]): IterableIterator<E>;
185
+ }
186
+ export declare abstract class LinearLinkedBase<E, R = any, NODE extends LinkedListNode<E> = LinkedListNode<E>> extends LinearBase<E, R, NODE> {
187
+ /**
188
+ * The constructor initializes the LinearBase class with optional options, setting the maximum length
189
+ * if provided and valid.
190
+ * @param [options] - The `options` parameter is an optional object that can be passed to the
191
+ * constructor. It is of type `LinearBaseOptions<E, R>`. This object may contain properties such as
192
+ * `maxLen`, which is a number representing the maximum length. If `maxLen` is a positive integer,
193
+ */
194
+ protected constructor(options?: LinearBaseOptions<E, R>);
195
+ /**
196
+ * Time Complexity: O(n)
197
+ * Space Complexity: O(1)
198
+ *
199
+ * The function overrides the indexOf method to improve performance by searching for an element in a
200
+ * custom array implementation starting from a specified index.
201
+ * @param {E} searchElement - The `searchElement` parameter is the element that you are searching for
202
+ * within the array. The `indexOf` method will return the index of the first occurrence of this
203
+ * element within the array.
204
+ * @param {number} [fromIndex=0] - The `fromIndex` parameter in the `indexOf` method specifies the
205
+ * index in the array at which to start the search for the `searchElement`. If provided, the search
206
+ * will begin at the specified index and continue to the end of the array. If not provided, the
207
+ * search will start at index
208
+ * @returns The `indexOf` method is returning the index of the `searchElement` if it is found in the
209
+ * array starting from the `fromIndex`. If the `searchElement` is not found, it returns -1.
210
+ */
211
+ indexOf(searchElement: E, fromIndex?: number): number;
212
+ /**
213
+ * Time Complexity: O(n)
214
+ * Space Complexity: O(1)
215
+ *
216
+ * The function overrides the lastIndexOf method in TypeScript to improve performance by searching
217
+ * for an element in reverse order starting from a specified index.
218
+ * @param {E} searchElement - The `searchElement` parameter is the element that you want to find
219
+ * within the array. The `lastIndexOf` method searches the array for this element starting from the
220
+ * end of the array (or from the specified `fromIndex` if provided) and returns the index of the last
221
+ * occurrence of the element
222
+ * @param {number} fromIndex - The `fromIndex` parameter in the `lastIndexOf` method specifies the
223
+ * index at which to start searching for the `searchElement` in the array. If provided, the search
224
+ * will begin at this index and move towards the beginning of the array. If not provided, the search
225
+ * will start at the
226
+ * @returns The `lastIndexOf` method is being overridden to search for the `searchElement` starting
227
+ * from the specified `fromIndex` (defaulting to the end of the array). It iterates over the array in
228
+ * reverse order using a custom iterator `_getReverseIterator` and returns the index of the last
229
+ * occurrence of the `searchElement` if found, or -1 if not found.
230
+ */
231
+ lastIndexOf(searchElement: E, fromIndex?: number): number;
232
+ concat(...items: LinearBase<E, R>[]): this;
233
+ /**
234
+ * Time Complexity: O(m)
235
+ * Space Complexity: O(m)
236
+ *
237
+ * The `slice` method is overridden to improve performance by creating a new instance and iterating
238
+ * through the array to extract a subset based on the specified start and end indices.
239
+ * @param {number} [start=0] - The `start` parameter in the `slice` method specifies the index at
240
+ * which to begin extracting elements from the array. If no `start` parameter is provided, the
241
+ * default value is 0, indicating that extraction should start from the beginning of the array.
242
+ * @param {number} end - The `end` parameter in the `slice` method represents the index at which to
243
+ * end the slicing of the array. If not provided, it defaults to the length of the array.
244
+ * @returns The `slice` method is returning a new instance of the array implementation with elements
245
+ * sliced from the original array based on the `start` and `end` parameters.
246
+ */
247
+ slice(start?: number, end?: number): this;
248
+ /**
249
+ * Time Complexity: O(n + m)
250
+ * Space Complexity: O(m)
251
+ *
252
+ * The function overrides the splice method to handle deletion and insertion of elements in a data
253
+ * structure while returning the removed elements.
254
+ * @param {number} start - The `start` parameter in the `splice` method indicates the index at which
255
+ * to start modifying the array.
256
+ * @param {number} [deleteCount=0] - The `deleteCount` parameter in the `splice` method specifies the
257
+ * number of elements to remove from the array starting at the specified `start` index. If
258
+ * `deleteCount` is not provided, it defaults to 0, meaning no elements will be removed but new
259
+ * elements can still be inserted at
260
+ * @param {E[]} items - The `items` parameter in the `splice` method represents the elements that
261
+ * will be inserted into the array at the specified `start` index. These elements can be of any type
262
+ * and there can be multiple elements passed as arguments to be inserted into the array.
263
+ * @returns The `splice` method is returning a new instance of the data structure that was modified
264
+ * by removing elements specified by the `start` and `deleteCount` parameters, and inserting new
265
+ * elements provided in the `items` array.
266
+ */
267
+ splice(start: number, deleteCount?: number, ...items: E[]): this;
268
+ reduceRight(callbackfn: ReduceLinearCallback<E>): E;
269
+ reduceRight(callbackfn: ReduceLinearCallback<E>, initialValue: E): E;
270
+ reduceRight<U>(callbackfn: ReduceLinearCallback<E, U>, initialValue: U): U;
271
+ abstract delete(elementOrNode: E | NODE | undefined): boolean;
272
+ abstract addBefore(existingElementOrNode: E | NODE, newElementOrNode: E | NODE): boolean;
273
+ abstract addAfter(existingElementOrNode: E | NODE, newElementOrNode: E | NODE): boolean;
274
+ abstract getNodeAt(index: number): NODE | undefined;
275
+ protected abstract _getNodeIterator(...args: any[]): IterableIterator<NODE>;
276
+ protected abstract _getPrevNode(node: NODE): NODE | undefined;
277
+ }