min-heap-typed 1.38.0 → 1.38.1

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 (334) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.d.ts +100 -0
  2. package/dist/data-structures/binary-tree/avl-tree.js +341 -0
  3. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +144 -0
  4. package/dist/data-structures/binary-tree/binary-indexed-tree.js +261 -0
  5. package/dist/data-structures/binary-tree/binary-tree.d.ts +409 -0
  6. package/dist/data-structures/binary-tree/binary-tree.js +1065 -0
  7. package/dist/data-structures/binary-tree/bst.d.ts +167 -0
  8. package/dist/data-structures/binary-tree/bst.js +512 -0
  9. package/dist/data-structures/binary-tree/index.d.ts +7 -0
  10. package/dist/data-structures/binary-tree/index.js +23 -0
  11. package/dist/data-structures/binary-tree/rb-tree.d.ts +13 -0
  12. package/dist/data-structures/binary-tree/rb-tree.js +27 -0
  13. package/dist/data-structures/binary-tree/segment-tree.d.ts +83 -0
  14. package/dist/data-structures/binary-tree/segment-tree.js +228 -0
  15. package/dist/data-structures/binary-tree/tree-multiset.d.ts +122 -0
  16. package/dist/data-structures/binary-tree/tree-multiset.js +351 -0
  17. package/dist/data-structures/graph/abstract-graph.d.ts +332 -0
  18. package/dist/data-structures/graph/abstract-graph.js +923 -0
  19. package/dist/data-structures/graph/directed-graph.d.ts +200 -0
  20. package/dist/data-structures/graph/directed-graph.js +422 -0
  21. package/dist/data-structures/graph/index.d.ts +4 -0
  22. package/dist/data-structures/graph/index.js +20 -0
  23. package/dist/data-structures/graph/map-graph.d.ts +79 -0
  24. package/dist/data-structures/graph/map-graph.js +111 -0
  25. package/dist/data-structures/graph/undirected-graph.d.ts +127 -0
  26. package/dist/data-structures/graph/undirected-graph.js +252 -0
  27. package/dist/data-structures/hash/coordinate-map.d.ts +45 -0
  28. package/dist/data-structures/hash/coordinate-map.js +65 -0
  29. package/dist/data-structures/hash/coordinate-set.d.ts +37 -0
  30. package/dist/data-structures/hash/coordinate-set.js +55 -0
  31. package/dist/data-structures/hash/hash-map.d.ts +56 -0
  32. package/dist/data-structures/hash/hash-map.js +171 -0
  33. package/dist/data-structures/hash/hash-table.d.ts +106 -0
  34. package/dist/data-structures/hash/hash-table.js +245 -0
  35. package/dist/data-structures/hash/index.d.ts +6 -0
  36. package/dist/data-structures/hash/index.js +22 -0
  37. package/dist/data-structures/hash/tree-map.d.ts +2 -0
  38. package/dist/data-structures/hash/tree-map.js +6 -0
  39. package/dist/data-structures/hash/tree-set.d.ts +2 -0
  40. package/dist/data-structures/hash/tree-set.js +6 -0
  41. package/dist/data-structures/heap/heap.d.ts +224 -0
  42. package/dist/data-structures/heap/heap.js +497 -0
  43. package/dist/data-structures/heap/index.d.ts +3 -0
  44. package/dist/data-structures/heap/index.js +19 -0
  45. package/dist/data-structures/heap/max-heap.d.ts +12 -0
  46. package/dist/data-structures/heap/max-heap.js +24 -0
  47. package/dist/data-structures/heap/min-heap.d.ts +12 -0
  48. package/dist/data-structures/heap/min-heap.js +24 -0
  49. package/dist/data-structures/index.d.ts +11 -0
  50. package/dist/data-structures/index.js +27 -0
  51. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +234 -0
  52. package/dist/data-structures/linked-list/doubly-linked-list.js +583 -0
  53. package/dist/data-structures/linked-list/index.d.ts +3 -0
  54. package/dist/data-structures/linked-list/index.js +19 -0
  55. package/dist/data-structures/linked-list/singly-linked-list.d.ts +157 -0
  56. package/dist/data-structures/linked-list/singly-linked-list.js +448 -0
  57. package/dist/data-structures/linked-list/skip-linked-list.d.ts +61 -0
  58. package/dist/data-structures/linked-list/skip-linked-list.js +142 -0
  59. package/dist/data-structures/matrix/index.d.ts +4 -0
  60. package/dist/data-structures/matrix/index.js +20 -0
  61. package/dist/data-structures/matrix/matrix.d.ts +21 -0
  62. package/dist/data-structures/matrix/matrix.js +28 -0
  63. package/dist/data-structures/matrix/matrix2d.d.ts +108 -0
  64. package/dist/data-structures/matrix/matrix2d.js +203 -0
  65. package/dist/data-structures/matrix/navigator.d.ts +52 -0
  66. package/dist/data-structures/matrix/navigator.js +106 -0
  67. package/dist/data-structures/matrix/vector2d.d.ts +201 -0
  68. package/dist/data-structures/matrix/vector2d.js +291 -0
  69. package/dist/data-structures/priority-queue/index.d.ts +3 -0
  70. package/dist/data-structures/priority-queue/index.js +19 -0
  71. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +12 -0
  72. package/dist/data-structures/priority-queue/max-priority-queue.js +24 -0
  73. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +12 -0
  74. package/dist/data-structures/priority-queue/min-priority-queue.js +24 -0
  75. package/dist/data-structures/priority-queue/priority-queue.d.ts +12 -0
  76. package/dist/data-structures/priority-queue/priority-queue.js +17 -0
  77. package/dist/data-structures/queue/deque.d.ts +165 -0
  78. package/dist/data-structures/queue/deque.js +276 -0
  79. package/dist/data-structures/queue/index.d.ts +2 -0
  80. package/dist/data-structures/queue/index.js +18 -0
  81. package/dist/data-structures/queue/queue.d.ts +107 -0
  82. package/dist/data-structures/queue/queue.js +170 -0
  83. package/dist/data-structures/stack/index.d.ts +1 -0
  84. package/dist/data-structures/stack/index.js +17 -0
  85. package/dist/data-structures/stack/stack.d.ts +63 -0
  86. package/dist/data-structures/stack/stack.js +91 -0
  87. package/dist/data-structures/tree/index.d.ts +1 -0
  88. package/dist/data-structures/tree/index.js +17 -0
  89. package/dist/data-structures/tree/tree.d.ts +14 -0
  90. package/dist/data-structures/tree/tree.js +58 -0
  91. package/dist/data-structures/trie/index.d.ts +1 -0
  92. package/dist/data-structures/trie/index.js +17 -0
  93. package/dist/data-structures/trie/trie.d.ts +84 -0
  94. package/dist/data-structures/trie/trie.js +268 -0
  95. package/dist/index.d.ts +3 -3
  96. package/dist/index.js +3 -3
  97. package/dist/interfaces/binary-tree.d.ts +7 -0
  98. package/dist/interfaces/binary-tree.js +2 -0
  99. package/dist/interfaces/doubly-linked-list.d.ts +1 -0
  100. package/dist/interfaces/doubly-linked-list.js +2 -0
  101. package/dist/interfaces/graph.d.ts +5 -0
  102. package/dist/interfaces/graph.js +2 -0
  103. package/dist/interfaces/heap.d.ts +1 -0
  104. package/dist/interfaces/heap.js +2 -0
  105. package/dist/interfaces/index.d.ts +8 -0
  106. package/dist/interfaces/index.js +24 -0
  107. package/dist/interfaces/navigator.d.ts +1 -0
  108. package/dist/interfaces/navigator.js +2 -0
  109. package/dist/interfaces/priority-queue.d.ts +1 -0
  110. package/dist/interfaces/priority-queue.js +2 -0
  111. package/dist/interfaces/segment-tree.d.ts +1 -0
  112. package/dist/interfaces/segment-tree.js +2 -0
  113. package/dist/interfaces/singly-linked-list.d.ts +1 -0
  114. package/dist/interfaces/singly-linked-list.js +2 -0
  115. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
  116. package/dist/types/data-structures/binary-tree/avl-tree.js +2 -0
  117. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
  118. package/dist/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
  119. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +31 -0
  120. package/dist/types/data-structures/binary-tree/binary-tree.js +24 -0
  121. package/dist/types/data-structures/binary-tree/bst.d.ts +7 -0
  122. package/dist/types/data-structures/binary-tree/bst.js +2 -0
  123. package/dist/types/data-structures/binary-tree/index.d.ts +6 -0
  124. package/dist/types/data-structures/binary-tree/index.js +22 -0
  125. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +8 -0
  126. package/dist/types/data-structures/binary-tree/rb-tree.js +8 -0
  127. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
  128. package/dist/types/data-structures/binary-tree/segment-tree.js +2 -0
  129. package/dist/types/data-structures/binary-tree/tree-multiset.d.ts +4 -0
  130. package/dist/types/data-structures/binary-tree/tree-multiset.js +2 -0
  131. package/dist/types/data-structures/graph/abstract-graph.d.ts +10 -0
  132. package/dist/types/data-structures/graph/abstract-graph.js +2 -0
  133. package/dist/types/data-structures/graph/directed-graph.d.ts +6 -0
  134. package/dist/types/data-structures/graph/directed-graph.js +9 -0
  135. package/dist/types/data-structures/graph/index.d.ts +3 -0
  136. package/dist/types/data-structures/graph/index.js +19 -0
  137. package/dist/types/data-structures/graph/map-graph.d.ts +1 -0
  138. package/dist/types/data-structures/graph/map-graph.js +2 -0
  139. package/dist/types/data-structures/graph/undirected-graph.d.ts +1 -0
  140. package/dist/types/data-structures/graph/undirected-graph.js +2 -0
  141. package/dist/types/data-structures/hash/coordinate-map.d.ts +1 -0
  142. package/dist/types/data-structures/hash/coordinate-map.js +2 -0
  143. package/dist/types/data-structures/hash/coordinate-set.d.ts +1 -0
  144. package/dist/types/data-structures/hash/coordinate-set.js +2 -0
  145. package/dist/types/data-structures/hash/hash-map.d.ts +1 -0
  146. package/dist/types/data-structures/hash/hash-map.js +2 -0
  147. package/dist/types/data-structures/hash/hash-table.d.ts +1 -0
  148. package/dist/types/data-structures/hash/hash-table.js +2 -0
  149. package/dist/types/data-structures/hash/index.d.ts +1 -0
  150. package/dist/types/data-structures/hash/index.js +2 -0
  151. package/dist/types/data-structures/hash/tree-map.d.ts +1 -0
  152. package/dist/types/data-structures/hash/tree-map.js +2 -0
  153. package/dist/types/data-structures/hash/tree-set.d.ts +1 -0
  154. package/dist/types/data-structures/hash/tree-set.js +2 -0
  155. package/dist/types/data-structures/heap/heap.d.ts +1 -0
  156. package/dist/types/data-structures/heap/heap.js +2 -0
  157. package/dist/types/data-structures/heap/index.d.ts +1 -0
  158. package/dist/types/data-structures/heap/index.js +17 -0
  159. package/dist/types/data-structures/heap/max-heap.d.ts +1 -0
  160. package/dist/types/data-structures/heap/max-heap.js +2 -0
  161. package/dist/types/data-structures/heap/min-heap.d.ts +1 -0
  162. package/dist/types/data-structures/heap/min-heap.js +2 -0
  163. package/dist/types/data-structures/index.d.ts +11 -0
  164. package/dist/types/data-structures/index.js +27 -0
  165. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -0
  166. package/dist/types/data-structures/linked-list/doubly-linked-list.js +2 -0
  167. package/dist/types/data-structures/linked-list/index.d.ts +2 -0
  168. package/dist/types/data-structures/linked-list/index.js +18 -0
  169. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -0
  170. package/dist/types/data-structures/linked-list/singly-linked-list.js +2 -0
  171. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
  172. package/dist/types/data-structures/linked-list/skip-linked-list.js +2 -0
  173. package/dist/types/data-structures/matrix/index.d.ts +1 -0
  174. package/dist/types/data-structures/matrix/index.js +17 -0
  175. package/dist/types/data-structures/matrix/matrix.d.ts +1 -0
  176. package/dist/types/data-structures/matrix/matrix.js +2 -0
  177. package/dist/types/data-structures/matrix/matrix2d.d.ts +1 -0
  178. package/dist/types/data-structures/matrix/matrix2d.js +2 -0
  179. package/dist/types/data-structures/matrix/navigator.d.ts +14 -0
  180. package/dist/types/data-structures/matrix/navigator.js +2 -0
  181. package/dist/types/data-structures/matrix/vector2d.d.ts +1 -0
  182. package/dist/types/data-structures/matrix/vector2d.js +2 -0
  183. package/dist/types/data-structures/priority-queue/index.d.ts +3 -0
  184. package/dist/types/data-structures/priority-queue/index.js +19 -0
  185. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
  186. package/dist/types/data-structures/priority-queue/max-priority-queue.js +2 -0
  187. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
  188. package/dist/types/data-structures/priority-queue/min-priority-queue.js +2 -0
  189. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  190. package/dist/types/data-structures/priority-queue/priority-queue.js +2 -0
  191. package/dist/types/data-structures/queue/deque.d.ts +1 -0
  192. package/dist/types/data-structures/queue/deque.js +2 -0
  193. package/dist/types/data-structures/queue/index.d.ts +2 -0
  194. package/dist/types/data-structures/queue/index.js +18 -0
  195. package/dist/types/data-structures/queue/queue.d.ts +1 -0
  196. package/dist/types/data-structures/queue/queue.js +2 -0
  197. package/dist/types/data-structures/stack/index.d.ts +1 -0
  198. package/dist/types/data-structures/stack/index.js +17 -0
  199. package/dist/types/data-structures/stack/stack.d.ts +1 -0
  200. package/dist/types/data-structures/stack/stack.js +2 -0
  201. package/dist/types/data-structures/tree/index.d.ts +1 -0
  202. package/dist/types/data-structures/tree/index.js +17 -0
  203. package/dist/types/data-structures/tree/tree.d.ts +1 -0
  204. package/dist/types/data-structures/tree/tree.js +2 -0
  205. package/dist/types/data-structures/trie/index.d.ts +1 -0
  206. package/dist/types/data-structures/trie/index.js +17 -0
  207. package/dist/types/data-structures/trie/trie.d.ts +1 -0
  208. package/dist/types/data-structures/trie/trie.js +2 -0
  209. package/dist/types/helpers.d.ts +9 -0
  210. package/dist/types/helpers.js +9 -0
  211. package/dist/types/index.d.ts +3 -0
  212. package/dist/types/index.js +19 -0
  213. package/dist/types/utils/index.d.ts +2 -0
  214. package/dist/types/utils/index.js +18 -0
  215. package/dist/types/utils/utils.d.ts +7 -0
  216. package/dist/types/utils/utils.js +2 -0
  217. package/dist/types/utils/validate-type.d.ts +19 -0
  218. package/dist/types/utils/validate-type.js +2 -0
  219. package/dist/utils/index.d.ts +1 -0
  220. package/dist/utils/index.js +17 -0
  221. package/dist/utils/utils.d.ts +20 -0
  222. package/dist/utils/utils.js +73 -0
  223. package/package.json +1 -4
  224. package/src/data-structures/binary-tree/avl-tree.ts +342 -0
  225. package/src/data-structures/binary-tree/binary-indexed-tree.ts +298 -0
  226. package/src/data-structures/binary-tree/binary-tree.ts +1141 -0
  227. package/src/data-structures/binary-tree/bst.ts +529 -0
  228. package/src/data-structures/binary-tree/index.ts +7 -0
  229. package/src/data-structures/binary-tree/rb-tree.ts +366 -0
  230. package/src/data-structures/binary-tree/segment-tree.ts +257 -0
  231. package/src/data-structures/binary-tree/tree-multiset.ts +375 -0
  232. package/src/data-structures/graph/abstract-graph.ts +1044 -0
  233. package/src/data-structures/graph/directed-graph.ts +470 -0
  234. package/src/data-structures/graph/index.ts +4 -0
  235. package/src/data-structures/graph/map-graph.ts +134 -0
  236. package/src/data-structures/graph/undirected-graph.ts +274 -0
  237. package/src/data-structures/hash/coordinate-map.ts +67 -0
  238. package/src/data-structures/hash/coordinate-set.ts +56 -0
  239. package/src/data-structures/hash/hash-map.ts +209 -0
  240. package/src/data-structures/hash/hash-table.ts +280 -0
  241. package/src/data-structures/hash/index.ts +6 -0
  242. package/src/data-structures/hash/tree-map.ts +1 -0
  243. package/src/data-structures/hash/tree-set.ts +1 -0
  244. package/src/data-structures/heap/heap.ts +561 -0
  245. package/src/data-structures/heap/index.ts +3 -0
  246. package/src/data-structures/heap/max-heap.ts +24 -0
  247. package/src/data-structures/heap/min-heap.ts +24 -0
  248. package/src/data-structures/index.ts +11 -0
  249. package/src/data-structures/linked-list/doubly-linked-list.ts +636 -0
  250. package/src/data-structures/linked-list/index.ts +3 -0
  251. package/src/data-structures/linked-list/singly-linked-list.ts +501 -0
  252. package/src/data-structures/linked-list/skip-linked-list.ts +173 -0
  253. package/src/data-structures/matrix/index.ts +4 -0
  254. package/src/data-structures/matrix/matrix.ts +27 -0
  255. package/src/data-structures/matrix/matrix2d.ts +213 -0
  256. package/src/data-structures/matrix/navigator.ts +121 -0
  257. package/src/data-structures/matrix/vector2d.ts +316 -0
  258. package/src/data-structures/priority-queue/index.ts +3 -0
  259. package/src/data-structures/priority-queue/max-priority-queue.ts +23 -0
  260. package/src/data-structures/priority-queue/min-priority-queue.ts +23 -0
  261. package/src/data-structures/priority-queue/priority-queue.ts +16 -0
  262. package/src/data-structures/queue/deque.ts +297 -0
  263. package/src/data-structures/queue/index.ts +2 -0
  264. package/src/data-structures/queue/queue.ts +191 -0
  265. package/src/data-structures/stack/index.ts +1 -0
  266. package/src/data-structures/stack/stack.ts +98 -0
  267. package/src/data-structures/tree/index.ts +1 -0
  268. package/src/data-structures/tree/tree.ts +67 -0
  269. package/src/data-structures/trie/index.ts +1 -0
  270. package/src/data-structures/trie/trie.ts +286 -0
  271. package/src/index.ts +3 -3
  272. package/src/interfaces/binary-tree.ts +10 -0
  273. package/src/interfaces/doubly-linked-list.ts +1 -0
  274. package/src/interfaces/graph.ts +7 -0
  275. package/src/interfaces/heap.ts +1 -0
  276. package/src/interfaces/index.ts +8 -0
  277. package/src/interfaces/navigator.ts +1 -0
  278. package/src/interfaces/priority-queue.ts +1 -0
  279. package/src/interfaces/segment-tree.ts +1 -0
  280. package/src/interfaces/singly-linked-list.ts +1 -0
  281. package/src/types/data-structures/binary-tree/avl-tree.ts +5 -0
  282. package/src/types/data-structures/binary-tree/binary-indexed-tree.ts +1 -0
  283. package/src/types/data-structures/binary-tree/binary-tree.ts +35 -0
  284. package/src/types/data-structures/binary-tree/bst.ts +11 -0
  285. package/src/types/data-structures/binary-tree/index.ts +6 -0
  286. package/src/types/data-structures/binary-tree/rb-tree.ts +8 -0
  287. package/src/types/data-structures/binary-tree/segment-tree.ts +1 -0
  288. package/src/types/data-structures/binary-tree/tree-multiset.ts +6 -0
  289. package/src/types/data-structures/graph/abstract-graph.ts +11 -0
  290. package/src/types/data-structures/graph/directed-graph.ts +8 -0
  291. package/src/types/data-structures/graph/index.ts +3 -0
  292. package/src/types/data-structures/graph/map-graph.ts +1 -0
  293. package/src/types/data-structures/graph/undirected-graph.ts +1 -0
  294. package/src/types/data-structures/hash/coordinate-map.ts +1 -0
  295. package/src/types/data-structures/hash/coordinate-set.ts +1 -0
  296. package/src/types/data-structures/hash/hash-map.ts +1 -0
  297. package/src/types/data-structures/hash/hash-table.ts +1 -0
  298. package/src/types/data-structures/hash/index.ts +1 -0
  299. package/src/types/data-structures/hash/tree-map.ts +1 -0
  300. package/src/types/data-structures/hash/tree-set.ts +1 -0
  301. package/src/types/data-structures/heap/heap.ts +1 -0
  302. package/src/types/data-structures/heap/index.ts +1 -0
  303. package/src/types/data-structures/heap/max-heap.ts +1 -0
  304. package/src/types/data-structures/heap/min-heap.ts +1 -0
  305. package/src/types/data-structures/index.ts +11 -0
  306. package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -0
  307. package/src/types/data-structures/linked-list/index.ts +2 -0
  308. package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -0
  309. package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
  310. package/src/types/data-structures/matrix/index.ts +1 -0
  311. package/src/types/data-structures/matrix/matrix.ts +1 -0
  312. package/src/types/data-structures/matrix/matrix2d.ts +1 -0
  313. package/src/types/data-structures/matrix/navigator.ts +14 -0
  314. package/src/types/data-structures/matrix/vector2d.ts +1 -0
  315. package/src/types/data-structures/priority-queue/index.ts +3 -0
  316. package/src/types/data-structures/priority-queue/max-priority-queue.ts +1 -0
  317. package/src/types/data-structures/priority-queue/min-priority-queue.ts +1 -0
  318. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  319. package/src/types/data-structures/queue/deque.ts +1 -0
  320. package/src/types/data-structures/queue/index.ts +2 -0
  321. package/src/types/data-structures/queue/queue.ts +1 -0
  322. package/src/types/data-structures/stack/index.ts +1 -0
  323. package/src/types/data-structures/stack/stack.ts +1 -0
  324. package/src/types/data-structures/tree/index.ts +1 -0
  325. package/src/types/data-structures/tree/tree.ts +1 -0
  326. package/src/types/data-structures/trie/index.ts +1 -0
  327. package/src/types/data-structures/trie/trie.ts +1 -0
  328. package/src/types/helpers.ts +13 -0
  329. package/src/types/index.ts +3 -0
  330. package/src/types/utils/index.ts +2 -0
  331. package/src/types/utils/utils.ts +6 -0
  332. package/src/types/utils/validate-type.ts +35 -0
  333. package/src/utils/index.ts +1 -0
  334. package/src/utils/utils.ts +86 -0
@@ -0,0 +1,529 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Tyler Zeng
5
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import type {
9
+ BinaryTreeNodeKey,
10
+ BSTComparator,
11
+ BSTNodeNested,
12
+ BSTOptions,
13
+ MapCallback,
14
+ MapCallbackReturn
15
+ } from '../../types';
16
+ import {CP, IterationType} from '../../types';
17
+ import {BinaryTree, BinaryTreeNode} from './binary-tree';
18
+ import {IBinaryTree} from '../../interfaces';
19
+ import {Queue} from '../queue';
20
+
21
+ export class BSTNode<V = any, FAMILY extends BSTNode<V, FAMILY> = BSTNodeNested<V>> extends BinaryTreeNode<V, FAMILY> {
22
+ constructor(key: BinaryTreeNodeKey, val?: V) {
23
+ super(key, val);
24
+ }
25
+ }
26
+
27
+ export class BST<N extends BSTNode<N['val'], N> = BSTNode> extends BinaryTree<N> implements IBinaryTree<N> {
28
+ /**
29
+ * The constructor function initializes a binary search tree object with an optional comparator
30
+ * function.
31
+ * @param {BSTOptions} [options] - An optional object that contains configuration options for the
32
+ * binary search tree.
33
+ */
34
+ constructor(options?: BSTOptions) {
35
+ super(options);
36
+ if (options !== undefined) {
37
+ const {comparator} = options;
38
+ if (comparator !== undefined) {
39
+ this._comparator = comparator;
40
+ }
41
+ }
42
+ }
43
+
44
+ /**
45
+ * The function creates a new binary search tree node with the given key and value.
46
+ * @param {BinaryTreeNodeKey} key - The key parameter is the key value that will be associated with
47
+ * the new node. It is used to determine the position of the node in the binary search tree.
48
+ * @param [val] - The parameter `val` is an optional value that can be assigned to the node. It
49
+ * represents the value associated with the node in a binary search tree.
50
+ * @returns a new instance of the BSTNode class with the specified key and value.
51
+ */
52
+ override createNode(key: BinaryTreeNodeKey, val?: N['val']): N {
53
+ return new BSTNode<N['val'], N>(key, val) as N;
54
+ }
55
+
56
+ /**
57
+ * The `add` function in a binary search tree class inserts a new node with a given key and value
58
+ * into the tree.
59
+ * @param {BinaryTreeNodeKey | N | null} keyOrNode - The `keyOrNode` parameter can be either a
60
+ * `BinaryTreeNodeKey` (which can be a number or a string), a `BSTNode` object, or `null`.
61
+ * @param [val] - The `val` parameter is the value to be assigned to the new node being added to the
62
+ * binary search tree.
63
+ * @returns the inserted node (N) if it was successfully added to the binary search tree. If the node
64
+ * was not added or if the parameters were invalid, it returns null or undefined.
65
+ */
66
+ override add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined {
67
+ // TODO support node as a parameter
68
+ let inserted: N | null = null;
69
+ let newNode: N | null = null;
70
+ if (keyOrNode instanceof BSTNode) {
71
+ newNode = keyOrNode;
72
+ } else if (typeof keyOrNode === 'number') {
73
+ newNode = this.createNode(keyOrNode, val);
74
+ } else if (keyOrNode === null) {
75
+ newNode = null;
76
+ }
77
+ if (this.root === null) {
78
+ this._setRoot(newNode);
79
+ this._setSize(this.size + 1);
80
+ inserted = this.root;
81
+ } else {
82
+ let cur = this.root;
83
+ let traversing = true;
84
+ while (traversing) {
85
+ if (cur !== null && newNode !== null) {
86
+ if (this._compare(cur.key, newNode.key) === CP.eq) {
87
+ if (newNode) {
88
+ cur.val = newNode.val;
89
+ }
90
+ //Duplicates are not accepted.
91
+ traversing = false;
92
+ inserted = cur;
93
+ } else if (this._compare(cur.key, newNode.key) === CP.gt) {
94
+ // Traverse left of the node
95
+ if (cur.left === undefined) {
96
+ if (newNode) {
97
+ newNode.parent = cur;
98
+ }
99
+ //Add to the left of the current node
100
+ cur.left = newNode;
101
+ this._setSize(this.size + 1);
102
+ traversing = false;
103
+ inserted = cur.left;
104
+ } else {
105
+ //Traverse the left of the current node
106
+ if (cur.left) cur = cur.left;
107
+ }
108
+ } else if (this._compare(cur.key, newNode.key) === CP.lt) {
109
+ // Traverse right of the node
110
+ if (cur.right === undefined) {
111
+ if (newNode) {
112
+ newNode.parent = cur;
113
+ }
114
+ //Add to the right of the current node
115
+ cur.right = newNode;
116
+ this._setSize(this.size + 1);
117
+ traversing = false;
118
+ inserted = cur.right;
119
+ } else {
120
+ //Traverse the left of the current node
121
+ if (cur.right) cur = cur.right;
122
+ }
123
+ }
124
+ } else {
125
+ traversing = false;
126
+ }
127
+ }
128
+ }
129
+ return inserted;
130
+ }
131
+
132
+ /**
133
+ * The `addMany` function is used to efficiently add multiple nodes to a binary search tree while
134
+ * maintaining balance.
135
+ * @param {[BinaryTreeNodeKey | N, N['val']][]} arr - The `arr` parameter in the `addMany` function
136
+ * represents an array of keys or nodes that need to be added to the binary search tree. It can be an
137
+ * array of `BinaryTreeNodeKey` or `N` (which represents the node type in the binary search tree) or
138
+ * `null
139
+ * @param {N['val'][]} data - The values of tree nodes
140
+ * @param {boolean} isBalanceAdd - If true the nodes will be balance inserted in binary search method.
141
+ * @param iterationType - The `iterationType` parameter determines the type of iteration to be used.
142
+ * It can have two possible values:
143
+ * @returns The `addMany` function returns an array of `N`, `null`, or `undefined` values.
144
+ */
145
+
146
+ override addMany(
147
+ keysOrNodes: (BinaryTreeNodeKey | null)[] | (N | null)[],
148
+ data?: N['val'][],
149
+ isBalanceAdd = true,
150
+ iterationType = this.iterationType
151
+ ): (N | null | undefined)[] {
152
+ // TODO this addMany function is inefficient, it should be optimized
153
+ function hasNoNull(arr: (BinaryTreeNodeKey | null)[] | (N | null)[]): arr is BinaryTreeNodeKey[] | N[] {
154
+ return arr.indexOf(null) === -1;
155
+ }
156
+
157
+ if (!isBalanceAdd || !hasNoNull(keysOrNodes)) {
158
+ return super.addMany(keysOrNodes, data);
159
+ }
160
+ const inserted: (N | null | undefined)[] = [];
161
+ const combinedArr: [BinaryTreeNodeKey | N, N['val']][] = keysOrNodes.map((value, index) => [value, data?.[index]]);
162
+ let sorted = [];
163
+
164
+ function isNodeOrNullTuple(arr: [BinaryTreeNodeKey | N, N['val']][]): arr is [N, N['val']][] {
165
+ for (const [keyOrNode] of arr) if (keyOrNode instanceof BSTNode) return true;
166
+ return false;
167
+ }
168
+
169
+ function isBinaryTreeKeyOrNullTuple(
170
+ arr: [BinaryTreeNodeKey | N, N['val']][]
171
+ ): arr is [BinaryTreeNodeKey, N['val']][] {
172
+ for (const [keyOrNode] of arr) if (typeof keyOrNode === 'number') return true;
173
+ return false;
174
+ }
175
+
176
+ let sortedKeysOrNodes: (number | N | null)[] = [],
177
+ sortedData: (N['val'] | undefined)[] | undefined = [];
178
+
179
+ if (isNodeOrNullTuple(combinedArr)) {
180
+ sorted = combinedArr.sort((a, b) => a[0].key - b[0].key);
181
+ } else if (isBinaryTreeKeyOrNullTuple(combinedArr)) {
182
+ sorted = combinedArr.sort((a, b) => a[0] - b[0]);
183
+ } else {
184
+ throw new Error('Invalid input keysOrNodes');
185
+ }
186
+ sortedKeysOrNodes = sorted.map(([keyOrNode]) => keyOrNode);
187
+ sortedData = sorted.map(([, val]) => val);
188
+ const recursive = (arr: (BinaryTreeNodeKey | null | N)[], data?: N['val'][]) => {
189
+ if (arr.length === 0) return;
190
+
191
+ const mid = Math.floor((arr.length - 1) / 2);
192
+ const newNode = this.add(arr[mid], data?.[mid]);
193
+ inserted.push(newNode);
194
+ recursive(arr.slice(0, mid), data?.slice(0, mid));
195
+ recursive(arr.slice(mid + 1), data?.slice(mid + 1));
196
+ };
197
+ const iterative = () => {
198
+ const n = sorted.length;
199
+ const stack: [[number, number]] = [[0, n - 1]];
200
+ while (stack.length > 0) {
201
+ const popped = stack.pop();
202
+ if (popped) {
203
+ const [l, r] = popped;
204
+ if (l <= r) {
205
+ const m = l + Math.floor((r - l) / 2);
206
+ const newNode = this.add(sortedKeysOrNodes[m], sortedData?.[m]);
207
+ inserted.push(newNode);
208
+ stack.push([m + 1, r]);
209
+ stack.push([l, m - 1]);
210
+ }
211
+ }
212
+ }
213
+ };
214
+ if (iterationType === IterationType.RECURSIVE) {
215
+ recursive(sortedKeysOrNodes, sortedData);
216
+ } else {
217
+ iterative();
218
+ }
219
+
220
+ return inserted;
221
+ }
222
+
223
+ /**
224
+ * The function returns the first node in the binary tree that matches the given node property and
225
+ * callback.
226
+ * @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter is used to specify the
227
+ * property of the binary tree node that you want to search for. It can be either a specific key
228
+ * value (`BinaryTreeNodeKey`) or a custom callback function (`MapCallback<N>`) that determines
229
+ * whether a node matches the desired property.
230
+ * @param callback - The `callback` parameter is a function that is used to determine whether a node
231
+ * matches the desired property. It takes a node as input and returns a boolean value indicating
232
+ * whether the node matches the property or not. If no callback function is provided, the default
233
+ * callback function `_defaultCallbackByKey` is used
234
+ * @param beginRoot - The `beginRoot` parameter is the starting point for the search. It specifies
235
+ * the root node from which the search should begin.
236
+ * @param iterationType - The `iterationType` parameter is used to specify the type of iteration to
237
+ * be performed when searching for nodes in the binary tree. It can have one of the following values:
238
+ * @returns either the first node that matches the given nodeProperty and callback, or null if no
239
+ * matching node is found.
240
+ */
241
+ override get(
242
+ nodeProperty: BinaryTreeNodeKey | N,
243
+ callback: MapCallback<N> = this._defaultCallbackByKey,
244
+ beginRoot = this.root,
245
+ iterationType = this.iterationType
246
+ ): N | null {
247
+ return this.getNodes(nodeProperty, callback, true, beginRoot, iterationType)[0] ?? null;
248
+ }
249
+
250
+ /**
251
+ * The function `lastKey` returns the key of the rightmost node if the comparison result is less
252
+ * than, the key of the leftmost node if the comparison result is greater than, and the key of the
253
+ * rightmost node otherwise.
254
+ * @param {N | null} beginRoot - The `beginRoot` parameter is the starting point for finding the last
255
+ * key in a binary tree. It represents the root node of the subtree from which the search for the
256
+ * last key should begin. If no specific `beginRoot` is provided, the search will start from the root
257
+ * of the entire binary
258
+ * @param iterationType - The `iterationType` parameter is used to specify the type of iteration to
259
+ * be performed when finding the last key. It determines whether the iteration should be performed in
260
+ * pre-order, in-order, or post-order.
261
+ * @returns the key of the rightmost node in the binary tree if the comparison result is less than,
262
+ * the key of the leftmost node if the comparison result is greater than, and the key of the
263
+ * rightmost node otherwise. If no node is found, it returns 0.
264
+ */
265
+ lastKey(beginRoot: N | null = this.root, iterationType = this.iterationType): BinaryTreeNodeKey {
266
+ if (this._compare(0, 1) === CP.lt) return this.getRightMost(beginRoot, iterationType)?.key ?? 0;
267
+ else if (this._compare(0, 1) === CP.gt) return this.getLeftMost(beginRoot, iterationType)?.key ?? 0;
268
+ else return this.getRightMost(beginRoot, iterationType)?.key ?? 0;
269
+ }
270
+
271
+ /**
272
+ * The function `getNodes` retrieves nodes from a binary tree based on a given node property or key,
273
+ * using either recursive or iterative traversal.
274
+ * @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter represents the property
275
+ * of the binary tree node that you want to search for. It can be either a `BinaryTreeNodeKey` or a
276
+ * generic type `N`.
277
+ * @param callback - The `callback` parameter is a function that takes a node as input and returns a
278
+ * value. This value is compared with the `nodeProperty` parameter to determine if the node should be
279
+ * included in the result. The default value for `callback` is `this._defaultCallbackByKey`, which is
280
+ * a
281
+ * @param [onlyOne=false] - A boolean value indicating whether to stop the traversal after finding
282
+ * the first node that matches the nodeProperty. If set to true, the function will return an array
283
+ * containing only that node. If set to false (default), the function will continue the traversal and
284
+ * return an array containing all nodes that match the node
285
+ * @param {N | null} beginRoot - The `beginRoot` parameter is the starting node for the traversal. It
286
+ * specifies the root node of the binary tree from which the traversal should begin. If `beginRoot`
287
+ * is `null`, an empty array will be returned.
288
+ * @param iterationType - The `iterationType` parameter determines the type of iteration used to
289
+ * traverse the binary tree. It can have one of the following values:
290
+ * @returns an array of nodes (N[]).
291
+ */
292
+ override getNodes(
293
+ nodeProperty: BinaryTreeNodeKey | N,
294
+ callback: MapCallback<N> = this._defaultCallbackByKey,
295
+ onlyOne = false,
296
+ beginRoot: N | null = this.root,
297
+ iterationType = this.iterationType
298
+ ): N[] {
299
+ if (!beginRoot) return [];
300
+ const ans: N[] = [];
301
+
302
+ if (iterationType === IterationType.RECURSIVE) {
303
+ const _traverse = (cur: N) => {
304
+ const callbackResult = callback(cur);
305
+ if (callbackResult === nodeProperty) {
306
+ ans.push(cur);
307
+ if (onlyOne) return;
308
+ }
309
+
310
+ if (!cur.left && !cur.right) return;
311
+ // TODO potential bug
312
+ if (callback === this._defaultCallbackByKey) {
313
+ if (this._compare(cur.key, nodeProperty as number) === CP.gt) cur.left && _traverse(cur.left);
314
+ if (this._compare(cur.key, nodeProperty as number) === CP.lt) cur.right && _traverse(cur.right);
315
+ } else {
316
+ cur.left && _traverse(cur.left);
317
+ cur.right && _traverse(cur.right);
318
+ }
319
+ };
320
+
321
+ _traverse(beginRoot);
322
+ } else {
323
+ const queue = new Queue<N>([beginRoot]);
324
+ while (queue.size > 0) {
325
+ const cur = queue.shift();
326
+ if (cur) {
327
+ const callbackResult = callback(cur);
328
+ if (callbackResult === nodeProperty) {
329
+ ans.push(cur);
330
+ if (onlyOne) return ans;
331
+ }
332
+ // TODO potential bug
333
+ if (callback === this._defaultCallbackByKey) {
334
+ if (this._compare(cur.key, nodeProperty as number) === CP.gt) cur.left && queue.push(cur.left);
335
+ if (this._compare(cur.key, nodeProperty as number) === CP.lt) cur.right && queue.push(cur.right);
336
+ } else {
337
+ cur.left && queue.push(cur.left);
338
+ cur.right && queue.push(cur.right);
339
+ }
340
+ }
341
+ }
342
+ }
343
+
344
+ return ans;
345
+ }
346
+
347
+ // --- start additional functions
348
+
349
+ /**
350
+ * The `lesserOrGreaterTraverse` function traverses a binary tree and applies a callback function to
351
+ * nodes that have a key value lesser or greater than a target key value.
352
+ * @param callback - The `callback` parameter is a function that will be called for each node that
353
+ * meets the condition specified by the `lesserOrGreater` parameter. It takes a node as an argument
354
+ * and returns a value.
355
+ * @param {CP} lesserOrGreater - The `lesserOrGreater` parameter is used to determine whether to
356
+ * traverse nodes that are lesser than, greater than, or equal to the `targetNode`. It can take one
357
+ * of the following values:
358
+ * @param {N | BinaryTreeNodeKey | null} targetNode - The `targetNode` parameter in the
359
+ * `lesserOrGreaterTraverse` function is used to specify the node from which the traversal should
360
+ * start. It can be either a reference to a specific node (`N`), the key of a node
361
+ * (`BinaryTreeNodeKey`), or `null` to
362
+ * @param iterationType - The `iterationType` parameter determines whether the traversal should be
363
+ * done recursively or iteratively. It can have two possible values:
364
+ * @returns The function `lesserOrGreaterTraverse` returns an array of `MapCallbackReturn<N>`.
365
+ */
366
+ lesserOrGreaterTraverse(
367
+ callback: MapCallback<N> = this._defaultCallbackByKey,
368
+ lesserOrGreater: CP = CP.lt,
369
+ targetNode: N | BinaryTreeNodeKey | null = this.root,
370
+ iterationType = this.iterationType
371
+ ): MapCallbackReturn<N> {
372
+ if (typeof targetNode === 'number') targetNode = this.get(targetNode);
373
+ const ans: MapCallbackReturn<N>[] = [];
374
+ if (!targetNode) return ans;
375
+ const targetKey = targetNode.key;
376
+ if (!this.root) return ans;
377
+
378
+ if (iterationType === IterationType.RECURSIVE) {
379
+ const _traverse = (cur: N) => {
380
+ const compared = this._compare(cur.key, targetKey);
381
+ if (compared === lesserOrGreater) ans.push(callback(cur));
382
+
383
+ if (!cur.left && !cur.right) return;
384
+ if (cur.left && this._compare(cur.left.key, targetKey) === lesserOrGreater) _traverse(cur.left);
385
+ if (cur.right && this._compare(cur.right.key, targetKey) === lesserOrGreater) _traverse(cur.right);
386
+ };
387
+
388
+ _traverse(this.root);
389
+ return ans;
390
+ } else {
391
+ const queue = new Queue<N>([this.root]);
392
+ while (queue.size > 0) {
393
+ const cur = queue.shift();
394
+ if (cur) {
395
+ const compared = this._compare(cur.key, targetKey);
396
+ if (compared === lesserOrGreater) ans.push(callback(cur));
397
+
398
+ if (cur.left && this._compare(cur.left.key, targetKey) === lesserOrGreater) queue.push(cur.left);
399
+ if (cur.right && this._compare(cur.right.key, targetKey) === lesserOrGreater) queue.push(cur.right);
400
+ }
401
+ }
402
+ return ans;
403
+ }
404
+ }
405
+
406
+ /**
407
+ * Balancing Adjustment:
408
+ * Perfectly Balanced Binary Tree: Since the balance of a perfectly balanced binary tree is already fixed, no additional balancing adjustment is needed. Any insertion or deletion operation will disrupt the perfect balance, often requiring a complete reconstruction of the tree.
409
+ * AVL Tree: After insertion or deletion operations, an AVL tree performs rotation adjustments based on the balance factor of nodes to restore the tree's balance. These rotations can be left rotations, right rotations, left-right rotations, or right-left rotations, performed as needed.
410
+ *
411
+ * Use Cases and Efficiency:
412
+ * Perfectly Balanced Binary Tree: Perfectly balanced binary trees are typically used in specific scenarios such as complete binary heaps in heap sort or certain types of Huffman trees. However, they are not suitable for dynamic operations requiring frequent insertions and deletions, as these operations often necessitate full tree reconstruction.
413
+ * AVL Tree: AVL trees are well-suited for scenarios involving frequent searching, insertion, and deletion operations. Through rotation adjustments, AVL trees maintain their balance, ensuring average and worst-case time complexity of O(log n).
414
+ */
415
+
416
+ /**
417
+ * The `perfectlyBalance` function balances a binary search tree by adding nodes in a way that
418
+ * ensures the tree is perfectly balanced.
419
+ * @param iterationType - The `iterationType` parameter is an optional parameter that specifies the
420
+ * type of iteration to use when building a balanced binary search tree. It can have two possible
421
+ * values:
422
+ * @returns The function `perfectlyBalance` returns a boolean value.
423
+ */
424
+ perfectlyBalance(iterationType = this.iterationType): boolean {
425
+ const sorted = this.dfs(node => node, 'in'),
426
+ n = sorted.length;
427
+ this.clear();
428
+
429
+ if (sorted.length < 1) return false;
430
+ if (iterationType === IterationType.RECURSIVE) {
431
+ const buildBalanceBST = (l: number, r: number) => {
432
+ if (l > r) return;
433
+ const m = l + Math.floor((r - l) / 2);
434
+ const midNode = sorted[m];
435
+ this.add(midNode.key, midNode.val);
436
+ buildBalanceBST(l, m - 1);
437
+ buildBalanceBST(m + 1, r);
438
+ };
439
+
440
+ buildBalanceBST(0, n - 1);
441
+ return true;
442
+ } else {
443
+ const stack: [[number, number]] = [[0, n - 1]];
444
+ while (stack.length > 0) {
445
+ const popped = stack.pop();
446
+ if (popped) {
447
+ const [l, r] = popped;
448
+ if (l <= r) {
449
+ const m = l + Math.floor((r - l) / 2);
450
+ const midNode = sorted[m];
451
+ this.add(midNode.key, midNode.val);
452
+ stack.push([m + 1, r]);
453
+ stack.push([l, m - 1]);
454
+ }
455
+ }
456
+ }
457
+ return true;
458
+ }
459
+ }
460
+
461
+ /**
462
+ * The function checks if a binary tree is AVL balanced using either recursive or iterative approach.
463
+ * @param iterationType - The `iterationType` parameter is used to determine the method of iteration
464
+ * to check if the AVL tree is balanced. It can have two possible values:
465
+ * @returns a boolean value.
466
+ */
467
+ isAVLBalanced(iterationType = this.iterationType): boolean {
468
+ if (!this.root) return true;
469
+
470
+ let balanced = true;
471
+
472
+ if (iterationType === IterationType.RECURSIVE) {
473
+ const _height = (cur: N | null | undefined): number => {
474
+ if (!cur) return 0;
475
+ const leftHeight = _height(cur.left),
476
+ rightHeight = _height(cur.right);
477
+ if (Math.abs(leftHeight - rightHeight) > 1) balanced = false;
478
+ return Math.max(leftHeight, rightHeight) + 1;
479
+ };
480
+ _height(this.root);
481
+ } else {
482
+ const stack: N[] = [];
483
+ let node: N | null | undefined = this.root,
484
+ last: N | null = null;
485
+ const depths: Map<N, number> = new Map();
486
+
487
+ while (stack.length > 0 || node) {
488
+ if (node) {
489
+ stack.push(node);
490
+ node = node.left;
491
+ } else {
492
+ node = stack[stack.length - 1];
493
+ if (!node.right || last === node.right) {
494
+ node = stack.pop();
495
+ if (node) {
496
+ const left = node.left ? depths.get(node.left) ?? -1 : -1;
497
+ const right = node.right ? depths.get(node.right) ?? -1 : -1;
498
+ if (Math.abs(left - right) > 1) return false;
499
+ depths.set(node, 1 + Math.max(left, right));
500
+ last = node;
501
+ node = null;
502
+ }
503
+ } else node = node.right;
504
+ }
505
+ }
506
+ }
507
+
508
+ return balanced;
509
+ }
510
+
511
+ protected _comparator: BSTComparator = (a, b) => a - b;
512
+
513
+ /**
514
+ * The function compares two values using a comparator function and returns whether the first value
515
+ * is greater than, less than, or equal to the second value.
516
+ * @param {BinaryTreeNodeKey} a - The parameter "a" is of type BinaryTreeNodeKey.
517
+ * @param {BinaryTreeNodeKey} b - The parameter "b" in the above code represents a BinaryTreeNodeKey.
518
+ * @returns a value of type CP (ComparisonResult). The possible return values are CP.gt (greater
519
+ * than), CP.lt (less than), or CP.eq (equal).
520
+ */
521
+ protected _compare(a: BinaryTreeNodeKey, b: BinaryTreeNodeKey): CP {
522
+ const compared = this._comparator(a, b);
523
+ if (compared > 0) return CP.gt;
524
+ else if (compared < 0) return CP.lt;
525
+ else return CP.eq;
526
+ }
527
+
528
+ // --- end additional functions
529
+ }
@@ -0,0 +1,7 @@
1
+ export * from './binary-tree';
2
+ export * from './bst';
3
+ export * from './binary-indexed-tree';
4
+ export * from './segment-tree';
5
+ export * from './avl-tree';
6
+ export * from './rb-tree';
7
+ export * from './tree-multiset';