max-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/max-priority-queue-typed.js +71 -0
- 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/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
|
|
|
@@ -234,6 +234,35 @@ var maxPriorityQueueTyped = (() => {
|
|
|
234
234
|
for (const ele of this) if (ele === element) return true;
|
|
235
235
|
return false;
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Check whether a value exists (Array-compatible alias for `has`).
|
|
239
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
240
|
+
* @param element - Element to search for (uses `===`).
|
|
241
|
+
* @returns `true` if found.
|
|
242
|
+
*/
|
|
243
|
+
includes(element) {
|
|
244
|
+
return this.has(element);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
248
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
249
|
+
*/
|
|
250
|
+
*entries() {
|
|
251
|
+
let index = 0;
|
|
252
|
+
for (const value of this) {
|
|
253
|
+
yield [index++, value];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Return an iterator of numeric indices (Array-compatible).
|
|
258
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
259
|
+
*/
|
|
260
|
+
*keys() {
|
|
261
|
+
let index = 0;
|
|
262
|
+
for (const _ of this) {
|
|
263
|
+
yield index++;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
237
266
|
/**
|
|
238
267
|
* Reduces all elements to a single accumulated value.
|
|
239
268
|
*
|
|
@@ -380,6 +409,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
380
409
|
|
|
381
410
|
|
|
382
411
|
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
383
415
|
|
|
384
416
|
|
|
385
417
|
|
|
@@ -471,6 +503,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
471
503
|
|
|
472
504
|
|
|
473
505
|
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
474
509
|
|
|
475
510
|
|
|
476
511
|
|
|
@@ -532,6 +567,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
532
567
|
|
|
533
568
|
|
|
534
569
|
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
535
573
|
|
|
536
574
|
|
|
537
575
|
|
|
@@ -626,6 +664,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
626
664
|
*/
|
|
627
665
|
/**
|
|
628
666
|
* @deprecated Use `pop` instead. Will be removed in a future major version.
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
629
670
|
* @example
|
|
630
671
|
* // Heap with custom comparator (MaxHeap behavior)
|
|
631
672
|
* interface Task {
|
|
@@ -709,6 +750,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
709
750
|
|
|
710
751
|
|
|
711
752
|
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
712
756
|
|
|
713
757
|
|
|
714
758
|
|
|
@@ -813,6 +857,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
813
857
|
|
|
814
858
|
|
|
815
859
|
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
816
863
|
|
|
817
864
|
|
|
818
865
|
|
|
@@ -864,6 +911,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
864
911
|
|
|
865
912
|
|
|
866
913
|
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
867
917
|
|
|
868
918
|
|
|
869
919
|
|
|
@@ -908,6 +958,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
908
958
|
|
|
909
959
|
|
|
910
960
|
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
|
|
911
964
|
|
|
912
965
|
|
|
913
966
|
|
|
@@ -959,6 +1012,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
959
1012
|
|
|
960
1013
|
|
|
961
1014
|
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
|
|
962
1018
|
|
|
963
1019
|
|
|
964
1020
|
|
|
@@ -1062,6 +1118,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
1062
1118
|
|
|
1063
1119
|
|
|
1064
1120
|
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
|
|
1065
1124
|
|
|
1066
1125
|
|
|
1067
1126
|
|
|
@@ -1146,6 +1205,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
1146
1205
|
|
|
1147
1206
|
|
|
1148
1207
|
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1149
1211
|
|
|
1150
1212
|
|
|
1151
1213
|
|
|
@@ -1203,6 +1265,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
1203
1265
|
|
|
1204
1266
|
|
|
1205
1267
|
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1206
1271
|
|
|
1207
1272
|
|
|
1208
1273
|
|
|
@@ -1259,6 +1324,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
1259
1324
|
|
|
1260
1325
|
|
|
1261
1326
|
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1262
1330
|
|
|
1263
1331
|
|
|
1264
1332
|
|
|
@@ -1322,6 +1390,9 @@ var maxPriorityQueueTyped = (() => {
|
|
|
1322
1390
|
|
|
1323
1391
|
|
|
1324
1392
|
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
|
|
1325
1396
|
|
|
1326
1397
|
|
|
1327
1398
|
|