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.
Files changed (61) hide show
  1. package/dist/cjs/index.cjs +71 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +71 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +71 -0
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +71 -0
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/base/iterable-element-base.d.ts +17 -0
  10. package/dist/types/data-structures/base/linear-base.d.ts +6 -0
  11. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +36 -0
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +42 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +75 -0
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +72 -0
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +57 -0
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +18 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +375 -0
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +389 -0
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +330 -0
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +438 -0
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +30 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +27 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +33 -0
  24. package/dist/types/data-structures/heap/heap.d.ts +42 -0
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +75 -2
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +45 -0
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +54 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +24 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +90 -1
  30. package/dist/types/data-structures/queue/queue.d.ts +36 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +30 -0
  32. package/dist/types/data-structures/trie/trie.d.ts +36 -0
  33. package/dist/umd/priority-queue-typed.js +71 -0
  34. package/dist/umd/priority-queue-typed.js.map +1 -1
  35. package/dist/umd/priority-queue-typed.min.js +1 -1
  36. package/dist/umd/priority-queue-typed.min.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/data-structures/base/iterable-element-base.ts +32 -0
  39. package/src/data-structures/base/linear-base.ts +11 -0
  40. package/src/data-structures/binary-tree/avl-tree.ts +36 -0
  41. package/src/data-structures/binary-tree/binary-indexed-tree.ts +42 -0
  42. package/src/data-structures/binary-tree/binary-tree.ts +75 -0
  43. package/src/data-structures/binary-tree/bst.ts +72 -0
  44. package/src/data-structures/binary-tree/red-black-tree.ts +57 -0
  45. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  46. package/src/data-structures/binary-tree/tree-map.ts +375 -0
  47. package/src/data-structures/binary-tree/tree-multi-map.ts +392 -0
  48. package/src/data-structures/binary-tree/tree-multi-set.ts +336 -0
  49. package/src/data-structures/binary-tree/tree-set.ts +492 -0
  50. package/src/data-structures/graph/directed-graph.ts +30 -0
  51. package/src/data-structures/graph/undirected-graph.ts +27 -0
  52. package/src/data-structures/hash/hash-map.ts +33 -0
  53. package/src/data-structures/heap/heap.ts +42 -0
  54. package/src/data-structures/linked-list/doubly-linked-list.ts +90 -2
  55. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  56. package/src/data-structures/linked-list/skip-linked-list.ts +54 -0
  57. package/src/data-structures/matrix/matrix.ts +24 -0
  58. package/src/data-structures/queue/deque.ts +103 -1
  59. package/src/data-structures/queue/queue.ts +36 -0
  60. package/src/data-structures/stack/stack.ts +30 -0
  61. package/src/data-structures/trie/trie.ts +36 -0
@@ -210,6 +210,35 @@ var IterableElementBase = class {
210
210
  for (const ele of this) if (ele === element) return true;
211
211
  return false;
212
212
  }
213
+ /**
214
+ * Check whether a value exists (Array-compatible alias for `has`).
215
+ * @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1).
216
+ * @param element - Element to search for (uses `===`).
217
+ * @returns `true` if found.
218
+ */
219
+ includes(element) {
220
+ return this.has(element);
221
+ }
222
+ /**
223
+ * Return an iterator of `[index, value]` pairs (Array-compatible).
224
+ * @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
225
+ */
226
+ *entries() {
227
+ let index = 0;
228
+ for (const value of this) {
229
+ yield [index++, value];
230
+ }
231
+ }
232
+ /**
233
+ * Return an iterator of numeric indices (Array-compatible).
234
+ * @remarks Provided for familiarity when migrating from Array. Time O(n), Space O(1) per step.
235
+ */
236
+ *keys() {
237
+ let index = 0;
238
+ for (const _ of this) {
239
+ yield index++;
240
+ }
241
+ }
213
242
  /**
214
243
  * Reduces all elements to a single accumulated value.
215
244
  *
@@ -350,6 +379,9 @@ var Heap = class _Heap extends IterableElementBase {
350
379
 
351
380
 
352
381
 
382
+
383
+
384
+
353
385
 
354
386
 
355
387
 
@@ -440,6 +472,9 @@ var Heap = class _Heap extends IterableElementBase {
440
472
 
441
473
 
442
474
 
475
+
476
+
477
+
443
478
 
444
479
 
445
480
 
@@ -501,6 +536,9 @@ var Heap = class _Heap extends IterableElementBase {
501
536
 
502
537
 
503
538
 
539
+
540
+
541
+
504
542
 
505
543
 
506
544
 
@@ -595,6 +633,9 @@ var Heap = class _Heap extends IterableElementBase {
595
633
  */
596
634
  /**
597
635
  * @deprecated Use `pop` instead. Will be removed in a future major version.
636
+
637
+
638
+
598
639
  * @example
599
640
  * // Heap with custom comparator (MaxHeap behavior)
600
641
  * interface Task {
@@ -678,6 +719,9 @@ var Heap = class _Heap extends IterableElementBase {
678
719
 
679
720
 
680
721
 
722
+
723
+
724
+
681
725
 
682
726
 
683
727
 
@@ -782,6 +826,9 @@ var Heap = class _Heap extends IterableElementBase {
782
826
 
783
827
 
784
828
 
829
+
830
+
831
+
785
832
 
786
833
 
787
834
 
@@ -833,6 +880,9 @@ var Heap = class _Heap extends IterableElementBase {
833
880
 
834
881
 
835
882
 
883
+
884
+
885
+
836
886
 
837
887
 
838
888
 
@@ -877,6 +927,9 @@ var Heap = class _Heap extends IterableElementBase {
877
927
 
878
928
 
879
929
 
930
+
931
+
932
+
880
933
 
881
934
 
882
935
 
@@ -928,6 +981,9 @@ var Heap = class _Heap extends IterableElementBase {
928
981
 
929
982
 
930
983
 
984
+
985
+
986
+
931
987
 
932
988
 
933
989
 
@@ -1031,6 +1087,9 @@ var Heap = class _Heap extends IterableElementBase {
1031
1087
 
1032
1088
 
1033
1089
 
1090
+
1091
+
1092
+
1034
1093
 
1035
1094
 
1036
1095
 
@@ -1115,6 +1174,9 @@ var Heap = class _Heap extends IterableElementBase {
1115
1174
 
1116
1175
 
1117
1176
 
1177
+
1178
+
1179
+
1118
1180
 
1119
1181
 
1120
1182
 
@@ -1172,6 +1234,9 @@ var Heap = class _Heap extends IterableElementBase {
1172
1234
 
1173
1235
 
1174
1236
 
1237
+
1238
+
1239
+
1175
1240
 
1176
1241
 
1177
1242
 
@@ -1228,6 +1293,9 @@ var Heap = class _Heap extends IterableElementBase {
1228
1293
 
1229
1294
 
1230
1295
 
1296
+
1297
+
1298
+
1231
1299
 
1232
1300
 
1233
1301
 
@@ -1291,6 +1359,9 @@ var Heap = class _Heap extends IterableElementBase {
1291
1359
 
1292
1360
 
1293
1361
 
1362
+
1363
+
1364
+
1294
1365
 
1295
1366
 
1296
1367