data-structure-typed 1.52.4 → 1.52.5

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 (181) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +13 -13
  3. package/README_zh-CN.md +216 -26
  4. package/benchmark/report.html +13 -13
  5. package/benchmark/report.json +158 -158
  6. package/dist/cjs/data-structures/base/iterable-element-base.d.ts +1 -37
  7. package/dist/cjs/data-structures/base/iterable-element-base.js +1 -37
  8. package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
  9. package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +2 -54
  10. package/dist/cjs/data-structures/base/iterable-entry-base.js +1 -49
  11. package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -1
  12. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
  13. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
  14. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
  16. package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -46
  17. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
  19. package/dist/cjs/data-structures/binary-tree/binary-tree.js +299 -331
  20. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/bst.d.ts +1 -40
  22. package/dist/cjs/data-structures/binary-tree/bst.js +12 -44
  23. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  24. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
  25. package/dist/cjs/data-structures/binary-tree/rb-tree.js +2 -50
  26. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
  27. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
  28. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +9 -41
  29. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  30. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -75
  31. package/dist/cjs/data-structures/graph/abstract-graph.js +0 -75
  32. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  33. package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -98
  34. package/dist/cjs/data-structures/graph/directed-graph.js +0 -98
  35. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  36. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -50
  37. package/dist/cjs/data-structures/graph/undirected-graph.js +0 -50
  38. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  39. package/dist/cjs/data-structures/hash/hash-map.d.ts +5 -92
  40. package/dist/cjs/data-structures/hash/hash-map.js +27 -111
  41. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  42. package/dist/cjs/data-structures/heap/heap.d.ts +0 -32
  43. package/dist/cjs/data-structures/heap/heap.js +0 -32
  44. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  45. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
  46. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +5 -88
  47. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  48. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
  49. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +2 -84
  50. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  51. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
  52. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +1 -35
  53. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
  54. package/dist/cjs/data-structures/queue/deque.d.ts +1 -98
  55. package/dist/cjs/data-structures/queue/deque.js +3 -99
  56. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  57. package/dist/cjs/data-structures/queue/queue.d.ts +1 -54
  58. package/dist/cjs/data-structures/queue/queue.js +0 -53
  59. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  60. package/dist/cjs/data-structures/stack/stack.d.ts +1 -34
  61. package/dist/cjs/data-structures/stack/stack.js +1 -34
  62. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  63. package/dist/cjs/data-structures/tree/tree.js +0 -1
  64. package/dist/cjs/data-structures/tree/tree.js.map +1 -1
  65. package/dist/cjs/data-structures/trie/trie.d.ts +0 -64
  66. package/dist/cjs/data-structures/trie/trie.js +0 -64
  67. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  68. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
  69. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +6 -0
  70. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -1
  71. package/dist/cjs/types/utils/utils.d.ts +13 -12
  72. package/dist/cjs/utils/number.d.ts +13 -0
  73. package/dist/cjs/utils/number.js +13 -0
  74. package/dist/cjs/utils/number.js.map +1 -1
  75. package/dist/cjs/utils/utils.d.ts +125 -3
  76. package/dist/cjs/utils/utils.js +177 -21
  77. package/dist/cjs/utils/utils.js.map +1 -1
  78. package/dist/mjs/data-structures/base/iterable-element-base.d.ts +1 -37
  79. package/dist/mjs/data-structures/base/iterable-element-base.js +1 -37
  80. package/dist/mjs/data-structures/base/iterable-entry-base.d.ts +2 -54
  81. package/dist/mjs/data-structures/base/iterable-entry-base.js +1 -49
  82. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -32
  83. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js +9 -41
  84. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -46
  85. package/dist/mjs/data-structures/binary-tree/avl-tree.js +0 -46
  86. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +82 -147
  87. package/dist/mjs/data-structures/binary-tree/binary-tree.js +298 -332
  88. package/dist/mjs/data-structures/binary-tree/bst.d.ts +1 -40
  89. package/dist/mjs/data-structures/binary-tree/bst.js +12 -44
  90. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +0 -48
  91. package/dist/mjs/data-structures/binary-tree/rb-tree.js +2 -50
  92. package/dist/mjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -32
  93. package/dist/mjs/data-structures/binary-tree/tree-multi-map.js +9 -41
  94. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +0 -75
  95. package/dist/mjs/data-structures/graph/abstract-graph.js +0 -75
  96. package/dist/mjs/data-structures/graph/directed-graph.d.ts +0 -98
  97. package/dist/mjs/data-structures/graph/directed-graph.js +0 -98
  98. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +0 -50
  99. package/dist/mjs/data-structures/graph/undirected-graph.js +0 -50
  100. package/dist/mjs/data-structures/hash/hash-map.d.ts +5 -92
  101. package/dist/mjs/data-structures/hash/hash-map.js +27 -111
  102. package/dist/mjs/data-structures/heap/heap.d.ts +0 -32
  103. package/dist/mjs/data-structures/heap/heap.js +0 -32
  104. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +5 -88
  105. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +5 -88
  106. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +1 -83
  107. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -84
  108. package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +1 -35
  109. package/dist/mjs/data-structures/linked-list/skip-linked-list.js +1 -35
  110. package/dist/mjs/data-structures/queue/deque.d.ts +1 -98
  111. package/dist/mjs/data-structures/queue/deque.js +3 -99
  112. package/dist/mjs/data-structures/queue/queue.d.ts +1 -54
  113. package/dist/mjs/data-structures/queue/queue.js +0 -53
  114. package/dist/mjs/data-structures/stack/stack.d.ts +1 -34
  115. package/dist/mjs/data-structures/stack/stack.js +1 -34
  116. package/dist/mjs/data-structures/tree/tree.js +0 -1
  117. package/dist/mjs/data-structures/trie/trie.d.ts +0 -64
  118. package/dist/mjs/data-structures/trie/trie.js +0 -64
  119. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +8 -0
  120. package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +5 -1
  121. package/dist/mjs/types/utils/utils.d.ts +13 -12
  122. package/dist/mjs/utils/number.d.ts +13 -0
  123. package/dist/mjs/utils/number.js +13 -0
  124. package/dist/mjs/utils/utils.d.ts +125 -3
  125. package/dist/mjs/utils/utils.js +177 -21
  126. package/dist/umd/data-structure-typed.js +408 -1474
  127. package/dist/umd/data-structure-typed.min.js +5 -4
  128. package/dist/umd/data-structure-typed.min.js.map +1 -1
  129. package/package.json +6 -6
  130. package/src/data-structures/base/iterable-element-base.ts +2 -42
  131. package/src/data-structures/base/iterable-entry-base.ts +3 -62
  132. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +8 -48
  133. package/src/data-structures/binary-tree/avl-tree.ts +0 -57
  134. package/src/data-structures/binary-tree/binary-tree.ts +329 -358
  135. package/src/data-structures/binary-tree/bst.ts +11 -54
  136. package/src/data-structures/binary-tree/rb-tree.ts +2 -62
  137. package/src/data-structures/binary-tree/tree-multi-map.ts +8 -48
  138. package/src/data-structures/graph/abstract-graph.ts +0 -92
  139. package/src/data-structures/graph/directed-graph.ts +0 -122
  140. package/src/data-structures/graph/undirected-graph.ts +0 -62
  141. package/src/data-structures/hash/hash-map.ts +29 -133
  142. package/src/data-structures/heap/heap.ts +0 -40
  143. package/src/data-structures/linked-list/doubly-linked-list.ts +5 -112
  144. package/src/data-structures/linked-list/singly-linked-list.ts +2 -104
  145. package/src/data-structures/linked-list/skip-linked-list.ts +1 -44
  146. package/src/data-structures/queue/deque.ts +2 -125
  147. package/src/data-structures/queue/queue.ts +1 -68
  148. package/src/data-structures/stack/stack.ts +1 -43
  149. package/src/data-structures/tree/tree.ts +1 -1
  150. package/src/data-structures/trie/trie.ts +0 -80
  151. package/src/types/data-structures/binary-tree/binary-tree.ts +8 -1
  152. package/src/types/utils/utils.ts +17 -15
  153. package/src/utils/number.ts +13 -0
  154. package/src/utils/utils.ts +174 -18
  155. package/test/config.ts +8 -0
  156. package/test/integration/all-in-one.test.ts +1 -1
  157. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +13 -13
  158. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +18 -13
  159. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +471 -64
  160. package/test/unit/data-structures/binary-tree/bst.test.ts +167 -23
  161. package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
  162. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +136 -13
  163. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +18 -13
  164. package/test/unit/data-structures/graph/directed-graph.test.ts +46 -32
  165. package/test/unit/data-structures/graph/map-graph.test.ts +24 -2
  166. package/test/unit/data-structures/graph/undirected-graph.test.ts +24 -24
  167. package/test/unit/data-structures/hash/hash-map.test.ts +225 -35
  168. package/test/unit/data-structures/heap/heap.test.ts +47 -39
  169. package/test/unit/data-structures/heap/min-heap.test.ts +5 -5
  170. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +34 -4
  171. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +32 -0
  172. package/test/unit/data-structures/matrix/matrix.test.ts +35 -5
  173. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +31 -0
  174. package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +18 -0
  175. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +17 -0
  176. package/test/unit/data-structures/queue/deque.test.ts +288 -47
  177. package/test/unit/data-structures/queue/queue.test.ts +62 -37
  178. package/test/unit/data-structures/stack/stack.test.ts +30 -5
  179. package/test/unit/data-structures/tree/tree.test.ts +58 -0
  180. package/test/unit/data-structures/trie/trie.test.ts +46 -5
  181. package/test/unit/utils/utils.test.ts +169 -0
@@ -96,10 +96,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
96
96
  * @return The last element in the array
97
97
  */
98
98
  get last(): E | undefined;
99
- /**
100
- * Time Complexity - Amortized O(1) (possible reallocation)
101
- * Space Complexity - O(n) (due to potential resizing).
102
- */
103
99
  /**
104
100
  * Time Complexity - Amortized O(1) (possible reallocation),
105
101
  * Space Complexity - O(n) (due to potential resizing).
@@ -110,10 +106,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
110
106
  * @returns The size of the data structure after the element has been pushed.
111
107
  */
112
108
  push(element: E): boolean;
113
- /**
114
- * Time Complexity: O(1)
115
- * Space Complexity: O(1)
116
- */
117
109
  /**
118
110
  * Time Complexity: O(1)
119
111
  * Space Complexity: O(1)
@@ -123,10 +115,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
123
115
  * @returns The element that was removed from the data structure is being returned.
124
116
  */
125
117
  pop(): E | undefined;
126
- /**
127
- * Time Complexity: Amortized O(1)
128
- * Space Complexity: O(n)
129
- */
130
118
  /**
131
119
  * Time Complexity: Amortized O(1)
132
120
  * Space Complexity: O(n)
@@ -138,10 +126,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
138
126
  * @returns The size of the data structure after the element has been added.
139
127
  */
140
128
  unshift(element: E): boolean;
141
- /**
142
- * Time Complexity: O(1)
143
- * Space Complexity: O(1)
144
- */
145
129
  /**
146
130
  * Time Complexity: O(1)
147
131
  * Space Complexity: O(1)
@@ -152,10 +136,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
152
136
  * returned.
153
137
  */
154
138
  shift(): E | undefined;
155
- /**
156
- * Time Complexity: O(1)
157
- * Space Complexity: O(1)
158
- */
159
139
  /**
160
140
  * Time Complexity: O(1)
161
141
  * Space Complexity: O(1)
@@ -164,10 +144,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
164
144
  * @returns A boolean value indicating whether the size of the object is 0 or not.
165
145
  */
166
146
  isEmpty(): boolean;
167
- /**
168
- * Time Complexity: O(1)
169
- * Space Complexity: O(1)
170
- */
171
147
  /**
172
148
  * Time Complexity: O(1)
173
149
  * Space Complexity: O(1)
@@ -185,10 +161,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
185
161
  * the last element.
186
162
  */
187
163
  reverseBegin(): Generator<E>;
188
- /**
189
- * Time Complexity: O(1)
190
- * Space Complexity: O(1)
191
- */
192
164
  /**
193
165
  * Time Complexity: O(1)
194
166
  * Space Complexity: O(1)
@@ -200,10 +172,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
200
172
  * @returns The element at the specified position in the data structure is being returned.
201
173
  */
202
174
  at(pos: number): E;
203
- /**
204
- * Time Complexity: O(1)
205
- * Space Complexity: O(1)
206
- */
207
175
  /**
208
176
  * Time Complexity: O(1)
209
177
  * Space Complexity: O(1)
@@ -215,10 +183,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
215
183
  * position in the data structure.
216
184
  */
217
185
  setAt(pos: number, element: E): boolean;
218
- /**
219
- * Time Complexity: O(n)
220
- * Space Complexity: O(n)
221
- */
222
186
  /**
223
187
  * Time Complexity: O(n)
224
188
  * Space Complexity: O(n)
@@ -235,10 +199,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
235
199
  * @returns The size of the array after the insertion is being returned.
236
200
  */
237
201
  addAt(pos: number, element: E, num?: number): boolean;
238
- /**
239
- * Time Complexity: O(1)
240
- * Space Complexity: O(1)
241
- */
242
202
  /**
243
203
  * Time Complexity: O(1)
244
204
  * Space Complexity: O(1)
@@ -251,10 +211,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
251
211
  * @returns The method is returning the updated size of the data structure.
252
212
  */
253
213
  cut(pos: number, isCutSelf?: boolean): Deque<E>;
254
- /**
255
- * Time Complexity: O(1)
256
- * Space Complexity: O(1) or O(n)
257
- */
258
214
  /**
259
215
  * Time Complexity: O(1)
260
216
  * Space Complexity: O(1) or O(n)
@@ -271,10 +227,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
271
227
  * (`newDeque`) depending on the value of the `isCutSelf` parameter.
272
228
  */
273
229
  cutRest(pos: number, isCutSelf?: boolean): Deque<E>;
274
- /**
275
- * Time Complexity: O(n)
276
- * Space Complexity: O(1) or O(n)
277
- */
278
230
  /**
279
231
  * Time Complexity: O(n)
280
232
  * Space Complexity: O(1) or O(n)
@@ -287,10 +239,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
287
239
  * @returns The size of the data structure after the deletion operation is performed.
288
240
  */
289
241
  deleteAt(pos: number): boolean;
290
- /**
291
- * Time Complexity: O(n)
292
- * Space Complexity: O(1)
293
- */
294
242
  /**
295
243
  * Time Complexity: O(n)
296
244
  * Space Complexity: O(1)
@@ -302,10 +250,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
302
250
  * @returns The size of the data structure after the element has been deleted.
303
251
  */
304
252
  delete(element: E): boolean;
305
- /**
306
- * Time Complexity: O(n)
307
- * Space Complexity: O(1)
308
- */
309
253
  /**
310
254
  * Time Complexity: O(n)
311
255
  * Space Complexity: O(1)
@@ -316,10 +260,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
316
260
  * operation on the buckets and updating the relevant properties.
317
261
  */
318
262
  reverse(): this;
319
- /**
320
- * Time Complexity: O(n)
321
- * Space Complexity: O(1)
322
- */
323
263
  /**
324
264
  * Time Complexity: O(n)
325
265
  * Space Complexity: O(1)
@@ -329,10 +269,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
329
269
  * @returns The size of the modified array is being returned.
330
270
  */
331
271
  unique(): this;
332
- /**
333
- * Time Complexity: O(n log n)
334
- * Space Complexity: O(n)
335
- */
336
272
  /**
337
273
  * Time Complexity: O(n log n)
338
274
  * Space Complexity: O(n)
@@ -344,10 +280,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
344
280
  * @returns Deque<E>
345
281
  */
346
282
  sort(comparator?: (x: E, y: E) => number): this;
347
- /**
348
- * Time Complexity: O(n)
349
- * Space Complexity: O(n)
350
- */
351
283
  /**
352
284
  * Time Complexity: O(n)
353
285
  * Space Complexity: O(n)
@@ -358,10 +290,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
358
290
  * `this.size` is 0, but it does not return any value.
359
291
  */
360
292
  shrinkToFit(): void;
361
- /**
362
- * Time Complexity: O(n)
363
- * Space Complexity: O(1)
364
- */
365
293
  /**
366
294
  * Time Complexity: O(n)
367
295
  * Space Complexity: O(1)
@@ -374,10 +302,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
374
302
  * in the data structure. If the element is not found, it returns -1.
375
303
  */
376
304
  indexOf(element: E): number;
377
- /**
378
- * Time Complexity: O(n)
379
- * Space Complexity: O(n)
380
- */
381
305
  /**
382
306
  * Time Complexity: O(n)
383
307
  * Space Complexity: O(n)
@@ -386,10 +310,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
386
310
  * @returns The `toArray()` method is returning an array of elements of type `E`.
387
311
  */
388
312
  toArray(): E[];
389
- /**
390
- * Time Complexity: O(n)
391
- * Space Complexity: O(n)
392
- */
393
313
  /**
394
314
  * Time Complexity: O(n)
395
315
  * Space Complexity: O(n)
@@ -400,10 +320,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
400
320
  * elements as the original deque (`this`) and the same bucket size.
401
321
  */
402
322
  clone(): Deque<E, R>;
403
- /**
404
- * Time Complexity: O(n)
405
- * Space Complexity: O(n)
406
- */
407
323
  /**
408
324
  * Time Complexity: O(n)
409
325
  * Space Complexity: O(n)
@@ -424,8 +340,7 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
424
340
  /**
425
341
  * Time Complexity: O(n)
426
342
  * Space Complexity: O(n)
427
- */
428
- /**
343
+ *
429
344
  * The `map` function takes a callback function and applies it to each element in the deque,
430
345
  * returning a new deque with the results.
431
346
  * @param callback - The callback parameter is a function that will be called for each element in the
@@ -441,10 +356,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
441
356
  * @returns a new Deque object with elements of type EM and raw elements of type RM.
442
357
  */
443
358
  map<EM, RM>(callback: ElementCallback<E, R, EM, Deque<E, R>>, toElementFn?: (rawElement: RM) => EM, thisArg?: any): Deque<EM, RM>;
444
- /**
445
- * Time Complexity: O(n)
446
- * Space Complexity: O(1)
447
- */
448
359
  /**
449
360
  * Time Complexity: O(n)
450
361
  * Space Complexity: O(1)
@@ -453,10 +364,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
453
364
  * object to be iterated over using a for...of loop.
454
365
  */
455
366
  protected _getIterator(): IterableIterator<E>;
456
- /**
457
- * Time Complexity: O(n)
458
- * Space Complexity: O(n)
459
- */
460
367
  /**
461
368
  * Time Complexity: O(n)
462
369
  * Space Complexity: O(n)
@@ -467,10 +374,6 @@ export declare class Deque<E = any, R = any> extends IterableElementBase<E, R, D
467
374
  * current bucket count (`this._bucketCount >> 1`) or 1 if the current bucket count is less than 2.
468
375
  */
469
376
  protected _reallocate(needBucketNum?: number): void;
470
- /**
471
- * Time Complexity: O(1)
472
- * Space Complexity: O(1)
473
- */
474
377
  /**
475
378
  * Time Complexity: O(1)
476
379
  * Space Complexity: O(1)
@@ -152,10 +152,6 @@ export class Deque extends IterableElementBase {
152
152
  return;
153
153
  return this._buckets[this._bucketLast][this._lastInBucket];
154
154
  }
155
- /**
156
- * Time Complexity - Amortized O(1) (possible reallocation)
157
- * Space Complexity - O(n) (due to potential resizing).
158
- */
159
155
  /**
160
156
  * Time Complexity - Amortized O(1) (possible reallocation),
161
157
  * Space Complexity - O(n) (due to potential resizing).
@@ -187,10 +183,6 @@ export class Deque extends IterableElementBase {
187
183
  this.shift();
188
184
  return true;
189
185
  }
190
- /**
191
- * Time Complexity: O(1)
192
- * Space Complexity: O(1)
193
- */
194
186
  /**
195
187
  * Time Complexity: O(1)
196
188
  * Space Complexity: O(1)
@@ -219,10 +211,6 @@ export class Deque extends IterableElementBase {
219
211
  this._size -= 1;
220
212
  return element;
221
213
  }
222
- /**
223
- * Time Complexity: Amortized O(1)
224
- * Space Complexity: O(n)
225
- */
226
214
  /**
227
215
  * Time Complexity: Amortized O(1)
228
216
  * Space Complexity: O(n)
@@ -255,10 +243,6 @@ export class Deque extends IterableElementBase {
255
243
  this.pop();
256
244
  return true;
257
245
  }
258
- /**
259
- * Time Complexity: O(1)
260
- * Space Complexity: O(1)
261
- */
262
246
  /**
263
247
  * Time Complexity: O(1)
264
248
  * Space Complexity: O(1)
@@ -288,10 +272,6 @@ export class Deque extends IterableElementBase {
288
272
  this._size -= 1;
289
273
  return element;
290
274
  }
291
- /**
292
- * Time Complexity: O(1)
293
- * Space Complexity: O(1)
294
- */
295
275
  /**
296
276
  * Time Complexity: O(1)
297
277
  * Space Complexity: O(1)
@@ -302,10 +282,6 @@ export class Deque extends IterableElementBase {
302
282
  isEmpty() {
303
283
  return this.size === 0;
304
284
  }
305
- /**
306
- * Time Complexity: O(1)
307
- * Space Complexity: O(1)
308
- */
309
285
  /**
310
286
  * Time Complexity: O(1)
311
287
  * Space Complexity: O(1)
@@ -340,10 +316,6 @@ export class Deque extends IterableElementBase {
340
316
  index--;
341
317
  }
342
318
  }
343
- /**
344
- * Time Complexity: O(1)
345
- * Space Complexity: O(1)
346
- */
347
319
  /**
348
320
  * Time Complexity: O(1)
349
321
  * Space Complexity: O(1)
@@ -359,10 +331,6 @@ export class Deque extends IterableElementBase {
359
331
  const { bucketIndex, indexInBucket } = this._getBucketAndPosition(pos);
360
332
  return this._buckets[bucketIndex][indexInBucket];
361
333
  }
362
- /**
363
- * Time Complexity: O(1)
364
- * Space Complexity: O(1)
365
- */
366
334
  /**
367
335
  * Time Complexity: O(1)
368
336
  * Space Complexity: O(1)
@@ -379,10 +347,6 @@ export class Deque extends IterableElementBase {
379
347
  this._buckets[bucketIndex][indexInBucket] = element;
380
348
  return true;
381
349
  }
382
- /**
383
- * Time Complexity: O(n)
384
- * Space Complexity: O(n)
385
- */
386
350
  /**
387
351
  * Time Complexity: O(n)
388
352
  * Space Complexity: O(n)
@@ -422,10 +386,6 @@ export class Deque extends IterableElementBase {
422
386
  }
423
387
  return true;
424
388
  }
425
- /**
426
- * Time Complexity: O(1)
427
- * Space Complexity: O(1)
428
- */
429
389
  /**
430
390
  * Time Complexity: O(1)
431
391
  * Space Complexity: O(1)
@@ -457,10 +417,6 @@ export class Deque extends IterableElementBase {
457
417
  return newDeque;
458
418
  }
459
419
  }
460
- /**
461
- * Time Complexity: O(1)
462
- * Space Complexity: O(1) or O(n)
463
- */
464
420
  /**
465
421
  * Time Complexity: O(1)
466
422
  * Space Complexity: O(1) or O(n)
@@ -479,7 +435,6 @@ export class Deque extends IterableElementBase {
479
435
  cutRest(pos, isCutSelf = false) {
480
436
  if (isCutSelf) {
481
437
  if (pos < 0) {
482
- this.clear();
483
438
  return this;
484
439
  }
485
440
  const { bucketIndex, indexInBucket } = this._getBucketAndPosition(pos);
@@ -490,16 +445,14 @@ export class Deque extends IterableElementBase {
490
445
  }
491
446
  else {
492
447
  const newDeque = new Deque([], { bucketSize: this._bucketSize });
448
+ if (pos < 0)
449
+ pos = 0;
493
450
  for (let i = pos; i < this.size; i++) {
494
451
  newDeque.push(this.at(i));
495
452
  }
496
453
  return newDeque;
497
454
  }
498
455
  }
499
- /**
500
- * Time Complexity: O(n)
501
- * Space Complexity: O(1) or O(n)
502
- */
503
456
  /**
504
457
  * Time Complexity: O(n)
505
458
  * Space Complexity: O(1) or O(n)
@@ -530,10 +483,6 @@ export class Deque extends IterableElementBase {
530
483
  }
531
484
  return true;
532
485
  }
533
- /**
534
- * Time Complexity: O(n)
535
- * Space Complexity: O(1)
536
- */
537
486
  /**
538
487
  * Time Complexity: O(n)
539
488
  * Space Complexity: O(1)
@@ -561,10 +510,6 @@ export class Deque extends IterableElementBase {
561
510
  this.cut(index - 1, true);
562
511
  return true;
563
512
  }
564
- /**
565
- * Time Complexity: O(n)
566
- * Space Complexity: O(1)
567
- */
568
513
  /**
569
514
  * Time Complexity: O(n)
570
515
  * Space Complexity: O(1)
@@ -585,10 +530,6 @@ export class Deque extends IterableElementBase {
585
530
  this._lastInBucket = this._bucketSize - _firstInBucket - 1;
586
531
  return this;
587
532
  }
588
- /**
589
- * Time Complexity: O(n)
590
- * Space Complexity: O(1)
591
- */
592
533
  /**
593
534
  * Time Complexity: O(n)
594
535
  * Space Complexity: O(1)
@@ -613,10 +554,6 @@ export class Deque extends IterableElementBase {
613
554
  this.cut(index - 1, true);
614
555
  return this;
615
556
  }
616
- /**
617
- * Time Complexity: O(n log n)
618
- * Space Complexity: O(n)
619
- */
620
557
  /**
621
558
  * Time Complexity: O(n log n)
622
559
  * Space Complexity: O(n)
@@ -638,10 +575,6 @@ export class Deque extends IterableElementBase {
638
575
  }
639
576
  return this;
640
577
  }
641
- /**
642
- * Time Complexity: O(n)
643
- * Space Complexity: O(n)
644
- */
645
578
  /**
646
579
  * Time Complexity: O(n)
647
580
  * Space Complexity: O(n)
@@ -674,10 +607,6 @@ export class Deque extends IterableElementBase {
674
607
  this._bucketLast = newBuckets.length - 1;
675
608
  this._buckets = newBuckets;
676
609
  }
677
- /**
678
- * Time Complexity: O(n)
679
- * Space Complexity: O(1)
680
- */
681
610
  /**
682
611
  * Time Complexity: O(n)
683
612
  * Space Complexity: O(1)
@@ -697,10 +626,6 @@ export class Deque extends IterableElementBase {
697
626
  }
698
627
  return -1;
699
628
  }
700
- /**
701
- * Time Complexity: O(n)
702
- * Space Complexity: O(n)
703
- */
704
629
  /**
705
630
  * Time Complexity: O(n)
706
631
  * Space Complexity: O(n)
@@ -711,10 +636,6 @@ export class Deque extends IterableElementBase {
711
636
  toArray() {
712
637
  return [...this];
713
638
  }
714
- /**
715
- * Time Complexity: O(n)
716
- * Space Complexity: O(n)
717
- */
718
639
  /**
719
640
  * Time Complexity: O(n)
720
641
  * Space Complexity: O(n)
@@ -727,10 +648,6 @@ export class Deque extends IterableElementBase {
727
648
  clone() {
728
649
  return new Deque(this, { bucketSize: this.bucketSize, toElementFn: this.toElementFn });
729
650
  }
730
- /**
731
- * Time Complexity: O(n)
732
- * Space Complexity: O(n)
733
- */
734
651
  /**
735
652
  * Time Complexity: O(n)
736
653
  * Space Complexity: O(n)
@@ -761,8 +678,7 @@ export class Deque extends IterableElementBase {
761
678
  /**
762
679
  * Time Complexity: O(n)
763
680
  * Space Complexity: O(n)
764
- */
765
- /**
681
+ *
766
682
  * The `map` function takes a callback function and applies it to each element in the deque,
767
683
  * returning a new deque with the results.
768
684
  * @param callback - The callback parameter is a function that will be called for each element in the
@@ -786,10 +702,6 @@ export class Deque extends IterableElementBase {
786
702
  }
787
703
  return newDeque;
788
704
  }
789
- /**
790
- * Time Complexity: O(n)
791
- * Space Complexity: O(1)
792
- */
793
705
  /**
794
706
  * Time Complexity: O(n)
795
707
  * Space Complexity: O(1)
@@ -802,10 +714,6 @@ export class Deque extends IterableElementBase {
802
714
  yield this.at(i);
803
715
  }
804
716
  }
805
- /**
806
- * Time Complexity: O(n)
807
- * Space Complexity: O(n)
808
- */
809
717
  /**
810
718
  * Time Complexity: O(n)
811
719
  * Space Complexity: O(n)
@@ -836,10 +744,6 @@ export class Deque extends IterableElementBase {
836
744
  this._buckets = newBuckets;
837
745
  this._bucketCount = newBuckets.length;
838
746
  }
839
- /**
840
- * Time Complexity: O(1)
841
- * Space Complexity: O(1)
842
- */
843
747
  /**
844
748
  * Time Complexity: O(1)
845
749
  * Space Complexity: O(1)
@@ -34,10 +34,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
34
34
  * @returns {number} The size of the array, which is the difference between the length of the array and the offset.
35
35
  */
36
36
  get size(): number;
37
- /**
38
- * Time Complexity: O(1)
39
- * Space Complexity: O(1)
40
- */
41
37
  /**
42
38
  * Time Complexity: O(1)
43
39
  * Space Complexity: O(1)
@@ -47,10 +43,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
47
43
  * the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
48
44
  */
49
45
  get first(): E | undefined;
50
- /**
51
- * Time Complexity: O(1)
52
- * Space Complexity: O(1)
53
- */
54
46
  /**
55
47
  * Time Complexity: O(1)
56
48
  * Space Complexity: O(1)
@@ -60,7 +52,7 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
60
52
  * array is empty, it returns `undefined`.
61
53
  */
62
54
  get last(): E | undefined;
63
- _autoCompactRatio: number;
55
+ protected _autoCompactRatio: number;
64
56
  /**
65
57
  * This function returns the value of the autoCompactRatio property.
66
58
  * @returns The `autoCompactRatio` property of the object, which is a number.
@@ -72,10 +64,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
72
64
  * `_autoCompactRatio` property.
73
65
  */
74
66
  set autoCompactRatio(v: number);
75
- /**
76
- * Time Complexity: O(n)
77
- * Space Complexity: O(n)
78
- */
79
67
  /**
80
68
  * Time Complexity: O(n)
81
69
  * Space Complexity: O(n)
@@ -87,10 +75,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
87
75
  * array.
88
76
  */
89
77
  static fromArray<E>(elements: E[]): Queue<E>;
90
- /**
91
- * Time Complexity: O(1)
92
- * Space Complexity: O(1)
93
- */
94
78
  /**
95
79
  * Time Complexity: O(1)
96
80
  * Space Complexity: O(1)
@@ -100,10 +84,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
100
84
  * @returns Always returns true, indicating the element was successfully added.
101
85
  */
102
86
  push(element: E): boolean;
103
- /**
104
- * Time Complexity: O(1)
105
- * Space Complexity: O(1)
106
- */
107
87
  /**
108
88
  * Time Complexity: O(1)
109
89
  * Space Complexity: O(1)
@@ -125,10 +105,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
125
105
  * @return A boolean value
126
106
  */
127
107
  deleteAt(index: number): boolean;
128
- /**
129
- * Time Complexity: O(1)
130
- * Space Complexity: O(1)
131
- */
132
108
  /**
133
109
  * Time Complexity: O(1)
134
110
  * Space Complexity: O(1)
@@ -136,10 +112,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
136
112
  * @param index
137
113
  */
138
114
  at(index: number): E | undefined;
139
- /**
140
- * Time Complexity: O(1)
141
- * Space Complexity: O(1)
142
- */
143
115
  /**
144
116
  * Time Complexity: O(1)
145
117
  * Space Complexity: O(1)
@@ -148,10 +120,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
148
120
  * @returns {boolean} A boolean value indicating whether the size of the object is 0 or not.
149
121
  */
150
122
  isEmpty(): boolean;
151
- /**
152
- * Time Complexity: O(1)
153
- * Space Complexity: O(n)
154
- */
155
123
  /**
156
124
  * Time Complexity: O(1)
157
125
  * Space Complexity: O(n)
@@ -160,10 +128,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
160
128
  * @returns An array of type E is being returned.
161
129
  */
162
130
  toArray(): E[];
163
- /**
164
- * Time Complexity: O(1)
165
- * Space Complexity: O(1)
166
- */
167
131
  /**
168
132
  * Time Complexity: O(1)
169
133
  * Space Complexity: O(1)
@@ -177,11 +141,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
177
141
  * @returns The `compact()` method is returning a boolean value of `true`.
178
142
  */
179
143
  compact(): boolean;
180
- /**
181
- * Time Complexity: O(n)
182
- * Space Complexity: O(n)
183
- * where n is the number of elements in the queue. It creates a shallow copy of the internal array. the space required is proportional to the number of elements in the queue.
184
- */
185
144
  /**
186
145
  * Time Complexity: O(n)
187
146
  * Space Complexity: O(n)
@@ -190,10 +149,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
190
149
  * @returns The `clone()` method is returning a new instance of the `Queue` class.
191
150
  */
192
151
  clone(): Queue<E, R>;
193
- /**
194
- * Time Complexity: O(n)
195
- * Space Complexity: O(n)
196
- */
197
152
  /**
198
153
  * Time Complexity: O(n)
199
154
  * Space Complexity: O(n)
@@ -216,10 +171,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
216
171
  * Space Complexity: O(n)
217
172
  */
218
173
  map<EM, RM>(callback: ElementCallback<E, R, EM, Queue<E, R>>, toElementFn?: (rawElement: RM) => EM, thisArg?: any): Queue<EM, RM>;
219
- /**
220
- * Time Complexity: O(n)
221
- * Space Complexity: O(n)
222
- */
223
174
  /**
224
175
  * Time Complexity: O(n)
225
176
  * Space Complexity: O(n)
@@ -235,10 +186,6 @@ export declare class Queue<E = any, R = any> extends IterableElementBase<E, R, Q
235
186
  * 4. Frequent Enqueuing and Dequeuing Operations: If your application involves frequent enqueuing and dequeuing operations and is less concerned with random access, then LinkedListQueue is a good choice.
236
187
  */
237
188
  export declare class LinkedListQueue<E = any, R = any> extends SinglyLinkedList<E, R> {
238
- /**
239
- * Time Complexity: O(n)
240
- * Space Complexity: O(n)
241
- */
242
189
  /**
243
190
  * Time Complexity: O(n)
244
191
  * Space Complexity: O(n)