data-structure-typed 0.9.16 → 1.12.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.
Files changed (199) hide show
  1. package/.dependency-cruiser.js +449 -0
  2. package/.idea/data-structure-typed.iml +2 -0
  3. package/README.md +102 -1
  4. package/dist/data-structures/binary-tree/avl-tree.d.ts +57 -0
  5. package/dist/data-structures/binary-tree/avl-tree.js +57 -0
  6. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +27 -0
  7. package/dist/data-structures/binary-tree/binary-indexed-tree.js +27 -0
  8. package/dist/data-structures/binary-tree/binary-tree.d.ts +215 -9
  9. package/dist/data-structures/binary-tree/binary-tree.js +283 -15
  10. package/dist/data-structures/binary-tree/bst.d.ts +16 -0
  11. package/dist/data-structures/binary-tree/bst.js +12 -0
  12. package/dist/data-structures/binary-tree/segment-tree.d.ts +4 -0
  13. package/dist/data-structures/binary-tree/segment-tree.js +4 -0
  14. package/dist/data-structures/binary-tree/tree-multiset.d.ts +4 -0
  15. package/dist/data-structures/binary-tree/tree-multiset.js +4 -0
  16. package/dist/data-structures/graph/abstract-graph.d.ts +163 -13
  17. package/dist/data-structures/graph/abstract-graph.js +166 -12
  18. package/dist/data-structures/graph/directed-graph.d.ts +111 -1
  19. package/dist/data-structures/graph/directed-graph.js +122 -0
  20. package/dist/data-structures/graph/undirected-graph.d.ts +63 -0
  21. package/dist/data-structures/graph/undirected-graph.js +67 -0
  22. package/dist/data-structures/hash/coordinate-map.d.ts +32 -0
  23. package/dist/data-structures/hash/coordinate-map.js +32 -0
  24. package/dist/data-structures/hash/coordinate-set.d.ts +25 -0
  25. package/dist/data-structures/hash/coordinate-set.js +25 -0
  26. package/dist/data-structures/heap/heap.d.ts +26 -31
  27. package/dist/data-structures/heap/heap.js +23 -32
  28. package/dist/data-structures/heap/max-heap.d.ts +6 -1
  29. package/dist/data-structures/heap/max-heap.js +6 -1
  30. package/dist/data-structures/heap/min-heap.d.ts +7 -1
  31. package/dist/data-structures/heap/min-heap.js +7 -1
  32. package/dist/data-structures/index.d.ts +0 -1
  33. package/dist/data-structures/index.js +0 -1
  34. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +14 -6
  35. package/dist/data-structures/linked-list/doubly-linked-list.js +45 -8
  36. package/dist/data-structures/linked-list/singly-linked-list.d.ts +11 -8
  37. package/dist/data-structures/linked-list/singly-linked-list.js +4 -0
  38. package/dist/data-structures/matrix/matrix.d.ts +9 -0
  39. package/dist/data-structures/matrix/matrix.js +11 -0
  40. package/dist/data-structures/matrix/matrix2d.d.ts +82 -2
  41. package/dist/data-structures/matrix/matrix2d.js +82 -2
  42. package/dist/data-structures/matrix/navigator.d.ts +32 -0
  43. package/dist/data-structures/matrix/navigator.js +28 -0
  44. package/dist/data-structures/matrix/vector2d.d.ts +139 -15
  45. package/dist/data-structures/matrix/vector2d.js +139 -15
  46. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +8 -0
  47. package/dist/data-structures/priority-queue/max-priority-queue.js +8 -0
  48. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +8 -0
  49. package/dist/data-structures/priority-queue/min-priority-queue.js +8 -0
  50. package/dist/data-structures/priority-queue/priority-queue.d.ts +130 -0
  51. package/dist/data-structures/priority-queue/priority-queue.js +126 -0
  52. package/dist/data-structures/queue/deque.d.ts +69 -0
  53. package/dist/data-structures/queue/deque.js +69 -0
  54. package/dist/data-structures/queue/queue.d.ts +30 -32
  55. package/dist/data-structures/queue/queue.js +30 -32
  56. package/dist/data-structures/stack/stack.d.ts +26 -31
  57. package/dist/data-structures/stack/stack.js +26 -31
  58. package/dist/data-structures/trie/trie.d.ts +26 -6
  59. package/dist/data-structures/trie/trie.js +26 -7
  60. package/dist/data-structures/types/avl-tree.d.ts +1 -1
  61. package/dist/data-structures/types/binary-tree.d.ts +1 -1
  62. package/dist/data-structures/types/index.d.ts +1 -1
  63. package/dist/data-structures/types/index.js +1 -1
  64. package/dist/data-structures/types/singly-linked-list.d.ts +1 -5
  65. package/dist/data-structures/types/tree-multiset.d.ts +1 -1
  66. package/dist/{data-structures → utils}/trampoline.d.ts +5 -7
  67. package/dist/utils/types/index.d.ts +1 -0
  68. package/dist/utils/types/index.js +17 -0
  69. package/dist/{data-structures → utils}/types/utils.d.ts +8 -0
  70. package/dist/{data-structures → utils}/types/utils.js +1 -0
  71. package/dist/utils/utils.d.ts +1 -1
  72. package/docs/.nojekyll +1 -0
  73. package/docs/assets/highlight.css +85 -0
  74. package/docs/assets/main.js +58 -0
  75. package/docs/assets/search.js +1 -0
  76. package/docs/assets/style.css +1367 -0
  77. package/docs/classes/AVLTree.html +2046 -0
  78. package/docs/classes/AVLTreeNode.html +423 -0
  79. package/docs/classes/AaTree.html +117 -0
  80. package/docs/classes/AbstractEdge.html +198 -0
  81. package/docs/classes/AbstractGraph.html +891 -0
  82. package/docs/classes/AbstractVertex.html +164 -0
  83. package/docs/classes/ArrayDeque.html +384 -0
  84. package/docs/classes/BST.html +1893 -0
  85. package/docs/classes/BSTNode.html +425 -0
  86. package/docs/classes/BTree.html +117 -0
  87. package/docs/classes/BinaryIndexedTree.html +244 -0
  88. package/docs/classes/BinaryTree.html +1754 -0
  89. package/docs/classes/BinaryTreeNode.html +396 -0
  90. package/docs/classes/Character.html +165 -0
  91. package/docs/classes/CoordinateMap.html +394 -0
  92. package/docs/classes/CoordinateSet.html +355 -0
  93. package/docs/classes/Deque.html +617 -0
  94. package/docs/classes/DirectedEdge.html +247 -0
  95. package/docs/classes/DirectedGraph.html +1207 -0
  96. package/docs/classes/DirectedVertex.html +154 -0
  97. package/docs/classes/DoublyLinkedList.html +619 -0
  98. package/docs/classes/DoublyLinkedListNode.html +160 -0
  99. package/docs/classes/Heap.html +315 -0
  100. package/docs/classes/Matrix2D.html +447 -0
  101. package/docs/classes/MatrixNTI2D.html +181 -0
  102. package/docs/classes/MaxHeap.html +325 -0
  103. package/docs/classes/MaxPriorityQueue.html +668 -0
  104. package/docs/classes/MinHeap.html +326 -0
  105. package/docs/classes/MinPriorityQueue.html +668 -0
  106. package/docs/classes/Navigator.html +285 -0
  107. package/docs/classes/ObjectDeque.html +289 -0
  108. package/docs/classes/PriorityQueue.html +643 -0
  109. package/docs/classes/Queue.html +337 -0
  110. package/docs/classes/RBTree.html +117 -0
  111. package/docs/classes/SegmentTree.html +234 -0
  112. package/docs/classes/SegmentTreeNode.html +302 -0
  113. package/docs/classes/SinglyLinkedList.html +1035 -0
  114. package/docs/classes/SinglyLinkedListNode.html +304 -0
  115. package/docs/classes/SplayTree.html +117 -0
  116. package/docs/classes/Stack.html +313 -0
  117. package/docs/classes/TreeMultiSet.html +1897 -0
  118. package/docs/classes/Trie.html +317 -0
  119. package/docs/classes/TrieNode.html +221 -0
  120. package/docs/classes/TwoThreeTree.html +117 -0
  121. package/docs/classes/UndirectedEdge.html +220 -0
  122. package/docs/classes/UndirectedGraph.html +1006 -0
  123. package/docs/classes/UndirectedVertex.html +154 -0
  124. package/docs/classes/Vector2D.html +746 -0
  125. package/docs/enums/CP.html +126 -0
  126. package/docs/enums/FamilyPosition.html +126 -0
  127. package/docs/enums/LoopType.html +119 -0
  128. package/docs/index.html +288 -0
  129. package/docs/modules.html +146 -0
  130. package/jest.config.js +5 -0
  131. package/package.json +19 -11
  132. package/rename_clear_files.sh +29 -0
  133. package/src/assets/complexities-diff.jpg +0 -0
  134. package/src/assets/data-structure-complexities.jpg +0 -0
  135. package/src/data-structures/binary-tree/avl-tree.ts +57 -0
  136. package/src/data-structures/binary-tree/binary-indexed-tree.ts +27 -0
  137. package/src/data-structures/binary-tree/binary-tree.ts +288 -18
  138. package/src/data-structures/binary-tree/bst.ts +16 -1
  139. package/src/data-structures/binary-tree/segment-tree.ts +5 -0
  140. package/src/data-structures/binary-tree/tree-multiset.ts +4 -0
  141. package/src/data-structures/diagrams/README.md +5 -7
  142. package/src/data-structures/graph/abstract-graph.ts +167 -15
  143. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
  144. package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
  145. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
  146. package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
  147. package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
  148. package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
  149. package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
  150. package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
  151. package/src/data-structures/graph/diagrams/mst.jpg +0 -0
  152. package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
  153. package/src/data-structures/graph/directed-graph.ts +127 -5
  154. package/src/data-structures/graph/undirected-graph.ts +67 -1
  155. package/src/data-structures/hash/coordinate-map.ts +32 -0
  156. package/src/data-structures/hash/coordinate-set.ts +25 -0
  157. package/src/data-structures/heap/heap.ts +27 -32
  158. package/src/data-structures/heap/max-heap.ts +6 -1
  159. package/src/data-structures/heap/min-heap.ts +7 -1
  160. package/src/data-structures/index.ts +0 -1
  161. package/src/data-structures/linked-list/doubly-linked-list.ts +49 -8
  162. package/src/data-structures/linked-list/singly-linked-list.ts +39 -8
  163. package/src/data-structures/matrix/matrix.ts +11 -0
  164. package/src/data-structures/matrix/matrix2d.ts +82 -2
  165. package/src/data-structures/matrix/navigator.ts +32 -0
  166. package/src/data-structures/matrix/vector2d.ts +139 -15
  167. package/src/data-structures/priority-queue/max-priority-queue.ts +8 -0
  168. package/src/data-structures/priority-queue/min-priority-queue.ts +8 -0
  169. package/src/data-structures/priority-queue/priority-queue.ts +130 -0
  170. package/src/data-structures/queue/deque.ts +69 -0
  171. package/src/data-structures/queue/queue.ts +30 -32
  172. package/src/data-structures/stack/stack.ts +26 -31
  173. package/src/data-structures/trie/trie.ts +26 -7
  174. package/src/data-structures/types/avl-tree.ts +1 -1
  175. package/src/data-structures/types/binary-tree.ts +1 -1
  176. package/src/data-structures/types/bst.ts +1 -1
  177. package/src/data-structures/types/index.ts +1 -1
  178. package/src/data-structures/types/navigator.ts +1 -0
  179. package/src/data-structures/types/singly-linked-list.ts +1 -15
  180. package/src/data-structures/types/tree-multiset.ts +1 -1
  181. package/src/{data-structures → utils}/trampoline.ts +6 -6
  182. package/src/utils/types/index.ts +1 -0
  183. package/src/{data-structures → utils}/types/utils.ts +7 -0
  184. package/src/utils/utils.ts +12 -2
  185. package/tests/unit/data-structures/binary-tree/bst.test.ts +185 -0
  186. package/tests/unit/data-structures/graph/abstract-graph.ts +0 -0
  187. package/tests/unit/data-structures/graph/directed-graph.test.ts +71 -0
  188. package/tests/unit/data-structures/graph/index.ts +3 -0
  189. package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
  190. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.png +0 -0
  191. package/src/data-structures/graph/diagrams/adjacency-list.png +0 -0
  192. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.png +0 -0
  193. package/src/data-structures/graph/diagrams/adjacency-matrix.png +0 -0
  194. package/src/data-structures/graph/diagrams/dfs-can-do.png +0 -0
  195. package/src/data-structures/graph/diagrams/edge-list-pros-cons.png +0 -0
  196. package/src/data-structures/graph/diagrams/edge-list.png +0 -0
  197. package/src/data-structures/graph/diagrams/max-flow.png +0 -0
  198. package/src/data-structures/graph/diagrams/mst.png +0 -0
  199. /package/dist/{data-structures → utils}/trampoline.js +0 -0
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
4
+ * @license MIT
5
+ */
2
6
  var __values = (this && this.__values) || function(o) {
3
7
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
8
  if (m) return m.call(o);
@@ -28,7 +32,7 @@ var __read = (this && this.__read) || function (o, n) {
28
32
  };
29
33
  Object.defineProperty(exports, "__esModule", { value: true });
30
34
  exports.BinaryTree = exports.BinaryTreeNode = exports.LoopType = exports.FamilyPosition = void 0;
31
- var trampoline_1 = require("../trampoline");
35
+ var trampoline_1 = require("../../utils/trampoline");
32
36
  var FamilyPosition;
33
37
  (function (FamilyPosition) {
34
38
  FamilyPosition[FamilyPosition["root"] = 0] = "root";
@@ -160,6 +164,11 @@ var BinaryTreeNode = /** @class */ (function () {
160
164
  }());
161
165
  exports.BinaryTreeNode = BinaryTreeNode;
162
166
  var BinaryTree = /** @class */ (function () {
167
+ /**
168
+ * The constructor function accepts an optional options object and sets the values of loopType, autoIncrementId, and
169
+ * isDuplicatedVal based on the provided options.
170
+ * @param [options] - An optional object that can contain the following properties:
171
+ */
163
172
  function BinaryTree(options) {
164
173
  this._loopType = LoopType.iterative;
165
174
  this._visitedId = [];
@@ -214,24 +223,47 @@ var BinaryTree = /** @class */ (function () {
214
223
  enumerable: false,
215
224
  configurable: true
216
225
  });
217
- BinaryTree.prototype.getCount = function () {
218
- return this._count;
219
- };
226
+ /**
227
+ * The function creates a new binary tree node with the given id, value, and count, or returns null if the value is
228
+ * null.
229
+ * @param {BinaryTreeNodeId} id - The `id` parameter is the identifier for the binary tree node. It is of type
230
+ * `BinaryTreeNodeId`, which could be a string or a number, depending on how you want to identify your nodes.
231
+ * @param {T | null} val - The `val` parameter represents the value to be stored in the binary tree node. It can be of
232
+ * any type `T` or `null`.
233
+ * @param {number} [count] - The count parameter is an optional parameter that represents the number of occurrences of
234
+ * the value in the binary tree node. It is of type number.
235
+ * @returns The function `createNode` returns a `BinaryTreeNode<T>` object if the `val` parameter is not null.
236
+ * Otherwise, it returns null.
237
+ */
220
238
  BinaryTree.prototype.createNode = function (id, val, count) {
221
239
  return val !== null ? new BinaryTreeNode(id, val, count) : null;
222
240
  };
241
+ /**
242
+ * The clear function resets the state of an object by setting its properties to their initial values.
243
+ */
223
244
  BinaryTree.prototype.clear = function () {
224
245
  this.root = null;
225
246
  this.size = 0;
226
247
  this.count = 0;
227
248
  this._maxId = -1;
228
249
  };
250
+ /**
251
+ * The function checks if the size of an object is equal to zero and returns a boolean value.
252
+ * @returns A boolean value indicating whether the size of the object is 0 or not.
253
+ */
229
254
  BinaryTree.prototype.isEmpty = function () {
230
255
  return this.size === 0;
231
256
  };
232
- BinaryTree.prototype.insertTo = function (_a) {
233
- var _b, _c;
234
- var newNode = _a.newNode, parent = _a.parent;
257
+ /**
258
+ * The function inserts a new node into a binary tree as the left or right child of a given parent node.
259
+ * @param {BinaryTreeNode<T> | null} newNode - The `newNode` parameter is an instance of the `BinaryTreeNode` class or
260
+ * `null`. It represents the node that needs to be inserted into the binary tree.
261
+ * @param parent - The `parent` parameter is a BinaryTreeNode object representing the parent node to which the new node
262
+ * will be inserted as a child.
263
+ * @returns The method returns the newly inserted node, either as the left child or the right child of the parent node.
264
+ */
265
+ BinaryTree.prototype.putTo = function (newNode, parent) {
266
+ var _a, _b;
235
267
  if (parent) {
236
268
  if (parent.left === undefined) {
237
269
  if (newNode) {
@@ -241,7 +273,7 @@ var BinaryTree = /** @class */ (function () {
241
273
  parent.left = newNode;
242
274
  if (newNode !== null) {
243
275
  this.size++;
244
- this.count += (_b = newNode === null || newNode === void 0 ? void 0 : newNode.count) !== null && _b !== void 0 ? _b : 0;
276
+ this.count += (_a = newNode === null || newNode === void 0 ? void 0 : newNode.count) !== null && _a !== void 0 ? _a : 0;
245
277
  }
246
278
  return parent.left;
247
279
  }
@@ -253,7 +285,7 @@ var BinaryTree = /** @class */ (function () {
253
285
  parent.right = newNode;
254
286
  if (newNode !== null) {
255
287
  this.size++;
256
- this.count += (_c = newNode === null || newNode === void 0 ? void 0 : newNode.count) !== null && _c !== void 0 ? _c : 0;
288
+ this.count += (_b = newNode === null || newNode === void 0 ? void 0 : newNode.count) !== null && _b !== void 0 ? _b : 0;
257
289
  }
258
290
  return parent.right;
259
291
  }
@@ -265,6 +297,17 @@ var BinaryTree = /** @class */ (function () {
265
297
  return;
266
298
  }
267
299
  };
300
+ /**
301
+ * The `put` function inserts a new node with a given ID and value into a binary tree, updating the count if the node
302
+ * already exists.
303
+ * @param {BinaryTreeNodeId} id - The id parameter is the identifier of the binary tree node. It is used to uniquely
304
+ * identify each node in the binary tree.
305
+ * @param {T} val - The value to be inserted into the binary tree.
306
+ * @param {number} [count] - The `count` parameter is an optional parameter that specifies the number of times the
307
+ * value should be inserted into the binary tree. If not provided, it defaults to 1.
308
+ * @returns The function `put` returns a `BinaryTreeNode<T>` object if a new node is inserted, or `null` if no new node
309
+ * is inserted, or `undefined` if the insertion fails.
310
+ */
268
311
  BinaryTree.prototype.put = function (id, val, count) {
269
312
  var _this = this;
270
313
  count = count !== null && count !== void 0 ? count : 1;
@@ -273,7 +316,7 @@ var BinaryTree = /** @class */ (function () {
273
316
  while (queue.length > 0) {
274
317
  var cur = queue.shift();
275
318
  if (cur) {
276
- var inserted_1 = _this.insertTo({ newNode: newNode, parent: cur });
319
+ var inserted_1 = _this.putTo(newNode, cur);
277
320
  if (inserted_1 !== undefined)
278
321
  return inserted_1;
279
322
  if (cur.left)
@@ -312,6 +355,13 @@ var BinaryTree = /** @class */ (function () {
312
355
  }
313
356
  return inserted;
314
357
  };
358
+ /**
359
+ * The `insertMany` function inserts multiple items into a binary tree and returns an array of the inserted nodes or
360
+ * null/undefined values.
361
+ * @param {T[] | BinaryTreeNode<T>[]} data - The `data` parameter can be either an array of elements of type `T` or an
362
+ * array of `BinaryTreeNode<T>` objects.
363
+ * @returns The function `insertMany` returns an array of `BinaryTreeNode<T>`, `null`, or `undefined` values.
364
+ */
315
365
  BinaryTree.prototype.insertMany = function (data) {
316
366
  var e_1, _a, e_2, _b;
317
367
  var _c;
@@ -377,10 +427,28 @@ var BinaryTree = /** @class */ (function () {
377
427
  }
378
428
  return inserted;
379
429
  };
430
+ /**
431
+ * The `fill` function clears the current data and inserts new data, returning a boolean indicating if the insertion
432
+ * was successful.
433
+ * @param {T[] | BinaryTreeNode<T>[]} data - The `data` parameter can be either an array of elements of type `T` or an
434
+ * array of `BinaryTreeNode<T>` objects.
435
+ * @returns The method is returning a boolean value.
436
+ */
380
437
  BinaryTree.prototype.fill = function (data) {
381
438
  this.clear();
382
439
  return data.length === this.insertMany(data).length;
383
440
  };
441
+ /**
442
+ * The function removes a node from a binary tree and returns information about the deleted node.
443
+ * @param {BinaryTreeNodeId} id - The `id` parameter is the identifier of the binary tree node that you want to remove.
444
+ * It is of type `BinaryTreeNodeId`.
445
+ * @param {boolean} [ignoreCount] - The `ignoreCount` parameter is an optional boolean parameter that determines
446
+ * whether to ignore the count of the node being removed. If `ignoreCount` is set to `true`, the count of the node will
447
+ * not be decremented and the overall count of the binary tree will not be updated. If `
448
+ * @returns An array of objects is being returned. Each object in the array has two properties: "deleted" and
449
+ * "needBalanced". The "deleted" property contains the deleted node or undefined if no node was deleted. The
450
+ * "needBalanced" property is always null.
451
+ */
384
452
  BinaryTree.prototype.remove = function (id, ignoreCount) {
385
453
  var nodes = this.getNodes(id, 'id', true);
386
454
  var node = nodes[0];
@@ -416,6 +484,12 @@ var BinaryTree = /** @class */ (function () {
416
484
  }
417
485
  return [{ deleted: node, needBalanced: null }];
418
486
  };
487
+ /**
488
+ * The function calculates the depth of a binary tree node by traversing its parent nodes.
489
+ * @param node - BinaryTreeNode<T> - This is the node for which we want to calculate the depth. It is a generic type,
490
+ * meaning it can represent any type of data that we want to store in the node.
491
+ * @returns The depth of the given binary tree node.
492
+ */
419
493
  BinaryTree.prototype.getDepth = function (node) {
420
494
  var depth = 0;
421
495
  while (node.parent) {
@@ -424,6 +498,14 @@ var BinaryTree = /** @class */ (function () {
424
498
  }
425
499
  return depth;
426
500
  };
501
+ /**
502
+ * The `getHeight` function calculates the maximum height of a binary tree using either a recursive or iterative
503
+ * approach.
504
+ * @param {BinaryTreeNode<T> | null} [beginRoot] - The `beginRoot` parameter is an optional parameter of type
505
+ * `BinaryTreeNode<T> | null`. It represents the starting node from which to calculate the height of the binary tree.
506
+ * If no value is provided for `beginRoot`, the function will use the `root` property of the class instance as
507
+ * @returns the height of the binary tree.
508
+ */
427
509
  BinaryTree.prototype.getHeight = function (beginRoot) {
428
510
  var _a, _b, _c;
429
511
  beginRoot = beginRoot !== null && beginRoot !== void 0 ? beginRoot : this.root;
@@ -467,6 +549,14 @@ var BinaryTree = /** @class */ (function () {
467
549
  return (_c = depths.get(beginRoot)) !== null && _c !== void 0 ? _c : -1;
468
550
  }
469
551
  };
552
+ /**
553
+ * The `getMinHeight` function calculates the minimum height of a binary tree using either a recursive or iterative
554
+ * approach.
555
+ * @param {BinaryTreeNode<T> | null} [beginRoot] - The `beginRoot` parameter is an optional parameter of type
556
+ * `BinaryTreeNode<T> | null`. It represents the starting node from which to calculate the minimum height of the binary
557
+ * tree. If no value is provided for `beginRoot`, the function will use the root node of the binary tree.
558
+ * @returns The function `getMinHeight` returns the minimum height of the binary tree.
559
+ */
470
560
  BinaryTree.prototype.getMinHeight = function (beginRoot) {
471
561
  var _a, _b, _c;
472
562
  beginRoot = beginRoot || this.root;
@@ -512,9 +602,27 @@ var BinaryTree = /** @class */ (function () {
512
602
  return (_c = depths.get(beginRoot)) !== null && _c !== void 0 ? _c : -1;
513
603
  }
514
604
  };
605
+ /**
606
+ * The function checks if a binary tree is balanced by comparing the minimum height and the maximum height of the tree.
607
+ * @param {BinaryTreeNode<T> | null} [beginRoot] - The `beginRoot` parameter is the root node of a binary tree. It is
608
+ * of type `BinaryTreeNode<T> | null`, which means it can either be a `BinaryTreeNode` object or `null`.
609
+ * @returns The method is returning a boolean value.
610
+ */
515
611
  BinaryTree.prototype.isBalanced = function (beginRoot) {
516
612
  return (this.getMinHeight(beginRoot) + 1 >= this.getHeight(beginRoot));
517
613
  };
614
+ /**
615
+ * The function `getNodes` returns an array of binary tree nodes that match a given property value, with options for
616
+ * searching recursively or iteratively.
617
+ * @param {BinaryTreeNodeId | T} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeId` or a
618
+ * generic type `T`. It represents the property of the binary tree node that you want to search for.
619
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
620
+ * specifies the property name to use when searching for nodes. If not provided, it defaults to 'id'.
621
+ * @param {boolean} [onlyOne] - The `onlyOne` parameter is an optional boolean parameter that determines whether to
622
+ * return only one node that matches the `nodeProperty` or `propertyName` criteria. If `onlyOne` is set to `true`, the
623
+ * function will stop traversing the tree and return the first matching node. If `
624
+ * @returns The function `getNodes` returns an array of `BinaryTreeNode<T> | null | undefined` objects.
625
+ */
518
626
  BinaryTree.prototype.getNodes = function (nodeProperty, propertyName, onlyOne) {
519
627
  var _this = this;
520
628
  if (!this.root)
@@ -546,14 +654,39 @@ var BinaryTree = /** @class */ (function () {
546
654
  }
547
655
  return result;
548
656
  };
657
+ /**
658
+ * The function checks if a binary tree node has a specific property or if any node in the tree has a specific
659
+ * property.
660
+ * @param {BinaryTreeNodeId | T} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeId` or a
661
+ * generic type `T`. It represents the property of a binary tree node that you want to check.
662
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
663
+ * specifies the name of the property to check for in the nodes.
664
+ * @returns a boolean value.
665
+ */
549
666
  BinaryTree.prototype.has = function (nodeProperty, propertyName) {
550
667
  return this.getNodes(nodeProperty, propertyName).length > 0;
551
668
  };
669
+ /**
670
+ * The function returns the first binary tree node that matches the given property name and value, or null if no match
671
+ * is found.
672
+ * @param {BinaryTreeNodeId | T} nodeProperty - The `nodeProperty` parameter can be either a `BinaryTreeNodeId` or a
673
+ * generic type `T`. It represents the property of the binary tree node that you want to search for.
674
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
675
+ * specifies the property of the binary tree node to search for. If not provided, it defaults to `'id'`.
676
+ * @returns a BinaryTreeNode object or null.
677
+ */
552
678
  BinaryTree.prototype.get = function (nodeProperty, propertyName) {
553
679
  var _a;
554
680
  propertyName = propertyName !== null && propertyName !== void 0 ? propertyName : 'id';
555
681
  return (_a = this.getNodes(nodeProperty, propertyName, true)[0]) !== null && _a !== void 0 ? _a : null;
556
682
  };
683
+ /**
684
+ * The function getPathToRoot returns an array of BinaryTreeNode objects representing the path from a given node to the
685
+ * root of a binary tree.
686
+ * @param node - The `node` parameter is a BinaryTreeNode object.
687
+ * @returns The function `getPathToRoot` returns an array of `BinaryTreeNode<T>` objects, representing the path from
688
+ * the given `node` to the root of the binary tree.
689
+ */
557
690
  BinaryTree.prototype.getPathToRoot = function (node) {
558
691
  var result = [];
559
692
  while (node.parent) {
@@ -563,9 +696,14 @@ var BinaryTree = /** @class */ (function () {
563
696
  result.unshift(node);
564
697
  return result;
565
698
  };
566
- BinaryTree.prototype.getRoot = function () {
567
- return this.root;
568
- };
699
+ /**
700
+ * The `getLeftMost` function returns the leftmost node in a binary tree, either recursively or iteratively using tail
701
+ * recursion optimization.
702
+ * @param {BinaryTreeNode<T> | null} [node] - The `node` parameter is an optional parameter of type `BinaryTreeNode<T>
703
+ * | null`. It represents the starting node from which to find the leftmost node in a binary tree. If no node is
704
+ * provided, the function will use the root node of the binary tree.
705
+ * @returns The `getLeftMost` function returns the leftmost node in a binary tree.
706
+ */
569
707
  BinaryTree.prototype.getLeftMost = function (node) {
570
708
  node = node !== null && node !== void 0 ? node : this.root;
571
709
  if (!node)
@@ -588,6 +726,14 @@ var BinaryTree = /** @class */ (function () {
588
726
  return _traverse_3(node);
589
727
  }
590
728
  };
729
+ /**
730
+ * The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using
731
+ * tail recursion optimization.
732
+ * @param {BinaryTreeNode<T> | null} [node] - The `node` parameter is an optional parameter of type `BinaryTreeNode<T>
733
+ * | null`. It represents the starting node from which to find the rightmost node in a binary tree. If no node is
734
+ * provided, the function will use the root node of the binary tree.
735
+ * @returns The `getRightMost` function returns the rightmost node in a binary tree.
736
+ */
591
737
  BinaryTree.prototype.getRightMost = function (node) {
592
738
  node = node !== null && node !== void 0 ? node : this.root;
593
739
  if (!node)
@@ -611,6 +757,14 @@ var BinaryTree = /** @class */ (function () {
611
757
  }
612
758
  };
613
759
  // --- start additional methods ---
760
+ /**
761
+ * The `isBST` function checks if a binary tree is a binary search tree.
762
+ * @param {BinaryTreeNode<T> | null} [node] - The `node` parameter is an optional parameter of type `BinaryTreeNode<T>
763
+ * | null`. It represents the root node of the binary search tree (BST) that we want to check for validity. If no node
764
+ * is provided, the function will default to using the root node of the BST instance that
765
+ * @returns The `isBST` function returns a boolean value. It returns `true` if the binary tree is a valid binary search
766
+ * tree, and `false` otherwise.
767
+ */
614
768
  BinaryTree.prototype.isBST = function (node) {
615
769
  node = node !== null && node !== void 0 ? node : this.root;
616
770
  if (!node)
@@ -642,6 +796,14 @@ var BinaryTree = /** @class */ (function () {
642
796
  return true;
643
797
  }
644
798
  };
799
+ /**
800
+ * The function calculates the size and count of a subtree in a binary tree using either recursive or iterative
801
+ * traversal.
802
+ * @param {BinaryTreeNode<T> | null | undefined} subTreeRoot - The `subTreeRoot` parameter is the root node of a binary
803
+ * tree.
804
+ * @returns The function `getSubTreeSizeAndCount` returns an array `[number, number]`. The first element of the array
805
+ * represents the size of the subtree, and the second element represents the count of the nodes in the subtree.
806
+ */
645
807
  BinaryTree.prototype.getSubTreeSizeAndCount = function (subTreeRoot) {
646
808
  var res = [0, 0];
647
809
  if (!subTreeRoot)
@@ -668,6 +830,16 @@ var BinaryTree = /** @class */ (function () {
668
830
  return res;
669
831
  }
670
832
  };
833
+ /**
834
+ * The function `subTreeSum` calculates the sum of a specified property in a binary tree, either recursively or
835
+ * iteratively.
836
+ * @param subTreeRoot - The subTreeRoot parameter is the root node of the subtree for which you want to calculate the
837
+ * sum.
838
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
839
+ * specifies the property of the `BinaryTreeNode` object to use for calculating the sum. If `propertyName` is not
840
+ * provided, it defaults to `'val'`.
841
+ * @returns a number, which is the sum of the values of the nodes in the subtree rooted at `subTreeRoot`.
842
+ */
671
843
  BinaryTree.prototype.subTreeSum = function (subTreeRoot, propertyName) {
672
844
  propertyName = propertyName !== null && propertyName !== void 0 ? propertyName : 'val';
673
845
  if (!subTreeRoot)
@@ -710,6 +882,15 @@ var BinaryTree = /** @class */ (function () {
710
882
  }
711
883
  return sum;
712
884
  };
885
+ /**
886
+ * The function `subTreeAdd` adds a specified delta value to a property of each node in a binary tree.
887
+ * @param subTreeRoot - The `subTreeRoot` parameter is the root node of the subtree where the values will be modified.
888
+ * @param {number} delta - The `delta` parameter is a number that represents the amount by which the property value of
889
+ * each node in the subtree should be increased or decreased.
890
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
891
+ * specifies the property of the `BinaryTreeNode` that should be modified. It defaults to `'id'` if not provided.
892
+ * @returns a boolean value, which is `true`.
893
+ */
713
894
  BinaryTree.prototype.subTreeAdd = function (subTreeRoot, delta, propertyName) {
714
895
  var _this = this;
715
896
  propertyName = propertyName !== null && propertyName !== void 0 ? propertyName : 'id';
@@ -748,6 +929,15 @@ var BinaryTree = /** @class */ (function () {
748
929
  }
749
930
  return true;
750
931
  };
932
+ /**
933
+ * The BFS function performs a breadth-first search on a binary tree and returns the results based on a specified node
934
+ * or property name.
935
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
936
+ * represents either a node or a property name. If a node is provided, the breadth-first search algorithm will be
937
+ * performed starting from that node. If a property name is provided, the breadth-first search algorithm will be
938
+ * performed starting from the root node
939
+ * @returns an object of type `ResultsByProperty<T>`.
940
+ */
751
941
  BinaryTree.prototype.BFS = function (nodeOrPropertyName) {
752
942
  nodeOrPropertyName = nodeOrPropertyName !== null && nodeOrPropertyName !== void 0 ? nodeOrPropertyName : 'id';
753
943
  this._resetResults();
@@ -764,6 +954,18 @@ var BinaryTree = /** @class */ (function () {
764
954
  }
765
955
  return this._getResultByPropertyName(nodeOrPropertyName);
766
956
  };
957
+ /**
958
+ * The DFS function performs a depth-first search traversal on a binary tree and returns the results based on the
959
+ * specified pattern and node or property name.
960
+ * @param {'in' | 'pre' | 'post'} [pattern] - The "pattern" parameter is used to specify the order in which the nodes
961
+ * of a binary tree are traversed during the Depth-First Search (DFS) algorithm. It can take one of three values: 'in',
962
+ * 'pre', or 'post'.
963
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is a string that represents
964
+ * either the name of a property in the `BinaryTreeNode` object or the value of the `id` property in the
965
+ * `BinaryTreeNode` object. This parameter is used to accumulate the results based on the specified property name. If
966
+ * no value
967
+ * @returns an object of type `ResultsByProperty<T>`.
968
+ */
767
969
  BinaryTree.prototype.DFS = function (pattern, nodeOrPropertyName) {
768
970
  var _this = this;
769
971
  pattern = pattern !== null && pattern !== void 0 ? pattern : 'in';
@@ -846,6 +1048,18 @@ var BinaryTree = /** @class */ (function () {
846
1048
  }
847
1049
  return this._getResultByPropertyName(nodeOrPropertyName);
848
1050
  };
1051
+ /**
1052
+ * The `levelIterative` function performs a level-order traversal on a binary tree and returns the values of the nodes
1053
+ * in an array, based on a specified property name.
1054
+ * @param {BinaryTreeNode<T> | null} node - The `node` parameter is a BinaryTreeNode object representing the starting
1055
+ * node for the level order traversal. It can be null if no specific node is provided, in which case the root node of
1056
+ * the tree is used as the starting node.
1057
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is an optional parameter that
1058
+ * can be either a `BinaryTreeNode` property name or the string `'id'`. If a property name is provided, the function
1059
+ * will accumulate results based on that property. If no property name is provided, the function will default to
1060
+ * accumulating results
1061
+ * @returns The function `levelIterative` returns an object of type `ResultsByProperty<T>`.
1062
+ */
849
1063
  BinaryTree.prototype.levelIterative = function (node, nodeOrPropertyName) {
850
1064
  nodeOrPropertyName = nodeOrPropertyName || 'id';
851
1065
  node = node || this.root;
@@ -867,6 +1081,15 @@ var BinaryTree = /** @class */ (function () {
867
1081
  }
868
1082
  return this._getResultByPropertyName(nodeOrPropertyName);
869
1083
  };
1084
+ /**
1085
+ * The `listLevels` function collects nodes from a binary tree by a specified property and organizes them into levels.
1086
+ * @param {BinaryTreeNode<T> | null} node - The `node` parameter is a BinaryTreeNode object or null. It represents the
1087
+ * root node of a binary tree. If it is null, the function will use the root node of the current binary tree instance.
1088
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is an optional parameter that
1089
+ * specifies the property of the `BinaryTreeNode` object to collect at each level. It can be one of the following
1090
+ * values:
1091
+ * @returns The function `listLevels` returns a 2D array of `ResultByProperty<T>` objects.
1092
+ */
870
1093
  BinaryTree.prototype.listLevels = function (node, nodeOrPropertyName) {
871
1094
  nodeOrPropertyName = nodeOrPropertyName || 'id';
872
1095
  node = node || this.root;
@@ -920,6 +1143,11 @@ var BinaryTree = /** @class */ (function () {
920
1143
  }
921
1144
  return levelsNodes;
922
1145
  };
1146
+ /**
1147
+ * The function returns the predecessor of a given node in a binary tree.
1148
+ * @param node - The parameter `node` is a BinaryTreeNode object, representing a node in a binary tree.
1149
+ * @returns the predecessor of the given node in a binary tree.
1150
+ */
923
1151
  BinaryTree.prototype.getPredecessor = function (node) {
924
1152
  if (node.left) {
925
1153
  var predecessor = node.left;
@@ -935,10 +1163,16 @@ var BinaryTree = /** @class */ (function () {
935
1163
  }
936
1164
  };
937
1165
  /**
1166
+ * The `morris` function performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris
1167
+ * traversal algorithm and returns the results based on the specified property name.
938
1168
  * The time complexity of Morris traversal is O(n), it's may slower than others
939
1169
  * The space complexity Morris traversal is O(1) because no using stack
940
- * @param pattern
941
- * @param nodeOrPropertyName
1170
+ * @param {'in' | 'pre' | 'post'} [pattern] - The `pattern` parameter is an optional parameter that determines the
1171
+ * traversal pattern of the binary tree. It can have one of three values:
1172
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is used to specify the
1173
+ * property of the nodes that you want to retrieve in the results. It can be either the node itself or the name of the
1174
+ * property. If not provided, it defaults to `'id'`.
1175
+ * @returns The function `morris` returns an object of type `ResultsByProperty<T>`.
942
1176
  */
943
1177
  BinaryTree.prototype.morris = function (pattern, nodeOrPropertyName) {
944
1178
  var _this = this;
@@ -1027,6 +1261,9 @@ var BinaryTree = /** @class */ (function () {
1027
1261
  }
1028
1262
  return this._getResultByPropertyName(nodeOrPropertyName);
1029
1263
  };
1264
+ /**
1265
+ * The function resets the values of several arrays used for tracking visited nodes and their properties.
1266
+ */
1030
1267
  BinaryTree.prototype._resetResults = function () {
1031
1268
  this._visitedId = [];
1032
1269
  this._visitedVal = [];
@@ -1034,6 +1271,22 @@ var BinaryTree = /** @class */ (function () {
1034
1271
  this._visitedCount = [];
1035
1272
  this._visitedLeftSum = [];
1036
1273
  };
1274
+ /**
1275
+ * The function checks if a given property of a binary tree node matches a specified value, and if so, adds the node to
1276
+ * a result array.
1277
+ * @param cur - The current binary tree node that is being checked.
1278
+ * @param {(BinaryTreeNode<T> | null | undefined)[]} result - An array that stores the matching nodes found during the
1279
+ * traversal.
1280
+ * @param {BinaryTreeNodeId | T} nodeProperty - The `nodeProperty` parameter is the value that we are searching for in
1281
+ * the binary tree nodes. It can be either the `id`, `count`, or `val` property of the node.
1282
+ * @param {BinaryTreeNodePropertyName} [propertyName] - The `propertyName` parameter is an optional parameter that
1283
+ * specifies the property of the `BinaryTreeNode` object that you want to compare with the `nodeProperty` value. It can
1284
+ * be one of the following values: 'id', 'count', or 'val'. If no `propertyName` is provided,
1285
+ * @param {boolean} [onlyOne] - The `onlyOne` parameter is an optional boolean parameter that determines whether to
1286
+ * stop after finding the first matching node or continue searching for all matching nodes. If `onlyOne` is set to
1287
+ * `true`, the function will stop after finding the first matching node and return `true`. If `onlyOne
1288
+ * @returns a boolean value indicating whether or not a node was pushed into the result array.
1289
+ */
1037
1290
  BinaryTree.prototype._pushByPropertyNameStopOrNot = function (cur, result, nodeProperty, propertyName, onlyOne) {
1038
1291
  switch (propertyName) {
1039
1292
  case 'id':
@@ -1062,6 +1315,14 @@ var BinaryTree = /** @class */ (function () {
1062
1315
  break;
1063
1316
  }
1064
1317
  };
1318
+ /**
1319
+ * The function `_accumulatedByPropertyName` pushes a property value of a binary tree node into an array based on the
1320
+ * provided property name or a default property name.
1321
+ * @param node - The `node` parameter is of type `BinaryTreeNode<T>`, which represents a node in a binary tree.
1322
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
1323
+ * can be either a string representing a property name or a reference to a node object. If it is a string, it specifies
1324
+ * the property name of the node that should be accumulated. If it is a node object, it specifies the node itself
1325
+ */
1065
1326
  BinaryTree.prototype._accumulatedByPropertyName = function (node, nodeOrPropertyName) {
1066
1327
  nodeOrPropertyName = nodeOrPropertyName !== null && nodeOrPropertyName !== void 0 ? nodeOrPropertyName : 'id';
1067
1328
  switch (nodeOrPropertyName) {
@@ -1082,6 +1343,13 @@ var BinaryTree = /** @class */ (function () {
1082
1343
  break;
1083
1344
  }
1084
1345
  };
1346
+ /**
1347
+ * The function `_getResultByPropertyName` returns different results based on the provided property name or defaulting
1348
+ * to 'id'.
1349
+ * @param {NodeOrPropertyName} [nodeOrPropertyName] - The parameter `nodeOrPropertyName` is an optional parameter that
1350
+ * can accept a value of type `NodeOrPropertyName`.
1351
+ * @returns The method returns an object of type `ResultsByProperty<T>`.
1352
+ */
1085
1353
  BinaryTree.prototype._getResultByPropertyName = function (nodeOrPropertyName) {
1086
1354
  nodeOrPropertyName = nodeOrPropertyName !== null && nodeOrPropertyName !== void 0 ? nodeOrPropertyName : 'id';
1087
1355
  switch (nodeOrPropertyName) {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
1
5
  import type { BinaryTreeNodeId, BinaryTreeNodePropertyName, BSTComparator, BSTDeletedResult } from '../types';
2
6
  import { BinaryTree, BinaryTreeNode, LoopType } from './binary-tree';
3
7
  export declare enum CP {
@@ -14,6 +18,18 @@ export declare class BST<T> extends BinaryTree<T> {
14
18
  loopType?: LoopType;
15
19
  });
16
20
  createNode(id: BinaryTreeNodeId, val: T | null, count?: number): BSTNode<T> | null;
21
+ /**
22
+ * The `put` function inserts a new node into a binary search tree, updating the count and value of an existing node if
23
+ * the ID matches, and returns the inserted node.
24
+ * @param {BinaryTreeNodeId} id - The `id` parameter represents the identifier of the binary tree node. It is used to
25
+ * determine the position of the node in the binary search tree.
26
+ * @param {T | null} val - The `val` parameter represents the value to be stored in the binary search tree node. It can
27
+ * be of type `T` (the generic type) or `null`.
28
+ * @param {number} [count=1] - The `count` parameter represents the number of times the value should be inserted into
29
+ * the binary search tree. By default, it is set to 1, meaning that if no count is specified, the value will be
30
+ * inserted once.
31
+ * @returns The method `put` returns a `BSTNode<T>` object or `null`.
32
+ */
17
33
  put(id: BinaryTreeNodeId, val: T | null, count?: number): BSTNode<T> | null;
18
34
  get(nodeProperty: BinaryTreeNodeId | T, propertyName?: BinaryTreeNodePropertyName): BSTNode<T> | null;
19
35
  lastKey(): number;
@@ -66,6 +66,18 @@ var BST = /** @class */ (function (_super) {
66
66
  BST.prototype.createNode = function (id, val, count) {
67
67
  return val !== null ? new BSTNode(id, val, count) : null;
68
68
  };
69
+ /**
70
+ * The `put` function inserts a new node into a binary search tree, updating the count and value of an existing node if
71
+ * the ID matches, and returns the inserted node.
72
+ * @param {BinaryTreeNodeId} id - The `id` parameter represents the identifier of the binary tree node. It is used to
73
+ * determine the position of the node in the binary search tree.
74
+ * @param {T | null} val - The `val` parameter represents the value to be stored in the binary search tree node. It can
75
+ * be of type `T` (the generic type) or `null`.
76
+ * @param {number} [count=1] - The `count` parameter represents the number of times the value should be inserted into
77
+ * the binary search tree. By default, it is set to 1, meaning that if no count is specified, the value will be
78
+ * inserted once.
79
+ * @returns The method `put` returns a `BSTNode<T>` object or `null`.
80
+ */
69
81
  BST.prototype.put = function (id, val, count) {
70
82
  var _a;
71
83
  if (count === void 0) { count = 1; }
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
1
5
  import type { SegmentTreeNodeVal } from '../types';
2
6
  export declare class SegmentTreeNode {
3
7
  constructor(start: number, end: number, sum: number, val?: SegmentTreeNodeVal | null);
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
4
+ * @license MIT
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  exports.SegmentTree = exports.SegmentTreeNode = void 0;
4
8
  var SegmentTreeNode = /** @class */ (function () {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
1
5
  import { BST, BSTNode } from './bst';
2
6
  import type { BinaryTreeNodeId, TreeMultiSetDeletedResult } from '../types';
3
7
  export declare class TreeMultiSet<T> extends BST<T> {
@@ -16,6 +16,10 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.TreeMultiSet = void 0;
19
+ /**
20
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
21
+ * @license MIT
22
+ */
19
23
  var bst_1 = require("./bst");
20
24
  var TreeMultiSet = /** @class */ (function (_super) {
21
25
  __extends(TreeMultiSet, _super);