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.
- package/dist/cjs/index.cjs +771 -68
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +771 -68
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +771 -69
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +771 -69
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
- package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
- package/dist/types/data-structures/heap/heap.d.ts +336 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
- package/dist/types/data-structures/queue/deque.d.ts +364 -4
- package/dist/types/data-structures/queue/queue.d.ts +288 -0
- package/dist/types/data-structures/stack/stack.d.ts +240 -0
- package/dist/types/data-structures/trie/trie.d.ts +292 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/binary-tree-typed.js +773 -71
- package/dist/umd/binary-tree-typed.js.map +1 -1
- package/dist/umd/binary-tree-typed.min.js +5 -5
- package/dist/umd/binary-tree-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +299 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +341 -5
- package/src/data-structures/binary-tree/binary-tree.ts +606 -6
- package/src/data-structures/binary-tree/bst.ts +946 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +472 -0
- package/src/data-structures/binary-tree/segment-tree.ts +145 -2
- package/src/data-structures/binary-tree/tree-map.ts +3423 -499
- package/src/data-structures/binary-tree/tree-multi-map.ts +3537 -596
- package/src/data-structures/binary-tree/tree-multi-set.ts +2855 -495
- package/src/data-structures/binary-tree/tree-set.ts +3209 -413
- package/src/data-structures/graph/abstract-graph.ts +6 -6
- package/src/data-structures/graph/directed-graph.ts +240 -0
- package/src/data-structures/graph/undirected-graph.ts +216 -0
- package/src/data-structures/hash/hash-map.ts +281 -19
- package/src/data-structures/heap/heap.ts +340 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +411 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +363 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +439 -7
- package/src/data-structures/matrix/matrix.ts +202 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +365 -5
- package/src/data-structures/queue/queue.ts +288 -0
- package/src/data-structures/stack/stack.ts +240 -0
- package/src/data-structures/trie/trie.ts +295 -7
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
|
@@ -59,6 +59,60 @@ function makeTrampoline(fn) {
|
|
|
59
59
|
}
|
|
60
60
|
__name(makeTrampoline, "makeTrampoline");
|
|
61
61
|
|
|
62
|
+
// src/common/error.ts
|
|
63
|
+
function raise(ErrorClass, message) {
|
|
64
|
+
throw new ErrorClass(message);
|
|
65
|
+
}
|
|
66
|
+
__name(raise, "raise");
|
|
67
|
+
var ERR = {
|
|
68
|
+
// Range / index
|
|
69
|
+
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
70
|
+
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
71
|
+
// Type / argument
|
|
72
|
+
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
73
|
+
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
74
|
+
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
75
|
+
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
76
|
+
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
77
|
+
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
78
|
+
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
79
|
+
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
80
|
+
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
81
|
+
// State / operation
|
|
82
|
+
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
83
|
+
// Matrix
|
|
84
|
+
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
85
|
+
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
86
|
+
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
87
|
+
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
88
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
89
|
+
// Order statistic
|
|
90
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/common/index.ts
|
|
94
|
+
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
95
|
+
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
96
|
+
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
97
|
+
return DFSOperation2;
|
|
98
|
+
})(DFSOperation || {});
|
|
99
|
+
var _Range = class _Range {
|
|
100
|
+
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
101
|
+
this.low = low;
|
|
102
|
+
this.high = high;
|
|
103
|
+
this.includeLow = includeLow;
|
|
104
|
+
this.includeHigh = includeHigh;
|
|
105
|
+
}
|
|
106
|
+
// Determine whether a key is within the range
|
|
107
|
+
isInRange(key, comparator) {
|
|
108
|
+
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
109
|
+
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
110
|
+
return lowCheck && highCheck;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
__name(_Range, "Range");
|
|
114
|
+
var Range = _Range;
|
|
115
|
+
|
|
62
116
|
// src/data-structures/base/iterable-element-base.ts
|
|
63
117
|
var _IterableElementBase = class _IterableElementBase {
|
|
64
118
|
/**
|
|
@@ -81,7 +135,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
81
135
|
if (options) {
|
|
82
136
|
const { toElementFn } = options;
|
|
83
137
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
84
|
-
else if (toElementFn)
|
|
138
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
85
139
|
}
|
|
86
140
|
}
|
|
87
141
|
/**
|
|
@@ -237,7 +291,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
237
291
|
acc = initialValue;
|
|
238
292
|
} else {
|
|
239
293
|
const first = iter.next();
|
|
240
|
-
if (first.done)
|
|
294
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
241
295
|
acc = first.value;
|
|
242
296
|
index = 1;
|
|
243
297
|
}
|
|
@@ -473,54 +527,6 @@ var _LinearBase = class _LinearBase extends IterableElementBase {
|
|
|
473
527
|
__name(_LinearBase, "LinearBase");
|
|
474
528
|
var LinearBase = _LinearBase;
|
|
475
529
|
|
|
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 _Range {
|
|
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
|
-
// Determine whether a key is within the range
|
|
515
|
-
isInRange(key, comparator) {
|
|
516
|
-
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
517
|
-
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
518
|
-
return lowCheck && highCheck;
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
__name(_Range, "Range");
|
|
522
|
-
var Range = _Range;
|
|
523
|
-
|
|
524
530
|
// src/data-structures/base/iterable-entry-base.ts
|
|
525
531
|
var _IterableEntryBase = class _IterableEntryBase {
|
|
526
532
|
/**
|
|
@@ -770,6 +776,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
770
776
|
|
|
771
777
|
|
|
772
778
|
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
|
|
773
803
|
* @example
|
|
774
804
|
* // Track queue length
|
|
775
805
|
* const q = new Queue<number>();
|
|
@@ -796,6 +826,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
796
826
|
|
|
797
827
|
|
|
798
828
|
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
799
853
|
* @example
|
|
800
854
|
* // View the front element
|
|
801
855
|
* const q = new Queue<string>(['first', 'second', 'third']);
|
|
@@ -838,6 +892,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
838
892
|
|
|
839
893
|
|
|
840
894
|
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
841
919
|
* @example
|
|
842
920
|
* // Queue for...of iteration and isEmpty check
|
|
843
921
|
* const queue = new Queue<string>(['A', 'B', 'C', 'D']);
|
|
@@ -876,6 +954,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
876
954
|
|
|
877
955
|
|
|
878
956
|
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
879
981
|
* @example
|
|
880
982
|
* // basic Queue creation and push operation
|
|
881
983
|
* // Create a simple Queue with initial values
|
|
@@ -921,6 +1023,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
921
1023
|
|
|
922
1024
|
|
|
923
1025
|
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
924
1050
|
* @example
|
|
925
1051
|
* // Queue shift and peek operations
|
|
926
1052
|
* const queue = new Queue<number>([10, 20, 30, 40]);
|
|
@@ -956,6 +1082,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
956
1082
|
|
|
957
1083
|
|
|
958
1084
|
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
959
1109
|
* @example
|
|
960
1110
|
* // Remove specific element
|
|
961
1111
|
* const q = new Queue<number>([1, 2, 3, 2]);
|
|
@@ -984,23 +1134,47 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
984
1134
|
|
|
985
1135
|
|
|
986
1136
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
* @example
|
|
1162
|
+
* // Access element by index
|
|
1163
|
+
* const q = new Queue<string>(['a', 'b', 'c']);
|
|
1164
|
+
* console.log(q.at(0)); // 'a';
|
|
1165
|
+
* console.log(q.at(2)); // 'c';
|
|
1166
|
+
*/
|
|
1167
|
+
at(index) {
|
|
1168
|
+
if (index < 0 || index >= this.length) return void 0;
|
|
1169
|
+
return this._elements[this._offset + index];
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Delete the element at a given index.
|
|
1173
|
+
* @remarks Time O(N), Space O(1)
|
|
1174
|
+
* @param index - Zero-based index from the front.
|
|
1175
|
+
* @returns Removed element or undefined.
|
|
1176
|
+
*/
|
|
1177
|
+
deleteAt(index) {
|
|
1004
1178
|
if (index < 0 || index >= this.length) return void 0;
|
|
1005
1179
|
const gi = this._offset + index;
|
|
1006
1180
|
const [deleted] = this.elements.splice(gi, 1);
|
|
@@ -1053,6 +1227,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1053
1227
|
|
|
1054
1228
|
|
|
1055
1229
|
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1056
1254
|
* @example
|
|
1057
1255
|
* // Remove all elements
|
|
1058
1256
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -1075,6 +1273,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1075
1273
|
|
|
1076
1274
|
|
|
1077
1275
|
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1078
1300
|
* @example
|
|
1079
1301
|
* // Reclaim unused memory
|
|
1080
1302
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -1120,6 +1342,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1120
1342
|
|
|
1121
1343
|
|
|
1122
1344
|
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1123
1369
|
* @example
|
|
1124
1370
|
* // Create independent copy
|
|
1125
1371
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -1149,6 +1395,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1149
1395
|
|
|
1150
1396
|
|
|
1151
1397
|
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1152
1422
|
* @example
|
|
1153
1423
|
* // Filter elements
|
|
1154
1424
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -1182,6 +1452,30 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1182
1452
|
|
|
1183
1453
|
|
|
1184
1454
|
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1185
1479
|
* @example
|
|
1186
1480
|
* // Transform elements
|
|
1187
1481
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -1450,7 +1744,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1450
1744
|
if (isMapMode !== void 0) this._isMapMode = isMapMode;
|
|
1451
1745
|
if (isDuplicate !== void 0) this._isDuplicate = isDuplicate;
|
|
1452
1746
|
if (typeof toEntryFn === "function") this._toEntryFn = toEntryFn;
|
|
1453
|
-
else if (toEntryFn)
|
|
1747
|
+
else if (toEntryFn) raise(TypeError, ERR.notAFunction("toEntryFn", "BinaryTree"));
|
|
1454
1748
|
}
|
|
1455
1749
|
if (keysNodesEntriesOrRaws) this.setMany(keysNodesEntriesOrRaws);
|
|
1456
1750
|
}
|
|
@@ -1666,6 +1960,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1666
1960
|
|
|
1667
1961
|
|
|
1668
1962
|
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
|
|
1669
1987
|
* @example
|
|
1670
1988
|
* // Add a single node
|
|
1671
1989
|
* const tree = new BinaryTree<number>();
|
|
@@ -1696,6 +2014,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1696
2014
|
|
|
1697
2015
|
|
|
1698
2016
|
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
|
|
1699
2041
|
* @example
|
|
1700
2042
|
* // basic BinaryTree creation and insertion
|
|
1701
2043
|
* // Create a BinaryTree with entries
|
|
@@ -1778,6 +2120,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1778
2120
|
|
|
1779
2121
|
|
|
1780
2122
|
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
|
|
2146
|
+
|
|
1781
2147
|
* @example
|
|
1782
2148
|
* // Bulk add
|
|
1783
2149
|
* const tree = new BinaryTree<number>();
|
|
@@ -1796,6 +2162,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1796
2162
|
* @returns An array of booleans indicating the success of each individual `set` operation.
|
|
1797
2163
|
|
|
1798
2164
|
|
|
2165
|
+
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
|
|
1799
2189
|
* @example
|
|
1800
2190
|
* // Set multiple entries
|
|
1801
2191
|
* const tree = new BinaryTree<number, string>();
|
|
@@ -1835,6 +2225,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1835
2225
|
|
|
1836
2226
|
|
|
1837
2227
|
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
|
|
2250
|
+
|
|
2251
|
+
|
|
1838
2252
|
* @example
|
|
1839
2253
|
* // Combine trees
|
|
1840
2254
|
* const t1 = new BinaryTree<number>([1, 2]);
|
|
@@ -1873,6 +2287,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1873
2287
|
|
|
1874
2288
|
|
|
1875
2289
|
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
|
|
2293
|
+
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
|
|
1876
2314
|
* @example
|
|
1877
2315
|
* // Remove a node
|
|
1878
2316
|
* const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
|
|
@@ -1989,6 +2427,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1989
2427
|
|
|
1990
2428
|
|
|
1991
2429
|
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
|
|
1992
2454
|
* @example
|
|
1993
2455
|
* // Get node by key
|
|
1994
2456
|
* const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'child']]);
|
|
@@ -2023,6 +2485,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2023
2485
|
|
|
2024
2486
|
|
|
2025
2487
|
|
|
2488
|
+
|
|
2489
|
+
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2026
2512
|
* @example
|
|
2027
2513
|
* // Retrieve value by key
|
|
2028
2514
|
* const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'left'], [3, 'right']]);
|
|
@@ -2060,6 +2546,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2060
2546
|
|
|
2061
2547
|
|
|
2062
2548
|
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
|
|
2063
2573
|
* @example
|
|
2064
2574
|
* // Remove all nodes
|
|
2065
2575
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -2084,6 +2594,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2084
2594
|
|
|
2085
2595
|
|
|
2086
2596
|
|
|
2597
|
+
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
|
|
2603
|
+
|
|
2604
|
+
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
|
|
2613
|
+
|
|
2614
|
+
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
|
|
2619
|
+
|
|
2620
|
+
|
|
2087
2621
|
* @example
|
|
2088
2622
|
* // Check empty
|
|
2089
2623
|
* console.log(new BinaryTree().isEmpty()); // true;
|
|
@@ -2117,6 +2651,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2117
2651
|
|
|
2118
2652
|
|
|
2119
2653
|
|
|
2654
|
+
|
|
2655
|
+
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
|
|
2677
|
+
|
|
2120
2678
|
* @example
|
|
2121
2679
|
* // Check BST property
|
|
2122
2680
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -2177,6 +2735,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2177
2735
|
|
|
2178
2736
|
|
|
2179
2737
|
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2760
|
+
|
|
2761
|
+
|
|
2180
2762
|
* @example
|
|
2181
2763
|
* // Get depth of a node
|
|
2182
2764
|
* const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
|
|
@@ -2214,6 +2796,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2214
2796
|
|
|
2215
2797
|
|
|
2216
2798
|
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
|
|
2820
|
+
|
|
2821
|
+
|
|
2822
|
+
|
|
2217
2823
|
* @example
|
|
2218
2824
|
* // Get tree height
|
|
2219
2825
|
* const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
|
|
@@ -2667,6 +3273,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2667
3273
|
|
|
2668
3274
|
|
|
2669
3275
|
|
|
3276
|
+
|
|
3277
|
+
|
|
3278
|
+
|
|
3279
|
+
|
|
3280
|
+
|
|
3281
|
+
|
|
3282
|
+
|
|
3283
|
+
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
|
|
3288
|
+
|
|
3289
|
+
|
|
3290
|
+
|
|
3291
|
+
|
|
3292
|
+
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
|
|
3297
|
+
|
|
3298
|
+
|
|
3299
|
+
|
|
2670
3300
|
* @example
|
|
2671
3301
|
* // Deep copy
|
|
2672
3302
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -2695,6 +3325,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2695
3325
|
|
|
2696
3326
|
|
|
2697
3327
|
|
|
3328
|
+
|
|
3329
|
+
|
|
3330
|
+
|
|
3331
|
+
|
|
3332
|
+
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
|
|
3351
|
+
|
|
2698
3352
|
* @example
|
|
2699
3353
|
* // Filter nodes by condition
|
|
2700
3354
|
* const tree = new BinaryTree<number>([1, 2, 3, 4]);
|
|
@@ -2727,6 +3381,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2727
3381
|
|
|
2728
3382
|
|
|
2729
3383
|
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
|
|
3387
|
+
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
|
|
3406
|
+
|
|
3407
|
+
|
|
2730
3408
|
* @example
|
|
2731
3409
|
* // Transform to new tree
|
|
2732
3410
|
* const tree = new BinaryTree<number, number>([[1, 10], [2, 20]]);
|
|
@@ -2784,6 +3462,30 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2784
3462
|
|
|
2785
3463
|
|
|
2786
3464
|
|
|
3465
|
+
|
|
3466
|
+
|
|
3467
|
+
|
|
3468
|
+
|
|
3469
|
+
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
|
|
3482
|
+
|
|
3483
|
+
|
|
3484
|
+
|
|
3485
|
+
|
|
3486
|
+
|
|
3487
|
+
|
|
3488
|
+
|
|
2787
3489
|
* @example
|
|
2788
3490
|
* // Display tree
|
|
2789
3491
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -3259,6 +3961,6 @@ var BinaryTree = _BinaryTree;
|
|
|
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
|