max-priority-queue-typed 2.5.0 → 2.5.2
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.
- package/dist/cjs/index.cjs +398 -55
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +397 -54
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +398 -56
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +397 -55
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
- package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
- package/dist/types/data-structures/heap/heap.d.ts +336 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
- package/dist/types/data-structures/queue/deque.d.ts +364 -4
- package/dist/types/data-structures/queue/queue.d.ts +288 -0
- package/dist/types/data-structures/stack/stack.d.ts +240 -0
- package/dist/types/data-structures/trie/trie.d.ts +292 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/max-priority-queue-typed.js +395 -53
- package/dist/umd/max-priority-queue-typed.js.map +1 -1
- package/dist/umd/max-priority-queue-typed.min.js +1 -1
- package/dist/umd/max-priority-queue-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +299 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +341 -5
- package/src/data-structures/binary-tree/binary-tree.ts +606 -6
- package/src/data-structures/binary-tree/bst.ts +946 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +472 -0
- package/src/data-structures/binary-tree/segment-tree.ts +145 -2
- package/src/data-structures/binary-tree/tree-map.ts +3423 -499
- package/src/data-structures/binary-tree/tree-multi-map.ts +3537 -596
- package/src/data-structures/binary-tree/tree-multi-set.ts +2855 -495
- package/src/data-structures/binary-tree/tree-set.ts +3209 -413
- package/src/data-structures/graph/abstract-graph.ts +6 -6
- package/src/data-structures/graph/directed-graph.ts +240 -0
- package/src/data-structures/graph/undirected-graph.ts +216 -0
- package/src/data-structures/hash/hash-map.ts +281 -19
- package/src/data-structures/heap/heap.ts +340 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +411 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +363 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +439 -7
- package/src/data-structures/matrix/matrix.ts +202 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +365 -5
- package/src/data-structures/queue/queue.ts +288 -0
- package/src/data-structures/stack/stack.ts +240 -0
- package/src/data-structures/trie/trie.ts +295 -7
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
|
@@ -153,6 +153,30 @@ export declare class Matrix {
|
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
156
180
|
* @example
|
|
157
181
|
* // Get and set individual cells
|
|
158
182
|
* const m = new Matrix([
|
|
@@ -193,6 +217,30 @@ export declare class Matrix {
|
|
|
193
217
|
|
|
194
218
|
|
|
195
219
|
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
196
244
|
* @example
|
|
197
245
|
* // Modify individual cells
|
|
198
246
|
* const m = Matrix.zeros(2, 2);
|
|
@@ -225,6 +273,30 @@ export declare class Matrix {
|
|
|
225
273
|
|
|
226
274
|
|
|
227
275
|
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
228
300
|
* @example
|
|
229
301
|
* // Basic matrix arithmetic
|
|
230
302
|
* const a = new Matrix([
|
|
@@ -266,6 +338,30 @@ export declare class Matrix {
|
|
|
266
338
|
|
|
267
339
|
|
|
268
340
|
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
269
365
|
* @example
|
|
270
366
|
* // Element-wise subtraction
|
|
271
367
|
* const a = Matrix.from([[5, 6], [7, 8]]);
|
|
@@ -290,6 +386,30 @@ export declare class Matrix {
|
|
|
290
386
|
|
|
291
387
|
|
|
292
388
|
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
293
413
|
* @example
|
|
294
414
|
* // Matrix multiplication for transformations
|
|
295
415
|
* // 2x3 matrix * 3x2 matrix = 2x2 matrix
|
|
@@ -329,6 +449,30 @@ export declare class Matrix {
|
|
|
329
449
|
|
|
330
450
|
|
|
331
451
|
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
332
476
|
* @example
|
|
333
477
|
* // Matrix transpose (square matrix)
|
|
334
478
|
* const m = new Matrix([
|
|
@@ -364,6 +508,30 @@ export declare class Matrix {
|
|
|
364
508
|
|
|
365
509
|
|
|
366
510
|
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
367
535
|
* @example
|
|
368
536
|
* // Compute the inverse of a 2x2 matrix
|
|
369
537
|
* const m = Matrix.from([[4, 7], [2, 6]]);
|
|
@@ -392,6 +560,30 @@ export declare class Matrix {
|
|
|
392
560
|
|
|
393
561
|
|
|
394
562
|
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
395
587
|
* @example
|
|
396
588
|
* // Dot product of two matrices
|
|
397
589
|
* const a = Matrix.from([[1, 2], [3, 4]]);
|
|
@@ -177,6 +177,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
180
204
|
* @example
|
|
181
205
|
* // Deque peek at both ends
|
|
182
206
|
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
@@ -208,6 +232,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
208
232
|
|
|
209
233
|
|
|
210
234
|
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
211
259
|
* @example
|
|
212
260
|
* // Peek at the back element
|
|
213
261
|
* const dq = new Deque<string>(['a', 'b', 'c']);
|
|
@@ -242,6 +290,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
242
290
|
|
|
243
291
|
|
|
244
292
|
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
245
317
|
* @example
|
|
246
318
|
* // basic Deque creation and push/pop operations
|
|
247
319
|
* // Create a simple Deque with initial values
|
|
@@ -277,6 +349,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
277
349
|
|
|
278
350
|
|
|
279
351
|
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
280
376
|
* @example
|
|
281
377
|
* // Remove from the back
|
|
282
378
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -299,6 +395,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
299
395
|
|
|
300
396
|
|
|
301
397
|
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
302
422
|
* @example
|
|
303
423
|
* // Remove from the front
|
|
304
424
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -322,6 +442,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
322
442
|
|
|
323
443
|
|
|
324
444
|
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
325
469
|
* @example
|
|
326
470
|
* // Deque shift and unshift operations
|
|
327
471
|
* const deque = new Deque<number>([20, 30, 40]);
|
|
@@ -366,6 +510,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
366
510
|
|
|
367
511
|
|
|
368
512
|
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
369
537
|
* @example
|
|
370
538
|
* // Check if empty
|
|
371
539
|
* const dq = new Deque();
|
|
@@ -385,6 +553,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
385
553
|
|
|
386
554
|
|
|
387
555
|
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
388
580
|
* @example
|
|
389
581
|
* // Remove all elements
|
|
390
582
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -405,6 +597,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
405
597
|
|
|
406
598
|
|
|
407
599
|
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
408
624
|
* @example
|
|
409
625
|
* // Access by index
|
|
410
626
|
* const dq = new Deque<string>(['a', 'b', 'c']);
|
|
@@ -474,6 +690,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
474
690
|
|
|
475
691
|
|
|
476
692
|
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
477
717
|
* @example
|
|
478
718
|
* // Remove element
|
|
479
719
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -510,6 +750,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
510
750
|
|
|
511
751
|
|
|
512
752
|
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
|
|
513
777
|
* @example
|
|
514
778
|
* // Deque for...of iteration and reverse
|
|
515
779
|
* const deque = new Deque<string>(['A', 'B', 'C', 'D']);
|
|
@@ -564,6 +828,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
564
828
|
|
|
565
829
|
|
|
566
830
|
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
567
855
|
* @example
|
|
568
856
|
* // Reclaim memory
|
|
569
857
|
* const dq = new Deque<number>([1, 2, 3, 4, 5]);
|
|
@@ -587,6 +875,30 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
587
875
|
|
|
588
876
|
|
|
589
877
|
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
590
902
|
* @example
|
|
591
903
|
* // Create independent copy
|
|
592
904
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
@@ -611,13 +923,37 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
611
923
|
|
|
612
924
|
|
|
613
925
|
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
614
950
|
* @example
|
|
615
951
|
* // Filter elements
|
|
616
952
|
* const dq = new Deque<number>([1, 2, 3, 4]);
|
|
617
953
|
* const result = dq.filter(x => x > 2);
|
|
618
954
|
* console.log(result.length); // 2;
|
|
619
955
|
*/
|
|
620
|
-
filter(predicate: ElementCallback<E, R, boolean>, thisArg?:
|
|
956
|
+
filter(predicate: ElementCallback<E, R, boolean>, thisArg?: unknown): this;
|
|
621
957
|
/**
|
|
622
958
|
* Map elements into a new deque of the same element type.
|
|
623
959
|
* @remarks Time O(N), Space O(N)
|
|
@@ -625,7 +961,7 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
625
961
|
* @param [thisArg] - Value for `this` inside the callback.
|
|
626
962
|
* @returns A new deque with mapped values.
|
|
627
963
|
*/
|
|
628
|
-
mapSame(callback: ElementCallback<E, R, E>, thisArg?:
|
|
964
|
+
mapSame(callback: ElementCallback<E, R, E>, thisArg?: unknown): this;
|
|
629
965
|
/**
|
|
630
966
|
* Map elements into a new deque (possibly different element type).
|
|
631
967
|
* @remarks Time O(N), Space O(N)
|
|
@@ -643,13 +979,37 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
643
979
|
|
|
644
980
|
|
|
645
981
|
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
646
1006
|
* @example
|
|
647
1007
|
* // Transform elements
|
|
648
1008
|
* const dq = new Deque<number>([1, 2, 3]);
|
|
649
1009
|
* const result = dq.map(x => x * 10);
|
|
650
1010
|
* console.log(result.toArray()); // [10, 20, 30];
|
|
651
1011
|
*/
|
|
652
|
-
map<EM, RM>(callback: ElementCallback<E, R, EM>, options?: IterableElementBaseOptions<EM, RM>, thisArg?:
|
|
1012
|
+
map<EM, RM>(callback: ElementCallback<E, R, EM>, options?: IterableElementBaseOptions<EM, RM>, thisArg?: unknown): Deque<EM, RM>;
|
|
653
1013
|
/**
|
|
654
1014
|
* (Protected) Set the internal bucket size.
|
|
655
1015
|
* @remarks Time O(1), Space O(1)
|
|
@@ -696,7 +1056,7 @@ export declare class Deque<E = any, R = any> extends LinearBase<E, R> {
|
|
|
696
1056
|
* @param [options] - Options forwarded to the constructor.
|
|
697
1057
|
* @returns A like-kind Deque instance.
|
|
698
1058
|
*/
|
|
699
|
-
protected _createLike<T = E, RR = R>(elements?: IterableWithSizeOrLength<T> | IterableWithSizeOrLength<RR>, options?: DequeOptions<T, RR>):
|
|
1059
|
+
protected _createLike<T = E, RR = R>(elements?: IterableWithSizeOrLength<T> | IterableWithSizeOrLength<RR>, options?: DequeOptions<T, RR>): Deque<T, RR>;
|
|
700
1060
|
/**
|
|
701
1061
|
* (Protected) Iterate elements from back to front.
|
|
702
1062
|
* @remarks Time O(N), Space O(1)
|