data-structure-typed 2.0.4 → 2.1.0

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 (261) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/COMMANDS.md +17 -0
  3. package/README.md +11 -11
  4. package/benchmark/report.html +13 -77
  5. package/benchmark/report.json +158 -190
  6. package/dist/cjs/data-structures/base/iterable-element-base.d.ts +186 -83
  7. package/dist/cjs/data-structures/base/iterable-element-base.js +149 -107
  8. package/dist/cjs/data-structures/base/iterable-element-base.js.map +1 -1
  9. package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +95 -119
  10. package/dist/cjs/data-structures/base/iterable-entry-base.js +59 -116
  11. package/dist/cjs/data-structures/base/iterable-entry-base.js.map +1 -1
  12. package/dist/cjs/data-structures/base/linear-base.d.ts +250 -192
  13. package/dist/cjs/data-structures/base/linear-base.js +137 -274
  14. package/dist/cjs/data-structures/base/linear-base.js.map +1 -1
  15. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.d.ts +126 -158
  16. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +171 -205
  17. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
  18. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +100 -69
  19. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +135 -87
  20. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  21. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +138 -149
  22. package/dist/cjs/data-structures/binary-tree/avl-tree.js +208 -195
  23. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  24. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +476 -632
  25. package/dist/cjs/data-structures/binary-tree/binary-tree.js +608 -875
  26. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  27. package/dist/cjs/data-structures/binary-tree/bst.d.ts +258 -306
  28. package/dist/cjs/data-structures/binary-tree/bst.js +505 -481
  29. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  30. package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +107 -179
  31. package/dist/cjs/data-structures/binary-tree/red-black-tree.js +114 -209
  32. package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +1 -1
  33. package/dist/cjs/data-structures/binary-tree/tree-counter.d.ts +132 -154
  34. package/dist/cjs/data-structures/binary-tree/tree-counter.js +172 -203
  35. package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +1 -1
  36. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +72 -69
  37. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +105 -85
  38. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  39. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +238 -233
  40. package/dist/cjs/data-structures/graph/abstract-graph.js +267 -237
  41. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
  42. package/dist/cjs/data-structures/graph/directed-graph.d.ts +108 -224
  43. package/dist/cjs/data-structures/graph/directed-graph.js +146 -233
  44. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  45. package/dist/cjs/data-structures/graph/map-graph.d.ts +49 -55
  46. package/dist/cjs/data-structures/graph/map-graph.js +56 -59
  47. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
  48. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +103 -146
  49. package/dist/cjs/data-structures/graph/undirected-graph.js +129 -149
  50. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  51. package/dist/cjs/data-structures/hash/hash-map.d.ts +164 -338
  52. package/dist/cjs/data-structures/hash/hash-map.js +270 -457
  53. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
  54. package/dist/cjs/data-structures/heap/heap.d.ts +214 -289
  55. package/dist/cjs/data-structures/heap/heap.js +340 -349
  56. package/dist/cjs/data-structures/heap/heap.js.map +1 -1
  57. package/dist/cjs/data-structures/heap/max-heap.d.ts +11 -47
  58. package/dist/cjs/data-structures/heap/max-heap.js +11 -66
  59. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
  60. package/dist/cjs/data-structures/heap/min-heap.d.ts +12 -47
  61. package/dist/cjs/data-structures/heap/min-heap.js +11 -66
  62. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
  63. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +231 -347
  64. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +368 -494
  65. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  66. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +261 -310
  67. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +447 -466
  68. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  69. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +0 -107
  70. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +0 -100
  71. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
  72. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +12 -56
  73. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +11 -78
  74. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  75. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +11 -57
  76. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +10 -79
  77. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  78. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +2 -61
  79. package/dist/cjs/data-structures/priority-queue/priority-queue.js +8 -83
  80. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
  81. package/dist/cjs/data-structures/queue/deque.d.ts +227 -254
  82. package/dist/cjs/data-structures/queue/deque.js +309 -348
  83. package/dist/cjs/data-structures/queue/deque.js.map +1 -1
  84. package/dist/cjs/data-structures/queue/queue.d.ts +180 -201
  85. package/dist/cjs/data-structures/queue/queue.js +265 -248
  86. package/dist/cjs/data-structures/queue/queue.js.map +1 -1
  87. package/dist/cjs/data-structures/stack/stack.d.ts +124 -102
  88. package/dist/cjs/data-structures/stack/stack.js +181 -125
  89. package/dist/cjs/data-structures/stack/stack.js.map +1 -1
  90. package/dist/cjs/data-structures/trie/trie.d.ts +164 -165
  91. package/dist/cjs/data-structures/trie/trie.js +189 -172
  92. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  93. package/dist/cjs/interfaces/binary-tree.d.ts +56 -6
  94. package/dist/cjs/interfaces/graph.d.ts +16 -0
  95. package/dist/cjs/types/data-structures/base/base.d.ts +1 -1
  96. package/dist/cjs/types/data-structures/graph/abstract-graph.d.ts +4 -0
  97. package/dist/cjs/types/utils/utils.d.ts +6 -6
  98. package/dist/cjs/utils/utils.d.ts +110 -49
  99. package/dist/cjs/utils/utils.js +148 -73
  100. package/dist/cjs/utils/utils.js.map +1 -1
  101. package/dist/esm/data-structures/base/iterable-element-base.d.ts +186 -83
  102. package/dist/esm/data-structures/base/iterable-element-base.js +155 -107
  103. package/dist/esm/data-structures/base/iterable-element-base.js.map +1 -1
  104. package/dist/esm/data-structures/base/iterable-entry-base.d.ts +95 -119
  105. package/dist/esm/data-structures/base/iterable-entry-base.js +59 -116
  106. package/dist/esm/data-structures/base/iterable-entry-base.js.map +1 -1
  107. package/dist/esm/data-structures/base/linear-base.d.ts +250 -192
  108. package/dist/esm/data-structures/base/linear-base.js +137 -274
  109. package/dist/esm/data-structures/base/linear-base.js.map +1 -1
  110. package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +126 -158
  111. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +171 -212
  112. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +1 -1
  113. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +100 -69
  114. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +133 -94
  115. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  116. package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +138 -149
  117. package/dist/esm/data-structures/binary-tree/avl-tree.js +206 -200
  118. package/dist/esm/data-structures/binary-tree/avl-tree.js.map +1 -1
  119. package/dist/esm/data-structures/binary-tree/binary-tree.d.ts +476 -632
  120. package/dist/esm/data-structures/binary-tree/binary-tree.js +613 -885
  121. package/dist/esm/data-structures/binary-tree/binary-tree.js.map +1 -1
  122. package/dist/esm/data-structures/binary-tree/bst.d.ts +258 -306
  123. package/dist/esm/data-structures/binary-tree/bst.js +507 -487
  124. package/dist/esm/data-structures/binary-tree/bst.js.map +1 -1
  125. package/dist/esm/data-structures/binary-tree/red-black-tree.d.ts +107 -179
  126. package/dist/esm/data-structures/binary-tree/red-black-tree.js +114 -215
  127. package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +1 -1
  128. package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +132 -154
  129. package/dist/esm/data-structures/binary-tree/tree-counter.js +175 -209
  130. package/dist/esm/data-structures/binary-tree/tree-counter.js.map +1 -1
  131. package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +72 -69
  132. package/dist/esm/data-structures/binary-tree/tree-multi-map.js +103 -92
  133. package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  134. package/dist/esm/data-structures/graph/abstract-graph.d.ts +238 -233
  135. package/dist/esm/data-structures/graph/abstract-graph.js +267 -237
  136. package/dist/esm/data-structures/graph/abstract-graph.js.map +1 -1
  137. package/dist/esm/data-structures/graph/directed-graph.d.ts +108 -224
  138. package/dist/esm/data-structures/graph/directed-graph.js +145 -233
  139. package/dist/esm/data-structures/graph/directed-graph.js.map +1 -1
  140. package/dist/esm/data-structures/graph/map-graph.d.ts +49 -55
  141. package/dist/esm/data-structures/graph/map-graph.js +56 -59
  142. package/dist/esm/data-structures/graph/map-graph.js.map +1 -1
  143. package/dist/esm/data-structures/graph/undirected-graph.d.ts +103 -146
  144. package/dist/esm/data-structures/graph/undirected-graph.js +128 -149
  145. package/dist/esm/data-structures/graph/undirected-graph.js.map +1 -1
  146. package/dist/esm/data-structures/hash/hash-map.d.ts +164 -338
  147. package/dist/esm/data-structures/hash/hash-map.js +270 -457
  148. package/dist/esm/data-structures/hash/hash-map.js.map +1 -1
  149. package/dist/esm/data-structures/heap/heap.d.ts +214 -289
  150. package/dist/esm/data-structures/heap/heap.js +329 -349
  151. package/dist/esm/data-structures/heap/heap.js.map +1 -1
  152. package/dist/esm/data-structures/heap/max-heap.d.ts +11 -47
  153. package/dist/esm/data-structures/heap/max-heap.js +11 -66
  154. package/dist/esm/data-structures/heap/max-heap.js.map +1 -1
  155. package/dist/esm/data-structures/heap/min-heap.d.ts +12 -47
  156. package/dist/esm/data-structures/heap/min-heap.js +11 -66
  157. package/dist/esm/data-structures/heap/min-heap.js.map +1 -1
  158. package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +231 -347
  159. package/dist/esm/data-structures/linked-list/doubly-linked-list.js +368 -495
  160. package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +1 -1
  161. package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +261 -310
  162. package/dist/esm/data-structures/linked-list/singly-linked-list.js +448 -467
  163. package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +1 -1
  164. package/dist/esm/data-structures/linked-list/skip-linked-list.d.ts +0 -107
  165. package/dist/esm/data-structures/linked-list/skip-linked-list.js +0 -100
  166. package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +1 -1
  167. package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +12 -56
  168. package/dist/esm/data-structures/priority-queue/max-priority-queue.js +11 -78
  169. package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  170. package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +11 -57
  171. package/dist/esm/data-structures/priority-queue/min-priority-queue.js +10 -79
  172. package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  173. package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +2 -61
  174. package/dist/esm/data-structures/priority-queue/priority-queue.js +8 -83
  175. package/dist/esm/data-structures/priority-queue/priority-queue.js.map +1 -1
  176. package/dist/esm/data-structures/queue/deque.d.ts +227 -254
  177. package/dist/esm/data-structures/queue/deque.js +313 -348
  178. package/dist/esm/data-structures/queue/deque.js.map +1 -1
  179. package/dist/esm/data-structures/queue/queue.d.ts +180 -201
  180. package/dist/esm/data-structures/queue/queue.js +263 -248
  181. package/dist/esm/data-structures/queue/queue.js.map +1 -1
  182. package/dist/esm/data-structures/stack/stack.d.ts +124 -102
  183. package/dist/esm/data-structures/stack/stack.js +181 -125
  184. package/dist/esm/data-structures/stack/stack.js.map +1 -1
  185. package/dist/esm/data-structures/trie/trie.d.ts +164 -165
  186. package/dist/esm/data-structures/trie/trie.js +193 -172
  187. package/dist/esm/data-structures/trie/trie.js.map +1 -1
  188. package/dist/esm/interfaces/binary-tree.d.ts +56 -6
  189. package/dist/esm/interfaces/graph.d.ts +16 -0
  190. package/dist/esm/types/data-structures/base/base.d.ts +1 -1
  191. package/dist/esm/types/data-structures/graph/abstract-graph.d.ts +4 -0
  192. package/dist/esm/types/utils/utils.d.ts +6 -6
  193. package/dist/esm/utils/utils.d.ts +110 -49
  194. package/dist/esm/utils/utils.js +139 -68
  195. package/dist/esm/utils/utils.js.map +1 -1
  196. package/dist/umd/data-structure-typed.js +4737 -6525
  197. package/dist/umd/data-structure-typed.min.js +8 -6
  198. package/dist/umd/data-structure-typed.min.js.map +1 -1
  199. package/package.json +3 -4
  200. package/src/data-structures/base/iterable-element-base.ts +238 -115
  201. package/src/data-structures/base/iterable-entry-base.ts +96 -120
  202. package/src/data-structures/base/linear-base.ts +271 -277
  203. package/src/data-structures/binary-tree/avl-tree-counter.ts +198 -216
  204. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +192 -101
  205. package/src/data-structures/binary-tree/avl-tree.ts +239 -206
  206. package/src/data-structures/binary-tree/binary-tree.ts +677 -901
  207. package/src/data-structures/binary-tree/bst.ts +568 -570
  208. package/src/data-structures/binary-tree/red-black-tree.ts +161 -222
  209. package/src/data-structures/binary-tree/tree-counter.ts +199 -218
  210. package/src/data-structures/binary-tree/tree-multi-map.ts +131 -97
  211. package/src/data-structures/graph/abstract-graph.ts +339 -264
  212. package/src/data-structures/graph/directed-graph.ts +146 -236
  213. package/src/data-structures/graph/map-graph.ts +63 -60
  214. package/src/data-structures/graph/undirected-graph.ts +129 -152
  215. package/src/data-structures/hash/hash-map.ts +274 -496
  216. package/src/data-structures/heap/heap.ts +389 -402
  217. package/src/data-structures/heap/max-heap.ts +12 -76
  218. package/src/data-structures/heap/min-heap.ts +13 -76
  219. package/src/data-structures/linked-list/doubly-linked-list.ts +426 -530
  220. package/src/data-structures/linked-list/singly-linked-list.ts +495 -517
  221. package/src/data-structures/linked-list/skip-linked-list.ts +1 -108
  222. package/src/data-structures/priority-queue/max-priority-queue.ts +12 -87
  223. package/src/data-structures/priority-queue/min-priority-queue.ts +11 -88
  224. package/src/data-structures/priority-queue/priority-queue.ts +3 -92
  225. package/src/data-structures/queue/deque.ts +381 -357
  226. package/src/data-structures/queue/queue.ts +310 -264
  227. package/src/data-structures/stack/stack.ts +217 -131
  228. package/src/data-structures/trie/trie.ts +240 -175
  229. package/src/interfaces/binary-tree.ts +240 -6
  230. package/src/interfaces/graph.ts +37 -0
  231. package/src/types/data-structures/base/base.ts +5 -5
  232. package/src/types/data-structures/graph/abstract-graph.ts +5 -0
  233. package/src/types/utils/utils.ts +9 -5
  234. package/src/utils/utils.ts +152 -86
  235. package/test/integration/index.html +1 -1
  236. package/test/performance/benchmark-runner.ts +528 -0
  237. package/test/performance/reportor.mjs +43 -43
  238. package/test/performance/runner-config.json +39 -0
  239. package/test/performance/single-suite-runner.ts +69 -0
  240. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +3 -3
  241. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +5 -5
  242. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +4 -4
  243. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +350 -90
  244. package/test/unit/data-structures/binary-tree/bst.test.ts +84 -5
  245. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +2 -2
  246. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +25 -24
  247. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +3 -3
  248. package/test/unit/data-structures/graph/abstract-graph.test.ts +0 -4
  249. package/test/unit/data-structures/graph/directed-graph.test.ts +1 -1
  250. package/test/unit/data-structures/heap/heap.test.ts +14 -21
  251. package/test/unit/data-structures/heap/max-heap.test.ts +5 -9
  252. package/test/unit/data-structures/heap/min-heap.test.ts +1 -4
  253. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +14 -14
  254. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +0 -7
  255. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +8 -11
  256. package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +1 -4
  257. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +1 -4
  258. package/test/unit/data-structures/queue/queue.test.ts +4 -5
  259. package/test/unit/utils/utils.test.ts +0 -1
  260. package/test/performance/data-structures/binary-tree/avl-tree.test.mjs +0 -71
  261. package/test/performance/data-structures/binary-tree/red-black-tree.test.mjs +0 -81
@@ -1,24 +1,46 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Pablo Zeng
5
+ * @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
1
8
  import { AVLTree, AVLTreeNode } from './avl-tree';
9
+ /**
10
+ * AVL node with an extra 'count' field; keeps parent/child links.
11
+ * @remarks Time O(1), Space O(1)
12
+ * @template K
13
+ * @template V
14
+ */
2
15
  export class AVLTreeCounterNode extends AVLTreeNode {
3
16
  parent = undefined;
4
17
  /**
5
- * The constructor function initializes a BinaryTreeNode object with a key, value, and count.
6
- * @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
7
- * of the binary tree node.
8
- * @param {V} [value] - The `value` parameter is an optional parameter of type `V`. It represents the value of the binary
9
- * tree node. If no value is provided, it will be `undefined`.
10
- * @param {number} [count=1] - The `count` parameter is a number that represents the number of times a particular value
11
- * occurs in a binary tree node. It has a default value of 1, which means that if no value is provided for the `count`
12
- * parameter when creating a new instance of the `BinaryTreeNode` class.
18
+ * Create an AVL counter node.
19
+ * @remarks Time O(1), Space O(1)
20
+ * @param key - Key of the node.
21
+ * @param [value] - Associated value (ignored in map mode).
22
+ * @param [count] - Initial count for this node (default 1).
23
+ * @returns New AVLTreeCounterNode instance.
13
24
  */
14
25
  constructor(key, value, count = 1) {
15
26
  super(key, value);
16
27
  this.count = count;
17
28
  }
18
29
  _left = undefined;
30
+ /**
31
+ * Get the left child pointer.
32
+ * @remarks Time O(1), Space O(1)
33
+ * @returns Left child node, or null/undefined.
34
+ */
19
35
  get left() {
20
36
  return this._left;
21
37
  }
38
+ /**
39
+ * Set the left child and update its parent pointer.
40
+ * @remarks Time O(1), Space O(1)
41
+ * @param v - New left child node, or null/undefined.
42
+ * @returns void
43
+ */
22
44
  set left(v) {
23
45
  if (v) {
24
46
  v.parent = this;
@@ -26,9 +48,20 @@ export class AVLTreeCounterNode extends AVLTreeNode {
26
48
  this._left = v;
27
49
  }
28
50
  _right = undefined;
51
+ /**
52
+ * Get the right child pointer.
53
+ * @remarks Time O(1), Space O(1)
54
+ * @returns Right child node, or null/undefined.
55
+ */
29
56
  get right() {
30
57
  return this._right;
31
58
  }
59
+ /**
60
+ * Set the right child and update its parent pointer.
61
+ * @remarks Time O(1), Space O(1)
62
+ * @param v - New right child node, or null/undefined.
63
+ * @returns void
64
+ */
32
65
  set right(v) {
33
66
  if (v) {
34
67
  v.parent = this;
@@ -37,16 +70,19 @@ export class AVLTreeCounterNode extends AVLTreeNode {
37
70
  }
38
71
  }
39
72
  /**
40
- * The only distinction between a AVLTreeCounter and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
73
+ * AVL tree that tracks an aggregate 'count' across nodes; supports balanced insert/delete and map-like mode.
74
+ * @remarks Time O(1), Space O(1)
75
+ * @template K
76
+ * @template V
77
+ * @template R
41
78
  */
42
79
  export class AVLTreeCounter extends AVLTree {
43
80
  /**
44
- * The constructor initializes a new AVLTreeCounter object with optional initial elements.
45
- * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter is an
46
- * iterable object that can contain either keys, nodes, entries, or raw elements.
47
- * @param [options] - The `options` parameter is an optional object that can be used to customize the
48
- * behavior of the AVLTreeCounter. It can include properties such as `compareKeys` and
49
- * `compareValues` functions to define custom comparison logic for keys and values, respectively.
81
+ * Create a AVLTreeCounter instance
82
+ * @remarks Time O(n), Space O(n)
83
+ * @param keysNodesEntriesOrRaws
84
+ * @param options
85
+ * @returns New AVLTreeCounterNode instance.
50
86
  */
51
87
  constructor(keysNodesEntriesOrRaws = [], options) {
52
88
  super([], options);
@@ -54,84 +90,37 @@ export class AVLTreeCounter extends AVLTree {
54
90
  this.addMany(keysNodesEntriesOrRaws);
55
91
  }
56
92
  _count = 0;
57
- /**
58
- * The function calculates the sum of the count property of all nodes in a tree using depth-first
59
- * search.
60
- * @returns the sum of the count property of all nodes in the tree.
61
- */
62
93
  get count() {
63
94
  return this._count;
64
95
  }
65
96
  /**
66
- * Time Complexity: O(n)
67
- * Space Complexity: O(1)
68
- *
69
- * The function calculates the sum of the count property of all nodes in a tree using depth-first
70
- * search.
71
- * @returns the sum of the count property of all nodes in the tree.
97
+ * Compute the total count by traversing the tree (sums node.count).
98
+ * @remarks Time O(N), Space O(H)
99
+ * @returns Total count recomputed from nodes.
72
100
  */
73
101
  getComputedCount() {
74
102
  let sum = 0;
75
103
  this.dfs(node => (sum += node.count));
76
104
  return sum;
77
105
  }
78
- /**
79
- * The function creates a new AVLTreeCounterNode with the specified key, value, and count.
80
- * @param {K} key - The key parameter represents the key of the node being created. It is of type K,
81
- * which is a generic type that can be replaced with any specific type when using the function.
82
- * @param {V} [value] - The `value` parameter is an optional parameter that represents the value
83
- * associated with the key in the node. It is of type `V`, which can be any data type.
84
- * @param {number} [count] - The `count` parameter represents the number of occurrences of a
85
- * key-value pair in the AVLTreeCounterNode. It is an optional parameter, so it can be omitted when
86
- * calling the `createNode` method. If provided, it specifies the initial count for the node.
87
- * @returns a new instance of the AVLTreeCounterNode class, casted as AVLTreeCounterNode<K, V>.
88
- */
89
- createNode(key, value, count) {
106
+ _createNode(key, value, count) {
90
107
  return new AVLTreeCounterNode(key, this._isMapMode ? undefined : value, count);
91
108
  }
92
109
  /**
93
- * The function creates a new AVLTreeCounter object with the specified options and returns it.
94
- * @param [options] - The `options` parameter is an optional object that contains additional
95
- * configuration options for creating the AVLTreeCounter. It can have the following properties:
96
- * @returns a new instance of the AVLTreeCounter class, with the specified options, as a TREE
97
- * object.
98
- */
99
- createTree(options) {
100
- return new AVLTreeCounter([], {
101
- iterationType: this.iterationType,
102
- isMapMode: this._isMapMode,
103
- specifyComparable: this._specifyComparable,
104
- toEntryFn: this._toEntryFn,
105
- isReverse: this._isReverse,
106
- ...options
107
- });
108
- }
109
- /**
110
- * The function checks if the input is an instance of AVLTreeCounterNode.
111
- * @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The parameter
112
- * `keyNodeOrEntry` can be of type `R` or `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`.
113
- * @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
114
- * an instance of the `AVLTreeCounterNode` class.
110
+ * Type guard: check whether the input is an AVLTreeCounterNode.
111
+ * @remarks Time O(1), Space O(1)
112
+ * @returns True if the value is an AVLTreeCounterNode.
115
113
  */
116
114
  isNode(keyNodeOrEntry) {
117
115
  return keyNodeOrEntry instanceof AVLTreeCounterNode;
118
116
  }
119
117
  /**
120
- * Time Complexity: O(log n)
121
- * Space Complexity: O(1)
122
- *
123
- * The function overrides the add method of a TypeScript class to add a new node to a data structure
124
- * and update the count.
125
- * @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The
126
- * `keyNodeOrEntry` parameter can accept a value of type `R`, which can be any type. It
127
- * can also accept a value of type `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`, which represents a key, node,
128
- * entry, or raw element
129
- * @param {V} [value] - The `value` parameter represents the value associated with the key in the
130
- * data structure. It is an optional parameter, so it can be omitted if not needed.
131
- * @param [count=1] - The `count` parameter represents the number of times the key-value pair should
132
- * be added to the data structure. By default, it is set to 1, meaning that the key-value pair will
133
- * be added once. However, you can specify a different value for `count` if you want to add
134
- * @returns a boolean value.
118
+ * Insert or increment a node and update aggregate count.
119
+ * @remarks Time O(log N), Space O(1)
120
+ * @param keyNodeOrEntry - Key, node, or [key, value] entry to insert.
121
+ * @param [value] - Value when a bare key is provided (ignored in map mode).
122
+ * @param [count] - How much to increase the node's count (default 1).
123
+ * @returns True if inserted/updated; false if ignored.
135
124
  */
136
125
  add(keyNodeOrEntry, value, count = 1) {
137
126
  const [newNode, newValue] = this._keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value, count);
@@ -145,23 +134,11 @@ export class AVLTreeCounter extends AVLTree {
145
134
  return true;
146
135
  }
147
136
  /**
148
- * Time Complexity: O(log n)
149
- * Space Complexity: O(1)
150
- *
151
- * The function overrides the delete method in a binary tree data structure, handling deletion of
152
- * nodes and maintaining balance in the tree.
153
- * @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The `predicate`
154
- * parameter in the `delete` method is used to specify the condition for deleting a node from the
155
- * binary tree. It can be a key, node, or entry that determines which
156
- * node(s) should be deleted.
157
- * @param [ignoreCount=false] - The `ignoreCount` parameter in the `override delete` method is a
158
- * boolean flag that determines whether to ignore the count of the node being deleted. If
159
- * `ignoreCount` is set to `true`, the method will delete the node regardless of its count. If
160
- * `ignoreCount` is set to
161
- * @returns The `delete` method overrides the default delete behavior in a binary tree data
162
- * structure. It takes a predicate or node to be deleted and an optional flag to ignore count. The
163
- * method returns an array of `BinaryTreeDeleteResult` objects, each containing information about the
164
- * deleted node and whether balancing is needed in the tree.
137
+ * Delete a node (or decrement its count) and rebalance if needed.
138
+ * @remarks Time O(log N), Space O(1)
139
+ * @param keyNodeOrEntry - Key, node, or [key, value] entry identifying the node.
140
+ * @param [ignoreCount] - If true, remove the node regardless of its count.
141
+ * @returns Array of deletion results including deleted node and a rebalance hint when present.
165
142
  */
166
143
  delete(keyNodeOrEntry, ignoreCount = false) {
167
144
  const deletedResult = [];
@@ -210,7 +187,6 @@ export class AVLTreeCounter extends AVLTree {
210
187
  }
211
188
  }
212
189
  this._size = this._size - 1;
213
- // TODO How to handle when the count of target node is lesser than current node's count
214
190
  if (orgCurrent)
215
191
  this._count -= orgCurrent.count;
216
192
  }
@@ -221,125 +197,118 @@ export class AVLTreeCounter extends AVLTree {
221
197
  return deletedResult;
222
198
  }
223
199
  /**
224
- * Time Complexity: O(1)
225
- * Space Complexity: O(1)
226
- *
227
- * The "clear" function overrides the parent class's "clear" function and also resets the count to
228
- * zero.
200
+ * Remove all nodes and reset aggregate counters.
201
+ * @remarks Time O(N), Space O(1)
202
+ * @returns void
229
203
  */
230
204
  clear() {
231
205
  super.clear();
232
206
  this._count = 0;
233
207
  }
234
208
  /**
235
- * Time Complexity: O(n log n)
236
- * Space Complexity: O(log n)
237
- *
238
- * The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
239
- * tree using either a recursive or iterative approach.
240
- * @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
241
- * specifies the type of iteration to use when building the balanced binary search tree. It has a
242
- * default value of `this.iterationType`, which means it will use the iteration type currently set in
243
- * the object.
244
- * @returns The function `perfectlyBalance` returns a boolean value. It returns `true` if the
245
- * balancing operation is successful, and `false` if there are no nodes to balance.
209
+ * Rebuild the tree into a perfectly balanced form using in-order nodes.
210
+ * @remarks Time O(N), Space O(N)
211
+ * @param [iterationType] - Traversal style to use when constructing the balanced tree.
212
+ * @returns True if rebalancing succeeded (tree not empty).
246
213
  */
247
214
  perfectlyBalance(iterationType = this.iterationType) {
248
- const sorted = this.dfs(node => node, 'IN'), n = sorted.length;
249
- if (sorted.length < 1)
215
+ const nodes = this.dfs(node => node, 'IN', false, this._root, iterationType);
216
+ const n = nodes.length;
217
+ if (n === 0)
250
218
  return false;
251
- this.clear();
252
- if (iterationType === 'RECURSIVE') {
253
- const buildBalanceBST = (l, r) => {
254
- if (l > r)
255
- return;
256
- const m = l + Math.floor((r - l) / 2);
257
- const midNode = sorted[m];
258
- if (this._isMapMode)
259
- this.add(midNode.key, undefined, midNode.count);
260
- else
261
- this.add(midNode.key, midNode.value, midNode.count);
262
- buildBalanceBST(l, m - 1);
263
- buildBalanceBST(m + 1, r);
264
- };
265
- buildBalanceBST(0, n - 1);
266
- return true;
267
- }
268
- else {
269
- const stack = [[0, n - 1]];
270
- while (stack.length > 0) {
271
- const popped = stack.pop();
272
- if (popped) {
273
- const [l, r] = popped;
274
- if (l <= r) {
275
- const m = l + Math.floor((r - l) / 2);
276
- const midNode = sorted[m];
277
- if (this._isMapMode)
278
- this.add(midNode.key, undefined, midNode.count);
279
- else
280
- this.add(midNode.key, midNode.value, midNode.count);
281
- stack.push([m + 1, r]);
282
- stack.push([l, m - 1]);
283
- }
284
- }
285
- }
286
- return true;
287
- }
219
+ let total = 0;
220
+ for (const nd of nodes)
221
+ total += nd ? nd.count : 0;
222
+ this._clearNodes();
223
+ const build = (l, r, parent) => {
224
+ if (l > r)
225
+ return undefined;
226
+ const m = l + ((r - l) >> 1);
227
+ const root = nodes[m];
228
+ root.left = build(l, m - 1, root);
229
+ root.right = build(m + 1, r, root);
230
+ root.parent = parent;
231
+ const lh = root.left ? root.left.height : -1;
232
+ const rh = root.right ? root.right.height : -1;
233
+ root.height = Math.max(lh, rh) + 1;
234
+ return root;
235
+ };
236
+ const newRoot = build(0, n - 1, undefined);
237
+ this._setRoot(newRoot);
238
+ this._size = n;
239
+ this._count = total;
240
+ return true;
288
241
  }
289
242
  /**
290
- * Time complexity: O(n)
291
- * Space complexity: O(n)
292
- *
293
- * The function overrides the clone method to create a deep copy of a tree object.
294
- * @returns The `clone()` method is returning a cloned instance of the `TREE` object.
243
+ * Deep copy this tree, preserving map mode and aggregate counts.
244
+ * @remarks Time O(N), Space O(N)
245
+ * @returns A deep copy of this tree.
295
246
  */
296
247
  clone() {
297
- const cloned = this.createTree();
298
- if (this._isMapMode)
299
- this.bfs(node => cloned.add(node.key, undefined, node.count));
300
- else
301
- this.bfs(node => cloned.add(node.key, node.value, node.count));
248
+ const out = this._createInstance();
249
+ if (this._isMapMode) {
250
+ this.bfs(node => out.add(node.key, undefined, node.count));
251
+ }
252
+ else {
253
+ this.bfs(node => out.add(node.key, node.value, node.count));
254
+ }
302
255
  if (this._isMapMode)
303
- cloned._store = this._store;
304
- return cloned;
256
+ out._store = this._store;
257
+ return out;
305
258
  }
306
259
  /**
307
- * The `map` function in TypeScript overrides the default behavior to create a new AVLTreeCounter
308
- * with modified entries based on a provided callback.
309
- * @param callback - The `callback` parameter is a function that will be called for each entry in the
310
- * AVLTreeCounter. It takes four arguments:
311
- * @param [options] - The `options` parameter in the `override map` function is of type
312
- * `AVLTreeCounterOptions<MK, MV, MR>`. This parameter allows you to provide additional
313
- * configuration options when creating a new `AVLTreeCounter` instance within the `map` function.
314
- * These options
315
- * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
316
- * the value of `this` when executing the `callback` function. It allows you to set the context
317
- * (value of `this`) for the callback function. This can be useful when you want to access properties
318
- * or
319
- * @returns The `map` method is returning a new `AVLTreeCounter` instance with the entries
320
- * transformed by the provided `callback` function. Each entry in the original tree is passed to the
321
- * `callback` function along with the index and the original tree itself. The transformed entries are
322
- * then added to the new `AVLTreeCounter` instance, which is returned at the end.
260
+ * Create a new AVLTreeCounter by mapping each [key, value] entry.
261
+ * @remarks Time O(N log N), Space O(N)
262
+ * @template MK
263
+ * @template MV
264
+ * @template MR
265
+ * @param callback - Function mapping (key, value, index, tree) → [newKey, newValue].
266
+ * @param [options] - Options for the output tree.
267
+ * @param [thisArg] - Value for `this` inside the callback.
268
+ * @returns A new AVLTreeCounter with mapped entries.
323
269
  */
324
270
  map(callback, options, thisArg) {
325
- const newTree = new AVLTreeCounter([], options);
271
+ const out = this._createLike([], options);
326
272
  let index = 0;
327
273
  for (const [key, value] of this) {
328
- newTree.add(callback.call(thisArg, key, value, index++, this));
274
+ out.add(callback.call(thisArg, key, value, index++, this));
329
275
  }
330
- return newTree;
276
+ return out;
277
+ }
278
+ /**
279
+ * (Protected) Create an empty instance of the same concrete class.
280
+ * @remarks Time O(1), Space O(1)
281
+ * @template TK
282
+ * @template TV
283
+ * @template TR
284
+ * @param [options] - Optional constructor options for the like-kind instance.
285
+ * @returns An empty like-kind instance.
286
+ */
287
+ _createInstance(options) {
288
+ const Ctor = this.constructor;
289
+ return new Ctor([], { ...this._snapshotOptions(), ...(options ?? {}) });
290
+ }
291
+ /**
292
+ * (Protected) Create a like-kind instance and seed it from an iterable.
293
+ * @remarks Time O(N log N), Space O(N)
294
+ * @template TK
295
+ * @template TV
296
+ * @template TR
297
+ * @param iter - Iterable used to seed the new tree.
298
+ * @param [options] - Options merged with the current snapshot.
299
+ * @returns A like-kind AVLTreeCounter built from the iterable.
300
+ */
301
+ _createLike(iter = [], options) {
302
+ const Ctor = this.constructor;
303
+ return new Ctor(iter, { ...this._snapshotOptions(), ...(options ?? {}) });
331
304
  }
332
305
  /**
333
- * The function `keyValueNodeEntryRawToNodeAndValue` converts a key, value, entry, or raw element into
334
- * a node object.
335
- * @param {K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined} keyNodeOrEntry - The
336
- * `keyNodeOrEntry` parameter can be of type `R` or `K | AVLTreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined`.
337
- * @param {V} [value] - The `value` parameter is an optional value that can be passed to the
338
- * `override` function. It represents the value associated with the key in the data structure. If no
339
- * value is provided, it will default to `undefined`.
340
- * @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
341
- * times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
342
- * @returns either a AVLTreeCounterNode<K, V> object or undefined.
306
+ * (Protected) Normalize input into a node plus its effective value and count.
307
+ * @remarks Time O(1), Space O(1)
308
+ * @param keyNodeOrEntry - Key, node, or [key, value] entry.
309
+ * @param [value] - Value used when a bare key is provided.
310
+ * @param [count] - Count increment to apply (default 1).
311
+ * @returns Tuple [node, value] where node may be undefined.
343
312
  */
344
313
  _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value, count = 1) {
345
314
  if (keyNodeOrEntry === undefined || keyNodeOrEntry === null)
@@ -351,29 +320,23 @@ export class AVLTreeCounter extends AVLTree {
351
320
  if (key === undefined || key === null)
352
321
  return [undefined, undefined];
353
322
  const finalValue = value ?? entryValue;
354
- return [this.createNode(key, finalValue, count), finalValue];
323
+ return [this._createNode(key, finalValue, count), finalValue];
355
324
  }
356
- return [this.createNode(keyNodeOrEntry, value, count), value];
325
+ return [this._createNode(keyNodeOrEntry, value, count), value];
357
326
  }
358
327
  /**
359
- * Time Complexity: O(1)
360
- * Space Complexity: O(1)
361
- *
362
- * The `_swapProperties` function swaps the properties (key, value, count, height) between two nodes
363
- * in a binary search tree.
364
- * @param {BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>} srcNode - The `srcNode` parameter represents the source node
365
- * that will be swapped with the `destNode`.
366
- * @param {BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>} destNode - The `destNode` parameter represents the destination
367
- * node where the properties will be swapped with the source node.
368
- * @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
369
- * If either `srcNode` or `destNode` is undefined, it returns `undefined`.
328
+ * (Protected) Swap keys/values/counters between the source and destination nodes.
329
+ * @remarks Time O(1), Space O(1)
330
+ * @param srcNode - Source node (or key) whose properties will be moved.
331
+ * @param destNode - Destination node (or key) to receive properties.
332
+ * @returns Destination node after swap, or undefined.
370
333
  */
371
334
  _swapProperties(srcNode, destNode) {
372
335
  srcNode = this.ensureNode(srcNode);
373
336
  destNode = this.ensureNode(destNode);
374
337
  if (srcNode && destNode) {
375
338
  const { key, value, count, height } = destNode;
376
- const tempNode = this.createNode(key, value, count);
339
+ const tempNode = this._createNode(key, value, count);
377
340
  if (tempNode) {
378
341
  tempNode.height = height;
379
342
  destNode.key = srcNode.key;
@@ -392,15 +355,11 @@ export class AVLTreeCounter extends AVLTree {
392
355
  return undefined;
393
356
  }
394
357
  /**
395
- * Time Complexity: O(1)
396
- * Space Complexity: O(1)
397
- *
398
- * The function replaces an old node with a new node and updates the count property of the new node.
399
- * @param {AVLTreeCounterNode<K, V>} oldNode - The oldNode parameter represents the node that needs to be replaced in the
400
- * data structure. It is of type AVLTreeCounterNode<K, V>.
401
- * @param {AVLTreeCounterNode<K, V>} newNode - The `newNode` parameter is an instance of the `AVLTreeCounterNode<K, V>` class.
402
- * @returns The method is returning the result of calling the `_replaceNode` method from the
403
- * superclass, which is of type `AVLTreeCounterNode<K, V>`.
358
+ * (Protected) Replace one node by another and adjust counters accordingly.
359
+ * @remarks Time O(1), Space O(1)
360
+ * @param oldNode - Node being replaced.
361
+ * @param newNode - Replacement node.
362
+ * @returns The new node after replacement.
404
363
  */
405
364
  _replaceNode(oldNode, newNode) {
406
365
  newNode.count = oldNode.count + newNode.count;
@@ -1 +1 @@
1
- {"version":3,"file":"avl-tree-counter.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-counter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,OAAO,kBAAqC,SAAQ,WAAiB;IAChE,MAAM,GAA8B,SAAS,CAAC;IAEvD;;;;;;;;;OASG;IACH,YAAY,GAAM,EAAE,KA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Y,CAC7B,OAAiC,EACjC,OAAiC;QAEjC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9C,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF"}
1
+ {"version":3,"file":"avl-tree-counter.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-counter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAAO,kBAAqC,SAAQ,WAAiB;IAChE,MAAM,GAA8B,SAAS,CAAC;IAEvD;;;;;;;OAOG;IACH,YAAY,GAAM,EAAE,KAAS,EAAE,KAAK,GAAG,CAAC;QACtC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEQ,KAAK,GAAiD,SAAS,CAAC;IAEzE;;;;OAIG;IACH,IAAa,IAAI;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,IAAa,IAAI,CAAC,CAA8C;QAC9D,IAAI,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACjB,CAAC;IAEQ,MAAM,GAAiD,SAAS,CAAC;IAE1E;;;;OAIG;IACH,IAAa,KAAK;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,IAAa,KAAK,CAAC,CAA8C;QAC/D,IAAI,CAAC,EAAE,CAAC;YACN,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;CACF;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