data-structure-typed 1.54.0 → 1.54.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 (488) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +1 -0
  3. package/benchmark/report.html +1 -28
  4. package/benchmark/report.json +17 -326
  5. package/dist/{mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts → cjs/data-structures/binary-tree/avl-tree-counter.d.ts} +54 -47
  6. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +408 -0
  7. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
  8. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +71 -177
  9. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +135 -340
  10. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
  11. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +102 -57
  12. package/dist/cjs/data-structures/binary-tree/avl-tree.js +110 -47
  13. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
  14. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
  15. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +3 -0
  16. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -1
  17. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +240 -190
  18. package/dist/cjs/data-structures/binary-tree/binary-tree.js +269 -240
  19. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
  20. package/dist/cjs/data-structures/binary-tree/bst.d.ts +145 -112
  21. package/dist/cjs/data-structures/binary-tree/bst.js +180 -129
  22. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
  23. package/dist/cjs/data-structures/binary-tree/index.d.ts +2 -0
  24. package/dist/cjs/data-structures/binary-tree/index.js +2 -0
  25. package/dist/cjs/data-structures/binary-tree/index.js.map +1 -1
  26. package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +100 -82
  27. package/dist/cjs/data-structures/binary-tree/red-black-tree.js +115 -79
  28. package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +1 -1
  29. package/dist/{mjs/data-structures/binary-tree/tree-multi-map.d.ts → cjs/data-structures/binary-tree/tree-counter.d.ts} +74 -64
  30. package/dist/cjs/data-structures/binary-tree/tree-counter.js +445 -0
  31. package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +1 -0
  32. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +78 -174
  33. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +142 -377
  34. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
  35. package/dist/cjs/data-structures/graph/directed-graph.d.ts +3 -0
  36. package/dist/cjs/data-structures/graph/directed-graph.js +3 -0
  37. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
  38. package/dist/cjs/data-structures/graph/map-graph.d.ts +3 -0
  39. package/dist/cjs/data-structures/graph/map-graph.js +3 -0
  40. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
  41. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +3 -0
  42. package/dist/cjs/data-structures/graph/undirected-graph.js +3 -0
  43. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
  44. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +3 -0
  45. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +3 -0
  46. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
  47. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +3 -0
  48. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +3 -0
  49. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
  50. package/dist/cjs/data-structures/matrix/matrix.d.ts +3 -0
  51. package/dist/cjs/data-structures/matrix/matrix.js +3 -0
  52. package/dist/cjs/data-structures/matrix/matrix.js.map +1 -1
  53. package/dist/cjs/data-structures/matrix/navigator.d.ts +3 -0
  54. package/dist/cjs/data-structures/matrix/navigator.js +3 -0
  55. package/dist/cjs/data-structures/matrix/navigator.js.map +1 -1
  56. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
  57. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +3 -0
  58. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
  59. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
  60. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +3 -0
  61. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
  62. package/dist/cjs/data-structures/trie/trie.d.ts +0 -4
  63. package/dist/cjs/data-structures/trie/trie.js +0 -4
  64. package/dist/cjs/data-structures/trie/trie.js.map +1 -1
  65. package/dist/cjs/interfaces/binary-tree.d.ts +8 -8
  66. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
  67. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js +3 -0
  68. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
  69. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -4
  70. package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +0 -3
  71. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +0 -3
  72. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +3 -3
  73. package/dist/cjs/types/data-structures/binary-tree/index.d.ts +2 -0
  74. package/dist/cjs/types/data-structures/binary-tree/index.js +2 -0
  75. package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -1
  76. package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +1 -4
  77. package/dist/cjs/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
  78. package/dist/cjs/types/data-structures/binary-tree/tree-counter.js +3 -0
  79. package/dist/cjs/types/data-structures/binary-tree/tree-counter.js.map +1 -0
  80. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -4
  81. package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +213 -0
  82. package/dist/{mjs/data-structures/binary-tree/avl-tree-multi-map.js → esm/data-structures/binary-tree/avl-tree-counter.js} +73 -60
  83. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
  84. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +100 -0
  85. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +191 -0
  86. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -0
  87. package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +234 -0
  88. package/dist/{mjs → esm}/data-structures/binary-tree/avl-tree.js +110 -47
  89. package/dist/esm/data-structures/binary-tree/avl-tree.js.map +1 -0
  90. package/dist/{mjs → esm}/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
  91. package/dist/{mjs → esm}/data-structures/binary-tree/binary-indexed-tree.js +3 -0
  92. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
  93. package/dist/{mjs → esm}/data-structures/binary-tree/binary-tree.d.ts +240 -190
  94. package/dist/{mjs → esm}/data-structures/binary-tree/binary-tree.js +272 -245
  95. package/dist/esm/data-structures/binary-tree/binary-tree.js.map +1 -0
  96. package/dist/{mjs → esm}/data-structures/binary-tree/bst.d.ts +145 -112
  97. package/dist/{mjs → esm}/data-structures/binary-tree/bst.js +201 -155
  98. package/dist/esm/data-structures/binary-tree/bst.js.map +1 -0
  99. package/dist/{mjs → esm}/data-structures/binary-tree/index.d.ts +2 -0
  100. package/dist/{mjs → esm}/data-structures/binary-tree/index.js +2 -0
  101. package/dist/{mjs → esm}/data-structures/binary-tree/index.js.map +1 -1
  102. package/dist/{mjs → esm}/data-structures/binary-tree/red-black-tree.d.ts +100 -82
  103. package/dist/{mjs → esm}/data-structures/binary-tree/red-black-tree.js +115 -79
  104. package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +1 -0
  105. package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +212 -0
  106. package/dist/{mjs/data-structures/binary-tree/tree-multi-map.js → esm/data-structures/binary-tree/tree-counter.js} +111 -96
  107. package/dist/esm/data-structures/binary-tree/tree-counter.js.map +1 -0
  108. package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +106 -0
  109. package/dist/esm/data-structures/binary-tree/tree-multi-map.js +196 -0
  110. package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +1 -0
  111. package/dist/{mjs → esm}/data-structures/graph/directed-graph.d.ts +3 -0
  112. package/dist/{mjs → esm}/data-structures/graph/directed-graph.js +3 -0
  113. package/dist/esm/data-structures/graph/directed-graph.js.map +1 -0
  114. package/dist/{mjs → esm}/data-structures/graph/map-graph.d.ts +3 -0
  115. package/dist/{mjs → esm}/data-structures/graph/map-graph.js +3 -0
  116. package/dist/esm/data-structures/graph/map-graph.js.map +1 -0
  117. package/dist/{mjs → esm}/data-structures/graph/undirected-graph.d.ts +3 -0
  118. package/dist/{mjs → esm}/data-structures/graph/undirected-graph.js +3 -0
  119. package/dist/esm/data-structures/graph/undirected-graph.js.map +1 -0
  120. package/dist/{mjs → esm}/data-structures/linked-list/singly-linked-list.d.ts +3 -0
  121. package/dist/{mjs → esm}/data-structures/linked-list/singly-linked-list.js +3 -0
  122. package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +1 -0
  123. package/dist/{mjs → esm}/data-structures/linked-list/skip-linked-list.d.ts +3 -0
  124. package/dist/{mjs → esm}/data-structures/linked-list/skip-linked-list.js +3 -0
  125. package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +1 -0
  126. package/dist/{mjs → esm}/data-structures/matrix/matrix.d.ts +3 -0
  127. package/dist/{mjs → esm}/data-structures/matrix/matrix.js +3 -0
  128. package/dist/esm/data-structures/matrix/matrix.js.map +1 -0
  129. package/dist/{mjs → esm}/data-structures/matrix/navigator.d.ts +3 -0
  130. package/dist/{mjs → esm}/data-structures/matrix/navigator.js +3 -0
  131. package/dist/esm/data-structures/matrix/navigator.js.map +1 -0
  132. package/dist/{mjs → esm}/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
  133. package/dist/{mjs → esm}/data-structures/priority-queue/max-priority-queue.js +3 -0
  134. package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +1 -0
  135. package/dist/{mjs → esm}/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
  136. package/dist/{mjs → esm}/data-structures/priority-queue/min-priority-queue.js +3 -0
  137. package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +1 -0
  138. package/dist/{mjs → esm}/data-structures/trie/trie.d.ts +0 -4
  139. package/dist/{mjs → esm}/data-structures/trie/trie.js +0 -4
  140. package/dist/esm/data-structures/trie/trie.js.map +1 -0
  141. package/dist/esm/interfaces/binary-tree.d.ts +9 -0
  142. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
  143. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js +2 -0
  144. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
  145. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -0
  146. package/dist/esm/types/data-structures/binary-tree/avl-tree.d.ts +2 -0
  147. package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-tree.d.ts +0 -3
  148. package/dist/{mjs → esm}/types/data-structures/binary-tree/bst.d.ts +3 -3
  149. package/dist/{mjs → esm}/types/data-structures/binary-tree/index.d.ts +2 -0
  150. package/dist/{mjs → esm}/types/data-structures/binary-tree/index.js +2 -0
  151. package/dist/{mjs → esm}/types/data-structures/binary-tree/index.js.map +1 -1
  152. package/dist/esm/types/data-structures/binary-tree/rb-tree.d.ts +3 -0
  153. package/dist/esm/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
  154. package/dist/esm/types/data-structures/binary-tree/tree-counter.js +2 -0
  155. package/dist/esm/types/data-structures/binary-tree/tree-counter.js.map +1 -0
  156. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -0
  157. package/dist/umd/data-structure-typed.js +1464 -895
  158. package/dist/umd/data-structure-typed.min.js +5 -5
  159. package/dist/umd/data-structure-typed.min.js.map +1 -1
  160. package/package.json +14 -14
  161. package/src/data-structures/binary-tree/avl-tree-counter.ts +463 -0
  162. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +155 -393
  163. package/src/data-structures/binary-tree/avl-tree.ts +144 -93
  164. package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -0
  165. package/src/data-structures/binary-tree/binary-tree.ts +433 -405
  166. package/src/data-structures/binary-tree/bst.ts +261 -239
  167. package/src/data-structures/binary-tree/index.ts +2 -0
  168. package/src/data-structures/binary-tree/red-black-tree.ts +163 -134
  169. package/src/data-structures/binary-tree/tree-counter.ts +504 -0
  170. package/src/data-structures/binary-tree/tree-multi-map.ts +161 -429
  171. package/src/data-structures/graph/directed-graph.ts +3 -0
  172. package/src/data-structures/graph/map-graph.ts +3 -0
  173. package/src/data-structures/graph/undirected-graph.ts +3 -0
  174. package/src/data-structures/linked-list/singly-linked-list.ts +3 -0
  175. package/src/data-structures/linked-list/skip-linked-list.ts +3 -0
  176. package/src/data-structures/matrix/matrix.ts +3 -0
  177. package/src/data-structures/matrix/navigator.ts +3 -0
  178. package/src/data-structures/priority-queue/max-priority-queue.ts +3 -0
  179. package/src/data-structures/priority-queue/min-priority-queue.ts +3 -0
  180. package/src/data-structures/trie/trie.ts +0 -4
  181. package/src/interfaces/binary-tree.ts +10 -24
  182. package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
  183. package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -6
  184. package/src/types/data-structures/binary-tree/avl-tree.ts +0 -5
  185. package/src/types/data-structures/binary-tree/binary-tree.ts +0 -5
  186. package/src/types/data-structures/binary-tree/bst.ts +5 -5
  187. package/src/types/data-structures/binary-tree/index.ts +2 -0
  188. package/src/types/data-structures/binary-tree/rb-tree.ts +1 -6
  189. package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
  190. package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -6
  191. package/test/integration/all-in-one.test.ts +1 -1
  192. package/test/integration/avl-tree.test.ts +1 -1
  193. package/test/integration/bst.test.ts +2 -2
  194. package/test/integration/compile.js +144 -0
  195. package/test/integration/compile.ts +171 -0
  196. package/test/integration/index.html +48 -48
  197. package/test/performance/data-structures/binary-tree/avl-tree.test.ts +4 -4
  198. package/test/performance/data-structures/binary-tree/rb-tree.test.ts +5 -4
  199. package/test/performance/data-structures/comparison/comparison.test.ts +2 -2
  200. package/test/performance/reportor.ts +5 -3
  201. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +877 -0
  202. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +459 -761
  203. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +223 -223
  204. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +474 -492
  205. package/test/unit/data-structures/binary-tree/bst.test.ts +1 -1
  206. package/test/unit/data-structures/binary-tree/overall.test.ts +0 -3
  207. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +87 -90
  208. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +975 -0
  209. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +729 -857
  210. package/test/unit/data-structures/hash/hash-map.test.ts +1 -1
  211. package/{tsconfig-mjs.json → tsconfig-esm.json} +1 -1
  212. package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  213. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -189
  214. package/dist/mjs/data-structures/binary-tree/avl-tree.js.map +0 -1
  215. package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  216. package/dist/mjs/data-structures/binary-tree/binary-tree.js.map +0 -1
  217. package/dist/mjs/data-structures/binary-tree/bst.js.map +0 -1
  218. package/dist/mjs/data-structures/binary-tree/red-black-tree.js.map +0 -1
  219. package/dist/mjs/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  220. package/dist/mjs/data-structures/graph/directed-graph.js.map +0 -1
  221. package/dist/mjs/data-structures/graph/map-graph.js.map +0 -1
  222. package/dist/mjs/data-structures/graph/undirected-graph.js.map +0 -1
  223. package/dist/mjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
  224. package/dist/mjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
  225. package/dist/mjs/data-structures/matrix/matrix.js.map +0 -1
  226. package/dist/mjs/data-structures/matrix/navigator.js.map +0 -1
  227. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  228. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  229. package/dist/mjs/data-structures/trie/trie.js.map +0 -1
  230. package/dist/mjs/interfaces/binary-tree.d.ts +0 -9
  231. package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -5
  232. package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +0 -5
  233. package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +0 -6
  234. package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -5
  235. /package/dist/{mjs → esm}/common/index.d.ts +0 -0
  236. /package/dist/{mjs → esm}/common/index.js +0 -0
  237. /package/dist/{mjs → esm}/common/index.js.map +0 -0
  238. /package/dist/{mjs → esm}/data-structures/base/index.d.ts +0 -0
  239. /package/dist/{mjs → esm}/data-structures/base/index.js +0 -0
  240. /package/dist/{mjs → esm}/data-structures/base/index.js.map +0 -0
  241. /package/dist/{mjs → esm}/data-structures/base/iterable-element-base.d.ts +0 -0
  242. /package/dist/{mjs → esm}/data-structures/base/iterable-element-base.js +0 -0
  243. /package/dist/{mjs → esm}/data-structures/base/iterable-element-base.js.map +0 -0
  244. /package/dist/{mjs → esm}/data-structures/base/iterable-entry-base.d.ts +0 -0
  245. /package/dist/{mjs → esm}/data-structures/base/iterable-entry-base.js +0 -0
  246. /package/dist/{mjs → esm}/data-structures/base/iterable-entry-base.js.map +0 -0
  247. /package/dist/{mjs → esm}/data-structures/binary-tree/segment-tree.d.ts +0 -0
  248. /package/dist/{mjs → esm}/data-structures/binary-tree/segment-tree.js +0 -0
  249. /package/dist/{mjs → esm}/data-structures/binary-tree/segment-tree.js.map +0 -0
  250. /package/dist/{mjs → esm}/data-structures/graph/abstract-graph.d.ts +0 -0
  251. /package/dist/{mjs → esm}/data-structures/graph/abstract-graph.js +0 -0
  252. /package/dist/{mjs → esm}/data-structures/graph/abstract-graph.js.map +0 -0
  253. /package/dist/{mjs → esm}/data-structures/graph/index.d.ts +0 -0
  254. /package/dist/{mjs → esm}/data-structures/graph/index.js +0 -0
  255. /package/dist/{mjs → esm}/data-structures/graph/index.js.map +0 -0
  256. /package/dist/{mjs → esm}/data-structures/hash/hash-map.d.ts +0 -0
  257. /package/dist/{mjs → esm}/data-structures/hash/hash-map.js +0 -0
  258. /package/dist/{mjs → esm}/data-structures/hash/hash-map.js.map +0 -0
  259. /package/dist/{mjs → esm}/data-structures/hash/index.d.ts +0 -0
  260. /package/dist/{mjs → esm}/data-structures/hash/index.js +0 -0
  261. /package/dist/{mjs → esm}/data-structures/hash/index.js.map +0 -0
  262. /package/dist/{mjs → esm}/data-structures/heap/heap.d.ts +0 -0
  263. /package/dist/{mjs → esm}/data-structures/heap/heap.js +0 -0
  264. /package/dist/{mjs → esm}/data-structures/heap/heap.js.map +0 -0
  265. /package/dist/{mjs → esm}/data-structures/heap/index.d.ts +0 -0
  266. /package/dist/{mjs → esm}/data-structures/heap/index.js +0 -0
  267. /package/dist/{mjs → esm}/data-structures/heap/index.js.map +0 -0
  268. /package/dist/{mjs → esm}/data-structures/heap/max-heap.d.ts +0 -0
  269. /package/dist/{mjs → esm}/data-structures/heap/max-heap.js +0 -0
  270. /package/dist/{mjs → esm}/data-structures/heap/max-heap.js.map +0 -0
  271. /package/dist/{mjs → esm}/data-structures/heap/min-heap.d.ts +0 -0
  272. /package/dist/{mjs → esm}/data-structures/heap/min-heap.js +0 -0
  273. /package/dist/{mjs → esm}/data-structures/heap/min-heap.js.map +0 -0
  274. /package/dist/{mjs → esm}/data-structures/index.d.ts +0 -0
  275. /package/dist/{mjs → esm}/data-structures/index.js +0 -0
  276. /package/dist/{mjs → esm}/data-structures/index.js.map +0 -0
  277. /package/dist/{mjs → esm}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
  278. /package/dist/{mjs → esm}/data-structures/linked-list/doubly-linked-list.js +0 -0
  279. /package/dist/{mjs → esm}/data-structures/linked-list/doubly-linked-list.js.map +0 -0
  280. /package/dist/{mjs → esm}/data-structures/linked-list/index.d.ts +0 -0
  281. /package/dist/{mjs → esm}/data-structures/linked-list/index.js +0 -0
  282. /package/dist/{mjs → esm}/data-structures/linked-list/index.js.map +0 -0
  283. /package/dist/{mjs → esm}/data-structures/matrix/index.d.ts +0 -0
  284. /package/dist/{mjs → esm}/data-structures/matrix/index.js +0 -0
  285. /package/dist/{mjs → esm}/data-structures/matrix/index.js.map +0 -0
  286. /package/dist/{mjs → esm}/data-structures/priority-queue/index.d.ts +0 -0
  287. /package/dist/{mjs → esm}/data-structures/priority-queue/index.js +0 -0
  288. /package/dist/{mjs → esm}/data-structures/priority-queue/index.js.map +0 -0
  289. /package/dist/{mjs → esm}/data-structures/priority-queue/priority-queue.d.ts +0 -0
  290. /package/dist/{mjs → esm}/data-structures/priority-queue/priority-queue.js +0 -0
  291. /package/dist/{mjs → esm}/data-structures/priority-queue/priority-queue.js.map +0 -0
  292. /package/dist/{mjs → esm}/data-structures/queue/deque.d.ts +0 -0
  293. /package/dist/{mjs → esm}/data-structures/queue/deque.js +0 -0
  294. /package/dist/{mjs → esm}/data-structures/queue/deque.js.map +0 -0
  295. /package/dist/{mjs → esm}/data-structures/queue/index.d.ts +0 -0
  296. /package/dist/{mjs → esm}/data-structures/queue/index.js +0 -0
  297. /package/dist/{mjs → esm}/data-structures/queue/index.js.map +0 -0
  298. /package/dist/{mjs → esm}/data-structures/queue/queue.d.ts +0 -0
  299. /package/dist/{mjs → esm}/data-structures/queue/queue.js +0 -0
  300. /package/dist/{mjs → esm}/data-structures/queue/queue.js.map +0 -0
  301. /package/dist/{mjs → esm}/data-structures/stack/index.d.ts +0 -0
  302. /package/dist/{mjs → esm}/data-structures/stack/index.js +0 -0
  303. /package/dist/{mjs → esm}/data-structures/stack/index.js.map +0 -0
  304. /package/dist/{mjs → esm}/data-structures/stack/stack.d.ts +0 -0
  305. /package/dist/{mjs → esm}/data-structures/stack/stack.js +0 -0
  306. /package/dist/{mjs → esm}/data-structures/stack/stack.js.map +0 -0
  307. /package/dist/{mjs → esm}/data-structures/tree/index.d.ts +0 -0
  308. /package/dist/{mjs → esm}/data-structures/tree/index.js +0 -0
  309. /package/dist/{mjs → esm}/data-structures/tree/index.js.map +0 -0
  310. /package/dist/{mjs → esm}/data-structures/tree/tree.d.ts +0 -0
  311. /package/dist/{mjs → esm}/data-structures/tree/tree.js +0 -0
  312. /package/dist/{mjs → esm}/data-structures/tree/tree.js.map +0 -0
  313. /package/dist/{mjs → esm}/data-structures/trie/index.d.ts +0 -0
  314. /package/dist/{mjs → esm}/data-structures/trie/index.js +0 -0
  315. /package/dist/{mjs → esm}/data-structures/trie/index.js.map +0 -0
  316. /package/dist/{mjs → esm}/index.d.ts +0 -0
  317. /package/dist/{mjs → esm}/index.js +0 -0
  318. /package/dist/{mjs → esm}/index.js.map +0 -0
  319. /package/dist/{mjs → esm}/interfaces/binary-tree.js +0 -0
  320. /package/dist/{mjs → esm}/interfaces/binary-tree.js.map +0 -0
  321. /package/dist/{mjs → esm}/interfaces/doubly-linked-list.d.ts +0 -0
  322. /package/dist/{mjs → esm}/interfaces/doubly-linked-list.js +0 -0
  323. /package/dist/{mjs → esm}/interfaces/doubly-linked-list.js.map +0 -0
  324. /package/dist/{mjs → esm}/interfaces/graph.d.ts +0 -0
  325. /package/dist/{mjs → esm}/interfaces/graph.js +0 -0
  326. /package/dist/{mjs → esm}/interfaces/graph.js.map +0 -0
  327. /package/dist/{mjs → esm}/interfaces/heap.d.ts +0 -0
  328. /package/dist/{mjs → esm}/interfaces/heap.js +0 -0
  329. /package/dist/{mjs → esm}/interfaces/heap.js.map +0 -0
  330. /package/dist/{mjs → esm}/interfaces/index.d.ts +0 -0
  331. /package/dist/{mjs → esm}/interfaces/index.js +0 -0
  332. /package/dist/{mjs → esm}/interfaces/index.js.map +0 -0
  333. /package/dist/{mjs → esm}/interfaces/navigator.d.ts +0 -0
  334. /package/dist/{mjs → esm}/interfaces/navigator.js +0 -0
  335. /package/dist/{mjs → esm}/interfaces/navigator.js.map +0 -0
  336. /package/dist/{mjs → esm}/interfaces/priority-queue.d.ts +0 -0
  337. /package/dist/{mjs → esm}/interfaces/priority-queue.js +0 -0
  338. /package/dist/{mjs → esm}/interfaces/priority-queue.js.map +0 -0
  339. /package/dist/{mjs → esm}/interfaces/segment-tree.d.ts +0 -0
  340. /package/dist/{mjs → esm}/interfaces/segment-tree.js +0 -0
  341. /package/dist/{mjs → esm}/interfaces/segment-tree.js.map +0 -0
  342. /package/dist/{mjs → esm}/interfaces/singly-linked-list.d.ts +0 -0
  343. /package/dist/{mjs → esm}/interfaces/singly-linked-list.js +0 -0
  344. /package/dist/{mjs → esm}/interfaces/singly-linked-list.js.map +0 -0
  345. /package/dist/{mjs → esm}/types/common.d.ts +0 -0
  346. /package/dist/{mjs → esm}/types/common.js +0 -0
  347. /package/dist/{mjs → esm}/types/common.js.map +0 -0
  348. /package/dist/{mjs → esm}/types/data-structures/base/base.d.ts +0 -0
  349. /package/dist/{mjs → esm}/types/data-structures/base/base.js +0 -0
  350. /package/dist/{mjs → esm}/types/data-structures/base/base.js.map +0 -0
  351. /package/dist/{mjs → esm}/types/data-structures/base/index.d.ts +0 -0
  352. /package/dist/{mjs → esm}/types/data-structures/base/index.js +0 -0
  353. /package/dist/{mjs → esm}/types/data-structures/base/index.js.map +0 -0
  354. /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -0
  355. /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -0
  356. /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree.js +0 -0
  357. /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree.js.map +0 -0
  358. /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
  359. /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-indexed-tree.js +0 -0
  360. /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -0
  361. /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-tree.js +0 -0
  362. /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-tree.js.map +0 -0
  363. /package/dist/{mjs → esm}/types/data-structures/binary-tree/bst.js +0 -0
  364. /package/dist/{mjs → esm}/types/data-structures/binary-tree/bst.js.map +0 -0
  365. /package/dist/{mjs → esm}/types/data-structures/binary-tree/rb-tree.js +0 -0
  366. /package/dist/{mjs → esm}/types/data-structures/binary-tree/rb-tree.js.map +0 -0
  367. /package/dist/{mjs → esm}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
  368. /package/dist/{mjs → esm}/types/data-structures/binary-tree/segment-tree.js +0 -0
  369. /package/dist/{mjs → esm}/types/data-structures/binary-tree/segment-tree.js.map +0 -0
  370. /package/dist/{mjs → esm}/types/data-structures/binary-tree/tree-multi-map.js +0 -0
  371. /package/dist/{mjs → esm}/types/data-structures/binary-tree/tree-multi-map.js.map +0 -0
  372. /package/dist/{mjs → esm}/types/data-structures/graph/abstract-graph.d.ts +0 -0
  373. /package/dist/{mjs → esm}/types/data-structures/graph/abstract-graph.js +0 -0
  374. /package/dist/{mjs → esm}/types/data-structures/graph/abstract-graph.js.map +0 -0
  375. /package/dist/{mjs → esm}/types/data-structures/graph/directed-graph.d.ts +0 -0
  376. /package/dist/{mjs → esm}/types/data-structures/graph/directed-graph.js +0 -0
  377. /package/dist/{mjs → esm}/types/data-structures/graph/directed-graph.js.map +0 -0
  378. /package/dist/{mjs → esm}/types/data-structures/graph/index.d.ts +0 -0
  379. /package/dist/{mjs → esm}/types/data-structures/graph/index.js +0 -0
  380. /package/dist/{mjs → esm}/types/data-structures/graph/index.js.map +0 -0
  381. /package/dist/{mjs → esm}/types/data-structures/graph/map-graph.d.ts +0 -0
  382. /package/dist/{mjs → esm}/types/data-structures/graph/map-graph.js +0 -0
  383. /package/dist/{mjs → esm}/types/data-structures/graph/map-graph.js.map +0 -0
  384. /package/dist/{mjs → esm}/types/data-structures/graph/undirected-graph.d.ts +0 -0
  385. /package/dist/{mjs → esm}/types/data-structures/graph/undirected-graph.js +0 -0
  386. /package/dist/{mjs → esm}/types/data-structures/graph/undirected-graph.js.map +0 -0
  387. /package/dist/{mjs → esm}/types/data-structures/hash/hash-map.d.ts +0 -0
  388. /package/dist/{mjs → esm}/types/data-structures/hash/hash-map.js +0 -0
  389. /package/dist/{mjs → esm}/types/data-structures/hash/hash-map.js.map +0 -0
  390. /package/dist/{mjs → esm}/types/data-structures/hash/index.d.ts +0 -0
  391. /package/dist/{mjs → esm}/types/data-structures/hash/index.js +0 -0
  392. /package/dist/{mjs → esm}/types/data-structures/hash/index.js.map +0 -0
  393. /package/dist/{mjs → esm}/types/data-structures/heap/heap.d.ts +0 -0
  394. /package/dist/{mjs → esm}/types/data-structures/heap/heap.js +0 -0
  395. /package/dist/{mjs → esm}/types/data-structures/heap/heap.js.map +0 -0
  396. /package/dist/{mjs → esm}/types/data-structures/heap/index.d.ts +0 -0
  397. /package/dist/{mjs → esm}/types/data-structures/heap/index.js +0 -0
  398. /package/dist/{mjs → esm}/types/data-structures/heap/index.js.map +0 -0
  399. /package/dist/{mjs → esm}/types/data-structures/heap/max-heap.d.ts +0 -0
  400. /package/dist/{mjs → esm}/types/data-structures/heap/max-heap.js +0 -0
  401. /package/dist/{mjs → esm}/types/data-structures/heap/max-heap.js.map +0 -0
  402. /package/dist/{mjs → esm}/types/data-structures/heap/min-heap.d.ts +0 -0
  403. /package/dist/{mjs → esm}/types/data-structures/heap/min-heap.js +0 -0
  404. /package/dist/{mjs → esm}/types/data-structures/heap/min-heap.js.map +0 -0
  405. /package/dist/{mjs → esm}/types/data-structures/index.d.ts +0 -0
  406. /package/dist/{mjs → esm}/types/data-structures/index.js +0 -0
  407. /package/dist/{mjs → esm}/types/data-structures/index.js.map +0 -0
  408. /package/dist/{mjs → esm}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
  409. /package/dist/{mjs → esm}/types/data-structures/linked-list/doubly-linked-list.js +0 -0
  410. /package/dist/{mjs → esm}/types/data-structures/linked-list/doubly-linked-list.js.map +0 -0
  411. /package/dist/{mjs → esm}/types/data-structures/linked-list/index.d.ts +0 -0
  412. /package/dist/{mjs → esm}/types/data-structures/linked-list/index.js +0 -0
  413. /package/dist/{mjs → esm}/types/data-structures/linked-list/index.js.map +0 -0
  414. /package/dist/{mjs → esm}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
  415. /package/dist/{mjs → esm}/types/data-structures/linked-list/singly-linked-list.js +0 -0
  416. /package/dist/{mjs → esm}/types/data-structures/linked-list/singly-linked-list.js.map +0 -0
  417. /package/dist/{mjs → esm}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
  418. /package/dist/{mjs → esm}/types/data-structures/linked-list/skip-linked-list.js +0 -0
  419. /package/dist/{mjs → esm}/types/data-structures/linked-list/skip-linked-list.js.map +0 -0
  420. /package/dist/{mjs → esm}/types/data-structures/matrix/index.d.ts +0 -0
  421. /package/dist/{mjs → esm}/types/data-structures/matrix/index.js +0 -0
  422. /package/dist/{mjs → esm}/types/data-structures/matrix/index.js.map +0 -0
  423. /package/dist/{mjs → esm}/types/data-structures/matrix/matrix.d.ts +0 -0
  424. /package/dist/{mjs → esm}/types/data-structures/matrix/matrix.js +0 -0
  425. /package/dist/{mjs → esm}/types/data-structures/matrix/matrix.js.map +0 -0
  426. /package/dist/{mjs → esm}/types/data-structures/matrix/navigator.d.ts +0 -0
  427. /package/dist/{mjs → esm}/types/data-structures/matrix/navigator.js +0 -0
  428. /package/dist/{mjs → esm}/types/data-structures/matrix/navigator.js.map +0 -0
  429. /package/dist/{mjs → esm}/types/data-structures/priority-queue/index.d.ts +0 -0
  430. /package/dist/{mjs → esm}/types/data-structures/priority-queue/index.js +0 -0
  431. /package/dist/{mjs → esm}/types/data-structures/priority-queue/index.js.map +0 -0
  432. /package/dist/{mjs → esm}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
  433. /package/dist/{mjs → esm}/types/data-structures/priority-queue/max-priority-queue.js +0 -0
  434. /package/dist/{mjs → esm}/types/data-structures/priority-queue/max-priority-queue.js.map +0 -0
  435. /package/dist/{mjs → esm}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
  436. /package/dist/{mjs → esm}/types/data-structures/priority-queue/min-priority-queue.js +0 -0
  437. /package/dist/{mjs → esm}/types/data-structures/priority-queue/min-priority-queue.js.map +0 -0
  438. /package/dist/{mjs → esm}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
  439. /package/dist/{mjs → esm}/types/data-structures/priority-queue/priority-queue.js +0 -0
  440. /package/dist/{mjs → esm}/types/data-structures/priority-queue/priority-queue.js.map +0 -0
  441. /package/dist/{mjs → esm}/types/data-structures/queue/deque.d.ts +0 -0
  442. /package/dist/{mjs → esm}/types/data-structures/queue/deque.js +0 -0
  443. /package/dist/{mjs → esm}/types/data-structures/queue/deque.js.map +0 -0
  444. /package/dist/{mjs → esm}/types/data-structures/queue/index.d.ts +0 -0
  445. /package/dist/{mjs → esm}/types/data-structures/queue/index.js +0 -0
  446. /package/dist/{mjs → esm}/types/data-structures/queue/index.js.map +0 -0
  447. /package/dist/{mjs → esm}/types/data-structures/queue/queue.d.ts +0 -0
  448. /package/dist/{mjs → esm}/types/data-structures/queue/queue.js +0 -0
  449. /package/dist/{mjs → esm}/types/data-structures/queue/queue.js.map +0 -0
  450. /package/dist/{mjs → esm}/types/data-structures/stack/index.d.ts +0 -0
  451. /package/dist/{mjs → esm}/types/data-structures/stack/index.js +0 -0
  452. /package/dist/{mjs → esm}/types/data-structures/stack/index.js.map +0 -0
  453. /package/dist/{mjs → esm}/types/data-structures/stack/stack.d.ts +0 -0
  454. /package/dist/{mjs → esm}/types/data-structures/stack/stack.js +0 -0
  455. /package/dist/{mjs → esm}/types/data-structures/stack/stack.js.map +0 -0
  456. /package/dist/{mjs → esm}/types/data-structures/tree/index.d.ts +0 -0
  457. /package/dist/{mjs → esm}/types/data-structures/tree/index.js +0 -0
  458. /package/dist/{mjs → esm}/types/data-structures/tree/index.js.map +0 -0
  459. /package/dist/{mjs → esm}/types/data-structures/tree/tree.d.ts +0 -0
  460. /package/dist/{mjs → esm}/types/data-structures/tree/tree.js +0 -0
  461. /package/dist/{mjs → esm}/types/data-structures/tree/tree.js.map +0 -0
  462. /package/dist/{mjs → esm}/types/data-structures/trie/index.d.ts +0 -0
  463. /package/dist/{mjs → esm}/types/data-structures/trie/index.js +0 -0
  464. /package/dist/{mjs → esm}/types/data-structures/trie/index.js.map +0 -0
  465. /package/dist/{mjs → esm}/types/data-structures/trie/trie.d.ts +0 -0
  466. /package/dist/{mjs → esm}/types/data-structures/trie/trie.js +0 -0
  467. /package/dist/{mjs → esm}/types/data-structures/trie/trie.js.map +0 -0
  468. /package/dist/{mjs → esm}/types/index.d.ts +0 -0
  469. /package/dist/{mjs → esm}/types/index.js +0 -0
  470. /package/dist/{mjs → esm}/types/index.js.map +0 -0
  471. /package/dist/{mjs → esm}/types/utils/index.d.ts +0 -0
  472. /package/dist/{mjs → esm}/types/utils/index.js +0 -0
  473. /package/dist/{mjs → esm}/types/utils/index.js.map +0 -0
  474. /package/dist/{mjs → esm}/types/utils/utils.d.ts +0 -0
  475. /package/dist/{mjs → esm}/types/utils/utils.js +0 -0
  476. /package/dist/{mjs → esm}/types/utils/utils.js.map +0 -0
  477. /package/dist/{mjs → esm}/types/utils/validate-type.d.ts +0 -0
  478. /package/dist/{mjs → esm}/types/utils/validate-type.js +0 -0
  479. /package/dist/{mjs → esm}/types/utils/validate-type.js.map +0 -0
  480. /package/dist/{mjs → esm}/utils/index.d.ts +0 -0
  481. /package/dist/{mjs → esm}/utils/index.js +0 -0
  482. /package/dist/{mjs → esm}/utils/index.js.map +0 -0
  483. /package/dist/{mjs → esm}/utils/number.d.ts +0 -0
  484. /package/dist/{mjs → esm}/utils/number.js +0 -0
  485. /package/dist/{mjs → esm}/utils/number.js.map +0 -0
  486. /package/dist/{mjs → esm}/utils/utils.d.ts +0 -0
  487. /package/dist/{mjs → esm}/utils/utils.js +0 -0
  488. /package/dist/{mjs → esm}/utils/utils.js.map +0 -0
@@ -0,0 +1,100 @@
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
+ */
8
+ import { AVLTreeMultiMapOptions, BTNRep, OptNodeOrNull } from '../../types';
9
+ import { AVLTree, AVLTreeNode } from './avl-tree';
10
+ import { IBinaryTree } from '../../interfaces';
11
+ export declare class AVLTreeMultiMapNode<K = any, V = any> extends AVLTreeNode<K, V[]> {
12
+ /**
13
+ * This TypeScript constructor initializes an object with a key of type K and an array of values of
14
+ * type V.
15
+ * @param {K} key - The `key` parameter is typically used to store a unique identifier or key for the
16
+ * data being stored in the data structure. It helps in quickly accessing or retrieving the
17
+ * associated value in the data structure.
18
+ * @param {V[]} value - The `value` parameter in the constructor represents an array of values of
19
+ * type `V`.
20
+ */
21
+ constructor(key: K, value: V[]);
22
+ parent?: AVLTreeMultiMapNode<K, V>;
23
+ _left?: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
24
+ get left(): OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
25
+ set left(v: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>);
26
+ _right?: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
27
+ get right(): OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
28
+ set right(v: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>);
29
+ }
30
+ /**
31
+ *
32
+ */
33
+ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends AVLTree<K, V[], R, MK, MV[], MR> implements IBinaryTree<K, V[], R, MK, MV, MR> {
34
+ /**
35
+ * The constructor initializes an AVLTreeMultiMap with the provided keys, nodes, entries, or raw data
36
+ * and options.
37
+ * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
38
+ * iterable that can contain either key-value pairs represented as `BTNRep<K, V[],
39
+ * AVLTreeMultiMapNode<K, V>>` or raw data represented as `R`. This parameter is used to initialize
40
+ * the AVLTreeMulti
41
+ * @param [options] - The `options` parameter in the constructor is of type
42
+ * `AVLTreeMultiMapOptions<K, V[], R>`. It is an optional parameter that allows you to specify
43
+ * additional options for configuring the AVLTreeMultiMap instance.
44
+ */
45
+ constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | R>, options?: AVLTreeMultiMapOptions<K, V[], R>);
46
+ /**
47
+ * Time Complexity: O(1)
48
+ * Space Complexity: O(1)
49
+ *
50
+ * The function `createTree` in TypeScript overrides the creation of an AVLTreeMultiMap with
51
+ * specified options.
52
+ * @param [options] - The `options` parameter in the `createTree` function is of type
53
+ * `AVLTreeMultiMapOptions<K, V[], R>`. This means it is an object that can have properties of type
54
+ * `K`, `V[]`, and `R`. The function creates a new `AVL
55
+ * @returns The `createTree` method is returning a new instance of `AVLTreeMultiMap` with the
56
+ * provided options.
57
+ */
58
+ createTree(options?: AVLTreeMultiMapOptions<K, V[], R>): AVLTreeMultiMap<K, V, R, MK, MV, MR>;
59
+ /**
60
+ * Time Complexity: O(1)
61
+ * Space Complexity: O(1)
62
+ *
63
+ * The function `createNode` overrides the method to create a new AVLTreeMultiMapNode with a
64
+ * specified key and an empty array of values.
65
+ * @param {K} key - The `key` parameter in the `createNode` method represents the key of the node
66
+ * that will be created in the AVLTreeMultiMap.
67
+ * @returns An AVLTreeMultiMapNode object is being returned, initialized with the provided key and an
68
+ * empty array.
69
+ */
70
+ createNode(key: K): AVLTreeMultiMapNode<K, V>;
71
+ add(node: BTNRep<K, V[], AVLTreeMultiMapNode<K, V>>): boolean;
72
+ add(key: K, value: V): boolean;
73
+ /**
74
+ * Time Complexity: O(log n)
75
+ * Space Complexity: O(log n)
76
+ *
77
+ * The function `deleteValue` removes a specific value from a key in an AVLTreeMultiMap data
78
+ * structure and deletes the entire node if no values are left for that key.
79
+ * @param {BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
80
+ * parameter in the `deleteValue` function can be either a `BTNRep` object representing a key-value
81
+ * pair in the AVLTreeMultiMapNode, or just the key itself.
82
+ * @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
83
+ * value that you want to delete from the multi-map data structure associated with a particular key.
84
+ * The function checks if the value exists in the array of values associated with the key, and if
85
+ * found, removes it from the array.
86
+ * @returns The `deleteValue` function returns a boolean value. It returns `true` if the specified
87
+ * `value` was successfully deleted from the array of values associated with the `keyNodeOrEntry`. If
88
+ * the value was not found in the array, it returns `false`.
89
+ */
90
+ deleteValue(keyNodeOrEntry: BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K, value: V): boolean;
91
+ /**
92
+ * Time Complexity: O(n)
93
+ * Space Complexity: O(n)
94
+ *
95
+ * The function `clone` overrides the default cloning behavior to create a deep copy of a tree
96
+ * structure.
97
+ * @returns A cloned tree object is being returned.
98
+ */
99
+ clone(): AVLTreeMultiMap<K, V, R, MK, MV, MR>;
100
+ }
@@ -0,0 +1,191 @@
1
+ import { AVLTree, AVLTreeNode } from './avl-tree';
2
+ export class AVLTreeMultiMapNode extends AVLTreeNode {
3
+ /**
4
+ * This TypeScript constructor initializes an object with a key of type K and an array of values of
5
+ * type V.
6
+ * @param {K} key - The `key` parameter is typically used to store a unique identifier or key for the
7
+ * data being stored in the data structure. It helps in quickly accessing or retrieving the
8
+ * associated value in the data structure.
9
+ * @param {V[]} value - The `value` parameter in the constructor represents an array of values of
10
+ * type `V`.
11
+ */
12
+ constructor(key, value) {
13
+ super(key, value);
14
+ }
15
+ parent = undefined;
16
+ _left = undefined;
17
+ get left() {
18
+ return this._left;
19
+ }
20
+ set left(v) {
21
+ if (v) {
22
+ v.parent = this;
23
+ }
24
+ this._left = v;
25
+ }
26
+ _right = undefined;
27
+ get right() {
28
+ return this._right;
29
+ }
30
+ set right(v) {
31
+ if (v) {
32
+ v.parent = this;
33
+ }
34
+ this._right = v;
35
+ }
36
+ }
37
+ /**
38
+ *
39
+ */
40
+ export class AVLTreeMultiMap extends AVLTree {
41
+ /**
42
+ * The constructor initializes an AVLTreeMultiMap with the provided keys, nodes, entries, or raw data
43
+ * and options.
44
+ * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
45
+ * iterable that can contain either key-value pairs represented as `BTNRep<K, V[],
46
+ * AVLTreeMultiMapNode<K, V>>` or raw data represented as `R`. This parameter is used to initialize
47
+ * the AVLTreeMulti
48
+ * @param [options] - The `options` parameter in the constructor is of type
49
+ * `AVLTreeMultiMapOptions<K, V[], R>`. It is an optional parameter that allows you to specify
50
+ * additional options for configuring the AVLTreeMultiMap instance.
51
+ */
52
+ constructor(keysNodesEntriesOrRaws = [], options) {
53
+ super([], { ...options, isMapMode: true });
54
+ if (keysNodesEntriesOrRaws) {
55
+ this.addMany(keysNodesEntriesOrRaws);
56
+ }
57
+ }
58
+ /**
59
+ * Time Complexity: O(1)
60
+ * Space Complexity: O(1)
61
+ *
62
+ * The function `createTree` in TypeScript overrides the creation of an AVLTreeMultiMap with
63
+ * specified options.
64
+ * @param [options] - The `options` parameter in the `createTree` function is of type
65
+ * `AVLTreeMultiMapOptions<K, V[], R>`. This means it is an object that can have properties of type
66
+ * `K`, `V[]`, and `R`. The function creates a new `AVL
67
+ * @returns The `createTree` method is returning a new instance of `AVLTreeMultiMap` with the
68
+ * provided options.
69
+ */
70
+ createTree(options) {
71
+ return new AVLTreeMultiMap([], {
72
+ iterationType: this.iterationType,
73
+ specifyComparable: this._specifyComparable,
74
+ toEntryFn: this._toEntryFn,
75
+ isReverse: this._isReverse,
76
+ ...options
77
+ });
78
+ }
79
+ /**
80
+ * Time Complexity: O(1)
81
+ * Space Complexity: O(1)
82
+ *
83
+ * The function `createNode` overrides the method to create a new AVLTreeMultiMapNode with a
84
+ * specified key and an empty array of values.
85
+ * @param {K} key - The `key` parameter in the `createNode` method represents the key of the node
86
+ * that will be created in the AVLTreeMultiMap.
87
+ * @returns An AVLTreeMultiMapNode object is being returned, initialized with the provided key and an
88
+ * empty array.
89
+ */
90
+ createNode(key) {
91
+ return new AVLTreeMultiMapNode(key, []);
92
+ }
93
+ /**
94
+ * Time Complexity: O(log n)
95
+ * Space Complexity: O(log n)
96
+ *
97
+ * The function `add` in TypeScript overrides the superclass method to add key-value pairs to an AVL
98
+ * tree multi-map.
99
+ * @param {BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
100
+ * parameter in the `override add` method can be either a key-value pair entry or just a key. If it
101
+ * is a key-value pair entry, it will be in the format `[key, values]`, where `key` is the key and
102
+ * `values`
103
+ * @param {V} [value] - The `value` parameter in the `override add` method represents the value that
104
+ * you want to add to the AVLTreeMultiMap. It can be a single value or an array of values associated
105
+ * with a specific key.
106
+ * @returns The `override add` method is returning a boolean value, which indicates whether the
107
+ * addition operation was successful or not.
108
+ */
109
+ add(keyNodeOrEntry, value) {
110
+ if (this.isRealNode(keyNodeOrEntry))
111
+ return super.add(keyNodeOrEntry);
112
+ const _commonAdd = (key, values) => {
113
+ if (key === undefined || key === null)
114
+ return false;
115
+ const existingValues = this.get(key);
116
+ if (existingValues !== undefined && values !== undefined) {
117
+ for (const value of values)
118
+ existingValues.push(value);
119
+ return true;
120
+ }
121
+ const existingNode = this.getNode(key);
122
+ if (this.isRealNode(existingNode)) {
123
+ if (existingValues === undefined) {
124
+ super.add(key, values);
125
+ return true;
126
+ }
127
+ if (values !== undefined) {
128
+ for (const value of values)
129
+ existingValues.push(value);
130
+ return true;
131
+ }
132
+ else {
133
+ return false;
134
+ }
135
+ }
136
+ else {
137
+ return super.add(key, values);
138
+ }
139
+ };
140
+ if (this.isEntry(keyNodeOrEntry)) {
141
+ const [key, values] = keyNodeOrEntry;
142
+ return _commonAdd(key, value !== undefined ? [value] : values);
143
+ }
144
+ return _commonAdd(keyNodeOrEntry, value !== undefined ? [value] : undefined);
145
+ }
146
+ /**
147
+ * Time Complexity: O(log n)
148
+ * Space Complexity: O(log n)
149
+ *
150
+ * The function `deleteValue` removes a specific value from a key in an AVLTreeMultiMap data
151
+ * structure and deletes the entire node if no values are left for that key.
152
+ * @param {BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
153
+ * parameter in the `deleteValue` function can be either a `BTNRep` object representing a key-value
154
+ * pair in the AVLTreeMultiMapNode, or just the key itself.
155
+ * @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
156
+ * value that you want to delete from the multi-map data structure associated with a particular key.
157
+ * The function checks if the value exists in the array of values associated with the key, and if
158
+ * found, removes it from the array.
159
+ * @returns The `deleteValue` function returns a boolean value. It returns `true` if the specified
160
+ * `value` was successfully deleted from the array of values associated with the `keyNodeOrEntry`. If
161
+ * the value was not found in the array, it returns `false`.
162
+ */
163
+ deleteValue(keyNodeOrEntry, value) {
164
+ const values = this.get(keyNodeOrEntry);
165
+ if (Array.isArray(values)) {
166
+ const index = values.indexOf(value);
167
+ if (index === -1)
168
+ return false;
169
+ values.splice(index, 1);
170
+ // If no values left, remove the entire node
171
+ if (values.length === 0)
172
+ this.delete(keyNodeOrEntry);
173
+ return true;
174
+ }
175
+ return false;
176
+ }
177
+ /**
178
+ * Time Complexity: O(n)
179
+ * Space Complexity: O(n)
180
+ *
181
+ * The function `clone` overrides the default cloning behavior to create a deep copy of a tree
182
+ * structure.
183
+ * @returns A cloned tree object is being returned.
184
+ */
185
+ clone() {
186
+ const cloned = this.createTree();
187
+ this._clone(cloned);
188
+ return cloned;
189
+ }
190
+ }
191
+ //# sourceMappingURL=avl-tree-multi-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avl-tree-multi-map.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-multi-map.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,234 @@
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
+ */
8
+ import { BST, BSTNode } from './bst';
9
+ import type { AVLTreeOptions, BinaryTreeDeleteResult, BSTNOptKeyOrNode, BTNRep, EntryCallback, OptNodeOrNull } from '../../types';
10
+ import { IBinaryTree } from '../../interfaces';
11
+ export declare class AVLTreeNode<K = any, V = any> extends BSTNode<K, V> {
12
+ /**
13
+ * This TypeScript constructor function initializes an instance with a key and an optional value.
14
+ * @param {K} key - The `key` parameter is typically used to uniquely identify an object or element
15
+ * within a data structure. It serves as a reference or identifier for accessing or manipulating the
16
+ * associated value or data.
17
+ * @param {V} [value] - The `value` parameter in the constructor is optional, meaning it does not
18
+ * have to be provided when creating an instance of the class. If a value is not provided, it will
19
+ * default to `undefined`.
20
+ */
21
+ constructor(key: K, value?: V);
22
+ parent?: AVLTreeNode<K, V>;
23
+ _left?: OptNodeOrNull<AVLTreeNode<K, V>>;
24
+ get left(): OptNodeOrNull<AVLTreeNode<K, V>>;
25
+ set left(v: OptNodeOrNull<AVLTreeNode<K, V>>);
26
+ _right?: OptNodeOrNull<AVLTreeNode<K, V>>;
27
+ get right(): OptNodeOrNull<AVLTreeNode<K, V>>;
28
+ set right(v: OptNodeOrNull<AVLTreeNode<K, V>>);
29
+ }
30
+ /**
31
+ * 1. Height-Balanced: Each node's left and right subtrees differ in height by no more than one.
32
+ * 2. Automatic Rebalancing: AVL trees rebalance themselves automatically during insertions and deletions.
33
+ * 3. Rotations for Balancing: Utilizes rotations (single or double) to maintain balance after updates.
34
+ * 4. Order Preservation: Maintains the binary search tree property where left child values are less than the parent, and right child values are greater.
35
+ * 5. Efficient Lookups: Offers O(log n) search time, where 'n' is the number of nodes, due to its balanced nature.
36
+ * 6. Complex Insertions and Deletions: Due to rebalancing, these operations are more complex than in a regular BST.
37
+ * 7. Path Length: The path length from the root to any leaf is longer compared to an unbalanced BST, but shorter than a linear chain of nodes.
38
+ */
39
+ export declare class AVLTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends BST<K, V, R, MK, MV, MR> implements IBinaryTree<K, V, R, MK, MV, MR> {
40
+ /**
41
+ * This TypeScript constructor initializes an AVLTree with keys, nodes, entries, or raw data provided
42
+ * in an iterable format.
43
+ * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
44
+ * iterable that can contain either `BTNRep<K, V, AVLTreeNode<K, V>>` objects or `R` objects. It is
45
+ * used to initialize the AVLTree with key-value pairs or raw data entries. If provided
46
+ * @param [options] - The `options` parameter in the constructor is of type `AVLTreeOptions<K, V,
47
+ * R>`. It is an optional parameter that allows you to specify additional options for configuring the
48
+ * AVL tree. These options could include things like custom comparators, initial capacity, or any
49
+ * other configuration settings specific
50
+ */
51
+ constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V, AVLTreeNode<K, V>> | R>, options?: AVLTreeOptions<K, V, R>);
52
+ /**
53
+ * Time Complexity: O(1)
54
+ * Space Complexity: O(1)
55
+ *
56
+ * The function creates a new AVL tree node with the given key and value.
57
+ * @param {K} key - The key parameter is of type K, which represents the key of the node being
58
+ * created.
59
+ * @param {V} [value] - The "value" parameter is an optional parameter of type V. It represents the
60
+ * value associated with the key in the node being created.
61
+ * @returns The method is returning a new instance of the AVLTreeNode class, casted as the generic
62
+ * type AVLTreeNode<K, V>.
63
+ */
64
+ createNode(key: K, value?: V): AVLTreeNode<K, V>;
65
+ /**
66
+ * Time Complexity: O(1)
67
+ * Space Complexity: O(1)
68
+ *
69
+ * The function creates a new AVL tree with the specified options and returns it.
70
+ * @param {AVLTreeOptions} [options] - The `options` parameter is an optional object that can be
71
+ * passed to the `createTree` function. It is used to customize the behavior of the AVL tree that is
72
+ * being created.
73
+ * @returns a new AVLTree object.
74
+ */
75
+ createTree(options?: AVLTreeOptions<K, V, R>): AVLTree<K, V, R, MK, MV, MR>;
76
+ /**
77
+ * Time Complexity: O(1)
78
+ * Space Complexity: O(1)
79
+ *
80
+ * The function checks if the input is an instance of AVLTreeNode.
81
+ * @param {BTNRep<K, V, AVLTreeNode<K, V>>} keyNodeOrEntry - The parameter
82
+ * `keyNodeOrEntry` can be of type `R` or `BTNRep<K, V, AVLTreeNode<K, V>>`.
83
+ * @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
84
+ * an instance of the `AVLTreeNode` class.
85
+ */
86
+ isNode(keyNodeOrEntry: BTNRep<K, V, AVLTreeNode<K, V>>): keyNodeOrEntry is AVLTreeNode<K, V>;
87
+ /**
88
+ * Time Complexity: O(log n)
89
+ * Space Complexity: O(log n)
90
+ *
91
+ * The function overrides the add method of a class and inserts a key-value pair into a data
92
+ * structure, then balances the path.
93
+ * @param {BTNRep<K, V, AVLTreeNode<K, V>>} keyNodeOrEntry - The parameter
94
+ * `keyNodeOrEntry` can accept values of type `R`, `BTNRep<K, V, AVLTreeNode<K, V>>`
95
+ * @param {V} [value] - The `value` parameter is an optional value that you want to associate with
96
+ * the key or node being added to the data structure.
97
+ * @returns The method is returning a boolean value.
98
+ */
99
+ add(keyNodeOrEntry: BTNRep<K, V, AVLTreeNode<K, V>>, value?: V): boolean;
100
+ /**
101
+ * Time Complexity: O(log n)
102
+ * Space Complexity: O(log n)
103
+ *
104
+ * The function overrides the delete method in a TypeScript class, performs deletion, and then
105
+ * balances the tree if necessary.
106
+ * @param {BTNRep<K, V, AVLTreeNode<K, V>>} keyNodeOrEntry - The `keyNodeOrEntry`
107
+ * parameter in the `override delete` method can be one of the following types:
108
+ * @returns The `delete` method is being overridden in this code snippet. It first calls the `delete`
109
+ * method from the superclass (presumably a parent class) with the provided `predicate`, which could
110
+ * be a key, node, entry, or a custom predicate. The result of this deletion operation is stored in
111
+ * `deletedResults`, which is an array of `BinaryTreeDeleteResult` objects.
112
+ */
113
+ delete(keyNodeOrEntry: BTNRep<K, V, AVLTreeNode<K, V>>): BinaryTreeDeleteResult<AVLTreeNode<K, V>>[];
114
+ /**
115
+ * Time Complexity: O(n)
116
+ * Space Complexity: O(n)
117
+ *
118
+ * The `map` function in TypeScript overrides the default map behavior of an AVLTree data structure
119
+ * by applying a callback function to each entry and creating a new AVLTree with the results.
120
+ * @param callback - A function that will be called for each entry in the AVLTree. It takes four
121
+ * arguments: the key, the value (which can be undefined), the index of the entry, and a reference to
122
+ * the AVLTree itself.
123
+ * @param [options] - The `options` parameter in the `override map` function is of type
124
+ * `AVLTreeOptions<MK, MV, MR>`. It is an optional parameter that allows you to specify additional
125
+ * options for the AVL tree being created during the mapping process. These options could include
126
+ * custom comparators, initial
127
+ * @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
128
+ * the value of `this` when executing the `callback` function. It allows you to set the context
129
+ * (value of `this`) within the callback function. This can be useful when you want to access
130
+ * properties or
131
+ * @returns The `map` method is returning a new AVLTree instance (`newTree`) with the entries
132
+ * modified by the provided callback function.
133
+ */
134
+ map(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: AVLTreeOptions<MK, MV, MR>, thisArg?: any): AVLTree<MK, MV, MR>;
135
+ /**
136
+ * Time Complexity: O(n)
137
+ * Space Complexity: O(n)
138
+ *
139
+ * The function `clone` overrides the default cloning behavior to create a deep copy of a tree
140
+ * structure.
141
+ * @returns A cloned tree object is being returned.
142
+ */
143
+ clone(): AVLTree<K, V, R, MK, MV, MR>;
144
+ /**
145
+ * Time Complexity: O(1)
146
+ * Space Complexity: O(1)
147
+ *
148
+ * The `_swapProperties` function swaps the key, value, and height properties between two nodes in a
149
+ * binary search tree.
150
+ * @param {BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>} srcNode - The `srcNode` parameter represents either a node
151
+ * object (`AVLTreeNode<K, V>`) or a key-value pair (`R`) that is being swapped with another node.
152
+ * @param {BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>} destNode - The `destNode` parameter is either an instance of
153
+ * `R` or an instance of `BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>`.
154
+ * @returns The method is returning the `destNodeEnsured` object if both `srcNodeEnsured` and
155
+ * `destNodeEnsured` are truthy. Otherwise, it returns `undefined`.
156
+ */
157
+ protected _swapProperties(srcNode: BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>, destNode: BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>): AVLTreeNode<K, V> | undefined;
158
+ /**
159
+ * Time Complexity: O(1)
160
+ * Space Complexity: O(1)
161
+ *
162
+ * The function calculates the balance factor of a node in a binary tree.
163
+ * @param {AVLTreeNode<K, V>} node - The parameter "node" is of type "AVLTreeNode<K, V>", which likely represents a node in a
164
+ * binary tree data structure.
165
+ * @returns the balance factor of a given node. The balance factor is calculated by subtracting the
166
+ * height of the left subtree from the height of the right subtree.
167
+ */
168
+ protected _balanceFactor(node: AVLTreeNode<K, V>): number;
169
+ /**
170
+ * Time Complexity: O(1)
171
+ * Space Complexity: O(1)
172
+ *
173
+ * The function updates the height of a node in a binary tree based on the heights of its left and
174
+ * right children.
175
+ * @param {AVLTreeNode<K, V>} node - The parameter "node" represents a node in a binary tree data structure.
176
+ */
177
+ protected _updateHeight(node: AVLTreeNode<K, V>): void;
178
+ /**
179
+ * Time Complexity: O(1)
180
+ * Space Complexity: O(1)
181
+ *
182
+ * The `_balanceLL` function performs a left-left rotation to balance a binary search tree.
183
+ * @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
184
+ */
185
+ protected _balanceLL(A: AVLTreeNode<K, V>): void;
186
+ /**
187
+ * Time Complexity: O(1)
188
+ * Space Complexity: O(1)
189
+ *
190
+ * The `_balanceLR` function performs a left-right rotation to balance a binary tree.
191
+ * @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
192
+ */
193
+ protected _balanceLR(A: AVLTreeNode<K, V>): void;
194
+ /**
195
+ * Time Complexity: O(1)
196
+ * Space Complexity: O(1)
197
+ *
198
+ * The function `_balanceRR` performs a right-right rotation to balance a binary tree.
199
+ * @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
200
+ */
201
+ protected _balanceRR(A: AVLTreeNode<K, V>): void;
202
+ /**
203
+ * Time Complexity: O(1)
204
+ * Space Complexity: O(1)
205
+ *
206
+ * The function `_balanceRL` performs a right-left rotation to balance a binary tree.
207
+ * @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
208
+ */
209
+ protected _balanceRL(A: AVLTreeNode<K, V>): void;
210
+ /**
211
+ * Time Complexity: O(log n)
212
+ * Space Complexity: O(1)
213
+ *
214
+ * The `_balancePath` function is used to update the heights of nodes and perform rotation operations
215
+ * to restore balance in an AVL tree after inserting a node.
216
+ * @param {BTNRep<K, V, AVLTreeNode<K, V>>} node - The `node` parameter can be of type `R` or
217
+ * `BTNRep<K, V, AVLTreeNode<K, V>>`.
218
+ */
219
+ protected _balancePath(node: BTNRep<K, V, AVLTreeNode<K, V>>): void;
220
+ /**
221
+ * Time Complexity: O(1)
222
+ * Space Complexity: O(1)
223
+ *
224
+ * The function replaces an old node with a new node and sets the height of the new node to be the
225
+ * same as the old node.
226
+ * @param {AVLTreeNode<K, V>} oldNode - The `oldNode` parameter represents the node that needs to be replaced in
227
+ * the data structure.
228
+ * @param {AVLTreeNode<K, V>} newNode - The `newNode` parameter is the new node that will replace the `oldNode` in
229
+ * the data structure.
230
+ * @returns The method is returning the result of calling the `_replaceNode` method from the
231
+ * superclass, with the `oldNode` and `newNode` as arguments.
232
+ */
233
+ protected _replaceNode(oldNode: AVLTreeNode<K, V>, newNode: AVLTreeNode<K, V>): AVLTreeNode<K, V>;
234
+ }