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
package/dist/cjs/index.cjs
CHANGED
|
@@ -59,6 +59,61 @@ 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 {
|
|
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
|
+
static {
|
|
107
|
+
__name(this, "Range");
|
|
108
|
+
}
|
|
109
|
+
// Determine whether a key is within the range
|
|
110
|
+
isInRange(key, comparator) {
|
|
111
|
+
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
112
|
+
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
113
|
+
return lowCheck && highCheck;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
62
117
|
// src/data-structures/base/iterable-element-base.ts
|
|
63
118
|
var IterableElementBase = class {
|
|
64
119
|
static {
|
|
@@ -77,7 +132,7 @@ var IterableElementBase = class {
|
|
|
77
132
|
if (options) {
|
|
78
133
|
const { toElementFn } = options;
|
|
79
134
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
80
|
-
else if (toElementFn)
|
|
135
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
81
136
|
}
|
|
82
137
|
}
|
|
83
138
|
/**
|
|
@@ -240,7 +295,7 @@ var IterableElementBase = class {
|
|
|
240
295
|
acc = initialValue;
|
|
241
296
|
} else {
|
|
242
297
|
const first = iter.next();
|
|
243
|
-
if (first.done)
|
|
298
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
244
299
|
acc = first.value;
|
|
245
300
|
index = 1;
|
|
246
301
|
}
|
|
@@ -475,55 +530,6 @@ var LinearBase = class _LinearBase extends IterableElementBase {
|
|
|
475
530
|
}
|
|
476
531
|
};
|
|
477
532
|
|
|
478
|
-
// src/common/error.ts
|
|
479
|
-
var ERR = {
|
|
480
|
-
// Range / index
|
|
481
|
-
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
482
|
-
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
483
|
-
// Type / argument
|
|
484
|
-
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
485
|
-
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
486
|
-
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
487
|
-
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
488
|
-
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
489
|
-
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
490
|
-
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
491
|
-
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
492
|
-
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
493
|
-
// State / operation
|
|
494
|
-
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
495
|
-
// Matrix
|
|
496
|
-
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
497
|
-
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
498
|
-
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
499
|
-
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
500
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
// src/common/index.ts
|
|
504
|
-
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
505
|
-
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
506
|
-
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
507
|
-
return DFSOperation2;
|
|
508
|
-
})(DFSOperation || {});
|
|
509
|
-
var Range = class {
|
|
510
|
-
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
511
|
-
this.low = low;
|
|
512
|
-
this.high = high;
|
|
513
|
-
this.includeLow = includeLow;
|
|
514
|
-
this.includeHigh = includeHigh;
|
|
515
|
-
}
|
|
516
|
-
static {
|
|
517
|
-
__name(this, "Range");
|
|
518
|
-
}
|
|
519
|
-
// Determine whether a key is within the range
|
|
520
|
-
isInRange(key, comparator) {
|
|
521
|
-
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
522
|
-
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
523
|
-
return lowCheck && highCheck;
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
|
|
527
533
|
// src/data-structures/base/iterable-entry-base.ts
|
|
528
534
|
var IterableEntryBase = class {
|
|
529
535
|
static {
|
|
@@ -777,6 +783,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
777
783
|
|
|
778
784
|
|
|
779
785
|
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
780
810
|
* @example
|
|
781
811
|
* // Track queue length
|
|
782
812
|
* const q = new Queue<number>();
|
|
@@ -803,6 +833,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
803
833
|
|
|
804
834
|
|
|
805
835
|
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
806
860
|
* @example
|
|
807
861
|
* // View the front element
|
|
808
862
|
* const q = new Queue<string>(['first', 'second', 'third']);
|
|
@@ -845,6 +899,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
845
899
|
|
|
846
900
|
|
|
847
901
|
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
848
926
|
* @example
|
|
849
927
|
* // Queue for...of iteration and isEmpty check
|
|
850
928
|
* const queue = new Queue<string>(['A', 'B', 'C', 'D']);
|
|
@@ -883,6 +961,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
883
961
|
|
|
884
962
|
|
|
885
963
|
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
886
988
|
* @example
|
|
887
989
|
* // basic Queue creation and push operation
|
|
888
990
|
* // Create a simple Queue with initial values
|
|
@@ -928,6 +1030,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
928
1030
|
|
|
929
1031
|
|
|
930
1032
|
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
931
1057
|
* @example
|
|
932
1058
|
* // Queue shift and peek operations
|
|
933
1059
|
* const queue = new Queue<number>([10, 20, 30, 40]);
|
|
@@ -963,6 +1089,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
963
1089
|
|
|
964
1090
|
|
|
965
1091
|
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
966
1116
|
* @example
|
|
967
1117
|
* // Remove specific element
|
|
968
1118
|
* const q = new Queue<number>([1, 2, 3, 2]);
|
|
@@ -991,21 +1141,45 @@ var Queue = class _Queue extends LinearBase {
|
|
|
991
1141
|
|
|
992
1142
|
|
|
993
1143
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
* @example
|
|
1169
|
+
* // Access element by index
|
|
1170
|
+
* const q = new Queue<string>(['a', 'b', 'c']);
|
|
1171
|
+
* console.log(q.at(0)); // 'a';
|
|
1172
|
+
* console.log(q.at(2)); // 'c';
|
|
1173
|
+
*/
|
|
1174
|
+
at(index) {
|
|
1175
|
+
if (index < 0 || index >= this.length) return void 0;
|
|
1176
|
+
return this._elements[this._offset + index];
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Delete the element at a given index.
|
|
1180
|
+
* @remarks Time O(N), Space O(1)
|
|
1181
|
+
* @param index - Zero-based index from the front.
|
|
1182
|
+
* @returns Removed element or undefined.
|
|
1009
1183
|
*/
|
|
1010
1184
|
deleteAt(index) {
|
|
1011
1185
|
if (index < 0 || index >= this.length) return void 0;
|
|
@@ -1060,6 +1234,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1060
1234
|
|
|
1061
1235
|
|
|
1062
1236
|
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1063
1261
|
* @example
|
|
1064
1262
|
* // Remove all elements
|
|
1065
1263
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -1082,6 +1280,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1082
1280
|
|
|
1083
1281
|
|
|
1084
1282
|
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
|
|
1085
1307
|
* @example
|
|
1086
1308
|
* // Reclaim unused memory
|
|
1087
1309
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -1127,6 +1349,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1127
1349
|
|
|
1128
1350
|
|
|
1129
1351
|
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
|
|
1130
1376
|
* @example
|
|
1131
1377
|
* // Create independent copy
|
|
1132
1378
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -1156,6 +1402,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1156
1402
|
|
|
1157
1403
|
|
|
1158
1404
|
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1159
1429
|
* @example
|
|
1160
1430
|
* // Filter elements
|
|
1161
1431
|
* const q = new Queue<number>([1, 2, 3, 4, 5]);
|
|
@@ -1189,6 +1459,30 @@ var Queue = class _Queue extends LinearBase {
|
|
|
1189
1459
|
|
|
1190
1460
|
|
|
1191
1461
|
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1192
1486
|
* @example
|
|
1193
1487
|
* // Transform elements
|
|
1194
1488
|
* const q = new Queue<number>([1, 2, 3]);
|
|
@@ -1439,7 +1733,7 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1439
1733
|
if (isMapMode !== void 0) this._isMapMode = isMapMode;
|
|
1440
1734
|
if (isDuplicate !== void 0) this._isDuplicate = isDuplicate;
|
|
1441
1735
|
if (typeof toEntryFn === "function") this._toEntryFn = toEntryFn;
|
|
1442
|
-
else if (toEntryFn)
|
|
1736
|
+
else if (toEntryFn) raise(TypeError, ERR.notAFunction("toEntryFn", "BinaryTree"));
|
|
1443
1737
|
}
|
|
1444
1738
|
if (keysNodesEntriesOrRaws) this.setMany(keysNodesEntriesOrRaws);
|
|
1445
1739
|
}
|
|
@@ -1665,6 +1959,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1665
1959
|
|
|
1666
1960
|
|
|
1667
1961
|
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
|
|
1668
1986
|
* @example
|
|
1669
1987
|
* // Add a single node
|
|
1670
1988
|
* const tree = new BinaryTree<number>();
|
|
@@ -1695,6 +2013,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1695
2013
|
|
|
1696
2014
|
|
|
1697
2015
|
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
|
|
1698
2040
|
* @example
|
|
1699
2041
|
* // basic BinaryTree creation and insertion
|
|
1700
2042
|
* // Create a BinaryTree with entries
|
|
@@ -1777,6 +2119,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1777
2119
|
|
|
1778
2120
|
|
|
1779
2121
|
|
|
2122
|
+
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
|
|
1780
2146
|
* @example
|
|
1781
2147
|
* // Bulk add
|
|
1782
2148
|
* const tree = new BinaryTree<number>();
|
|
@@ -1795,6 +2161,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1795
2161
|
* @returns An array of booleans indicating the success of each individual `set` operation.
|
|
1796
2162
|
|
|
1797
2163
|
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
|
|
1798
2188
|
* @example
|
|
1799
2189
|
* // Set multiple entries
|
|
1800
2190
|
* const tree = new BinaryTree<number, string>();
|
|
@@ -1834,7 +2224,31 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1834
2224
|
|
|
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
|
+
* @example
|
|
1838
2252
|
* // Combine trees
|
|
1839
2253
|
* const t1 = new BinaryTree<number>([1, 2]);
|
|
1840
2254
|
* const t2 = new BinaryTree<number>([3, 4]);
|
|
@@ -1872,6 +2286,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1872
2286
|
|
|
1873
2287
|
|
|
1874
2288
|
|
|
2289
|
+
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
|
|
2293
|
+
|
|
2294
|
+
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
1875
2313
|
* @example
|
|
1876
2314
|
* // Remove a node
|
|
1877
2315
|
* const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
|
|
@@ -1988,6 +2426,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
1988
2426
|
|
|
1989
2427
|
|
|
1990
2428
|
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
|
|
1991
2453
|
* @example
|
|
1992
2454
|
* // Get node by key
|
|
1993
2455
|
* const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'child']]);
|
|
@@ -2022,6 +2484,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2022
2484
|
|
|
2023
2485
|
|
|
2024
2486
|
|
|
2487
|
+
|
|
2488
|
+
|
|
2489
|
+
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2025
2511
|
* @example
|
|
2026
2512
|
* // Retrieve value by key
|
|
2027
2513
|
* const tree = new BinaryTree<number, string>([[1, 'root'], [2, 'left'], [3, 'right']]);
|
|
@@ -2058,6 +2544,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2058
2544
|
|
|
2059
2545
|
|
|
2060
2546
|
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
|
|
2061
2571
|
* @example
|
|
2062
2572
|
* // Remove all nodes
|
|
2063
2573
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -2082,6 +2592,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2082
2592
|
|
|
2083
2593
|
|
|
2084
2594
|
|
|
2595
|
+
|
|
2596
|
+
|
|
2597
|
+
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
|
|
2603
|
+
|
|
2604
|
+
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
|
|
2613
|
+
|
|
2614
|
+
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
|
|
2085
2619
|
* @example
|
|
2086
2620
|
* // Check empty
|
|
2087
2621
|
* console.log(new BinaryTree().isEmpty()); // true;
|
|
@@ -2115,6 +2649,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2115
2649
|
|
|
2116
2650
|
|
|
2117
2651
|
|
|
2652
|
+
|
|
2653
|
+
|
|
2654
|
+
|
|
2655
|
+
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2118
2676
|
* @example
|
|
2119
2677
|
* // Check BST property
|
|
2120
2678
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -2175,6 +2733,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2175
2733
|
|
|
2176
2734
|
|
|
2177
2735
|
|
|
2736
|
+
|
|
2737
|
+
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2178
2760
|
* @example
|
|
2179
2761
|
* // Get depth of a node
|
|
2180
2762
|
* const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
|
|
@@ -2212,6 +2794,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2212
2794
|
|
|
2213
2795
|
|
|
2214
2796
|
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
|
|
2816
|
+
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
|
|
2820
|
+
|
|
2215
2821
|
* @example
|
|
2216
2822
|
* // Get tree height
|
|
2217
2823
|
* const tree = new BinaryTree<number>([1, 2, 3, 4, 5]);
|
|
@@ -2665,6 +3271,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2665
3271
|
|
|
2666
3272
|
|
|
2667
3273
|
|
|
3274
|
+
|
|
3275
|
+
|
|
3276
|
+
|
|
3277
|
+
|
|
3278
|
+
|
|
3279
|
+
|
|
3280
|
+
|
|
3281
|
+
|
|
3282
|
+
|
|
3283
|
+
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
|
|
3288
|
+
|
|
3289
|
+
|
|
3290
|
+
|
|
3291
|
+
|
|
3292
|
+
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
|
|
3297
|
+
|
|
2668
3298
|
* @example
|
|
2669
3299
|
* // Deep copy
|
|
2670
3300
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -2693,6 +3323,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2693
3323
|
|
|
2694
3324
|
|
|
2695
3325
|
|
|
3326
|
+
|
|
3327
|
+
|
|
3328
|
+
|
|
3329
|
+
|
|
3330
|
+
|
|
3331
|
+
|
|
3332
|
+
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
|
|
2696
3350
|
* @example
|
|
2697
3351
|
* // Filter nodes by condition
|
|
2698
3352
|
* const tree = new BinaryTree<number>([1, 2, 3, 4]);
|
|
@@ -2725,6 +3379,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2725
3379
|
|
|
2726
3380
|
|
|
2727
3381
|
|
|
3382
|
+
|
|
3383
|
+
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
|
|
3387
|
+
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
|
|
2728
3406
|
* @example
|
|
2729
3407
|
* // Transform to new tree
|
|
2730
3408
|
* const tree = new BinaryTree<number, number>([[1, 10], [2, 20]]);
|
|
@@ -2782,6 +3460,30 @@ var BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
2782
3460
|
|
|
2783
3461
|
|
|
2784
3462
|
|
|
3463
|
+
|
|
3464
|
+
|
|
3465
|
+
|
|
3466
|
+
|
|
3467
|
+
|
|
3468
|
+
|
|
3469
|
+
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
|
|
3482
|
+
|
|
3483
|
+
|
|
3484
|
+
|
|
3485
|
+
|
|
3486
|
+
|
|
2785
3487
|
* @example
|
|
2786
3488
|
* // Display tree
|
|
2787
3489
|
* const tree = new BinaryTree<number>([1, 2, 3]);
|
|
@@ -3266,5 +3968,6 @@ exports.BinaryTreeNode = BinaryTreeNode;
|
|
|
3266
3968
|
exports.DFSOperation = DFSOperation;
|
|
3267
3969
|
exports.ERR = ERR;
|
|
3268
3970
|
exports.Range = Range;
|
|
3971
|
+
exports.raise = raise;
|
|
3269
3972
|
//# sourceMappingURL=index.cjs.map
|
|
3270
3973
|
//# sourceMappingURL=index.cjs.map
|