nlptoolkit-datastructure 1.0.8 → 1.0.9

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.
@@ -1,191 +1,186 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BTreeNode = void 0;
13
- class BTreeNode {
14
- /**
15
- * Another constructor of a B+ Tree node. By default, it is not a leaf node. Adds two children.
16
- * @param d d in d-ary tree.
17
- * @param firstChild First child of the root node.
18
- * @param secondChild Second child of the root node.
19
- * @param newK First value in the node.
20
- */
21
- constructor(d, firstChild, secondChild, newK) {
22
- this.d = d;
23
- this.K = [];
24
- this.children = [];
25
- if (firstChild == undefined) {
26
- this.m = 0;
27
- this.leaf = true;
28
- }
29
- else {
30
- this.m = 1;
31
- this.leaf = false;
32
- this.children[0] = firstChild;
33
- if (secondChild != undefined) {
34
- this.children[1] = secondChild;
35
- }
36
- if (newK != undefined) {
37
- this.K[0] = newK;
38
- }
39
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BTreeNode = void 0;
4
+ class BTreeNode {
5
+ K;
6
+ m;
7
+ d;
8
+ leaf;
9
+ children;
10
+ /**
11
+ * Another constructor of a B+ Tree node. By default, it is not a leaf node. Adds two children.
12
+ * @param d d in d-ary tree.
13
+ * @param firstChild First child of the root node.
14
+ * @param secondChild Second child of the root node.
15
+ * @param newK First value in the node.
16
+ */
17
+ constructor(d, firstChild, secondChild, newK) {
18
+ this.d = d;
19
+ this.K = [];
20
+ this.children = [];
21
+ if (firstChild == undefined) {
22
+ this.m = 0;
23
+ this.leaf = true;
40
24
  }
41
- /**
42
- * Searches the position of value in the list K. If the searched value is larger than the last value of node, we
43
- * need to continue the search with the rightmost child. If the searched value is smaller than the i. value of node,
44
- * we need to continue the search with the i. child.
45
- * @param value Searched value
46
- * @param comparator Comparator function which compares two elements.
47
- * @return The position of searched value in array K.
48
- */
49
- position(value, comparator) {
50
- if (this.m == 0) {
51
- return 0;
25
+ else {
26
+ this.m = 1;
27
+ this.leaf = false;
28
+ this.children[0] = firstChild;
29
+ if (secondChild != undefined) {
30
+ this.children[1] = secondChild;
52
31
  }
53
- if (comparator(value, this.K[this.m - 1]) > 0) {
54
- return this.m;
32
+ if (newK != undefined) {
33
+ this.K[0] = newK;
55
34
  }
56
- else {
57
- for (let i = 0; i < this.m; i++) {
58
- if (comparator(value, this.K[i]) <= 0) {
59
- return i;
60
- }
35
+ }
36
+ }
37
+ /**
38
+ * Searches the position of value in the list K. If the searched value is larger than the last value of node, we
39
+ * need to continue the search with the rightmost child. If the searched value is smaller than the i. value of node,
40
+ * we need to continue the search with the i. child.
41
+ * @param value Searched value
42
+ * @param comparator Comparator function which compares two elements.
43
+ * @return The position of searched value in array K.
44
+ */
45
+ position(value, comparator) {
46
+ if (this.m == 0) {
47
+ return 0;
48
+ }
49
+ if (comparator(value, this.K[this.m - 1]) > 0) {
50
+ return this.m;
51
+ }
52
+ else {
53
+ for (let i = 0; i < this.m; i++) {
54
+ if (comparator(value, this.K[i]) <= 0) {
55
+ return i;
61
56
  }
62
57
  }
63
- return -1;
64
58
  }
65
- /**
66
- * Add the new value insertedK to the array K into the calculated position index.
67
- * @param index Place to insert new value
68
- * @param insertedK New value to be inserted.
69
- */
70
- insertIntoK(index, insertedK) {
71
- for (let i = this.m; i > index; i--) {
72
- this.K[i] = this.K[i - 1];
73
- }
74
- this.K[index] = insertedK;
59
+ return -1;
60
+ }
61
+ /**
62
+ * Add the new value insertedK to the array K into the calculated position index.
63
+ * @param index Place to insert new value
64
+ * @param insertedK New value to be inserted.
65
+ */
66
+ insertIntoK(index, insertedK) {
67
+ for (let i = this.m; i > index; i--) {
68
+ this.K[i] = this.K[i - 1];
75
69
  }
76
- /**
77
- * Transfers the last d values of the current node to the newNode.
78
- * @param newNode New node.
79
- */
80
- moveHalfOfTheKToNewNode(newNode) {
81
- for (let i = 0; i < this.d; i++) {
82
- newNode.K[i] = this.K[i + this.d + 1];
83
- }
84
- newNode.m = this.d;
70
+ this.K[index] = insertedK;
71
+ }
72
+ /**
73
+ * Transfers the last d values of the current node to the newNode.
74
+ * @param newNode New node.
75
+ */
76
+ moveHalfOfTheKToNewNode(newNode) {
77
+ for (let i = 0; i < this.d; i++) {
78
+ newNode.K[i] = this.K[i + this.d + 1];
85
79
  }
86
- /**
87
- * Transfers the last d links of the current node to the newNode.
88
- * @param newNode New node.
89
- */
90
- moveHalfOfTheChildrenToNewNode(newNode) {
91
- for (let i = 0; i < this.d; i++) {
92
- newNode.children[i] = this.children[i + this.d + 1];
93
- }
80
+ newNode.m = this.d;
81
+ }
82
+ /**
83
+ * Transfers the last d links of the current node to the newNode.
84
+ * @param newNode New node.
85
+ */
86
+ moveHalfOfTheChildrenToNewNode(newNode) {
87
+ for (let i = 0; i < this.d; i++) {
88
+ newNode.children[i] = this.children[i + this.d + 1];
94
89
  }
95
- /**
96
- * Transfers the last d values and the last d links of the current node to the newNode.
97
- * @param newNode New node.
98
- */
99
- moveHalfOfTheElementsToNewNode(newNode) {
100
- this.moveHalfOfTheKToNewNode(newNode);
101
- this.moveHalfOfTheChildrenToNewNode(newNode);
90
+ }
91
+ /**
92
+ * Transfers the last d values and the last d links of the current node to the newNode.
93
+ * @param newNode New node.
94
+ */
95
+ moveHalfOfTheElementsToNewNode(newNode) {
96
+ this.moveHalfOfTheKToNewNode(newNode);
97
+ this.moveHalfOfTheChildrenToNewNode(newNode);
98
+ }
99
+ /**
100
+ * First the function position is used to determine the node or the subtree to which the new node will be added.
101
+ * If this subtree is a leaf node, we call the function insertLeaf that will add the value to a leaf node. If this
102
+ * subtree is not a leaf node the function calls itself with the determined subtree. Both insertNode and insertLeaf
103
+ * functions, if adding a new value/node to that node/subtree necessitates a new child node to be added to the
104
+ * parent node, they will both return the new added node and the node obtained by dividing the original node. If
105
+ * there is not such a restructuring, these functions will return null. If we add a new child node to the parent
106
+ * node, first we open a space for that child node in the value array K, then we add this new node to the array K.
107
+ * After adding there are two possibilities:
108
+ * <ul>
109
+ * <li>After inserting the new child node, the current node did not exceed its capacity. In this case, we open
110
+ * space for the link, which points to the new node, in the array children and place that link inside of this
111
+ * array.</li>
112
+ * <li>After inserting the new child node, the current node exceed its capacity. In this case, we need to create
113
+ * newNode, transfer the last d values and the last d links of the current node to the newNode. As a last case,
114
+ * if the divided node is the root node, we need to create a new root node and the first child of this new root
115
+ * node will be b, and the second child of the new root node will be newNode.</li>
116
+ * </ul>
117
+ * @param value Value to be inserted into B+ tree.
118
+ * @param comparator Comparator function to compare two elements.
119
+ * @param isRoot If true, value is inserted as a root node, otherwise false.
120
+ * @return If inserted node results in a creation of a node, the function returns that node, otherwise null.
121
+ */
122
+ insertNode(value, comparator, isRoot) {
123
+ let s;
124
+ let newNode;
125
+ let child;
126
+ child = this.position(value, comparator);
127
+ if (!this.children[child].leaf) {
128
+ s = this.children[child].insertNode(value, comparator, false);
102
129
  }
103
- /**
104
- * First the function position is used to determine the node or the subtree to which the new node will be added.
105
- * If this subtree is a leaf node, we call the function insertLeaf that will add the value to a leaf node. If this
106
- * subtree is not a leaf node the function calls itself with the determined subtree. Both insertNode and insertLeaf
107
- * functions, if adding a new value/node to that node/subtree necessitates a new child node to be added to the
108
- * parent node, they will both return the new added node and the node obtained by dividing the original node. If
109
- * there is not such a restructuring, these functions will return null. If we add a new child node to the parent
110
- * node, first we open a space for that child node in the value array K, then we add this new node to the array K.
111
- * After adding there are two possibilities:
112
- * <ul>
113
- * <li>After inserting the new child node, the current node did not exceed its capacity. In this case, we open
114
- * space for the link, which points to the new node, in the array children and place that link inside of this
115
- * array.</li>
116
- * <li>After inserting the new child node, the current node exceed its capacity. In this case, we need to create
117
- * newNode, transfer the last d values and the last d links of the current node to the newNode. As a last case,
118
- * if the divided node is the root node, we need to create a new root node and the first child of this new root
119
- * node will be b, and the second child of the new root node will be newNode.</li>
120
- * </ul>
121
- * @param value Value to be inserted into B+ tree.
122
- * @param comparator Comparator function to compare two elements.
123
- * @param isRoot If true, value is inserted as a root node, otherwise false.
124
- * @return If inserted node results in a creation of a node, the function returns that node, otherwise null.
125
- */
126
- insertNode(value, comparator, isRoot) {
127
- let s;
128
- let newNode;
129
- let child;
130
- child = this.position(value, comparator);
131
- if (!this.children[child].leaf) {
132
- s = this.children[child].insertNode(value, comparator, false);
133
- }
134
- else {
135
- s = this.children[child].insertLeaf(value, comparator);
136
- }
137
- if (s == null) {
138
- return null;
139
- }
140
- this.insertIntoK(child, this.children[child].K[this.d]);
141
- if (this.m < 2 * this.d) {
142
- this.children[child + 1] = s;
143
- this.m++;
144
- return null;
145
- }
146
- else {
147
- newNode = new BTreeNode(this.d, undefined, undefined, undefined);
148
- newNode.leaf = false;
149
- this.moveHalfOfTheElementsToNewNode(newNode);
150
- newNode.children[this.d] = s;
151
- this.m = this.d;
152
- if (isRoot) {
153
- return new BTreeNode(this.d, this, newNode, this.K[this.d]);
154
- }
155
- else {
156
- return newNode;
157
- }
158
- }
130
+ else {
131
+ s = this.children[child].insertLeaf(value, comparator);
132
+ }
133
+ if (s == null) {
134
+ return null;
135
+ }
136
+ this.insertIntoK(child, this.children[child].K[this.d]);
137
+ if (this.m < 2 * this.d) {
138
+ this.children[child + 1] = s;
139
+ this.m++;
140
+ return null;
159
141
  }
160
- /**
161
- * First the function position is used to determine the position where the new value will be placed Then we open a
162
- * space for that value in the value array K, then we add this new value to the array K into the calculated
163
- * position. At this stage there are again two possibilities:
164
- * <ul>
165
- * <li>After inserting the new value, the current leaf node did not exceed its capacity. The function returns
166
- * null.</li>
167
- * <li>After inserting the new value, the current leaf node exceed its capacity. In this case, we need to create
168
- * the newNode, and transfer the last d values of node b to this newNode.</li>
169
- * </ul>
170
- * @param value Value to be inserted into B+ tree.
171
- * @param comparator Comparator function to compare two elements.
172
- * @return If inserted node results in a creation of a node, the function returns that node, otherwise null.
173
- */
174
- insertLeaf(value, comparator) {
175
- let child = this.position(value, comparator);
176
- this.insertIntoK(child, value);
177
- if (this.m < 2 * this.d) {
178
- this.m++;
179
- return null;
142
+ else {
143
+ newNode = new BTreeNode(this.d, undefined, undefined, undefined);
144
+ newNode.leaf = false;
145
+ this.moveHalfOfTheElementsToNewNode(newNode);
146
+ newNode.children[this.d] = s;
147
+ this.m = this.d;
148
+ if (isRoot) {
149
+ return new BTreeNode(this.d, this, newNode, this.K[this.d]);
180
150
  }
181
151
  else {
182
- let newNode = new BTreeNode(this.d, undefined, undefined, undefined);
183
- this.moveHalfOfTheKToNewNode(newNode);
184
- this.m = this.d;
185
152
  return newNode;
186
153
  }
187
154
  }
188
155
  }
189
- exports.BTreeNode = BTreeNode;
190
- });
156
+ /**
157
+ * First the function position is used to determine the position where the new value will be placed Then we open a
158
+ * space for that value in the value array K, then we add this new value to the array K into the calculated
159
+ * position. At this stage there are again two possibilities:
160
+ * <ul>
161
+ * <li>After inserting the new value, the current leaf node did not exceed its capacity. The function returns
162
+ * null.</li>
163
+ * <li>After inserting the new value, the current leaf node exceed its capacity. In this case, we need to create
164
+ * the newNode, and transfer the last d values of node b to this newNode.</li>
165
+ * </ul>
166
+ * @param value Value to be inserted into B+ tree.
167
+ * @param comparator Comparator function to compare two elements.
168
+ * @return If inserted node results in a creation of a node, the function returns that node, otherwise null.
169
+ */
170
+ insertLeaf(value, comparator) {
171
+ let child = this.position(value, comparator);
172
+ this.insertIntoK(child, value);
173
+ if (this.m < 2 * this.d) {
174
+ this.m++;
175
+ return null;
176
+ }
177
+ else {
178
+ let newNode = new BTreeNode(this.d, undefined, undefined, undefined);
179
+ this.moveHalfOfTheKToNewNode(newNode);
180
+ this.m = this.d;
181
+ return newNode;
182
+ }
183
+ }
184
+ }
185
+ exports.BTreeNode = BTreeNode;
191
186
  //# sourceMappingURL=BTreeNode.js.map
@@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Q,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;YACf,IAAI,MAAM,EAAC,CAAC;gBACR,OAAO,IAAI,SAAS,CAAI,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;YAClE,CAAC;iBAAM,CAAC;gBACJ,OAAO,OAAO,CAAA;YAClB,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,UAAU,CAAC,KAAQ,EAAE,UAA6C;QACrE,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;QAC5C,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC9B,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,EAAC,CAAC;YACrB,IAAI,CAAC,CAAC,EAAE,CAAC;YACT,OAAO,IAAI,CAAA;QACf,CAAC;aAAM,CAAC;YACJ,IAAI,OAAO,GAAG,IAAI,SAAS,CAAI,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;YACxE,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YAChB,OAAO,OAAO,CAAC;QACnB,CAAC;IACL,CAAC;CAEJ;AAxLD,8BAwLC"}
package/dist/tree/Tree.js CHANGED
@@ -1,106 +1,97 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./TreeNode"], factory);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tree = void 0;
4
+ const TreeNode_1 = require("./TreeNode");
5
+ /**
6
+ * Tree structure is also a non-linear data structure. Different from the tree structure we see in the nature, the
7
+ * tree data structure has its root on top and develops its branches down.
8
+ * @param T Type of the data stored in the tree node.
9
+ */
10
+ class Tree {
11
+ root = null;
12
+ comparator;
13
+ /**
14
+ * Constructor of the tree. According to the comparator, the tree could contain any object.
15
+ * @param comparator Comparator function to compare two elements.
16
+ */
17
+ constructor(comparator) {
18
+ this.comparator = comparator;
8
19
  }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Tree = void 0;
13
- const TreeNode_1 = require("./TreeNode");
14
20
  /**
15
- * Tree structure is also a non-linear data structure. Different from the tree structure we see in the nature, the
16
- * tree data structure has its root on top and develops its branches down.
17
- * @param T Type of the data stored in the tree node.
21
+ * The search starts from the root node, and we represent the node, with which we compare the searched value, with
22
+ * d. If the searched value is equal to the value of the current node, we have found the node we search for, the
23
+ * function will return that node. If the searched value is smaller than the value of the current node , the number
24
+ * we search for must be on the left subtree of the current node, therefore the new current node must be the left
25
+ * child of the current node. As the last case, if the searched value is larger than the value of the current node,
26
+ * the number we search for must be on the right subtree of the current node, therefore the new current node must be
27
+ * the right child of the current node. If this search continues until the leaf nodes of the tree and we can't find
28
+ * the node we search for, node d will be null and the function will return null.
29
+ * @param value Searched value
30
+ * @return If the value exists in the tree, the function returns the node that contains the node. Otherwise, it
31
+ * returns null.
18
32
  */
19
- class Tree {
20
- /**
21
- * Constructor of the tree. According to the comparator, the tree could contain any object.
22
- * @param comparator Comparator function to compare two elements.
23
- */
24
- constructor(comparator) {
25
- this.root = null;
26
- this.comparator = comparator;
27
- }
28
- /**
29
- * The search starts from the root node, and we represent the node, with which we compare the searched value, with
30
- * d. If the searched value is equal to the value of the current node, we have found the node we search for, the
31
- * function will return that node. If the searched value is smaller than the value of the current node , the number
32
- * we search for must be on the left subtree of the current node, therefore the new current node must be the left
33
- * child of the current node. As the last case, if the searched value is larger than the value of the current node,
34
- * the number we search for must be on the right subtree of the current node, therefore the new current node must be
35
- * the right child of the current node. If this search continues until the leaf nodes of the tree and we can't find
36
- * the node we search for, node d will be null and the function will return null.
37
- * @param value Searched value
38
- * @return If the value exists in the tree, the function returns the node that contains the node. Otherwise, it
39
- * returns null.
40
- */
41
- search(value) {
42
- let d = this.root;
43
- while (d != null) {
44
- if (this.comparator(d.data, value) == 0) {
45
- return d;
33
+ search(value) {
34
+ let d = this.root;
35
+ while (d != null) {
36
+ if (this.comparator(d.data, value) == 0) {
37
+ return d;
38
+ }
39
+ else {
40
+ if (this.comparator(d.data, value) > 0) {
41
+ d = d.left;
46
42
  }
47
43
  else {
48
- if (this.comparator(d.data, value) > 0) {
49
- d = d.left;
50
- }
51
- else {
52
- d = d.right;
53
- }
44
+ d = d.right;
54
45
  }
55
46
  }
56
- return null;
57
47
  }
58
- /**
59
- * Inserts a child to its parent as left or right child.
60
- * @param parent New parent of the child node.
61
- * @param child Child node.
62
- */
63
- insertChild(parent, child) {
64
- if (parent == null) {
65
- this.root = child;
48
+ return null;
49
+ }
50
+ /**
51
+ * Inserts a child to its parent as left or right child.
52
+ * @param parent New parent of the child node.
53
+ * @param child Child node.
54
+ */
55
+ insertChild(parent, child) {
56
+ if (parent == null) {
57
+ this.root = child;
58
+ }
59
+ else {
60
+ if (this.comparator(child.data, parent.data) < 0) {
61
+ parent.left = child;
66
62
  }
67
63
  else {
68
- if (this.comparator(child.data, parent.data) < 0) {
69
- parent.left = child;
70
- }
71
- else {
72
- parent.right = child;
73
- }
64
+ parent.right = child;
74
65
  }
75
66
  }
76
- /**
77
- * In order to add a new node into a binary search tree, we need to first find out the place where we will insert
78
- * the new node. For this, we start from the root node and traverse the tree down. At each step, we compare the
79
- * value of the new node with the value of the current node. If the value of the new node is smaller than the value
80
- * of the current node, the new node will be inserted into the left subtree of the current node. To accomplish this,
81
- * we continue the process with the left child of the current node. If the situation is reverse, that is, if the
82
- * value of the new node is larger than the value of the current node, the new node will be inserted into the right
83
- * subtree of the current node. In this case, we continue the process with the right child of the current node.
84
- * @param node Node to be inserted.
85
- */
86
- insert(node) {
87
- let y = null;
88
- let x = this.root;
89
- while (x != null) {
90
- y = x;
91
- if (this.comparator(node.data, x.data) < 0) {
92
- x = x.left;
93
- }
94
- else {
95
- x = x.right;
96
- }
67
+ }
68
+ /**
69
+ * In order to add a new node into a binary search tree, we need to first find out the place where we will insert
70
+ * the new node. For this, we start from the root node and traverse the tree down. At each step, we compare the
71
+ * value of the new node with the value of the current node. If the value of the new node is smaller than the value
72
+ * of the current node, the new node will be inserted into the left subtree of the current node. To accomplish this,
73
+ * we continue the process with the left child of the current node. If the situation is reverse, that is, if the
74
+ * value of the new node is larger than the value of the current node, the new node will be inserted into the right
75
+ * subtree of the current node. In this case, we continue the process with the right child of the current node.
76
+ * @param node Node to be inserted.
77
+ */
78
+ insert(node) {
79
+ let y = null;
80
+ let x = this.root;
81
+ while (x != null) {
82
+ y = x;
83
+ if (this.comparator(node.data, x.data) < 0) {
84
+ x = x.left;
85
+ }
86
+ else {
87
+ x = x.right;
97
88
  }
98
- this.insertChild(y, node);
99
- }
100
- insertData(data) {
101
- this.insert(new TreeNode_1.TreeNode(data));
102
89
  }
90
+ this.insertChild(y, node);
91
+ }
92
+ insertData(data) {
93
+ this.insert(new TreeNode_1.TreeNode(data));
103
94
  }
104
- exports.Tree = Tree;
105
- });
95
+ }
96
+ exports.Tree = Tree;
106
97
  //# sourceMappingURL=Tree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../source/tree/Tree.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,yCAAoC;IAEpC;;;;OAIG;IACH,MAAa,IAAI;QAKb;;;WAGG;QACH,YAAY,UAA6C;YAP/C,SAAI,GAAwB,IAAI,CAAA;YAQtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAChC,CAAC;QAED;;;;;;;;;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,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/C,MAAM,CAAC,IAAI,GAAG,KAAK,CAAA;YACvB,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;YACxB,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,IAAiB;QAC3B,IAAI,CAAC,GAAwB,IAAI,CAAA;QACjC,IAAI,CAAC,GAAwB,IAAI,CAAC,IAAI,CAAC;QACvC,OAAO,CAAC,IAAI,IAAI,EAAC,CAAC;YACd,CAAC,GAAG,CAAC,CAAC;YACN,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAC,CAAC;gBACxC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACf,CAAC;iBAAM,CAAC;gBACJ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;YAChB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEM,UAAU,CAAC,IAAO;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,mBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;CAEJ;AAvFD,oBAuFC"}
@@ -1,22 +1,13 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TreeNode = void 0;
4
+ class TreeNode {
5
+ data;
6
+ left = null;
7
+ right = null;
8
+ constructor(data) {
9
+ this.data = data;
5
10
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.TreeNode = void 0;
13
- class TreeNode {
14
- constructor(data) {
15
- this.left = null;
16
- this.right = null;
17
- this.data = data;
18
- }
19
- }
20
- exports.TreeNode = TreeNode;
21
- });
11
+ }
12
+ exports.TreeNode = TreeNode;
22
13
  //# sourceMappingURL=TreeNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNode.js","sourceRoot":"","sources":["../../source/tree/TreeNode.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,MAAa,QAAQ;QAMjB,YAAY,IAAO;YAHnB,SAAI,GAAwB,IAAI,CAAA;YAChC,UAAK,GAAwB,IAAI,CAAA;YAG7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QACpB,CAAC;KAEJ;IAVD,4BAUC"}
1
+ {"version":3,"file":"TreeNode.js","sourceRoot":"","sources":["../../source/tree/TreeNode.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAQ;IAEjB,IAAI,CAAI;IACR,IAAI,GAAwB,IAAI,CAAA;IAChC,KAAK,GAAwB,IAAI,CAAA;IAEjC,YAAY,IAAO;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;CAEJ;AAVD,4BAUC"}