heap-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 (84) hide show
  1. package/dist/data-structures/base/iterable-element-base.d.ts +14 -40
  2. package/dist/data-structures/base/iterable-element-base.js +14 -11
  3. package/dist/data-structures/base/linear-base.d.ts +277 -0
  4. package/dist/data-structures/base/linear-base.js +552 -0
  5. package/dist/data-structures/binary-tree/avl-tree-counter.d.ts +21 -20
  6. package/dist/data-structures/binary-tree/avl-tree-counter.js +8 -7
  7. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +23 -19
  8. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +51 -38
  9. package/dist/data-structures/binary-tree/avl-tree.d.ts +89 -21
  10. package/dist/data-structures/binary-tree/avl-tree.js +76 -8
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +173 -225
  12. package/dist/data-structures/binary-tree/binary-tree.js +244 -149
  13. package/dist/data-structures/binary-tree/bst.d.ts +62 -56
  14. package/dist/data-structures/binary-tree/bst.js +89 -133
  15. package/dist/data-structures/binary-tree/red-black-tree.d.ts +19 -25
  16. package/dist/data-structures/binary-tree/red-black-tree.js +7 -13
  17. package/dist/data-structures/binary-tree/tree-counter.d.ts +19 -19
  18. package/dist/data-structures/binary-tree/tree-counter.js +12 -12
  19. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +186 -25
  20. package/dist/data-structures/binary-tree/tree-multi-map.js +211 -41
  21. package/dist/data-structures/graph/abstract-graph.js +2 -2
  22. package/dist/data-structures/heap/heap.d.ts +3 -11
  23. package/dist/data-structures/heap/heap.js +0 -10
  24. package/dist/data-structures/heap/max-heap.d.ts +2 -2
  25. package/dist/data-structures/heap/min-heap.d.ts +2 -2
  26. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
  27. package/dist/data-structures/linked-list/doubly-linked-list.js +131 -146
  28. package/dist/data-structures/linked-list/singly-linked-list.d.ts +79 -75
  29. package/dist/data-structures/linked-list/singly-linked-list.js +217 -169
  30. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
  31. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
  32. package/dist/data-structures/priority-queue/priority-queue.d.ts +2 -2
  33. package/dist/data-structures/queue/deque.d.ts +130 -91
  34. package/dist/data-structures/queue/deque.js +269 -169
  35. package/dist/data-structures/queue/queue.d.ts +84 -40
  36. package/dist/data-structures/queue/queue.js +134 -50
  37. package/dist/data-structures/stack/stack.d.ts +3 -11
  38. package/dist/data-structures/stack/stack.js +0 -10
  39. package/dist/data-structures/trie/trie.d.ts +4 -3
  40. package/dist/data-structures/trie/trie.js +3 -0
  41. package/dist/types/data-structures/base/base.d.ts +9 -4
  42. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
  43. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
  44. package/dist/types/data-structures/binary-tree/bst.d.ts +1 -1
  45. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
  46. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
  47. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
  48. package/dist/types/data-structures/queue/deque.d.ts +2 -3
  49. package/dist/types/data-structures/queue/queue.d.ts +2 -2
  50. package/dist/utils/utils.d.ts +2 -2
  51. package/package.json +2 -2
  52. package/src/data-structures/base/iterable-element-base.ts +29 -20
  53. package/src/data-structures/base/linear-base.ts +649 -0
  54. package/src/data-structures/binary-tree/avl-tree-counter.ts +30 -23
  55. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +74 -49
  56. package/src/data-structures/binary-tree/avl-tree.ts +99 -29
  57. package/src/data-structures/binary-tree/binary-tree.ts +474 -257
  58. package/src/data-structures/binary-tree/bst.ts +150 -152
  59. package/src/data-structures/binary-tree/red-black-tree.ts +27 -35
  60. package/src/data-structures/binary-tree/tree-counter.ts +33 -27
  61. package/src/data-structures/binary-tree/tree-multi-map.ts +235 -53
  62. package/src/data-structures/graph/abstract-graph.ts +2 -2
  63. package/src/data-structures/heap/heap.ts +3 -14
  64. package/src/data-structures/heap/max-heap.ts +2 -2
  65. package/src/data-structures/heap/min-heap.ts +2 -2
  66. package/src/data-structures/linked-list/doubly-linked-list.ts +144 -160
  67. package/src/data-structures/linked-list/singly-linked-list.ts +241 -185
  68. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -5
  69. package/src/data-structures/priority-queue/min-priority-queue.ts +2 -5
  70. package/src/data-structures/priority-queue/priority-queue.ts +2 -2
  71. package/src/data-structures/queue/deque.ts +286 -183
  72. package/src/data-structures/queue/queue.ts +149 -63
  73. package/src/data-structures/stack/stack.ts +3 -18
  74. package/src/data-structures/trie/trie.ts +7 -3
  75. package/src/types/data-structures/base/base.ts +17 -8
  76. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
  77. package/src/types/data-structures/binary-tree/binary-tree.ts +1 -0
  78. package/src/types/data-structures/binary-tree/bst.ts +1 -1
  79. package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -1
  80. package/src/types/data-structures/linked-list/doubly-linked-list.ts +2 -2
  81. package/src/types/data-structures/linked-list/singly-linked-list.ts +2 -2
  82. package/src/types/data-structures/queue/deque.ts +2 -3
  83. package/src/types/data-structures/queue/queue.ts +2 -2
  84. package/src/utils/utils.ts +2 -2
@@ -1,20 +1,12 @@
1
1
  import { ElementCallback, IterableElementBaseOptions, ReduceElementCallback } from '../../types';
2
- export declare abstract class IterableElementBase<E, R, C> {
2
+ export declare abstract class IterableElementBase<E, R> {
3
3
  /**
4
4
  * The protected constructor initializes the options for the IterableElementBase class, including the
5
5
  * toElementFn function.
6
6
  * @param [options] - An optional object that contains the following properties:
7
7
  */
8
8
  protected constructor(options?: IterableElementBaseOptions<E, R>);
9
- abstract get size(): number;
10
9
  protected _toElementFn?: (rawElement: R) => E;
11
- /**
12
- * The function returns the _toElementFn property, which is a function that converts a raw element to
13
- * a specific type.
14
- * @returns The function `get toElementFn()` is returning either a function that takes a raw element
15
- * `rawElement` of type `R` and returns an element `E`, or `undefined` if no function is assigned to
16
- * `_toElementFn`.
17
- */
18
10
  get toElementFn(): ((rawElement: R) => E) | undefined;
19
11
  /**
20
12
  * Time Complexity: O(n)
@@ -47,7 +39,7 @@ export declare abstract class IterableElementBase<E, R, C> {
47
39
  * @returns The `every` method is returning a boolean value. It returns `true` if every element in
48
40
  * the array satisfies the provided predicate function, and `false` otherwise.
49
41
  */
50
- every(predicate: ElementCallback<E, R, boolean, C>, thisArg?: any): boolean;
42
+ every(predicate: ElementCallback<E, R, boolean>, thisArg?: any): boolean;
51
43
  /**
52
44
  * Time Complexity: O(n)
53
45
  * Space Complexity: O(1)
@@ -62,7 +54,7 @@ export declare abstract class IterableElementBase<E, R, C> {
62
54
  * @returns a boolean value. It returns true if the predicate function returns true for any element
63
55
  * in the collection, and false otherwise.
64
56
  */
65
- some(predicate: ElementCallback<E, R, boolean, C>, thisArg?: any): boolean;
57
+ some(predicate: ElementCallback<E, R, boolean>, thisArg?: any): boolean;
66
58
  /**
67
59
  * Time Complexity: O(n)
68
60
  * Space Complexity: O(1)
@@ -76,24 +68,9 @@ export declare abstract class IterableElementBase<E, R, C> {
76
68
  * to be used as `this` when executing the `callbackfn` function. If `thisArg` is provided, it will
77
69
  * be passed as the `this` value to the `callbackfn` function. If `thisArg
78
70
  */
79
- forEach(callbackfn: ElementCallback<E, R, void, C>, thisArg?: any): void;
80
- /**
81
- * Time Complexity: O(n)
82
- * Space Complexity: O(1)
83
- *
84
- * The `find` function iterates over the elements of an array-like object and returns the first
85
- * element that satisfies the provided callback function.
86
- * @param callbackfn - The callbackfn parameter is a function that will be called for each element in
87
- * the array. It takes three arguments: the current element being processed, the index of the current
88
- * element, and the array itself. The function should return a boolean value indicating whether the
89
- * current element matches the desired condition.
90
- * @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
91
- * to be used as `this` when executing the `callbackfn` function. If `thisArg` is provided, it will
92
- * be passed as the `this` value to the `callbackfn` function. If `thisArg
93
- * @returns The `find` method returns the first element in the array that satisfies the provided
94
- * callback function. If no element satisfies the callback function, `undefined` is returned.
95
- */
96
- find(callbackfn: ElementCallback<E, R, boolean, C>, thisArg?: any): E | undefined;
71
+ forEach(callbackfn: ElementCallback<E, R, void>, thisArg?: any): void;
72
+ find<S extends E>(predicate: ElementCallback<E, R, S>, thisArg?: any): S | undefined;
73
+ find(predicate: ElementCallback<E, R, unknown>, thisArg?: any): E | undefined;
97
74
  /**
98
75
  * Time Complexity: O(n)
99
76
  * Space Complexity: O(1)
@@ -105,20 +82,17 @@ export declare abstract class IterableElementBase<E, R, C> {
105
82
  * otherwise.
106
83
  */
107
84
  has(element: E): boolean;
85
+ reduce(callbackfn: ReduceElementCallback<E, R>): E;
86
+ reduce(callbackfn: ReduceElementCallback<E, R>, initialValue: E): E;
87
+ reduce<U>(callbackfn: ReduceElementCallback<E, R, U>, initialValue: U): U;
108
88
  /**
109
89
  * Time Complexity: O(n)
110
- * Space Complexity: O(1)
90
+ * Space Complexity: O(n)
111
91
  *
112
- * The `reduce` function iterates over the elements of an array-like object and applies a callback
113
- * function to reduce them into a single value.
114
- * @param callbackfn - The callbackfn parameter is a function that will be called for each element in
115
- * the array. It takes four arguments:
116
- * @param {U} initialValue - The initialValue parameter is the initial value of the accumulator. It
117
- * is the value that the accumulator starts with before the reduction operation begins.
118
- * @returns The `reduce` method is returning the final value of the accumulator after iterating over
119
- * all the elements in the array and applying the callback function to each element.
92
+ * The `toArray` function converts a linked list into an array.
93
+ * @returns The `toArray()` method is returning an array of type `E[]`.
120
94
  */
121
- reduce<U>(callbackfn: ReduceElementCallback<E, R, U, C>, initialValue: U): U;
95
+ toArray(): E[];
122
96
  /**
123
97
  * Time Complexity: O(n)
124
98
  * Space Complexity: O(n)
@@ -135,7 +109,7 @@ export declare abstract class IterableElementBase<E, R, C> {
135
109
  print(): void;
136
110
  abstract isEmpty(): boolean;
137
111
  abstract clear(): void;
138
- abstract clone(): C;
112
+ abstract clone(): IterableElementBase<E, R>;
139
113
  abstract map(...args: any[]): any;
140
114
  abstract filter(...args: any[]): any;
141
115
  protected abstract _getIterator(...args: any[]): IterableIterator<E>;
@@ -16,13 +16,6 @@ class IterableElementBase {
16
16
  throw new TypeError('toElementFn must be a function type');
17
17
  }
18
18
  }
19
- /**
20
- * The function returns the _toElementFn property, which is a function that converts a raw element to
21
- * a specific type.
22
- * @returns The function `get toElementFn()` is returning either a function that takes a raw element
23
- * `rawElement` of type `R` and returns an element `E`, or `undefined` if no function is assigned to
24
- * `_toElementFn`.
25
- */
26
19
  get toElementFn() {
27
20
  return this._toElementFn;
28
21
  }
@@ -120,7 +113,7 @@ class IterableElementBase {
120
113
  *
121
114
  * The `find` function iterates over the elements of an array-like object and returns the first
122
115
  * element that satisfies the provided callback function.
123
- * @param callbackfn - The callbackfn parameter is a function that will be called for each element in
116
+ * @param predicate - The predicate parameter is a function that will be called for each element in
124
117
  * the array. It takes three arguments: the current element being processed, the index of the current
125
118
  * element, and the array itself. The function should return a boolean value indicating whether the
126
119
  * current element matches the desired condition.
@@ -130,10 +123,10 @@ class IterableElementBase {
130
123
  * @returns The `find` method returns the first element in the array that satisfies the provided
131
124
  * callback function. If no element satisfies the callback function, `undefined` is returned.
132
125
  */
133
- find(callbackfn, thisArg) {
126
+ find(predicate, thisArg) {
134
127
  let index = 0;
135
128
  for (const item of this) {
136
- if (callbackfn.call(thisArg, item, index++, this))
129
+ if (predicate.call(thisArg, item, index++, this))
137
130
  return item;
138
131
  }
139
132
  return;
@@ -169,13 +162,23 @@ class IterableElementBase {
169
162
  * all the elements in the array and applying the callback function to each element.
170
163
  */
171
164
  reduce(callbackfn, initialValue) {
172
- let accumulator = initialValue;
165
+ let accumulator = initialValue !== null && initialValue !== void 0 ? initialValue : 0;
173
166
  let index = 0;
174
167
  for (const item of this) {
175
168
  accumulator = callbackfn(accumulator, item, index++, this);
176
169
  }
177
170
  return accumulator;
178
171
  }
172
+ /**
173
+ * Time Complexity: O(n)
174
+ * Space Complexity: O(n)
175
+ *
176
+ * The `toArray` function converts a linked list into an array.
177
+ * @returns The `toArray()` method is returning an array of type `E[]`.
178
+ */
179
+ toArray() {
180
+ return [...this];
181
+ }
179
182
  /**
180
183
  * Time Complexity: O(n)
181
184
  * Space Complexity: O(n)
@@ -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
+ }