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
package/dist/esm/index.mjs
CHANGED
|
@@ -208,6 +208,35 @@ var IterableElementBase = class {
|
|
|
208
208
|
for (const ele of this) if (ele === element) return true;
|
|
209
209
|
return false;
|
|
210
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Check whether a value exists (Array-compatible alias for `has`).
|
|
213
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1).
|
|
214
|
+
* @param element - Element to search for (uses `===`).
|
|
215
|
+
* @returns `true` if found.
|
|
216
|
+
*/
|
|
217
|
+
includes(element) {
|
|
218
|
+
return this.has(element);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Return an iterator of `[index, value]` pairs (Array-compatible).
|
|
222
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
223
|
+
*/
|
|
224
|
+
*entries() {
|
|
225
|
+
let index = 0;
|
|
226
|
+
for (const value of this) {
|
|
227
|
+
yield [index++, value];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Return an iterator of numeric indices (Array-compatible).
|
|
232
|
+
* @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
|
|
233
|
+
*/
|
|
234
|
+
*keys() {
|
|
235
|
+
let index = 0;
|
|
236
|
+
for (const _ of this) {
|
|
237
|
+
yield index++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
211
240
|
/**
|
|
212
241
|
* Reduces all elements to a single accumulated value.
|
|
213
242
|
*
|
|
@@ -348,6 +377,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
348
377
|
|
|
349
378
|
|
|
350
379
|
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
351
383
|
|
|
352
384
|
|
|
353
385
|
|
|
@@ -438,6 +470,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
438
470
|
|
|
439
471
|
|
|
440
472
|
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
441
476
|
|
|
442
477
|
|
|
443
478
|
|
|
@@ -499,6 +534,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
499
534
|
|
|
500
535
|
|
|
501
536
|
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
502
540
|
|
|
503
541
|
|
|
504
542
|
|
|
@@ -593,6 +631,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
593
631
|
*/
|
|
594
632
|
/**
|
|
595
633
|
* @deprecated Use `pop` instead. Will be removed in a future major version.
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
596
637
|
* @example
|
|
597
638
|
* // Heap with custom comparator (MaxHeap behavior)
|
|
598
639
|
* interface Task {
|
|
@@ -676,6 +717,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
676
717
|
|
|
677
718
|
|
|
678
719
|
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
679
723
|
|
|
680
724
|
|
|
681
725
|
|
|
@@ -780,6 +824,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
780
824
|
|
|
781
825
|
|
|
782
826
|
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
783
830
|
|
|
784
831
|
|
|
785
832
|
|
|
@@ -831,6 +878,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
831
878
|
|
|
832
879
|
|
|
833
880
|
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
834
884
|
|
|
835
885
|
|
|
836
886
|
|
|
@@ -875,6 +925,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
875
925
|
|
|
876
926
|
|
|
877
927
|
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
878
931
|
|
|
879
932
|
|
|
880
933
|
|
|
@@ -926,6 +979,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
926
979
|
|
|
927
980
|
|
|
928
981
|
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
929
985
|
|
|
930
986
|
|
|
931
987
|
|
|
@@ -1029,6 +1085,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
1029
1085
|
|
|
1030
1086
|
|
|
1031
1087
|
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1032
1091
|
|
|
1033
1092
|
|
|
1034
1093
|
|
|
@@ -1113,6 +1172,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
1113
1172
|
|
|
1114
1173
|
|
|
1115
1174
|
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1116
1178
|
|
|
1117
1179
|
|
|
1118
1180
|
|
|
@@ -1170,6 +1232,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
1170
1232
|
|
|
1171
1233
|
|
|
1172
1234
|
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1173
1238
|
|
|
1174
1239
|
|
|
1175
1240
|
|
|
@@ -1226,6 +1291,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
1226
1291
|
|
|
1227
1292
|
|
|
1228
1293
|
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1229
1297
|
|
|
1230
1298
|
|
|
1231
1299
|
|
|
@@ -1289,6 +1357,9 @@ var Heap = class _Heap extends IterableElementBase {
|
|
|
1289
1357
|
|
|
1290
1358
|
|
|
1291
1359
|
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1292
1363
|
|
|
1293
1364
|
|
|
1294
1365
|
|