binary-tree-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.
Files changed (90) hide show
  1. package/dist/cjs/index.cjs +771 -68
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +771 -68
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +771 -69
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +771 -69
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/common/error.d.ts +9 -0
  10. package/dist/types/common/index.d.ts +1 -1
  11. package/dist/types/data-structures/base/index.d.ts +1 -0
  12. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  13. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  14. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
  15. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
  16. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
  17. package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
  18. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
  19. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
  20. package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
  21. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
  22. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
  23. package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
  24. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  25. package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
  26. package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
  27. package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
  28. package/dist/types/data-structures/heap/heap.d.ts +336 -0
  29. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
  30. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
  31. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
  32. package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
  33. package/dist/types/data-structures/queue/deque.d.ts +364 -4
  34. package/dist/types/data-structures/queue/queue.d.ts +288 -0
  35. package/dist/types/data-structures/stack/stack.d.ts +240 -0
  36. package/dist/types/data-structures/trie/trie.d.ts +292 -4
  37. package/dist/types/interfaces/graph.d.ts +1 -1
  38. package/dist/types/types/common.d.ts +2 -2
  39. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  40. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  41. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  42. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  43. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  44. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  45. package/dist/types/types/utils/validate-type.d.ts +4 -4
  46. package/dist/umd/binary-tree-typed.js +773 -71
  47. package/dist/umd/binary-tree-typed.js.map +1 -1
  48. package/dist/umd/binary-tree-typed.min.js +5 -5
  49. package/dist/umd/binary-tree-typed.min.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/common/error.ts +19 -1
  52. package/src/common/index.ts +1 -1
  53. package/src/data-structures/base/index.ts +1 -0
  54. package/src/data-structures/base/iterable-element-base.ts +3 -2
  55. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  56. package/src/data-structures/base/linear-base.ts +3 -3
  57. package/src/data-structures/binary-tree/avl-tree.ts +299 -0
  58. package/src/data-structures/binary-tree/binary-indexed-tree.ts +341 -5
  59. package/src/data-structures/binary-tree/binary-tree.ts +606 -6
  60. package/src/data-structures/binary-tree/bst.ts +946 -7
  61. package/src/data-structures/binary-tree/red-black-tree.ts +472 -0
  62. package/src/data-structures/binary-tree/segment-tree.ts +145 -2
  63. package/src/data-structures/binary-tree/tree-map.ts +3423 -499
  64. package/src/data-structures/binary-tree/tree-multi-map.ts +3537 -596
  65. package/src/data-structures/binary-tree/tree-multi-set.ts +2855 -495
  66. package/src/data-structures/binary-tree/tree-set.ts +3209 -413
  67. package/src/data-structures/graph/abstract-graph.ts +6 -6
  68. package/src/data-structures/graph/directed-graph.ts +240 -0
  69. package/src/data-structures/graph/undirected-graph.ts +216 -0
  70. package/src/data-structures/hash/hash-map.ts +281 -19
  71. package/src/data-structures/heap/heap.ts +340 -4
  72. package/src/data-structures/heap/max-heap.ts +2 -2
  73. package/src/data-structures/linked-list/doubly-linked-list.ts +411 -3
  74. package/src/data-structures/linked-list/singly-linked-list.ts +363 -3
  75. package/src/data-structures/linked-list/skip-linked-list.ts +439 -7
  76. package/src/data-structures/matrix/matrix.ts +202 -10
  77. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  78. package/src/data-structures/queue/deque.ts +365 -5
  79. package/src/data-structures/queue/queue.ts +288 -0
  80. package/src/data-structures/stack/stack.ts +240 -0
  81. package/src/data-structures/trie/trie.ts +295 -7
  82. package/src/interfaces/graph.ts +1 -1
  83. package/src/types/common.ts +2 -2
  84. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  85. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  86. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  87. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
  88. package/src/types/data-structures/heap/heap.ts +1 -0
  89. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  90. package/src/types/utils/validate-type.ts +4 -4
@@ -57,6 +57,61 @@ function makeTrampoline(fn) {
57
57
  }
58
58
  __name(makeTrampoline, "makeTrampoline");
59
59
 
60
+ // src/common/error.ts
61
+ function raise(ErrorClass, message) {
62
+ throw new ErrorClass(message);
63
+ }
64
+ __name(raise, "raise");
65
+ var ERR = {
66
+ // Range / index
67
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
68
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
69
+ // Type / argument
70
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
71
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
72
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
73
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
74
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
75
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
76
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
77
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
78
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
79
+ // State / operation
80
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
81
+ // Matrix
82
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
83
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
84
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
85
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
86
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
87
+ // Order statistic
88
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
89
+ };
90
+
91
+ // src/common/index.ts
92
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
93
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
94
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
95
+ return DFSOperation2;
96
+ })(DFSOperation || {});
97
+ var Range = class {
98
+ constructor(low, high, includeLow = true, includeHigh = true) {
99
+ this.low = low;
100
+ this.high = high;
101
+ this.includeLow = includeLow;
102
+ this.includeHigh = includeHigh;
103
+ }
104
+ static {
105
+ __name(this, "Range");
106
+ }
107
+ // Determine whether a key is within the range
108
+ isInRange(key, comparator) {
109
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
110
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
111
+ return lowCheck && highCheck;
112
+ }
113
+ };
114
+
60
115
  // src/data-structures/base/iterable-element-base.ts
61
116
  var IterableElementBase = class {
62
117
  static {
@@ -75,7 +130,7 @@ var IterableElementBase = class {
75
130
  if (options) {
76
131
  const { toElementFn } = options;
77
132
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
78
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
133
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
79
134
  }
80
135
  }
81
136
  /**
@@ -238,7 +293,7 @@ var IterableElementBase = class {
238
293
  acc = initialValue;
239
294
  } else {
240
295
  const first = iter.next();
241
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
296
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
242
297
  acc = first.value;
243
298
  index = 1;
244
299
  }
@@ -473,55 +528,6 @@ var LinearBase = class _LinearBase extends IterableElementBase {
473
528
  }
474
529
  };
475
530
 
476
- // src/common/error.ts
477
- var ERR = {
478
- // Range / index
479
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
480
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
481
- // Type / argument
482
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
483
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
484
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
485
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
486
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
487
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
488
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
489
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
490
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
491
- // State / operation
492
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
493
- // Matrix
494
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
495
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
496
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
497
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
498
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
499
- };
500
-
501
- // src/common/index.ts
502
- var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
503
- DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
504
- DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
505
- return DFSOperation2;
506
- })(DFSOperation || {});
507
- var Range = class {
508
- constructor(low, high, includeLow = true, includeHigh = true) {
509
- this.low = low;
510
- this.high = high;
511
- this.includeLow = includeLow;
512
- this.includeHigh = includeHigh;
513
- }
514
- static {
515
- __name(this, "Range");
516
- }
517
- // Determine whether a key is within the range
518
- isInRange(key, comparator) {
519
- const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
520
- const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
521
- return lowCheck && highCheck;
522
- }
523
- };
524
-
525
531
  // src/data-structures/base/iterable-entry-base.ts
526
532
  var IterableEntryBase = class {
527
533
  static {
@@ -775,6 +781,30 @@ var Queue = class _Queue extends LinearBase {
775
781
 
776
782
 
777
783
 
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
778
808
  * @example
779
809
  * // Track queue length
780
810
  * const q = new Queue<number>();
@@ -801,6 +831,30 @@ var Queue = class _Queue extends LinearBase {
801
831
 
802
832
 
803
833
 
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+
851
+
852
+
853
+
854
+
855
+
856
+
857
+
804
858
  * @example
805
859
  * // View the front element
806
860
  * const q = new Queue<string>(['first', 'second', 'third']);
@@ -843,6 +897,30 @@ var Queue = class _Queue extends LinearBase {
843
897
 
844
898
 
845
899
 
900
+
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+
846
924
  * @example
847
925
  * // Queue for...of iteration and isEmpty check
848
926
  * const queue = new Queue<string>(['A', 'B', 'C', 'D']);
@@ -881,6 +959,30 @@ var Queue = class _Queue extends LinearBase {
881
959
 
882
960
 
883
961
 
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+
976
+
977
+
978
+
979
+
980
+
981
+
982
+
983
+
984
+
985
+
884
986
  * @example
885
987
  * // basic Queue creation and push operation
886
988
  * // Create a simple Queue with initial values
@@ -926,6 +1028,30 @@ var Queue = class _Queue extends LinearBase {
926
1028
 
927
1029
 
928
1030
 
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
1044
+
1045
+
1046
+
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+
1054
+
929
1055
  * @example
930
1056
  * // Queue shift and peek operations
931
1057
  * const queue = new Queue<number>([10, 20, 30, 40]);
@@ -961,6 +1087,30 @@ var Queue = class _Queue extends LinearBase {
961
1087
 
962
1088
 
963
1089
 
1090
+
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
964
1114
  * @example
965
1115
  * // Remove specific element
966
1116
  * const q = new Queue<number>([1, 2, 3, 2]);
@@ -989,21 +1139,45 @@ var Queue = class _Queue extends LinearBase {
989
1139
 
990
1140
 
991
1141
 
992
- * @example
993
- * // Access element by index
994
- * const q = new Queue<string>(['a', 'b', 'c']);
995
- * console.log(q.at(0)); // 'a';
996
- * console.log(q.at(2)); // 'c';
997
- */
998
- at(index) {
999
- if (index < 0 || index >= this.length) return void 0;
1000
- return this._elements[this._offset + index];
1001
- }
1002
- /**
1003
- * Delete the element at a given index.
1004
- * @remarks Time O(N), Space O(1)
1005
- * @param index - Zero-based index from the front.
1006
- * @returns Removed element or undefined.
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1148
+
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+ * @example
1167
+ * // Access element by index
1168
+ * const q = new Queue<string>(['a', 'b', 'c']);
1169
+ * console.log(q.at(0)); // 'a';
1170
+ * console.log(q.at(2)); // 'c';
1171
+ */
1172
+ at(index) {
1173
+ if (index < 0 || index >= this.length) return void 0;
1174
+ return this._elements[this._offset + index];
1175
+ }
1176
+ /**
1177
+ * Delete the element at a given index.
1178
+ * @remarks Time O(N), Space O(1)
1179
+ * @param index - Zero-based index from the front.
1180
+ * @returns Removed element or undefined.
1007
1181
  */
1008
1182
  deleteAt(index) {
1009
1183
  if (index < 0 || index >= this.length) return void 0;
@@ -1058,6 +1232,30 @@ var Queue = class _Queue extends LinearBase {
1058
1232
 
1059
1233
 
1060
1234
 
1235
+
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+
1257
+
1258
+
1061
1259
  * @example
1062
1260
  * // Remove all elements
1063
1261
  * const q = new Queue<number>([1, 2, 3]);
@@ -1080,6 +1278,30 @@ var Queue = class _Queue extends LinearBase {
1080
1278
 
1081
1279
 
1082
1280
 
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+
1304
+
1083
1305
  * @example
1084
1306
  * // Reclaim unused memory
1085
1307
  * const q = new Queue<number>([1, 2, 3, 4, 5]);
@@ -1125,6 +1347,30 @@ var Queue = class _Queue extends LinearBase {
1125
1347
 
1126
1348
 
1127
1349
 
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1356
+
1357
+
1358
+
1359
+
1360
+
1361
+
1362
+
1363
+
1364
+
1365
+
1366
+
1367
+
1368
+
1369
+
1370
+
1371
+
1372
+
1373
+
1128
1374
  * @example
1129
1375
  * // Create independent copy
1130
1376
  * const q = new Queue<number>([1, 2, 3]);
@@ -1154,6 +1400,30 @@ var Queue = class _Queue extends LinearBase {
1154
1400
 
1155
1401
 
1156
1402
 
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+
1423
+
1424
+
1425
+
1426
+
1157
1427
  * @example
1158
1428
  * // Filter elements
1159
1429
  * const q = new Queue<number>([1, 2, 3, 4, 5]);
@@ -1187,6 +1457,30 @@ var Queue = class _Queue extends LinearBase {
1187
1457
 
1188
1458
 
1189
1459
 
1460
+
1461
+
1462
+
1463
+
1464
+
1465
+
1466
+
1467
+
1468
+
1469
+
1470
+
1471
+
1472
+
1473
+
1474
+
1475
+
1476
+
1477
+
1478
+
1479
+
1480
+
1481
+
1482
+
1483
+
1190
1484
  * @example
1191
1485
  * // Transform elements
1192
1486
  * const q = new Queue<number>([1, 2, 3]);
@@ -1437,7 +1731,7 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1437
1731
  if (isMapMode !== void 0) this._isMapMode = isMapMode;
1438
1732
  if (isDuplicate !== void 0) this._isDuplicate = isDuplicate;
1439
1733
  if (typeof toEntryFn === "function") this._toEntryFn = toEntryFn;
1440
- else if (toEntryFn) throw new TypeError(ERR.notAFunction("toEntryFn", "BinaryTree"));
1734
+ else if (toEntryFn) raise(TypeError, ERR.notAFunction("toEntryFn", "BinaryTree"));
1441
1735
  }
1442
1736
  if (keysNodesEntriesOrRaws) this.setMany(keysNodesEntriesOrRaws);
1443
1737
  }
@@ -1663,6 +1957,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1663
1957
 
1664
1958
 
1665
1959
 
1960
+
1961
+
1962
+
1963
+
1964
+
1965
+
1966
+
1967
+
1968
+
1969
+
1970
+
1971
+
1972
+
1973
+
1974
+
1975
+
1976
+
1977
+
1978
+
1979
+
1980
+
1981
+
1982
+
1983
+
1666
1984
  * @example
1667
1985
  * // Add a single node
1668
1986
  * const tree = new BinaryTree<number>();
@@ -1693,6 +2011,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1693
2011
 
1694
2012
 
1695
2013
 
2014
+
2015
+
2016
+
2017
+
2018
+
2019
+
2020
+
2021
+
2022
+
2023
+
2024
+
2025
+
2026
+
2027
+
2028
+
2029
+
2030
+
2031
+
2032
+
2033
+
2034
+
2035
+
2036
+
2037
+
1696
2038
  * @example
1697
2039
  * // basic BinaryTree creation and insertion
1698
2040
  * // Create a BinaryTree with entries
@@ -1775,6 +2117,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1775
2117
 
1776
2118
 
1777
2119
 
2120
+
2121
+
2122
+
2123
+
2124
+
2125
+
2126
+
2127
+
2128
+
2129
+
2130
+
2131
+
2132
+
2133
+
2134
+
2135
+
2136
+
2137
+
2138
+
2139
+
2140
+
2141
+
2142
+
2143
+
1778
2144
  * @example
1779
2145
  * // Bulk add
1780
2146
  * const tree = new BinaryTree<number>();
@@ -1793,6 +2159,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1793
2159
  * @returns An array of booleans indicating the success of each individual `set` operation.
1794
2160
 
1795
2161
 
2162
+
2163
+
2164
+
2165
+
2166
+
2167
+
2168
+
2169
+
2170
+
2171
+
2172
+
2173
+
2174
+
2175
+
2176
+
2177
+
2178
+
2179
+
2180
+
2181
+
2182
+
2183
+
2184
+
2185
+
1796
2186
  * @example
1797
2187
  * // Set multiple entries
1798
2188
  * const tree = new BinaryTree<number, string>();
@@ -1832,7 +2222,31 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1832
2222
 
1833
2223
 
1834
2224
 
1835
- * @example
2225
+
2226
+
2227
+
2228
+
2229
+
2230
+
2231
+
2232
+
2233
+
2234
+
2235
+
2236
+
2237
+
2238
+
2239
+
2240
+
2241
+
2242
+
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2249
+ * @example
1836
2250
  * // Combine trees
1837
2251
  * const t1 = new BinaryTree<number>([1, 2]);
1838
2252
  * const t2 = new BinaryTree<number>([3, 4]);
@@ -1870,6 +2284,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1870
2284
 
1871
2285
 
1872
2286
 
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+
2295
+
2296
+
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+
2304
+
2305
+
2306
+
2307
+
2308
+
2309
+
2310
+
1873
2311
  * @example
1874
2312
  * // Remove a node
1875
2313
  * const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
@@ -1986,6 +2424,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
1986
2424
 
1987
2425
 
1988
2426
 
2427
+
2428
+
2429
+
2430
+
2431
+
2432
+
2433
+
2434
+
2435
+
2436
+
2437
+
2438
+
2439
+
2440
+
2441
+
2442
+
2443
+
2444
+
2445
+
2446
+
2447
+
2448
+
2449
+
2450
+
1989
2451
  * @example
1990
2452
  * // Get node by key
1991
2453
  * const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'child']]);
@@ -2020,6 +2482,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2020
2482
 
2021
2483
 
2022
2484
 
2485
+
2486
+
2487
+
2488
+
2489
+
2490
+
2491
+
2492
+
2493
+
2494
+
2495
+
2496
+
2497
+
2498
+
2499
+
2500
+
2501
+
2502
+
2503
+
2504
+
2505
+
2506
+
2507
+
2508
+
2023
2509
  * @example
2024
2510
  * // Retrieve value by key
2025
2511
  * const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'left'], [3, 'right']]);
@@ -2056,6 +2542,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2056
2542
 
2057
2543
 
2058
2544
 
2545
+
2546
+
2547
+
2548
+
2549
+
2550
+
2551
+
2552
+
2553
+
2554
+
2555
+
2556
+
2557
+
2558
+
2559
+
2560
+
2561
+
2562
+
2563
+
2564
+
2565
+
2566
+
2567
+
2568
+
2059
2569
  * @example
2060
2570
  * // Remove all nodes
2061
2571
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -2080,6 +2590,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2080
2590
 
2081
2591
 
2082
2592
 
2593
+
2594
+
2595
+
2596
+
2597
+
2598
+
2599
+
2600
+
2601
+
2602
+
2603
+
2604
+
2605
+
2606
+
2607
+
2608
+
2609
+
2610
+
2611
+
2612
+
2613
+
2614
+
2615
+
2616
+
2083
2617
  * @example
2084
2618
  * // Check empty
2085
2619
  * console.log(new BinaryTree().isEmpty()); // true;
@@ -2113,6 +2647,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2113
2647
 
2114
2648
 
2115
2649
 
2650
+
2651
+
2652
+
2653
+
2654
+
2655
+
2656
+
2657
+
2658
+
2659
+
2660
+
2661
+
2662
+
2663
+
2664
+
2665
+
2666
+
2667
+
2668
+
2669
+
2670
+
2671
+
2672
+
2673
+
2116
2674
  * @example
2117
2675
  * // Check BST property
2118
2676
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -2173,6 +2731,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2173
2731
 
2174
2732
 
2175
2733
 
2734
+
2735
+
2736
+
2737
+
2738
+
2739
+
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+
2749
+
2750
+
2751
+
2752
+
2753
+
2754
+
2755
+
2756
+
2757
+
2176
2758
  * @example
2177
2759
  * // Get depth of a node
2178
2760
  * const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
@@ -2210,6 +2792,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2210
2792
 
2211
2793
 
2212
2794
 
2795
+
2796
+
2797
+
2798
+
2799
+
2800
+
2801
+
2802
+
2803
+
2804
+
2805
+
2806
+
2807
+
2808
+
2809
+
2810
+
2811
+
2812
+
2813
+
2814
+
2815
+
2816
+
2817
+
2818
+
2213
2819
  * @example
2214
2820
  * // Get tree height
2215
2821
  * const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
@@ -2663,6 +3269,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2663
3269
 
2664
3270
 
2665
3271
 
3272
+
3273
+
3274
+
3275
+
3276
+
3277
+
3278
+
3279
+
3280
+
3281
+
3282
+
3283
+
3284
+
3285
+
3286
+
3287
+
3288
+
3289
+
3290
+
3291
+
3292
+
3293
+
3294
+
3295
+
2666
3296
  * @example
2667
3297
  * // Deep copy
2668
3298
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -2691,6 +3321,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2691
3321
 
2692
3322
 
2693
3323
 
3324
+
3325
+
3326
+
3327
+
3328
+
3329
+
3330
+
3331
+
3332
+
3333
+
3334
+
3335
+
3336
+
3337
+
3338
+
3339
+
3340
+
3341
+
3342
+
3343
+
3344
+
3345
+
3346
+
3347
+
2694
3348
  * @example
2695
3349
  * // Filter nodes by condition
2696
3350
  * const tree = new BinaryTree<number>([1, 2, 3, 4]);
@@ -2723,6 +3377,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2723
3377
 
2724
3378
 
2725
3379
 
3380
+
3381
+
3382
+
3383
+
3384
+
3385
+
3386
+
3387
+
3388
+
3389
+
3390
+
3391
+
3392
+
3393
+
3394
+
3395
+
3396
+
3397
+
3398
+
3399
+
3400
+
3401
+
3402
+
3403
+
2726
3404
  * @example
2727
3405
  * // Transform to new tree
2728
3406
  * const tree = new BinaryTree<number, number>([[1, 10], [2, 20]]);
@@ -2780,6 +3458,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
2780
3458
 
2781
3459
 
2782
3460
 
3461
+
3462
+
3463
+
3464
+
3465
+
3466
+
3467
+
3468
+
3469
+
3470
+
3471
+
3472
+
3473
+
3474
+
3475
+
3476
+
3477
+
3478
+
3479
+
3480
+
3481
+
3482
+
3483
+
3484
+
2783
3485
  * @example
2784
3486
  * // Display tree
2785
3487
  * const tree = new BinaryTree<number>([1, 2, 3]);
@@ -3259,6 +3961,6 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
3259
3961
  * @license MIT License
3260
3962
  */
3261
3963
 
3262
- export { BinaryTree, BinaryTreeNode, DFSOperation, ERR, Range };
3964
+ export { BinaryTree, BinaryTreeNode, DFSOperation, ERR, Range, raise };
3263
3965
  //# sourceMappingURL=index.mjs.map
3264
3966
  //# sourceMappingURL=index.mjs.map