priority-queue-typed 2.5.3 → 2.6.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.
- package/dist/cjs/index.cjs +71 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +71 -0
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +71 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +71 -0
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
- package/dist/types/data-structures/base/linear-base.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
- package/dist/types/data-structures/heap/heap.d.ts +42 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
- package/dist/types/data-structures/queue/deque.d.ts +90 -1
- package/dist/types/data-structures/queue/queue.d.ts +36 -0
- package/dist/types/data-structures/stack/stack.d.ts +30 -0
- package/dist/types/data-structures/trie/trie.d.ts +36 -0
- package/dist/umd/priority-queue-typed.js +71 -0
- package/dist/umd/priority-queue-typed.js.map +1 -1
- package/dist/umd/priority-queue-typed.min.js +1 -1
- package/dist/umd/priority-queue-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +32 -0
- package/src/data-structures/base/linear-base.ts +11 -0
- package/src/data-structures/binary-tree/avl-tree.ts +36 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +42 -0
- package/src/data-structures/binary-tree/binary-tree.ts +75 -0
- package/src/data-structures/binary-tree/bst.ts +72 -0
- package/src/data-structures/binary-tree/red-black-tree.ts +57 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +375 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +392 -0
- package/src/data-structures/binary-tree/tree-multi-set.ts +336 -0
- package/src/data-structures/binary-tree/tree-set.ts +492 -0
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +33 -0
- package/src/data-structures/heap/heap.ts +42 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +90 -2
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +54 -0
- package/src/data-structures/matrix/matrix.ts +24 -0
- package/src/data-structures/queue/deque.ts +103 -1
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +36 -0
|
@@ -253,6 +253,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
253
253
|
|
|
254
254
|
|
|
255
255
|
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
256
259
|
|
|
257
260
|
|
|
258
261
|
|
|
@@ -311,6 +314,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
311
314
|
|
|
312
315
|
|
|
313
316
|
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
314
320
|
|
|
315
321
|
|
|
316
322
|
|
|
@@ -364,6 +370,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
364
370
|
|
|
365
371
|
|
|
366
372
|
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
367
376
|
|
|
368
377
|
|
|
369
378
|
|
|
@@ -413,6 +422,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
413
422
|
|
|
414
423
|
|
|
415
424
|
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
416
428
|
|
|
417
429
|
|
|
418
430
|
|
|
@@ -461,6 +473,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
461
473
|
|
|
462
474
|
|
|
463
475
|
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
464
479
|
|
|
465
480
|
|
|
466
481
|
|
|
@@ -512,6 +527,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
512
527
|
|
|
513
528
|
|
|
514
529
|
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
515
533
|
|
|
516
534
|
|
|
517
535
|
|
|
@@ -588,6 +606,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
588
606
|
|
|
589
607
|
|
|
590
608
|
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
591
612
|
|
|
592
613
|
|
|
593
614
|
|
|
@@ -647,6 +668,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
647
668
|
|
|
648
669
|
|
|
649
670
|
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
650
674
|
|
|
651
675
|
|
|
652
676
|
|
|
@@ -700,6 +724,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
700
724
|
|
|
701
725
|
|
|
702
726
|
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
703
730
|
|
|
704
731
|
|
|
705
732
|
|
|
@@ -753,6 +780,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
753
780
|
|
|
754
781
|
|
|
755
782
|
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
756
786
|
|
|
757
787
|
|
|
758
788
|
|
|
@@ -803,6 +833,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
803
833
|
|
|
804
834
|
|
|
805
835
|
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
806
839
|
|
|
807
840
|
|
|
808
841
|
|
|
@@ -848,6 +881,9 @@ export declare class Trie<R = any> extends IterableElementBase<string, R> {
|
|
|
848
881
|
|
|
849
882
|
|
|
850
883
|
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
851
887
|
|
|
852
888
|
|
|
853
889
|
|
|
@@ -237,6 +237,35 @@ var priorityQueueTyped = (() => {
|
|
|
237
237
|
for (const ele of this) if (ele === element) return true;
|
|
238
238
|
return false;
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Check whether a value exists (Array-compatible alias for `has`).
|
|
242
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
243
|
+
* @param element - Element to search for (uses `===`).
|
|
244
|
+
* @returns `true` if found.
|
|
245
|
+
*/
|
|
246
|
+
includes(element) {
|
|
247
|
+
return this.has(element);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
251
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
252
|
+
*/
|
|
253
|
+
*entries() {
|
|
254
|
+
let index = 0;
|
|
255
|
+
for (const value of this) {
|
|
256
|
+
yield [index++, value];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Return an iterator of numeric indices (Array-compatible).
|
|
261
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
262
|
+
*/
|
|
263
|
+
*keys() {
|
|
264
|
+
let index = 0;
|
|
265
|
+
for (const _ of this) {
|
|
266
|
+
yield index++;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
240
269
|
/**
|
|
241
270
|
* Reduces all elements to a single accumulated value.
|
|
242
271
|
*
|
|
@@ -383,6 +412,9 @@ var priorityQueueTyped = (() => {
|
|
|
383
412
|
|
|
384
413
|
|
|
385
414
|
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
386
418
|
|
|
387
419
|
|
|
388
420
|
|
|
@@ -474,6 +506,9 @@ var priorityQueueTyped = (() => {
|
|
|
474
506
|
|
|
475
507
|
|
|
476
508
|
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
477
512
|
|
|
478
513
|
|
|
479
514
|
|
|
@@ -535,6 +570,9 @@ var priorityQueueTyped = (() => {
|
|
|
535
570
|
|
|
536
571
|
|
|
537
572
|
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
538
576
|
|
|
539
577
|
|
|
540
578
|
|
|
@@ -629,6 +667,9 @@ var priorityQueueTyped = (() => {
|
|
|
629
667
|
*/
|
|
630
668
|
/**
|
|
631
669
|
* @deprecated Use `pop` instead. Will be removed in a future major version.
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
632
673
|
* @example
|
|
633
674
|
* // Heap with custom comparator (MaxHeap behavior)
|
|
634
675
|
* interface Task {
|
|
@@ -712,6 +753,9 @@ var priorityQueueTyped = (() => {
|
|
|
712
753
|
|
|
713
754
|
|
|
714
755
|
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
715
759
|
|
|
716
760
|
|
|
717
761
|
|
|
@@ -816,6 +860,9 @@ var priorityQueueTyped = (() => {
|
|
|
816
860
|
|
|
817
861
|
|
|
818
862
|
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
819
866
|
|
|
820
867
|
|
|
821
868
|
|
|
@@ -867,6 +914,9 @@ var priorityQueueTyped = (() => {
|
|
|
867
914
|
|
|
868
915
|
|
|
869
916
|
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
870
920
|
|
|
871
921
|
|
|
872
922
|
|
|
@@ -911,6 +961,9 @@ var priorityQueueTyped = (() => {
|
|
|
911
961
|
|
|
912
962
|
|
|
913
963
|
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
914
967
|
|
|
915
968
|
|
|
916
969
|
|
|
@@ -962,6 +1015,9 @@ var priorityQueueTyped = (() => {
|
|
|
962
1015
|
|
|
963
1016
|
|
|
964
1017
|
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
965
1021
|
|
|
966
1022
|
|
|
967
1023
|
|
|
@@ -1065,6 +1121,9 @@ var priorityQueueTyped = (() => {
|
|
|
1065
1121
|
|
|
1066
1122
|
|
|
1067
1123
|
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1068
1127
|
|
|
1069
1128
|
|
|
1070
1129
|
|
|
@@ -1149,6 +1208,9 @@ var priorityQueueTyped = (() => {
|
|
|
1149
1208
|
|
|
1150
1209
|
|
|
1151
1210
|
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1152
1214
|
|
|
1153
1215
|
|
|
1154
1216
|
|
|
@@ -1206,6 +1268,9 @@ var priorityQueueTyped = (() => {
|
|
|
1206
1268
|
|
|
1207
1269
|
|
|
1208
1270
|
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1209
1274
|
|
|
1210
1275
|
|
|
1211
1276
|
|
|
@@ -1262,6 +1327,9 @@ var priorityQueueTyped = (() => {
|
|
|
1262
1327
|
|
|
1263
1328
|
|
|
1264
1329
|
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
|
|
1265
1333
|
|
|
1266
1334
|
|
|
1267
1335
|
|
|
@@ -1325,6 +1393,9 @@ var priorityQueueTyped = (() => {
|
|
|
1325
1393
|
|
|
1326
1394
|
|
|
1327
1395
|
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
|
|
1328
1399
|
|
|
1329
1400
|
|
|
1330
1401
|
|