data-structure-typed 2.0.5 → 2.1.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 (785) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/COMMANDS.md +27 -0
  3. package/README.md +5 -34
  4. package/benchmark/report.html +13 -77
  5. package/benchmark/report.json +152 -184
  6. package/dist/cjs/index.cjs +13062 -0
  7. package/dist/cjs/index.cjs.map +1 -0
  8. package/dist/esm/index.mjs +12984 -0
  9. package/dist/esm/index.mjs.map +1 -0
  10. package/dist/index.cjs +13091 -0
  11. package/dist/index.cjs.map +1 -0
  12. package/dist/index.js +13013 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/types/data-structures/base/iterable-element-base.d.ts +219 -0
  15. package/dist/types/data-structures/base/iterable-entry-base.d.ts +144 -0
  16. package/dist/types/data-structures/base/linear-base.d.ts +335 -0
  17. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +182 -0
  18. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +135 -0
  19. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +291 -0
  20. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +754 -0
  21. package/dist/types/data-structures/binary-tree/bst.d.ts +413 -0
  22. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +208 -0
  23. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +190 -0
  24. package/dist/{esm → types}/data-structures/binary-tree/tree-multi-map.d.ts +72 -69
  25. package/dist/types/data-structures/graph/abstract-graph.d.ts +340 -0
  26. package/dist/types/data-structures/graph/directed-graph.d.ts +207 -0
  27. package/dist/types/data-structures/graph/map-graph.d.ts +78 -0
  28. package/dist/types/data-structures/graph/undirected-graph.d.ts +188 -0
  29. package/dist/types/data-structures/hash/hash-map.d.ts +345 -0
  30. package/dist/types/data-structures/heap/heap.d.ts +503 -0
  31. package/dist/types/data-structures/heap/max-heap.d.ts +32 -0
  32. package/dist/types/data-structures/heap/min-heap.d.ts +33 -0
  33. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +769 -0
  34. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +451 -0
  35. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +27 -0
  36. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +27 -0
  37. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +26 -0
  38. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +15 -0
  39. package/dist/types/data-structures/queue/deque.d.ts +431 -0
  40. package/dist/types/data-structures/queue/queue.d.ts +308 -0
  41. package/dist/{cjs → types}/data-structures/stack/stack.d.ts +124 -102
  42. package/dist/types/data-structures/trie/trie.d.ts +350 -0
  43. package/dist/types/interfaces/binary-tree.d.ts +59 -0
  44. package/dist/types/interfaces/graph.d.ts +21 -0
  45. package/dist/{cjs → types}/types/data-structures/base/base.d.ts +1 -1
  46. package/dist/{esm → types}/types/data-structures/graph/abstract-graph.d.ts +4 -0
  47. package/dist/{cjs → types}/types/utils/utils.d.ts +1 -0
  48. package/dist/{esm → types}/utils/utils.d.ts +1 -1
  49. package/dist/umd/data-structure-typed.js +4693 -6484
  50. package/dist/umd/data-structure-typed.js.map +1 -0
  51. package/dist/umd/data-structure-typed.min.js +8 -6
  52. package/dist/umd/data-structure-typed.min.js.map +1 -1
  53. package/jest.integration.config.js +3 -0
  54. package/package.json +13 -12
  55. package/src/data-structures/base/iterable-element-base.ts +238 -115
  56. package/src/data-structures/base/iterable-entry-base.ts +96 -120
  57. package/src/data-structures/base/linear-base.ts +271 -277
  58. package/src/data-structures/binary-tree/avl-tree-counter.ts +196 -217
  59. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +188 -102
  60. package/src/data-structures/binary-tree/avl-tree.ts +237 -206
  61. package/src/data-structures/binary-tree/binary-tree.ts +665 -896
  62. package/src/data-structures/binary-tree/bst.ts +565 -572
  63. package/src/data-structures/binary-tree/red-black-tree.ts +157 -223
  64. package/src/data-structures/binary-tree/tree-counter.ts +195 -219
  65. package/src/data-structures/binary-tree/tree-multi-map.ts +127 -98
  66. package/src/data-structures/graph/abstract-graph.ts +339 -264
  67. package/src/data-structures/graph/directed-graph.ts +146 -236
  68. package/src/data-structures/graph/map-graph.ts +63 -60
  69. package/src/data-structures/graph/undirected-graph.ts +129 -152
  70. package/src/data-structures/hash/hash-map.ts +274 -496
  71. package/src/data-structures/heap/heap.ts +389 -402
  72. package/src/data-structures/heap/max-heap.ts +12 -76
  73. package/src/data-structures/heap/min-heap.ts +13 -76
  74. package/src/data-structures/linked-list/doubly-linked-list.ts +426 -530
  75. package/src/data-structures/linked-list/singly-linked-list.ts +495 -517
  76. package/src/data-structures/linked-list/skip-linked-list.ts +1 -108
  77. package/src/data-structures/priority-queue/max-priority-queue.ts +12 -87
  78. package/src/data-structures/priority-queue/min-priority-queue.ts +11 -88
  79. package/src/data-structures/priority-queue/priority-queue.ts +3 -92
  80. package/src/data-structures/queue/deque.ts +381 -357
  81. package/src/data-structures/queue/queue.ts +310 -264
  82. package/src/data-structures/stack/stack.ts +217 -131
  83. package/src/data-structures/trie/trie.ts +240 -175
  84. package/src/interfaces/binary-tree.ts +240 -6
  85. package/src/interfaces/graph.ts +37 -0
  86. package/src/types/data-structures/base/base.ts +5 -5
  87. package/src/types/data-structures/graph/abstract-graph.ts +5 -0
  88. package/src/types/utils/utils.ts +2 -0
  89. package/src/utils/utils.ts +9 -14
  90. package/test/integration/all-in-one.test.ts +1 -1
  91. package/test/integration/index.html +1 -1
  92. package/test/performance/benchmark-runner.ts +528 -0
  93. package/test/performance/data-structures/comparison/comparison.test.ts +27 -57
  94. package/test/performance/reportor.mjs +43 -43
  95. package/test/performance/runner-config.json +39 -0
  96. package/test/performance/single-suite-runner.ts +69 -0
  97. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +3 -3
  98. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +5 -5
  99. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +4 -4
  100. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +350 -90
  101. package/test/unit/data-structures/binary-tree/bst.test.ts +12 -9
  102. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +2 -2
  103. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +25 -24
  104. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +112 -4
  105. package/test/unit/data-structures/graph/abstract-graph.test.ts +0 -4
  106. package/test/unit/data-structures/graph/directed-graph.test.ts +1 -1
  107. package/test/unit/data-structures/heap/heap.test.ts +14 -21
  108. package/test/unit/data-structures/heap/max-heap.test.ts +5 -9
  109. package/test/unit/data-structures/heap/min-heap.test.ts +1 -4
  110. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +14 -14
  111. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +0 -7
  112. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +8 -11
  113. package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +1 -4
  114. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +1 -4
  115. package/test/unit/data-structures/queue/queue.test.ts +4 -5
  116. package/test/unit/utils/utils.test.ts +0 -1
  117. package/tsconfig-base.json +20 -20
  118. package/tsconfig-types.json +17 -0
  119. package/tsconfig.test.json +8 -0
  120. package/tsup.config.js +11 -22
  121. package/tsup.node.config.ts +37 -0
  122. package/dist/cjs/common/index.js +0 -29
  123. package/dist/cjs/common/index.js.map +0 -1
  124. package/dist/cjs/data-structures/base/index.js +0 -19
  125. package/dist/cjs/data-structures/base/index.js.map +0 -1
  126. package/dist/cjs/data-structures/base/iterable-element-base.d.ts +0 -116
  127. package/dist/cjs/data-structures/base/iterable-element-base.js +0 -202
  128. package/dist/cjs/data-structures/base/iterable-element-base.js.map +0 -1
  129. package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +0 -168
  130. package/dist/cjs/data-structures/base/iterable-entry-base.js +0 -241
  131. package/dist/cjs/data-structures/base/iterable-entry-base.js.map +0 -1
  132. package/dist/cjs/data-structures/base/linear-base.d.ts +0 -277
  133. package/dist/cjs/data-structures/base/linear-base.js +0 -553
  134. package/dist/cjs/data-structures/base/linear-base.js.map +0 -1
  135. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.d.ts +0 -214
  136. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +0 -409
  137. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  138. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -104
  139. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +0 -203
  140. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  141. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -302
  142. package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -599
  143. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +0 -1
  144. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +0 -295
  145. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  146. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +0 -910
  147. package/dist/cjs/data-structures/binary-tree/binary-tree.js +0 -2197
  148. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +0 -1
  149. package/dist/cjs/data-structures/binary-tree/bst.d.ts +0 -461
  150. package/dist/cjs/data-structures/binary-tree/bst.js +0 -880
  151. package/dist/cjs/data-structures/binary-tree/bst.js.map +0 -1
  152. package/dist/cjs/data-structures/binary-tree/index.js +0 -27
  153. package/dist/cjs/data-structures/binary-tree/index.js.map +0 -1
  154. package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +0 -280
  155. package/dist/cjs/data-structures/binary-tree/red-black-tree.js +0 -642
  156. package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +0 -1
  157. package/dist/cjs/data-structures/binary-tree/segment-tree.js +0 -298
  158. package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +0 -1
  159. package/dist/cjs/data-structures/binary-tree/tree-counter.d.ts +0 -212
  160. package/dist/cjs/data-structures/binary-tree/tree-counter.js +0 -445
  161. package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +0 -1
  162. package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -267
  163. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +0 -365
  164. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  165. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -335
  166. package/dist/cjs/data-structures/graph/abstract-graph.js +0 -867
  167. package/dist/cjs/data-structures/graph/abstract-graph.js.map +0 -1
  168. package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -323
  169. package/dist/cjs/data-structures/graph/directed-graph.js +0 -613
  170. package/dist/cjs/data-structures/graph/directed-graph.js.map +0 -1
  171. package/dist/cjs/data-structures/graph/index.js +0 -21
  172. package/dist/cjs/data-structures/graph/index.js.map +0 -1
  173. package/dist/cjs/data-structures/graph/map-graph.d.ts +0 -84
  174. package/dist/cjs/data-structures/graph/map-graph.js +0 -111
  175. package/dist/cjs/data-structures/graph/map-graph.js.map +0 -1
  176. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -231
  177. package/dist/cjs/data-structures/graph/undirected-graph.js +0 -445
  178. package/dist/cjs/data-structures/graph/undirected-graph.js.map +0 -1
  179. package/dist/cjs/data-structures/hash/hash-map.d.ts +0 -519
  180. package/dist/cjs/data-structures/hash/hash-map.js +0 -880
  181. package/dist/cjs/data-structures/hash/hash-map.js.map +0 -1
  182. package/dist/cjs/data-structures/hash/index.js +0 -18
  183. package/dist/cjs/data-structures/hash/index.js.map +0 -1
  184. package/dist/cjs/data-structures/heap/heap.d.ts +0 -578
  185. package/dist/cjs/data-structures/heap/heap.js +0 -911
  186. package/dist/cjs/data-structures/heap/heap.js.map +0 -1
  187. package/dist/cjs/data-structures/heap/index.js +0 -20
  188. package/dist/cjs/data-structures/heap/index.js.map +0 -1
  189. package/dist/cjs/data-structures/heap/max-heap.d.ts +0 -68
  190. package/dist/cjs/data-structures/heap/max-heap.js +0 -96
  191. package/dist/cjs/data-structures/heap/max-heap.js.map +0 -1
  192. package/dist/cjs/data-structures/heap/min-heap.d.ts +0 -68
  193. package/dist/cjs/data-structures/heap/min-heap.js +0 -87
  194. package/dist/cjs/data-structures/heap/min-heap.js.map +0 -1
  195. package/dist/cjs/data-structures/index.js +0 -29
  196. package/dist/cjs/data-structures/index.js.map +0 -1
  197. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +0 -885
  198. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +0 -1238
  199. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  200. package/dist/cjs/data-structures/linked-list/index.js +0 -20
  201. package/dist/cjs/data-structures/linked-list/index.js.map +0 -1
  202. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +0 -500
  203. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +0 -870
  204. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
  205. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +0 -134
  206. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +0 -245
  207. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
  208. package/dist/cjs/data-structures/matrix/index.js +0 -19
  209. package/dist/cjs/data-structures/matrix/index.js.map +0 -1
  210. package/dist/cjs/data-structures/matrix/matrix.js +0 -449
  211. package/dist/cjs/data-structures/matrix/matrix.js.map +0 -1
  212. package/dist/cjs/data-structures/matrix/navigator.js +0 -112
  213. package/dist/cjs/data-structures/matrix/navigator.js.map +0 -1
  214. package/dist/cjs/data-structures/priority-queue/index.js +0 -20
  215. package/dist/cjs/data-structures/priority-queue/index.js.map +0 -1
  216. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +0 -71
  217. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +0 -102
  218. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  219. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +0 -72
  220. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +0 -94
  221. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  222. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +0 -74
  223. package/dist/cjs/data-structures/priority-queue/priority-queue.js +0 -96
  224. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +0 -1
  225. package/dist/cjs/data-structures/queue/deque.d.ts +0 -458
  226. package/dist/cjs/data-structures/queue/deque.js +0 -919
  227. package/dist/cjs/data-structures/queue/deque.js.map +0 -1
  228. package/dist/cjs/data-structures/queue/index.js +0 -19
  229. package/dist/cjs/data-structures/queue/index.js.map +0 -1
  230. package/dist/cjs/data-structures/queue/queue.d.ts +0 -329
  231. package/dist/cjs/data-structures/queue/queue.js +0 -457
  232. package/dist/cjs/data-structures/queue/queue.js.map +0 -1
  233. package/dist/cjs/data-structures/stack/index.js +0 -18
  234. package/dist/cjs/data-structures/stack/index.js.map +0 -1
  235. package/dist/cjs/data-structures/stack/stack.js +0 -346
  236. package/dist/cjs/data-structures/stack/stack.js.map +0 -1
  237. package/dist/cjs/data-structures/tree/index.js +0 -18
  238. package/dist/cjs/data-structures/tree/index.js.map +0 -1
  239. package/dist/cjs/data-structures/tree/tree.js +0 -108
  240. package/dist/cjs/data-structures/tree/tree.js.map +0 -1
  241. package/dist/cjs/data-structures/trie/index.js +0 -18
  242. package/dist/cjs/data-structures/trie/index.js.map +0 -1
  243. package/dist/cjs/data-structures/trie/trie.d.ts +0 -351
  244. package/dist/cjs/data-structures/trie/trie.js +0 -594
  245. package/dist/cjs/data-structures/trie/trie.js.map +0 -1
  246. package/dist/cjs/index.js +0 -22
  247. package/dist/cjs/index.js.map +0 -1
  248. package/dist/cjs/interfaces/binary-tree.d.ts +0 -9
  249. package/dist/cjs/interfaces/binary-tree.js +0 -3
  250. package/dist/cjs/interfaces/binary-tree.js.map +0 -1
  251. package/dist/cjs/interfaces/doubly-linked-list.js +0 -3
  252. package/dist/cjs/interfaces/doubly-linked-list.js.map +0 -1
  253. package/dist/cjs/interfaces/graph.d.ts +0 -5
  254. package/dist/cjs/interfaces/graph.js +0 -3
  255. package/dist/cjs/interfaces/graph.js.map +0 -1
  256. package/dist/cjs/interfaces/heap.js +0 -3
  257. package/dist/cjs/interfaces/heap.js.map +0 -1
  258. package/dist/cjs/interfaces/index.js +0 -25
  259. package/dist/cjs/interfaces/index.js.map +0 -1
  260. package/dist/cjs/interfaces/navigator.js +0 -3
  261. package/dist/cjs/interfaces/navigator.js.map +0 -1
  262. package/dist/cjs/interfaces/priority-queue.js +0 -3
  263. package/dist/cjs/interfaces/priority-queue.js.map +0 -1
  264. package/dist/cjs/interfaces/segment-tree.js +0 -3
  265. package/dist/cjs/interfaces/segment-tree.js.map +0 -1
  266. package/dist/cjs/interfaces/singly-linked-list.js +0 -3
  267. package/dist/cjs/interfaces/singly-linked-list.js.map +0 -1
  268. package/dist/cjs/types/common.js +0 -3
  269. package/dist/cjs/types/common.js.map +0 -1
  270. package/dist/cjs/types/data-structures/base/base.js +0 -3
  271. package/dist/cjs/types/data-structures/base/base.js.map +0 -1
  272. package/dist/cjs/types/data-structures/base/index.js +0 -18
  273. package/dist/cjs/types/data-structures/base/index.js.map +0 -1
  274. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js +0 -3
  275. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  276. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -3
  277. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  278. package/dist/cjs/types/data-structures/binary-tree/avl-tree.js +0 -3
  279. package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +0 -1
  280. package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js +0 -3
  281. package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  282. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +0 -3
  283. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +0 -1
  284. package/dist/cjs/types/data-structures/binary-tree/bst.js +0 -3
  285. package/dist/cjs/types/data-structures/binary-tree/bst.js.map +0 -1
  286. package/dist/cjs/types/data-structures/binary-tree/index.js +0 -26
  287. package/dist/cjs/types/data-structures/binary-tree/index.js.map +0 -1
  288. package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js +0 -3
  289. package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
  290. package/dist/cjs/types/data-structures/binary-tree/segment-tree.js +0 -3
  291. package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +0 -1
  292. package/dist/cjs/types/data-structures/binary-tree/tree-counter.js +0 -3
  293. package/dist/cjs/types/data-structures/binary-tree/tree-counter.js.map +0 -1
  294. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js +0 -3
  295. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  296. package/dist/cjs/types/data-structures/graph/abstract-graph.d.ts +0 -10
  297. package/dist/cjs/types/data-structures/graph/abstract-graph.js +0 -3
  298. package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +0 -1
  299. package/dist/cjs/types/data-structures/graph/directed-graph.js +0 -3
  300. package/dist/cjs/types/data-structures/graph/directed-graph.js.map +0 -1
  301. package/dist/cjs/types/data-structures/graph/index.js +0 -20
  302. package/dist/cjs/types/data-structures/graph/index.js.map +0 -1
  303. package/dist/cjs/types/data-structures/graph/map-graph.js +0 -3
  304. package/dist/cjs/types/data-structures/graph/map-graph.js.map +0 -1
  305. package/dist/cjs/types/data-structures/graph/undirected-graph.js +0 -3
  306. package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +0 -1
  307. package/dist/cjs/types/data-structures/hash/hash-map.js +0 -3
  308. package/dist/cjs/types/data-structures/hash/hash-map.js.map +0 -1
  309. package/dist/cjs/types/data-structures/hash/index.js +0 -18
  310. package/dist/cjs/types/data-structures/hash/index.js.map +0 -1
  311. package/dist/cjs/types/data-structures/heap/heap.js +0 -3
  312. package/dist/cjs/types/data-structures/heap/heap.js.map +0 -1
  313. package/dist/cjs/types/data-structures/heap/index.js +0 -18
  314. package/dist/cjs/types/data-structures/heap/index.js.map +0 -1
  315. package/dist/cjs/types/data-structures/heap/max-heap.js +0 -3
  316. package/dist/cjs/types/data-structures/heap/max-heap.js.map +0 -1
  317. package/dist/cjs/types/data-structures/heap/min-heap.js +0 -3
  318. package/dist/cjs/types/data-structures/heap/min-heap.js.map +0 -1
  319. package/dist/cjs/types/data-structures/index.js +0 -29
  320. package/dist/cjs/types/data-structures/index.js.map +0 -1
  321. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js +0 -3
  322. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  323. package/dist/cjs/types/data-structures/linked-list/index.js +0 -20
  324. package/dist/cjs/types/data-structures/linked-list/index.js.map +0 -1
  325. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js +0 -3
  326. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
  327. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js +0 -3
  328. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
  329. package/dist/cjs/types/data-structures/matrix/index.js +0 -19
  330. package/dist/cjs/types/data-structures/matrix/index.js.map +0 -1
  331. package/dist/cjs/types/data-structures/matrix/matrix.js +0 -3
  332. package/dist/cjs/types/data-structures/matrix/matrix.js.map +0 -1
  333. package/dist/cjs/types/data-structures/matrix/navigator.js +0 -3
  334. package/dist/cjs/types/data-structures/matrix/navigator.js.map +0 -1
  335. package/dist/cjs/types/data-structures/priority-queue/index.js +0 -20
  336. package/dist/cjs/types/data-structures/priority-queue/index.js.map +0 -1
  337. package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js +0 -3
  338. package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  339. package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js +0 -3
  340. package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  341. package/dist/cjs/types/data-structures/priority-queue/priority-queue.js +0 -3
  342. package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +0 -1
  343. package/dist/cjs/types/data-structures/queue/deque.js +0 -3
  344. package/dist/cjs/types/data-structures/queue/deque.js.map +0 -1
  345. package/dist/cjs/types/data-structures/queue/index.js +0 -19
  346. package/dist/cjs/types/data-structures/queue/index.js.map +0 -1
  347. package/dist/cjs/types/data-structures/queue/queue.js +0 -3
  348. package/dist/cjs/types/data-structures/queue/queue.js.map +0 -1
  349. package/dist/cjs/types/data-structures/stack/index.js +0 -18
  350. package/dist/cjs/types/data-structures/stack/index.js.map +0 -1
  351. package/dist/cjs/types/data-structures/stack/stack.js +0 -3
  352. package/dist/cjs/types/data-structures/stack/stack.js.map +0 -1
  353. package/dist/cjs/types/data-structures/tree/index.js +0 -18
  354. package/dist/cjs/types/data-structures/tree/index.js.map +0 -1
  355. package/dist/cjs/types/data-structures/tree/tree.js +0 -3
  356. package/dist/cjs/types/data-structures/tree/tree.js.map +0 -1
  357. package/dist/cjs/types/data-structures/trie/index.js +0 -18
  358. package/dist/cjs/types/data-structures/trie/index.js.map +0 -1
  359. package/dist/cjs/types/data-structures/trie/trie.js +0 -3
  360. package/dist/cjs/types/data-structures/trie/trie.js.map +0 -1
  361. package/dist/cjs/types/index.js +0 -20
  362. package/dist/cjs/types/index.js.map +0 -1
  363. package/dist/cjs/types/utils/index.js +0 -19
  364. package/dist/cjs/types/utils/index.js.map +0 -1
  365. package/dist/cjs/types/utils/utils.js +0 -3
  366. package/dist/cjs/types/utils/utils.js.map +0 -1
  367. package/dist/cjs/types/utils/validate-type.js +0 -3
  368. package/dist/cjs/types/utils/validate-type.js.map +0 -1
  369. package/dist/cjs/utils/index.js +0 -19
  370. package/dist/cjs/utils/index.js.map +0 -1
  371. package/dist/cjs/utils/number.js +0 -24
  372. package/dist/cjs/utils/number.js.map +0 -1
  373. package/dist/cjs/utils/utils.d.ts +0 -209
  374. package/dist/cjs/utils/utils.js +0 -353
  375. package/dist/cjs/utils/utils.js.map +0 -1
  376. package/dist/esm/common/index.d.ts +0 -12
  377. package/dist/esm/common/index.js +0 -29
  378. package/dist/esm/common/index.js.map +0 -1
  379. package/dist/esm/data-structures/base/index.d.ts +0 -2
  380. package/dist/esm/data-structures/base/index.js +0 -3
  381. package/dist/esm/data-structures/base/index.js.map +0 -1
  382. package/dist/esm/data-structures/base/iterable-element-base.d.ts +0 -116
  383. package/dist/esm/data-structures/base/iterable-element-base.js +0 -199
  384. package/dist/esm/data-structures/base/iterable-element-base.js.map +0 -1
  385. package/dist/esm/data-structures/base/iterable-entry-base.d.ts +0 -168
  386. package/dist/esm/data-structures/base/iterable-entry-base.js +0 -237
  387. package/dist/esm/data-structures/base/iterable-entry-base.js.map +0 -1
  388. package/dist/esm/data-structures/base/linear-base.d.ts +0 -277
  389. package/dist/esm/data-structures/base/linear-base.js +0 -549
  390. package/dist/esm/data-structures/base/linear-base.js.map +0 -1
  391. package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +0 -214
  392. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +0 -410
  393. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  394. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -104
  395. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +0 -205
  396. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  397. package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +0 -302
  398. package/dist/esm/data-structures/binary-tree/avl-tree.js +0 -601
  399. package/dist/esm/data-structures/binary-tree/avl-tree.js.map +0 -1
  400. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -174
  401. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js +0 -296
  402. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  403. package/dist/esm/data-structures/binary-tree/binary-tree.d.ts +0 -910
  404. package/dist/esm/data-structures/binary-tree/binary-tree.js +0 -2198
  405. package/dist/esm/data-structures/binary-tree/binary-tree.js.map +0 -1
  406. package/dist/esm/data-structures/binary-tree/bst.d.ts +0 -461
  407. package/dist/esm/data-structures/binary-tree/bst.js +0 -881
  408. package/dist/esm/data-structures/binary-tree/bst.js.map +0 -1
  409. package/dist/esm/data-structures/binary-tree/index.d.ts +0 -10
  410. package/dist/esm/data-structures/binary-tree/index.js +0 -11
  411. package/dist/esm/data-structures/binary-tree/index.js.map +0 -1
  412. package/dist/esm/data-structures/binary-tree/red-black-tree.d.ts +0 -280
  413. package/dist/esm/data-structures/binary-tree/red-black-tree.js +0 -641
  414. package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +0 -1
  415. package/dist/esm/data-structures/binary-tree/segment-tree.d.ts +0 -160
  416. package/dist/esm/data-structures/binary-tree/segment-tree.js +0 -295
  417. package/dist/esm/data-structures/binary-tree/segment-tree.js.map +0 -1
  418. package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +0 -212
  419. package/dist/esm/data-structures/binary-tree/tree-counter.js +0 -446
  420. package/dist/esm/data-structures/binary-tree/tree-counter.js.map +0 -1
  421. package/dist/esm/data-structures/binary-tree/tree-multi-map.js +0 -367
  422. package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  423. package/dist/esm/data-structures/graph/abstract-graph.d.ts +0 -335
  424. package/dist/esm/data-structures/graph/abstract-graph.js +0 -862
  425. package/dist/esm/data-structures/graph/abstract-graph.js.map +0 -1
  426. package/dist/esm/data-structures/graph/directed-graph.d.ts +0 -323
  427. package/dist/esm/data-structures/graph/directed-graph.js +0 -609
  428. package/dist/esm/data-structures/graph/directed-graph.js.map +0 -1
  429. package/dist/esm/data-structures/graph/index.d.ts +0 -4
  430. package/dist/esm/data-structures/graph/index.js +0 -5
  431. package/dist/esm/data-structures/graph/index.js.map +0 -1
  432. package/dist/esm/data-structures/graph/map-graph.d.ts +0 -84
  433. package/dist/esm/data-structures/graph/map-graph.js +0 -108
  434. package/dist/esm/data-structures/graph/map-graph.js.map +0 -1
  435. package/dist/esm/data-structures/graph/undirected-graph.d.ts +0 -231
  436. package/dist/esm/data-structures/graph/undirected-graph.js +0 -439
  437. package/dist/esm/data-structures/graph/undirected-graph.js.map +0 -1
  438. package/dist/esm/data-structures/hash/hash-map.d.ts +0 -519
  439. package/dist/esm/data-structures/hash/hash-map.js +0 -878
  440. package/dist/esm/data-structures/hash/hash-map.js.map +0 -1
  441. package/dist/esm/data-structures/hash/index.d.ts +0 -1
  442. package/dist/esm/data-structures/hash/index.js +0 -2
  443. package/dist/esm/data-structures/hash/index.js.map +0 -1
  444. package/dist/esm/data-structures/heap/heap.d.ts +0 -578
  445. package/dist/esm/data-structures/heap/heap.js +0 -914
  446. package/dist/esm/data-structures/heap/heap.js.map +0 -1
  447. package/dist/esm/data-structures/heap/index.d.ts +0 -3
  448. package/dist/esm/data-structures/heap/index.js +0 -4
  449. package/dist/esm/data-structures/heap/index.js.map +0 -1
  450. package/dist/esm/data-structures/heap/max-heap.d.ts +0 -68
  451. package/dist/esm/data-structures/heap/max-heap.js +0 -95
  452. package/dist/esm/data-structures/heap/max-heap.js.map +0 -1
  453. package/dist/esm/data-structures/heap/min-heap.d.ts +0 -68
  454. package/dist/esm/data-structures/heap/min-heap.js +0 -83
  455. package/dist/esm/data-structures/heap/min-heap.js.map +0 -1
  456. package/dist/esm/data-structures/index.d.ts +0 -12
  457. package/dist/esm/data-structures/index.js +0 -13
  458. package/dist/esm/data-structures/index.js.map +0 -1
  459. package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +0 -885
  460. package/dist/esm/data-structures/linked-list/doubly-linked-list.js +0 -1236
  461. package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  462. package/dist/esm/data-structures/linked-list/index.d.ts +0 -3
  463. package/dist/esm/data-structures/linked-list/index.js +0 -4
  464. package/dist/esm/data-structures/linked-list/index.js.map +0 -1
  465. package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +0 -500
  466. package/dist/esm/data-structures/linked-list/singly-linked-list.js +0 -866
  467. package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +0 -1
  468. package/dist/esm/data-structures/linked-list/skip-linked-list.d.ts +0 -134
  469. package/dist/esm/data-structures/linked-list/skip-linked-list.js +0 -243
  470. package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +0 -1
  471. package/dist/esm/data-structures/matrix/index.d.ts +0 -2
  472. package/dist/esm/data-structures/matrix/index.js +0 -3
  473. package/dist/esm/data-structures/matrix/index.js.map +0 -1
  474. package/dist/esm/data-structures/matrix/matrix.d.ts +0 -168
  475. package/dist/esm/data-structures/matrix/matrix.js +0 -444
  476. package/dist/esm/data-structures/matrix/matrix.js.map +0 -1
  477. package/dist/esm/data-structures/matrix/navigator.d.ts +0 -55
  478. package/dist/esm/data-structures/matrix/navigator.js +0 -114
  479. package/dist/esm/data-structures/matrix/navigator.js.map +0 -1
  480. package/dist/esm/data-structures/priority-queue/index.d.ts +0 -3
  481. package/dist/esm/data-structures/priority-queue/index.js +0 -4
  482. package/dist/esm/data-structures/priority-queue/index.js.map +0 -1
  483. package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +0 -71
  484. package/dist/esm/data-structures/priority-queue/max-priority-queue.js +0 -101
  485. package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  486. package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +0 -72
  487. package/dist/esm/data-structures/priority-queue/min-priority-queue.js +0 -90
  488. package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  489. package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +0 -74
  490. package/dist/esm/data-structures/priority-queue/priority-queue.js +0 -92
  491. package/dist/esm/data-structures/priority-queue/priority-queue.js.map +0 -1
  492. package/dist/esm/data-structures/queue/deque.d.ts +0 -458
  493. package/dist/esm/data-structures/queue/deque.js +0 -915
  494. package/dist/esm/data-structures/queue/deque.js.map +0 -1
  495. package/dist/esm/data-structures/queue/index.d.ts +0 -2
  496. package/dist/esm/data-structures/queue/index.js +0 -3
  497. package/dist/esm/data-structures/queue/index.js.map +0 -1
  498. package/dist/esm/data-structures/queue/queue.d.ts +0 -329
  499. package/dist/esm/data-structures/queue/queue.js +0 -452
  500. package/dist/esm/data-structures/queue/queue.js.map +0 -1
  501. package/dist/esm/data-structures/stack/index.d.ts +0 -1
  502. package/dist/esm/data-structures/stack/index.js +0 -2
  503. package/dist/esm/data-structures/stack/index.js.map +0 -1
  504. package/dist/esm/data-structures/stack/stack.d.ts +0 -284
  505. package/dist/esm/data-structures/stack/stack.js +0 -342
  506. package/dist/esm/data-structures/stack/stack.js.map +0 -1
  507. package/dist/esm/data-structures/tree/index.d.ts +0 -1
  508. package/dist/esm/data-structures/tree/index.js +0 -2
  509. package/dist/esm/data-structures/tree/index.js.map +0 -1
  510. package/dist/esm/data-structures/tree/tree.d.ts +0 -62
  511. package/dist/esm/data-structures/tree/tree.js +0 -107
  512. package/dist/esm/data-structures/tree/tree.js.map +0 -1
  513. package/dist/esm/data-structures/trie/index.d.ts +0 -1
  514. package/dist/esm/data-structures/trie/index.js +0 -2
  515. package/dist/esm/data-structures/trie/index.js.map +0 -1
  516. package/dist/esm/data-structures/trie/trie.d.ts +0 -351
  517. package/dist/esm/data-structures/trie/trie.js +0 -592
  518. package/dist/esm/data-structures/trie/trie.js.map +0 -1
  519. package/dist/esm/index.d.ts +0 -5
  520. package/dist/esm/index.js +0 -6
  521. package/dist/esm/index.js.map +0 -1
  522. package/dist/esm/interfaces/binary-tree.d.ts +0 -9
  523. package/dist/esm/interfaces/binary-tree.js +0 -2
  524. package/dist/esm/interfaces/binary-tree.js.map +0 -1
  525. package/dist/esm/interfaces/doubly-linked-list.d.ts +0 -1
  526. package/dist/esm/interfaces/doubly-linked-list.js +0 -2
  527. package/dist/esm/interfaces/doubly-linked-list.js.map +0 -1
  528. package/dist/esm/interfaces/graph.d.ts +0 -5
  529. package/dist/esm/interfaces/graph.js +0 -2
  530. package/dist/esm/interfaces/graph.js.map +0 -1
  531. package/dist/esm/interfaces/heap.d.ts +0 -1
  532. package/dist/esm/interfaces/heap.js +0 -2
  533. package/dist/esm/interfaces/heap.js.map +0 -1
  534. package/dist/esm/interfaces/index.d.ts +0 -8
  535. package/dist/esm/interfaces/index.js +0 -9
  536. package/dist/esm/interfaces/index.js.map +0 -1
  537. package/dist/esm/interfaces/navigator.d.ts +0 -1
  538. package/dist/esm/interfaces/navigator.js +0 -2
  539. package/dist/esm/interfaces/navigator.js.map +0 -1
  540. package/dist/esm/interfaces/priority-queue.d.ts +0 -1
  541. package/dist/esm/interfaces/priority-queue.js +0 -2
  542. package/dist/esm/interfaces/priority-queue.js.map +0 -1
  543. package/dist/esm/interfaces/segment-tree.d.ts +0 -1
  544. package/dist/esm/interfaces/segment-tree.js +0 -2
  545. package/dist/esm/interfaces/segment-tree.js.map +0 -1
  546. package/dist/esm/interfaces/singly-linked-list.d.ts +0 -1
  547. package/dist/esm/interfaces/singly-linked-list.js +0 -2
  548. package/dist/esm/interfaces/singly-linked-list.js.map +0 -1
  549. package/dist/esm/types/common.d.ts +0 -15
  550. package/dist/esm/types/common.js +0 -2
  551. package/dist/esm/types/common.js.map +0 -1
  552. package/dist/esm/types/data-structures/base/base.d.ts +0 -13
  553. package/dist/esm/types/data-structures/base/base.js +0 -2
  554. package/dist/esm/types/data-structures/base/base.js.map +0 -1
  555. package/dist/esm/types/data-structures/base/index.d.ts +0 -1
  556. package/dist/esm/types/data-structures/base/index.js +0 -2
  557. package/dist/esm/types/data-structures/base/index.js.map +0 -1
  558. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -2
  559. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js +0 -2
  560. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  561. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -2
  562. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -2
  563. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  564. package/dist/esm/types/data-structures/binary-tree/avl-tree.d.ts +0 -2
  565. package/dist/esm/types/data-structures/binary-tree/avl-tree.js +0 -2
  566. package/dist/esm/types/data-structures/binary-tree/avl-tree.js.map +0 -1
  567. package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -1
  568. package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
  569. package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  570. package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +0 -29
  571. package/dist/esm/types/data-structures/binary-tree/binary-tree.js +0 -2
  572. package/dist/esm/types/data-structures/binary-tree/binary-tree.js.map +0 -1
  573. package/dist/esm/types/data-structures/binary-tree/bst.d.ts +0 -12
  574. package/dist/esm/types/data-structures/binary-tree/bst.js +0 -2
  575. package/dist/esm/types/data-structures/binary-tree/bst.js.map +0 -1
  576. package/dist/esm/types/data-structures/binary-tree/index.d.ts +0 -9
  577. package/dist/esm/types/data-structures/binary-tree/index.js +0 -10
  578. package/dist/esm/types/data-structures/binary-tree/index.js.map +0 -1
  579. package/dist/esm/types/data-structures/binary-tree/red-black-tree.d.ts +0 -3
  580. package/dist/esm/types/data-structures/binary-tree/red-black-tree.js +0 -2
  581. package/dist/esm/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
  582. package/dist/esm/types/data-structures/binary-tree/segment-tree.d.ts +0 -1
  583. package/dist/esm/types/data-structures/binary-tree/segment-tree.js +0 -2
  584. package/dist/esm/types/data-structures/binary-tree/segment-tree.js.map +0 -1
  585. package/dist/esm/types/data-structures/binary-tree/tree-counter.d.ts +0 -2
  586. package/dist/esm/types/data-structures/binary-tree/tree-counter.js +0 -2
  587. package/dist/esm/types/data-structures/binary-tree/tree-counter.js.map +0 -1
  588. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -2
  589. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js +0 -2
  590. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  591. package/dist/esm/types/data-structures/graph/abstract-graph.js +0 -2
  592. package/dist/esm/types/data-structures/graph/abstract-graph.js.map +0 -1
  593. package/dist/esm/types/data-structures/graph/directed-graph.d.ts +0 -1
  594. package/dist/esm/types/data-structures/graph/directed-graph.js +0 -2
  595. package/dist/esm/types/data-structures/graph/directed-graph.js.map +0 -1
  596. package/dist/esm/types/data-structures/graph/index.d.ts +0 -3
  597. package/dist/esm/types/data-structures/graph/index.js +0 -4
  598. package/dist/esm/types/data-structures/graph/index.js.map +0 -1
  599. package/dist/esm/types/data-structures/graph/map-graph.d.ts +0 -1
  600. package/dist/esm/types/data-structures/graph/map-graph.js +0 -2
  601. package/dist/esm/types/data-structures/graph/map-graph.js.map +0 -1
  602. package/dist/esm/types/data-structures/graph/undirected-graph.d.ts +0 -1
  603. package/dist/esm/types/data-structures/graph/undirected-graph.js +0 -2
  604. package/dist/esm/types/data-structures/graph/undirected-graph.js.map +0 -1
  605. package/dist/esm/types/data-structures/hash/hash-map.d.ts +0 -19
  606. package/dist/esm/types/data-structures/hash/hash-map.js +0 -2
  607. package/dist/esm/types/data-structures/hash/hash-map.js.map +0 -1
  608. package/dist/esm/types/data-structures/hash/index.d.ts +0 -2
  609. package/dist/esm/types/data-structures/hash/index.js +0 -2
  610. package/dist/esm/types/data-structures/hash/index.js.map +0 -1
  611. package/dist/esm/types/data-structures/heap/heap.d.ts +0 -5
  612. package/dist/esm/types/data-structures/heap/heap.js +0 -2
  613. package/dist/esm/types/data-structures/heap/heap.js.map +0 -1
  614. package/dist/esm/types/data-structures/heap/index.d.ts +0 -1
  615. package/dist/esm/types/data-structures/heap/index.js +0 -2
  616. package/dist/esm/types/data-structures/heap/index.js.map +0 -1
  617. package/dist/esm/types/data-structures/heap/max-heap.d.ts +0 -1
  618. package/dist/esm/types/data-structures/heap/max-heap.js +0 -2
  619. package/dist/esm/types/data-structures/heap/max-heap.js.map +0 -1
  620. package/dist/esm/types/data-structures/heap/min-heap.d.ts +0 -1
  621. package/dist/esm/types/data-structures/heap/min-heap.js +0 -2
  622. package/dist/esm/types/data-structures/heap/min-heap.js.map +0 -1
  623. package/dist/esm/types/data-structures/index.d.ts +0 -12
  624. package/dist/esm/types/data-structures/index.js +0 -13
  625. package/dist/esm/types/data-structures/index.js.map +0 -1
  626. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -2
  627. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js +0 -2
  628. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  629. package/dist/esm/types/data-structures/linked-list/index.d.ts +0 -3
  630. package/dist/esm/types/data-structures/linked-list/index.js +0 -4
  631. package/dist/esm/types/data-structures/linked-list/index.js.map +0 -1
  632. package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +0 -2
  633. package/dist/esm/types/data-structures/linked-list/singly-linked-list.js +0 -2
  634. package/dist/esm/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
  635. package/dist/esm/types/data-structures/linked-list/skip-linked-list.d.ts +0 -4
  636. package/dist/esm/types/data-structures/linked-list/skip-linked-list.js +0 -2
  637. package/dist/esm/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
  638. package/dist/esm/types/data-structures/matrix/index.d.ts +0 -2
  639. package/dist/esm/types/data-structures/matrix/index.js +0 -3
  640. package/dist/esm/types/data-structures/matrix/index.js.map +0 -1
  641. package/dist/esm/types/data-structures/matrix/matrix.d.ts +0 -7
  642. package/dist/esm/types/data-structures/matrix/matrix.js +0 -2
  643. package/dist/esm/types/data-structures/matrix/matrix.js.map +0 -1
  644. package/dist/esm/types/data-structures/matrix/navigator.d.ts +0 -14
  645. package/dist/esm/types/data-structures/matrix/navigator.js +0 -2
  646. package/dist/esm/types/data-structures/matrix/navigator.js.map +0 -1
  647. package/dist/esm/types/data-structures/priority-queue/index.d.ts +0 -3
  648. package/dist/esm/types/data-structures/priority-queue/index.js +0 -4
  649. package/dist/esm/types/data-structures/priority-queue/index.js.map +0 -1
  650. package/dist/esm/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -1
  651. package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js +0 -2
  652. package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  653. package/dist/esm/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -1
  654. package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js +0 -2
  655. package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  656. package/dist/esm/types/data-structures/priority-queue/priority-queue.d.ts +0 -2
  657. package/dist/esm/types/data-structures/priority-queue/priority-queue.js +0 -2
  658. package/dist/esm/types/data-structures/priority-queue/priority-queue.js.map +0 -1
  659. package/dist/esm/types/data-structures/queue/deque.d.ts +0 -4
  660. package/dist/esm/types/data-structures/queue/deque.js +0 -2
  661. package/dist/esm/types/data-structures/queue/deque.js.map +0 -1
  662. package/dist/esm/types/data-structures/queue/index.d.ts +0 -2
  663. package/dist/esm/types/data-structures/queue/index.js +0 -3
  664. package/dist/esm/types/data-structures/queue/index.js.map +0 -1
  665. package/dist/esm/types/data-structures/queue/queue.d.ts +0 -4
  666. package/dist/esm/types/data-structures/queue/queue.js +0 -2
  667. package/dist/esm/types/data-structures/queue/queue.js.map +0 -1
  668. package/dist/esm/types/data-structures/stack/index.d.ts +0 -1
  669. package/dist/esm/types/data-structures/stack/index.js +0 -2
  670. package/dist/esm/types/data-structures/stack/index.js.map +0 -1
  671. package/dist/esm/types/data-structures/stack/stack.d.ts +0 -2
  672. package/dist/esm/types/data-structures/stack/stack.js +0 -2
  673. package/dist/esm/types/data-structures/stack/stack.js.map +0 -1
  674. package/dist/esm/types/data-structures/tree/index.d.ts +0 -1
  675. package/dist/esm/types/data-structures/tree/index.js +0 -2
  676. package/dist/esm/types/data-structures/tree/index.js.map +0 -1
  677. package/dist/esm/types/data-structures/tree/tree.d.ts +0 -1
  678. package/dist/esm/types/data-structures/tree/tree.js +0 -2
  679. package/dist/esm/types/data-structures/tree/tree.js.map +0 -1
  680. package/dist/esm/types/data-structures/trie/index.d.ts +0 -1
  681. package/dist/esm/types/data-structures/trie/index.js +0 -2
  682. package/dist/esm/types/data-structures/trie/index.js.map +0 -1
  683. package/dist/esm/types/data-structures/trie/trie.d.ts +0 -4
  684. package/dist/esm/types/data-structures/trie/trie.js +0 -2
  685. package/dist/esm/types/data-structures/trie/trie.js.map +0 -1
  686. package/dist/esm/types/index.d.ts +0 -3
  687. package/dist/esm/types/index.js +0 -4
  688. package/dist/esm/types/index.js.map +0 -1
  689. package/dist/esm/types/utils/index.d.ts +0 -2
  690. package/dist/esm/types/utils/index.js +0 -3
  691. package/dist/esm/types/utils/index.js.map +0 -1
  692. package/dist/esm/types/utils/utils.d.ts +0 -21
  693. package/dist/esm/types/utils/utils.js +0 -2
  694. package/dist/esm/types/utils/utils.js.map +0 -1
  695. package/dist/esm/types/utils/validate-type.d.ts +0 -19
  696. package/dist/esm/types/utils/validate-type.js +0 -2
  697. package/dist/esm/types/utils/validate-type.js.map +0 -1
  698. package/dist/esm/utils/index.d.ts +0 -2
  699. package/dist/esm/utils/index.js +0 -3
  700. package/dist/esm/utils/index.js.map +0 -1
  701. package/dist/esm/utils/number.d.ts +0 -14
  702. package/dist/esm/utils/number.js +0 -21
  703. package/dist/esm/utils/number.js.map +0 -1
  704. package/dist/esm/utils/utils.js +0 -324
  705. package/dist/esm/utils/utils.js.map +0 -1
  706. package/test/performance/data-structures/binary-tree/avl-tree.test.mjs +0 -71
  707. package/test/performance/data-structures/binary-tree/red-black-tree.test.mjs +0 -81
  708. package/tsconfig-cjs.json +0 -14
  709. package/tsconfig-esm.json +0 -14
  710. /package/dist/{cjs → types}/common/index.d.ts +0 -0
  711. /package/dist/{cjs → types}/data-structures/base/index.d.ts +0 -0
  712. /package/dist/{cjs → types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
  713. /package/dist/{cjs → types}/data-structures/binary-tree/index.d.ts +0 -0
  714. /package/dist/{cjs → types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
  715. /package/dist/{cjs → types}/data-structures/graph/index.d.ts +0 -0
  716. /package/dist/{cjs → types}/data-structures/hash/index.d.ts +0 -0
  717. /package/dist/{cjs → types}/data-structures/heap/index.d.ts +0 -0
  718. /package/dist/{cjs → types}/data-structures/index.d.ts +0 -0
  719. /package/dist/{cjs → types}/data-structures/linked-list/index.d.ts +0 -0
  720. /package/dist/{cjs → types}/data-structures/matrix/index.d.ts +0 -0
  721. /package/dist/{cjs → types}/data-structures/matrix/matrix.d.ts +0 -0
  722. /package/dist/{cjs → types}/data-structures/matrix/navigator.d.ts +0 -0
  723. /package/dist/{cjs → types}/data-structures/priority-queue/index.d.ts +0 -0
  724. /package/dist/{cjs → types}/data-structures/queue/index.d.ts +0 -0
  725. /package/dist/{cjs → types}/data-structures/stack/index.d.ts +0 -0
  726. /package/dist/{cjs → types}/data-structures/tree/index.d.ts +0 -0
  727. /package/dist/{cjs → types}/data-structures/tree/tree.d.ts +0 -0
  728. /package/dist/{cjs → types}/data-structures/trie/index.d.ts +0 -0
  729. /package/dist/{cjs → types}/index.d.ts +0 -0
  730. /package/dist/{cjs → types}/interfaces/doubly-linked-list.d.ts +0 -0
  731. /package/dist/{cjs → types}/interfaces/heap.d.ts +0 -0
  732. /package/dist/{cjs → types}/interfaces/index.d.ts +0 -0
  733. /package/dist/{cjs → types}/interfaces/navigator.d.ts +0 -0
  734. /package/dist/{cjs → types}/interfaces/priority-queue.d.ts +0 -0
  735. /package/dist/{cjs → types}/interfaces/segment-tree.d.ts +0 -0
  736. /package/dist/{cjs → types}/interfaces/singly-linked-list.d.ts +0 -0
  737. /package/dist/{cjs → types}/types/common.d.ts +0 -0
  738. /package/dist/{cjs → types}/types/data-structures/base/index.d.ts +0 -0
  739. /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -0
  740. /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -0
  741. /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree.d.ts +0 -0
  742. /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
  743. /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-tree.d.ts +0 -0
  744. /package/dist/{cjs → types}/types/data-structures/binary-tree/bst.d.ts +0 -0
  745. /package/dist/{cjs → types}/types/data-structures/binary-tree/index.d.ts +0 -0
  746. /package/dist/{cjs → types}/types/data-structures/binary-tree/red-black-tree.d.ts +0 -0
  747. /package/dist/{cjs → types}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
  748. /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-counter.d.ts +0 -0
  749. /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -0
  750. /package/dist/{cjs → types}/types/data-structures/graph/directed-graph.d.ts +0 -0
  751. /package/dist/{cjs → types}/types/data-structures/graph/index.d.ts +0 -0
  752. /package/dist/{cjs → types}/types/data-structures/graph/map-graph.d.ts +0 -0
  753. /package/dist/{cjs → types}/types/data-structures/graph/undirected-graph.d.ts +0 -0
  754. /package/dist/{cjs → types}/types/data-structures/hash/hash-map.d.ts +0 -0
  755. /package/dist/{cjs → types}/types/data-structures/hash/index.d.ts +0 -0
  756. /package/dist/{cjs → types}/types/data-structures/heap/heap.d.ts +0 -0
  757. /package/dist/{cjs → types}/types/data-structures/heap/index.d.ts +0 -0
  758. /package/dist/{cjs → types}/types/data-structures/heap/max-heap.d.ts +0 -0
  759. /package/dist/{cjs → types}/types/data-structures/heap/min-heap.d.ts +0 -0
  760. /package/dist/{cjs → types}/types/data-structures/index.d.ts +0 -0
  761. /package/dist/{cjs → types}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
  762. /package/dist/{cjs → types}/types/data-structures/linked-list/index.d.ts +0 -0
  763. /package/dist/{cjs → types}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
  764. /package/dist/{cjs → types}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
  765. /package/dist/{cjs → types}/types/data-structures/matrix/index.d.ts +0 -0
  766. /package/dist/{cjs → types}/types/data-structures/matrix/matrix.d.ts +0 -0
  767. /package/dist/{cjs → types}/types/data-structures/matrix/navigator.d.ts +0 -0
  768. /package/dist/{cjs → types}/types/data-structures/priority-queue/index.d.ts +0 -0
  769. /package/dist/{cjs → types}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
  770. /package/dist/{cjs → types}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
  771. /package/dist/{cjs → types}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
  772. /package/dist/{cjs → types}/types/data-structures/queue/deque.d.ts +0 -0
  773. /package/dist/{cjs → types}/types/data-structures/queue/index.d.ts +0 -0
  774. /package/dist/{cjs → types}/types/data-structures/queue/queue.d.ts +0 -0
  775. /package/dist/{cjs → types}/types/data-structures/stack/index.d.ts +0 -0
  776. /package/dist/{cjs → types}/types/data-structures/stack/stack.d.ts +0 -0
  777. /package/dist/{cjs → types}/types/data-structures/tree/index.d.ts +0 -0
  778. /package/dist/{cjs → types}/types/data-structures/tree/tree.d.ts +0 -0
  779. /package/dist/{cjs → types}/types/data-structures/trie/index.d.ts +0 -0
  780. /package/dist/{cjs → types}/types/data-structures/trie/trie.d.ts +0 -0
  781. /package/dist/{cjs → types}/types/index.d.ts +0 -0
  782. /package/dist/{cjs → types}/types/utils/index.d.ts +0 -0
  783. /package/dist/{cjs → types}/types/utils/validate-type.d.ts +0 -0
  784. /package/dist/{cjs → types}/utils/index.d.ts +0 -0
  785. /package/dist/{cjs → types}/utils/number.d.ts +0 -0
@@ -1,910 +0,0 @@
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 type { BinaryTreeDeleteResult, BinaryTreeOptions, BinaryTreePrintOptions, BTNEntry, DFSOrderPattern, EntryCallback, FamilyPosition, IterationType, NodeCallback, NodeDisplayLayout, NodePredicate, OptNodeOrNull, RBTNColor, ToEntryFn } from '../../types';
9
- import { IBinaryTree } from '../../interfaces';
10
- import { IterableEntryBase } from '../base';
11
- import { Range } from '../../common';
12
- /**
13
- * Represents a node in a binary tree.
14
- * @template V - The type of data stored in the node.
15
- * @template BinaryTreeNode<K, V> - The type of the family relationship in the binary tree.
16
- */
17
- export declare class BinaryTreeNode<K = any, V = any> {
18
- key: K;
19
- value?: V;
20
- parent?: BinaryTreeNode<K, V>;
21
- /**
22
- * The constructor function initializes an object with a key and an optional value in TypeScript.
23
- * @param {K} key - The `key` parameter in the constructor function is used to store the key value
24
- * for the key-value pair.
25
- * @param {V} [value] - The `value` parameter in the constructor is optional, meaning it does not
26
- * have to be provided when creating an instance of the class. If a `value` is not provided, it will
27
- * default to `undefined`.
28
- */
29
- constructor(key: K, value?: V);
30
- _left?: BinaryTreeNode<K, V> | null | undefined;
31
- get left(): BinaryTreeNode<K, V> | null | undefined;
32
- set left(v: BinaryTreeNode<K, V> | null | undefined);
33
- _right?: BinaryTreeNode<K, V> | null | undefined;
34
- get right(): BinaryTreeNode<K, V> | null | undefined;
35
- set right(v: BinaryTreeNode<K, V> | null | undefined);
36
- _height: number;
37
- get height(): number;
38
- set height(value: number);
39
- _color: RBTNColor;
40
- get color(): RBTNColor;
41
- set color(value: RBTNColor);
42
- _count: number;
43
- get count(): number;
44
- set count(value: number);
45
- get familyPosition(): FamilyPosition;
46
- }
47
- /**
48
- * 1. Two Children Maximum: Each node has at most two children.
49
- * 2. Left and Right Children: Nodes have distinct left and right children.
50
- * 3. Depth and Height: Depth is the number of edges from the root to a node; height is the maximum depth in the tree.
51
- * 4. Subtrees: Each child of a node forms the root of a subtree.
52
- * 5. Leaf Nodes: Nodes without children are leaves.
53
- * @example
54
- * // determine loan approval using a decision tree
55
- * // Decision tree structure
56
- * const loanDecisionTree = new BinaryTree<string>(
57
- * ['stableIncome', 'goodCredit', 'Rejected', 'Approved', 'Rejected'],
58
- * { isDuplicate: true }
59
- * );
60
- *
61
- * function determineLoanApproval(
62
- * node?: BinaryTreeNode<string> | null,
63
- * conditions?: { [key: string]: boolean }
64
- * ): string {
65
- * if (!node) throw new Error('Invalid node');
66
- *
67
- * // If it's a leaf node, return the decision result
68
- * if (!node.left && !node.right) return node.key;
69
- *
70
- * // Check if a valid condition exists for the current node's key
71
- * return conditions?.[node.key]
72
- * ? determineLoanApproval(node.left, conditions)
73
- * : determineLoanApproval(node.right, conditions);
74
- * }
75
- *
76
- * // Test case 1: Stable income and good credit score
77
- * console.log(determineLoanApproval(loanDecisionTree.root, { stableIncome: true, goodCredit: true })); // 'Approved'
78
- *
79
- * // Test case 2: Stable income but poor credit score
80
- * console.log(determineLoanApproval(loanDecisionTree.root, { stableIncome: true, goodCredit: false })); // 'Rejected'
81
- *
82
- * // Test case 3: No stable income
83
- * console.log(determineLoanApproval(loanDecisionTree.root, { stableIncome: false, goodCredit: true })); // 'Rejected'
84
- *
85
- * // Test case 4: No stable income and poor credit score
86
- * console.log(determineLoanApproval(loanDecisionTree.root, { stableIncome: false, goodCredit: false })); // 'Rejected'
87
- * @example
88
- * // evaluate the arithmetic expression represented by the binary tree
89
- * const expressionTree = new BinaryTree<number | string>(['+', 3, '*', null, null, 5, '-', null, null, 2, 8]);
90
- *
91
- * function evaluate(node?: BinaryTreeNode<number | string> | null): number {
92
- * if (!node) return 0;
93
- *
94
- * if (typeof node.key === 'number') return node.key;
95
- *
96
- * const leftValue = evaluate(node.left); // Evaluate the left subtree
97
- * const rightValue = evaluate(node.right); // Evaluate the right subtree
98
- *
99
- * // Perform the operation based on the current node's operator
100
- * switch (node.key) {
101
- * case '+':
102
- * return leftValue + rightValue;
103
- * case '-':
104
- * return leftValue - rightValue;
105
- * case '*':
106
- * return leftValue * rightValue;
107
- * case '/':
108
- * return rightValue !== 0 ? leftValue / rightValue : 0; // Handle division by zero
109
- * default:
110
- * throw new Error(`Unsupported operator: ${node.key}`);
111
- * }
112
- * }
113
- *
114
- * console.log(evaluate(expressionTree.root)); // -27
115
- */
116
- export declare class BinaryTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends IterableEntryBase<K, V | undefined> implements IBinaryTree<K, V, R, MK, MV, MR> {
117
- iterationType: IterationType;
118
- /**
119
- * This TypeScript constructor function initializes a binary tree with optional options and adds
120
- * elements based on the provided input.
121
- * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
122
- * iterable that can contain either objects of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`. It
123
- * is used to initialize the binary tree with keys, nodes, entries, or raw data.
124
- * @param [options] - The `options` parameter in the constructor is an optional object that can
125
- * contain the following properties:
126
- */
127
- constructor(keysNodesEntriesOrRaws?: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, options?: BinaryTreeOptions<K, V, R>);
128
- protected _isMapMode: boolean;
129
- get isMapMode(): boolean;
130
- protected _isDuplicate: boolean;
131
- get isDuplicate(): boolean;
132
- protected _store: Map<K, V | undefined>;
133
- get store(): Map<K, V | undefined>;
134
- protected _root?: BinaryTreeNode<K, V> | null | undefined;
135
- get root(): BinaryTreeNode<K, V> | null | undefined;
136
- protected _size: number;
137
- get size(): number;
138
- protected _NIL: BinaryTreeNode<K, V>;
139
- get NIL(): BinaryTreeNode<K, V>;
140
- protected _toEntryFn?: ToEntryFn<K, V, R>;
141
- get toEntryFn(): ToEntryFn<K, V, R> | undefined;
142
- /**
143
- * Time Complexity: O(1)
144
- * Space Complexity: O(1)
145
- *
146
- * The function creates a new binary tree node with a specified key and optional value.
147
- * @param {K} key - The `key` parameter is the key of the node being created in the binary tree.
148
- * @param {V} [value] - The `value` parameter in the `createNode` function is optional, meaning it is
149
- * not required to be provided when calling the function. If a `value` is provided, it should be of
150
- * type `V`, which is the type of the value associated with the node.
151
- * @returns A new BinaryTreeNode instance with the provided key and value is being returned, casted
152
- * as BinaryTreeNode<K, V>.
153
- */
154
- createNode(key: K, value?: V): BinaryTreeNode<K, V>;
155
- /**
156
- * Time Complexity: O(1)
157
- * Space Complexity: O(1)
158
- *
159
- * The function creates a binary tree with the specified options.
160
- * @param [options] - The `options` parameter in the `createTree` function is an optional parameter
161
- * that allows you to provide partial configuration options for creating a binary tree. It is of type
162
- * `Partial<BinaryTreeOptions<K, V, R>>`, which means you can pass in an object containing a subset
163
- * of properties
164
- * @returns A new instance of a binary tree with the specified options is being returned.
165
- */
166
- createTree(options?: BinaryTreeOptions<K, V, R>): BinaryTree<K, V, R, MK, MV, MR>;
167
- /**
168
- * Time Complexity: O(n)
169
- * Space Complexity: O(log n)
170
- *
171
- * The function `ensureNode` in TypeScript checks if a given input is a node, entry, key, or raw
172
- * value and returns the corresponding node or null.
173
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The `keyNodeOrEntry`
174
- * parameter in the `ensureNode` function can be of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`. It
175
- * is used to determine whether the input is a key, node, entry, or raw data. The
176
- * @param {IterationType} iterationType - The `iterationType` parameter in the `ensureNode` function
177
- * is used to specify the type of iteration to be performed. It has a default value of
178
- * `this.iterationType` if not explicitly provided.
179
- * @returns The `ensureNode` function returns either a node, `null`, or `undefined` based on the
180
- * conditions specified in the code snippet.
181
- */
182
- ensureNode(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): BinaryTreeNode<K, V> | null | undefined;
183
- /**
184
- * Time Complexity: O(1)
185
- * Space Complexity: O(1)
186
- *
187
- * The function isNode checks if the input is an instance of BinaryTreeNode.
188
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The parameter
189
- * `keyNodeOrEntry` can be either a key, a node, an entry, or raw data. The function is
190
- * checking if the input is an instance of a `BinaryTreeNode` and returning a boolean value
191
- * accordingly.
192
- * @returns The function `isNode` is checking if the input `keyNodeOrEntry` is an instance of
193
- * `BinaryTreeNode`. If it is, the function returns `true`, indicating that the input is a node. If
194
- * it is not an instance of `BinaryTreeNode`, the function returns `false`, indicating that the input
195
- * is not a node.
196
- */
197
- isNode(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is BinaryTreeNode<K, V>;
198
- /**
199
- * Time Complexity: O(1)
200
- * Space Complexity: O(1)
201
- *
202
- * The function `isRaw` checks if the input parameter is of type `R` by verifying if it is an object.
203
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R} keyNodeEntryOrRaw - K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined
204
- * @returns The function `isRaw` is checking if the `keyNodeEntryOrRaw` parameter is of type `R` by
205
- * checking if it is an object. If the parameter is an object, the function will return `true`,
206
- * indicating that it is of type `R`.
207
- */
208
- isRaw(keyNodeEntryOrRaw: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R): keyNodeEntryOrRaw is R;
209
- /**
210
- * Time Complexity: O(1)
211
- * Space Complexity: O(1)
212
- *
213
- * The function `isRealNode` checks if a given input is a valid node in a binary tree.
214
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The `keyNodeOrEntry`
215
- * parameter in the `isRealNode` function can be of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`.
216
- * The function checks if the input parameter is a `BinaryTreeNode<K, V>` type by verifying if it is not equal
217
- * @returns The function `isRealNode` is checking if the input `keyNodeOrEntry` is a valid
218
- * node by comparing it to `this._NIL`, `null`, and `undefined`. If the input is not one of these
219
- * values, it then calls the `isNode` method to further determine if the input is a node. The
220
- * function will return a boolean value indicating whether the
221
- */
222
- isRealNode(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is BinaryTreeNode<K, V>;
223
- /**
224
- * Time Complexity: O(1)
225
- * Space Complexity: O(1)
226
- *
227
- * The function checks if a given input is a valid node or null.
228
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The parameter
229
- * `keyNodeOrEntry` in the `isRealNodeOrNull` function can be of type `BTNRep<K,
230
- * V, BinaryTreeNode<K, V>>` or `R`. It is a union type that can either be a key, a node, an entry, or
231
- * @returns The function `isRealNodeOrNull` is returning a boolean value. It checks if the input
232
- * `keyNodeOrEntry` is either `null` or a real node, and returns `true` if it is a node or
233
- * `null`, and `false` otherwise.
234
- */
235
- isRealNodeOrNull(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is BinaryTreeNode<K, V> | null;
236
- /**
237
- * Time Complexity: O(1)
238
- * Space Complexity: O(1)
239
- *
240
- * The function isNIL checks if a given key, node, entry, or raw value is equal to the _NIL value.
241
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - BTNRep<K, V,
242
- * BinaryTreeNode<K, V>>
243
- * @returns The function is checking if the `keyNodeOrEntry` parameter is equal to the `_NIL`
244
- * property of the current object and returning a boolean value based on that comparison.
245
- */
246
- isNIL(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
247
- /**
248
- * Time Complexity: O(1)
249
- * Space Complexity: O(1)
250
- *
251
- * The function `isRange` checks if the input parameter is an instance of the `Range` class.
252
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>> | Range<K>} keyNodeEntryOrPredicate
253
- * - The `keyNodeEntryOrPredicate` parameter in the `isRange` function can be
254
- * of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined `, `NodePredicate<BinaryTreeNode<K, V>>`, or
255
- * `Range<K>`. The function checks if the `keyNodeEntry
256
- * @returns The `isRange` function is checking if the `keyNodeEntryOrPredicate` parameter is an
257
- * instance of the `Range` class. If it is an instance of `Range`, the function will return `true`,
258
- * indicating that the parameter is a `Range<K>`. If it is not an instance of `Range`, the function
259
- * will return `false`.
260
- */
261
- isRange(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>> | Range<K>): keyNodeEntryOrPredicate is Range<K>;
262
- /**
263
- * Time Complexity: O(1)
264
- * Space Complexity: O(1)
265
- *
266
- * The function determines whether a given key, node, entry, or raw data is a leaf node in a binary
267
- * tree.
268
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The parameter
269
- * `keyNodeOrEntry` can be of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`. It represents a
270
- * key, node, entry, or raw data in a binary tree structure. The function `isLeaf` checks whether the
271
- * provided
272
- * @returns The function `isLeaf` returns a boolean value indicating whether the input
273
- * `keyNodeOrEntry` is a leaf node in a binary tree.
274
- */
275
- isLeaf(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
276
- /**
277
- * Time Complexity: O(1)
278
- * Space Complexity: O(1)
279
- *
280
- * The function `isEntry` checks if the input is a BTNEntry object by verifying if it is an array
281
- * with a length of 2.
282
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The `keyNodeOrEntry`
283
- * parameter in the `isEntry` function can be of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or type `R`.
284
- * The function checks if the provided `keyNodeOrEntry` is of type `BTN
285
- * @returns The `isEntry` function is checking if the `keyNodeOrEntry` parameter is an array
286
- * with a length of 2. If it is, then it returns `true`, indicating that the parameter is of type
287
- * `BTNEntry<K, V>`. If the condition is not met, it returns `false`.
288
- */
289
- isEntry(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is BTNEntry<K, V>;
290
- /**
291
- * Time Complexity O(1)
292
- * Space Complexity O(1)
293
- *
294
- * The function `isValidKey` checks if a given key is comparable.
295
- * @param {any} key - The `key` parameter is of type `any`, which means it can be any data type in
296
- * TypeScript.
297
- * @returns The function `isValidKey` is checking if the `key` parameter is `null` or if it is comparable.
298
- * If the `key` is `null`, the function returns `true`. Otherwise, it returns the result of the
299
- * `isComparable` function, which is not provided in the code snippet.
300
- */
301
- isValidKey(key: any): key is K;
302
- /**
303
- * Time Complexity O(n)
304
- * Space Complexity O(1)
305
- *
306
- * The `add` function in TypeScript adds a new node to a binary tree while handling duplicate keys
307
- * and finding the correct insertion position.
308
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The `add` method you provided
309
- * seems to be for adding a new node to a binary tree structure. The `keyNodeOrEntry`
310
- * parameter in the method can accept different types of values:
311
- * @param {V} [value] - The `value` parameter in the `add` method represents the value associated
312
- * with the key that you want to add to the binary tree. When adding a key-value pair to the binary
313
- * tree, you provide the key and its corresponding value. The `add` method then creates a new node
314
- * with this
315
- * @returns The `add` method returns a boolean value. It returns `true` if the insertion of the new
316
- * node was successful, and `false` if the insertion position could not be found or if a duplicate
317
- * key was found and the node was replaced instead of inserted.
318
- */
319
- add(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): boolean;
320
- /**
321
- * Time Complexity: O(k * n)
322
- * Space Complexity: O(k)
323
- *
324
- * The `addMany` function takes in multiple keys or nodes or entries or raw values along with
325
- * optional values, and adds them to a data structure while returning an array indicating whether
326
- * each insertion was successful.
327
- * @param keysNodesEntriesOrRaws - `keysNodesEntriesOrRaws` is an iterable that can contain a
328
- * mix of keys, nodes, entries, or raw values. Each element in this iterable can be of type
329
- * `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`.
330
- * @param [values] - The `values` parameter in the `addMany` function is an optional parameter that
331
- * accepts an iterable of values. These values correspond to the keys or nodes being added in the
332
- * `keysNodesEntriesOrRaws` parameter. If provided, the function will iterate over the values and
333
- * assign them
334
- * @returns The `addMany` method returns an array of boolean values indicating whether each key,
335
- * node, entry, or raw value was successfully added to the data structure. Each boolean value
336
- * corresponds to the success of adding the corresponding key or value in the input iterable.
337
- */
338
- addMany(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): boolean[];
339
- /**
340
- * Time Complexity: O(k * n)
341
- * Space Complexity: O(1)
342
- *
343
- * The `merge` function in TypeScript merges another binary tree into the current tree by adding all
344
- * elements from the other tree.
345
- * @param anotherTree - BinaryTree<K, V, R, MK, MV, MR>
346
- */
347
- merge(anotherTree: BinaryTree<K, V, R, MK, MV, MR>): void;
348
- /**
349
- * Time Complexity: O(k * n)
350
- * Space Complexity: O(1)
351
- *
352
- * The `refill` function clears the existing data structure and then adds new key-value pairs based
353
- * on the provided input.
354
- * @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the `refill`
355
- * method can accept an iterable containing a mix of `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` objects or `R`
356
- * objects.
357
- * @param [values] - The `values` parameter in the `refill` method is an optional parameter that
358
- * accepts an iterable of values of type `V` or `undefined`.
359
- */
360
- refill(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): void;
361
- /**
362
- * Time Complexity: O(n)
363
- * Space Complexity: O(1)
364
- *
365
- * The function `delete` in TypeScript implements the deletion of a node in a binary tree and returns
366
- * the deleted node along with information for tree balancing.
367
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry
368
- * - The `delete` method you provided is used to delete a node from a binary tree based on the key,
369
- * node, entry or raw data. The method returns an array of
370
- * `BinaryTreeDeleteResult` objects containing information about the deleted node and whether
371
- * balancing is needed.
372
- * @returns The `delete` method returns an array of `BinaryTreeDeleteResult` objects. Each object in
373
- * the array contains information about the node that was deleted (`deleted`) and the node that may
374
- * need to be balanced (`needBalanced`).
375
- */
376
- delete(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
377
- /**
378
- * Time Complexity: O(n)
379
- * Space Complexity: O(k + log n)
380
- *
381
- * The `search` function in TypeScript performs a depth-first or breadth-first search on a tree
382
- * structure based on a given predicate or key, with options to return multiple results or just one.
383
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>} keyNodeEntryOrPredicate - The
384
- * `keyNodeEntryOrPredicate` parameter in the `search` function can accept three types of values:
385
- * @param [onlyOne=false] - The `onlyOne` parameter in the `search` function is a boolean flag that
386
- * determines whether the search should stop after finding the first matching node. If `onlyOne` is
387
- * set to `true`, the search will return as soon as a matching node is found. If `onlyOne` is
388
- * @param {C} callback - The `callback` parameter in the `search` function is a callback function
389
- * that will be called on each node that matches the search criteria. It is of type `C`, which
390
- * extends `NodeCallback<BinaryTreeNode<K, V> | null>`. The default value for `callback` is `this._DEFAULT_NODE_CALLBACK` if
391
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the `search` function is
392
- * used to specify the node from which the search operation should begin. It represents the starting
393
- * point in the binary tree where the search will be performed. If no specific `startNode` is
394
- * provided, the search operation will start from the root
395
- * @param {IterationType} iterationType - The `iterationType` parameter in the `search` function
396
- * specifies the type of iteration to be used when searching for nodes in a binary tree. It can have
397
- * two possible values:
398
- * @returns The `search` function returns an array of values that match the provided criteria based
399
- * on the search algorithm implemented within the function.
400
- */
401
- search<C extends NodeCallback<BinaryTreeNode<K, V> | null>>(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V> | null>, onlyOne?: boolean, callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): ReturnType<C>[];
402
- getNodes(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>, onlyOne?: boolean, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): BinaryTreeNode<K, V>[];
403
- /**
404
- * Time Complexity: O(n)
405
- * Space Complexity: O(log n)
406
- *
407
- * The `getNode` function retrieves a node based on the provided key, node, entry, raw data, or
408
- * predicate.
409
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>} keyNodeEntryOrPredicate
410
- * - The `keyNodeEntryOrPredicate` parameter in the `getNode` function can accept a key,
411
- * node, entry, raw data, or a predicate function.
412
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
413
- * `getNode` function is used to specify the starting point for searching for a node in a binary
414
- * tree. If no specific starting point is provided, the default value is set to `this._root`, which
415
- * is typically the root node of the binary tree.
416
- * @param {IterationType} iterationType - The `iterationType` parameter in the `getNode` method is
417
- * used to specify the type of iteration to be performed when searching for a node. It has a default
418
- * value of `this.iterationType`, which means it will use the iteration type defined in the current
419
- * context if no specific value is provided
420
- * @returns The `getNode` function is returning the first node that matches the specified criteria,
421
- * or `null` if no matching node is found.
422
- */
423
- getNode(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V> | null>, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): BinaryTreeNode<K, V> | null | undefined;
424
- /**
425
- * Time Complexity: O(n)
426
- * Space Complexity: O(log n)
427
- *
428
- * This function overrides the `get` method to retrieve the value associated with a specified key,
429
- * node, entry, raw data, or predicate in a data structure.
430
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>} keyNodeEntryOrPredicate
431
- * - The `keyNodeEntryOrPredicate` parameter in the `get` method can accept one of the
432
- * following types:
433
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the `get`
434
- * method is used to specify the starting point for searching for a key or node in the binary tree.
435
- * If no specific starting point is provided, the default starting point is the root of the binary
436
- * tree (`this._root`).
437
- * @param {IterationType} iterationType - The `iterationType` parameter in the `get` method is used
438
- * to specify the type of iteration to be performed when searching for a key in the binary tree. It
439
- * is an optional parameter with a default value of `this.iterationType`, which means it will use the
440
- * iteration type defined in the
441
- * @returns The `get` method is returning the value associated with the specified key, node, entry,
442
- * raw data, or predicate in the binary tree map. If the specified key or node is found in the tree,
443
- * the method returns the corresponding value. If the key or node is not found, it returns
444
- * `undefined`.
445
- */
446
- get(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): V | undefined;
447
- has(keyNodeEntryOrPredicate?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): boolean;
448
- /**
449
- * Time Complexity: O(1)
450
- * Space Complexity: O(1)
451
- *
452
- * The clear function removes nodes and values in map mode.
453
- */
454
- clear(): void;
455
- /**
456
- * Time Complexity: O(1)
457
- * Space Complexity: O(1)
458
- *
459
- * The `isEmpty` function in TypeScript checks if a data structure has no elements and returns a
460
- * boolean value.
461
- * @returns The `isEmpty()` method is returning a boolean value, specifically `true` if the `_size`
462
- * property is equal to 0, indicating that the data structure is empty, and `false` otherwise.
463
- */
464
- isEmpty(): boolean;
465
- /**
466
- * Time Complexity: O(n)
467
- * Space Complexity: O(log n)
468
- *
469
- * The function checks if a binary tree is perfectly balanced by comparing its minimum height with
470
- * its height.
471
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter is the starting
472
- * point for checking if the binary tree is perfectly balanced. It represents the root node of the
473
- * binary tree or a specific node from which the balance check should begin.
474
- * @returns The method `isPerfectlyBalanced` is returning a boolean value, which indicates whether
475
- * the tree starting from the `startNode` node is perfectly balanced or not. The return value is
476
- * determined by comparing the minimum height of the tree with the height of the tree. If the minimum
477
- * height plus 1 is greater than or equal to the height of the tree, then it is considered perfectly
478
- * balanced and
479
- */
480
- isPerfectlyBalanced(startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): boolean;
481
- /**
482
- * Time Complexity: O(n)
483
- * Space Complexity: O(log n)
484
- *
485
- * The function `isBST` in TypeScript checks if a binary search tree is valid using either recursive
486
- * or iterative methods.
487
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the `isBST`
488
- * function represents the starting point for checking whether a binary search tree (BST) is valid.
489
- * It can be a node in the BST or a reference to the root of the BST. If no specific node is
490
- * provided, the function will default to
491
- * @param {IterationType} iterationType - The `iterationType` parameter in the `isBST` function
492
- * determines whether the function should use a recursive approach or an iterative approach to check
493
- * if the binary search tree (BST) is valid.
494
- * @returns The `isBST` method is returning a boolean value, which indicates whether the binary
495
- * search tree (BST) represented by the given root node is a valid BST or not. The method checks if
496
- * the tree satisfies the BST property, where for every node, all nodes in its left subtree have keys
497
- * less than the node's key, and all nodes in its right subtree have keys greater than the node's
498
- */
499
- isBST(startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): boolean;
500
- /**
501
- * Time Complexity: O(n)
502
- * Space Complexity: O(log n)
503
- *
504
- * The `getDepth` function calculates the depth between two nodes in a binary tree.
505
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } dist - The `dist` parameter in the `getDepth`
506
- * function represents the node or entry in a binary tree map, or a reference to a node in the tree.
507
- * It is the target node for which you want to calculate the depth from the `startNode` node.
508
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
509
- * `getDepth` function represents the starting point from which you want to calculate the depth of a
510
- * given node or entry in a binary tree. If no specific starting point is provided, the default value
511
- * for `startNode` is set to the root of the binary
512
- * @returns The `getDepth` method returns the depth of a given node `dist` relative to the
513
- * `startNode` node in a binary tree. If the `dist` node is not found in the path to the `startNode`
514
- * node, it returns the depth of the `dist` node from the root of the tree.
515
- */
516
- getDepth(dist: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): number;
517
- /**
518
- * Time Complexity: O(n)
519
- * Space Complexity: O(log n)
520
- *
521
- * The `getHeight` function calculates the maximum height of a binary tree using either a recursive
522
- * or iterative approach in TypeScript.
523
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter is the starting
524
- * point from which the height of the binary tree will be calculated. It can be a node in the binary
525
- * tree or a reference to the root of the tree. If not provided, it defaults to the root of the
526
- * binary tree data structure.
527
- * @param {IterationType} iterationType - The `iterationType` parameter is used to determine the type
528
- * of iteration to be performed while calculating the height of the binary tree. It can have two
529
- * possible values:
530
- * @returns The `getHeight` method returns the height of the binary tree starting from the specified
531
- * root node. The height is calculated based on the maximum depth of the tree, considering either a
532
- * recursive approach or an iterative approach depending on the `iterationType` parameter.
533
- */
534
- getHeight(startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): number;
535
- /**
536
- * Time Complexity: O(n)
537
- * Space Complexity: O(log n)
538
- *
539
- * The `getMinHeight` function calculates the minimum height of a binary tree using either a
540
- * recursive or iterative approach in TypeScript.
541
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
542
- * `getMinHeight` function represents the starting node from which the minimum height of the binary
543
- * tree will be calculated. It is either a node in the binary tree or a reference to the root of the
544
- * tree. If not provided, the default value is the root
545
- * @param {IterationType} iterationType - The `iterationType` parameter in the `getMinHeight` method
546
- * specifies the type of iteration to use when calculating the minimum height of a binary tree. It
547
- * can have two possible values:
548
- * @returns The `getMinHeight` method returns the minimum height of the binary tree starting from the
549
- * specified root node. The height is calculated based on the shortest path from the root node to a
550
- * leaf node in the tree. The method uses either a recursive approach or an iterative approach (using
551
- * a stack) based on the `iterationType` parameter.
552
- */
553
- getMinHeight(startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): number;
554
- /**
555
- * Time Complexity: O(log n)
556
- * Space Complexity: O(log n)
557
- *
558
- * The function `getPathToRoot` in TypeScript retrieves the path from a given node to the root of a
559
- * tree structure, applying a specified callback function along the way.
560
- * @param {C} callback - The `callback` parameter is a function that is used to process each node in
561
- * the path to the root. It is expected to be a function that takes a node as an argument and returns
562
- * a value based on that node. The return type of the callback function is determined by the generic
563
- * type `C
564
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } beginNode - The `beginNode` parameter in the
565
- * `getPathToRoot` function can be either a key, a node, an entry, or any other value of type `R`.
566
- * @param [isReverse=true] - The `isReverse` parameter in the `getPathToRoot` function determines
567
- * whether the resulting path from the given `beginNode` to the root should be in reverse order or
568
- * not. If `isReverse` is set to `true`, the path will be reversed before being returned. If `is
569
- * @returns The function `getPathToRoot` returns an array of the return values of the callback
570
- * function `callback` applied to each node in the path from the `beginNode` to the root node. The
571
- * array is either in reverse order or in the original order based on the value of the `isReverse`
572
- * parameter.
573
- */
574
- getPathToRoot<C extends NodeCallback<OptNodeOrNull<BinaryTreeNode<K, V>>>>(beginNode: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, callback?: C, isReverse?: boolean): ReturnType<C>[];
575
- /**
576
- * Time Complexity: O(log n)
577
- * Space Complexity: O(log n)
578
- *
579
- * The function `getLeftMost` retrieves the leftmost node in a binary tree using either recursive or
580
- * tail-recursive iteration.
581
- * @param {C} callback - The `callback` parameter is a function that will be called with the leftmost
582
- * node of a binary tree or with `undefined` if the tree is empty. It is provided with a default
583
- * value of `_DEFAULT_NODE_CALLBACK` if not specified.
584
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
585
- * `getLeftMost` function represents the starting point for finding the leftmost node in a binary
586
- * tree. It can be either a key, a node, or an entry in the binary tree structure. If no specific
587
- * starting point is provided, the function will default
588
- * @param {IterationType} iterationType - The `iterationType` parameter in the `getLeftMost` function
589
- * specifies the type of iteration to be used when traversing the binary tree nodes. It can have two
590
- * possible values:
591
- * @returns The `getLeftMost` function returns the result of the callback function `C` applied to the
592
- * leftmost node in the binary tree starting from the `startNode` node. If the `startNode` node is
593
- * `NIL`, it returns the result of the callback function applied to `undefined`. If the `startNode`
594
- * node is not a real node, it returns the result of the callback
595
- */
596
- getLeftMost<C extends NodeCallback<OptNodeOrNull<BinaryTreeNode<K, V>>>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): ReturnType<C>;
597
- /**
598
- * Time Complexity: O(log n)
599
- * Space Complexity: O(log n)
600
- *
601
- * The function `getRightMost` retrieves the rightmost node in a binary tree using either recursive
602
- * or iterative traversal methods.
603
- * @param {C} callback - The `callback` parameter is a function that will be called with the result
604
- * of finding the rightmost node in a binary tree. It is of type `NodeCallback<OptNodeOrNull<BinaryTreeNode<K, V>>>`,
605
- * which means it is a callback function that can accept either an optional binary tree node or null
606
- * as
607
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
608
- * `getRightMost` function represents the starting point for finding the rightmost node in a binary
609
- * tree. It can be either a key, a node, or an entry in the binary tree structure. If no specific
610
- * starting point is provided, the function will default
611
- * @param {IterationType} iterationType - The `iterationType` parameter in the `getRightMost`
612
- * function specifies the type of iteration to be used when traversing the binary tree nodes. It can
613
- * have two possible values:
614
- * @returns The `getRightMost` function returns the result of the callback function `C`, which is
615
- * passed as a parameter to the function. The callback function is called with the rightmost node in
616
- * the binary tree structure, determined based on the specified iteration type ('RECURSIVE' or
617
- * other).
618
- */
619
- getRightMost<C extends NodeCallback<OptNodeOrNull<BinaryTreeNode<K, V>>>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): ReturnType<C>;
620
- /**
621
- * Time Complexity: O(log n)
622
- * Space Complexity: O(log n)
623
- *
624
- * The function `getPredecessor` in TypeScript returns the predecessor node of a given node in a
625
- * binary tree.
626
- * @param {BinaryTreeNode<K, V>} node - The `getPredecessor` function you provided seems to be attempting to find the
627
- * predecessor of a given node in a binary tree. However, there seems to be a logical issue in the
628
- * while loop condition that might cause an infinite loop.
629
- * @returns The `getPredecessor` function returns the predecessor node of the input `BinaryTreeNode<K, V>` parameter.
630
- * If the left child of the input node exists, it traverses to the rightmost node of the left subtree
631
- * to find the predecessor. If the left child does not exist, it returns the input node itself.
632
- */
633
- getPredecessor(node: BinaryTreeNode<K, V>): BinaryTreeNode<K, V>;
634
- /**
635
- * Time Complexity: O(log n)
636
- * Space Complexity: O(log n)
637
- *
638
- * The function `getSuccessor` in TypeScript returns the next node in an in-order traversal of a
639
- * binary tree.
640
- * @param {K | BinaryTreeNode<K, V> | null} [x] - The `getSuccessor` function takes a parameter `x`, which can be of
641
- * type `K`, `BinaryTreeNode<K, V>`, or `null`.
642
- * @returns The `getSuccessor` function returns the successor node of the input node `x`. If `x` has
643
- * a right child, the function returns the leftmost node in the right subtree of `x`. If `x` does not
644
- * have a right child, the function traverses up the parent nodes until it finds a node that is not
645
- * the right child of its parent, and returns that node
646
- */
647
- getSuccessor(x?: K | BinaryTreeNode<K, V> | null): BinaryTreeNode<K, V> | null | undefined;
648
- dfs<C extends NodeCallback<BinaryTreeNode<K, V>>>(callback?: C, pattern?: DFSOrderPattern, onlyOne?: boolean, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): ReturnType<C>[];
649
- dfs<C extends NodeCallback<BinaryTreeNode<K, V> | null>>(callback?: C, pattern?: DFSOrderPattern, onlyOne?: boolean, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType, includeNull?: boolean): ReturnType<C>[];
650
- bfs<C extends NodeCallback<BinaryTreeNode<K, V>>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType, includeNull?: false): ReturnType<C>[];
651
- bfs<C extends NodeCallback<BinaryTreeNode<K, V> | null>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType, includeNull?: true): ReturnType<C>[];
652
- /**
653
- * Time complexity: O(n)
654
- * Space complexity: O(n)
655
- *
656
- * The `leaves` function in TypeScript returns an array of values from leaf nodes in a binary tree
657
- * structure based on a specified callback and iteration type.
658
- * @param {C} callback - The `callback` parameter is a function that will be called on each leaf node
659
- * in the binary tree. It is optional and defaults to a default callback function if not provided.
660
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the `leaves`
661
- * method is used to specify the starting point for finding and processing the leaves of a binary
662
- * tree. It can be provided as either a key, a node, or an entry in the binary tree structure. If not
663
- * explicitly provided, the default value
664
- * @param {IterationType} iterationType - The `iterationType` parameter in the `leaves` method
665
- * specifies the type of iteration to be performed when collecting the leaves of a binary tree. It
666
- * can have two possible values:
667
- * @returns The `leaves` method returns an array of values that are the result of applying the
668
- * provided callback function to each leaf node in the binary tree.
669
- */
670
- leaves<C extends NodeCallback<BinaryTreeNode<K, V> | null>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType): ReturnType<C>[];
671
- listLevels<C extends NodeCallback<BinaryTreeNode<K, V>>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType, includeNull?: false): ReturnType<C>[][];
672
- listLevels<C extends NodeCallback<BinaryTreeNode<K, V> | null>>(callback?: C, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType, includeNull?: true): ReturnType<C>[][];
673
- morris<C extends NodeCallback<BinaryTreeNode<K, V>>>(callback?: C, pattern?: DFSOrderPattern, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): ReturnType<C>[];
674
- /**
675
- * Time complexity: O(n)
676
- * Space complexity: O(n)
677
- *
678
- * The `clone` function creates a deep copy of a tree structure by traversing it using breadth-first
679
- * search.
680
- * @returns The `clone()` method is returning a cloned copy of the tree with the same structure and
681
- * values as the original tree. The method creates a new tree, iterates over the nodes of the
682
- * original tree using breadth-first search (bfs), and adds the nodes to the new tree. If a node in
683
- * the original tree is null, a null node is added to the cloned tree. If a node
684
- */
685
- clone(): BinaryTree<K, V, R, MK, MV, MR>;
686
- /**
687
- * Time Complexity: O(n)
688
- * Space Complexity: O(n)
689
- *
690
- * The `filter` function iterates over key-value pairs in a tree data structure and creates a new
691
- * tree with elements that satisfy a given predicate.
692
- * @param predicate - The `predicate` parameter in the `filter` method is a function that will be
693
- * called with four arguments: the `value` of the current entry, the `key` of the current entry, the
694
- * `index` of the current entry in the iteration, and the reference to the tree itself (`
695
- * @param {any} [thisArg] - The `thisArg` parameter in the `filter` method allows you to specify the
696
- * value of `this` that should be used when executing the `predicate` function. This is useful when
697
- * the `predicate` function relies on the context of a specific object or value. By providing a
698
- * `thisArg
699
- * @returns The `filter` method is returning a new tree that contains entries that pass the provided
700
- * predicate function.
701
- */
702
- filter(predicate: EntryCallback<K, V | undefined, boolean>, thisArg?: any): BinaryTree<K, V, R, MK, MV, MR>;
703
- /**
704
- * Time Complexity: O(n)
705
- * Space Complexity: O(n)
706
- *
707
- * The `map` function in TypeScript creates a new BinaryTree by applying a callback function to each
708
- * entry in the original BinaryTree.
709
- * @param callback - A function that will be called for each entry in the current binary tree. It
710
- * takes the key, value (which can be undefined), and an array containing the mapped key and value as
711
- * arguments.
712
- * @param [options] - The `options` parameter in the `map` method is of type `BinaryTreeOptions<MK,
713
- * MV, MR>`. It is an optional parameter that allows you to specify additional options for the binary
714
- * tree being created during the mapping process. These options could include things like custom
715
- * comparators, initial
716
- * @param {any} [thisArg] - The `thisArg` parameter in the `map` method is used to specify the value
717
- * of `this` when executing the `callback` function. It allows you to set the context (value of
718
- * `this`) within the callback function. If `thisArg` is provided, it will be passed
719
- * @returns The `map` function is returning a new `BinaryTree` instance filled with entries that are
720
- * the result of applying the provided `callback` function to each entry in the original tree.
721
- */
722
- map(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: BinaryTreeOptions<MK, MV, MR>, thisArg?: any): BinaryTree<MK, MV, MR>;
723
- /**
724
- * Time Complexity: O(n)
725
- * Space Complexity: O(n)
726
- *
727
- * The function `toVisual` in TypeScript overrides the visual representation of a binary tree with
728
- * customizable options for displaying undefined, null, and sentinel nodes.
729
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
730
- * `toVisual` method is used to specify the starting point for visualizing the binary tree structure.
731
- * It can be a node, key, entry, or the root of the tree. If no specific starting point is provided,
732
- * the default is set to the root
733
- * @param {BinaryTreePrintOptions} [options] - The `options` parameter in the `toVisual` method is an
734
- * object that contains the following properties:
735
- * @returns The `override toVisual` method returns a string that represents the visual display of the
736
- * binary tree based on the provided options for showing undefined, null, and Red-Black NIL nodes.
737
- * The method constructs the visual representation by calling the `_displayAux` method and appending
738
- * the lines to the output string. The final output string contains the visual representation of the
739
- * binary tree with the specified options.
740
- */
741
- toVisual(startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, options?: BinaryTreePrintOptions): string;
742
- /**
743
- * Time Complexity: O(n)
744
- * Space Complexity: O(n)
745
- *
746
- * The function `print` in TypeScript overrides the default print behavior to log a visual
747
- * representation of the binary tree to the console.
748
- * @param {BinaryTreePrintOptions} [options] - The `options` parameter is used to specify the
749
- * printing options for the binary tree. It is an optional parameter that allows you to customize how
750
- * the binary tree is printed, such as choosing between different traversal orders or formatting
751
- * options.
752
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } startNode - The `startNode` parameter in the
753
- * `override print` method is used to specify the starting point for printing the binary tree. It can
754
- * be either a key, a node, an entry, or the root of the tree. If no specific starting point is
755
- * provided, the default value is set to
756
- */
757
- print(options?: BinaryTreePrintOptions, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): void;
758
- protected _clone(cloned: BinaryTree<K, V, R, MK, MV, MR>): void;
759
- /**
760
- * Time Complexity: O(1)
761
- * Space Complexity: O(1)
762
- *
763
- * The function `keyValueNodeEntryRawToNodeAndValue` converts various input types into a node object
764
- * or returns null.
765
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The
766
- * `keyValueNodeEntryRawToNodeAndValue` function takes in a parameter `keyNodeOrEntry`, which
767
- * can be of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`. This parameter represents either a key, a
768
- * node, an entry
769
- * @param {V} [value] - The `value` parameter in the `keyValueNodeEntryRawToNodeAndValue` function is
770
- * an optional parameter of type `V`. It represents the value associated with the key in the node
771
- * being created. If a `value` is provided, it will be used when creating the node. If
772
- * @returns The `keyValueNodeEntryRawToNodeAndValue` function returns an optional node
773
- * (`BinaryTreeNode<K, V> | null | undefined`) based on the input parameters provided. The function checks the type of the
774
- * input parameter (`keyNodeOrEntry`) and processes it accordingly to return a node or null
775
- * value.
776
- */
777
- protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V): [BinaryTreeNode<K, V> | null | undefined, V | undefined];
778
- protected _dfs<C extends NodeCallback<BinaryTreeNode<K, V>>>(callback: C, pattern?: DFSOrderPattern, onlyOne?: boolean, startNode?: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, iterationType?: IterationType, includeNull?: boolean, shouldVisitLeft?: (node: BinaryTreeNode<K, V> | null | undefined) => boolean, shouldVisitRight?: (node: BinaryTreeNode<K, V> | null | undefined) => boolean, shouldVisitRoot?: (node: BinaryTreeNode<K, V> | null | undefined) => boolean, shouldProcessRoot?: (node: BinaryTreeNode<K, V> | null | undefined) => boolean): ReturnType<C>[];
779
- /**
780
- * Time Complexity: O(1)
781
- * Space Complexity: O(1)
782
- *
783
- * The function `_getIterator` returns an iterable iterator for a binary tree data structure, either
784
- * using an iterative approach or a recursive approach based on the specified iteration type.
785
- * @param node - The `node` parameter in the `_getIterator` method represents the current node being
786
- * processed during iteration. It is initially set to the root node of the data structure (or the
787
- * node passed as an argument), and then it is traversed through the data structure based on the
788
- * iteration type specified (`ITER
789
- * @returns The `_getIterator` method returns an IterableIterator containing key-value pairs of nodes
790
- * in a binary tree structure. The method uses an iterative approach to traverse the tree based on
791
- * the `iterationType` property. If the `iterationType` is set to 'ITERATIVE', the method uses a
792
- * stack to perform an in-order traversal of the tree. If the `iterationType` is not 'ITERATIVE
793
- */
794
- protected _getIterator(node?: BinaryTreeNode<K, V> | null | undefined): IterableIterator<[K, V | undefined]>;
795
- /**
796
- * Time Complexity: O(n)
797
- * Space Complexity: O(n)
798
- *
799
- * The function `_displayAux` in TypeScript is responsible for generating the display layout of nodes
800
- * in a binary tree based on specified options.
801
- * @param node - The `node` parameter in the `_displayAux` function represents a node in a binary
802
- * tree. It can be either a valid node containing a key or a special type of node like null,
803
- * undefined, or a Red-Black tree NIL node. The function checks the type of the node and its
804
- * @param {BinaryTreePrintOptions} options - The `options` parameter in the `_displayAux` function
805
- * contains the following properties:
806
- * @returns The `_displayAux` function returns a `NodeDisplayLayout`, which is an array containing
807
- * information about how to display a node in a binary tree. The `NodeDisplayLayout` consists of four
808
- * elements:
809
- */
810
- protected _displayAux(node: BinaryTreeNode<K, V> | null | undefined, options: BinaryTreePrintOptions): NodeDisplayLayout;
811
- protected _DEFAULT_NODE_CALLBACK: (node: BinaryTreeNode<K, V> | null | undefined) => K | undefined;
812
- /**
813
- * Time Complexity: O(1)
814
- * Space Complexity: O(1)
815
- *
816
- * The _swapProperties function swaps key and value properties between two nodes in a binary tree.
817
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } srcNode - The `srcNode` parameter in the
818
- * `_swapProperties` method can be either a BTNRep object containing key and value
819
- * properties, or it can be of type R.
820
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } destNode - The `destNode` parameter in the
821
- * `_swapProperties` method represents the node or entry where the properties will be swapped with
822
- * the `srcNode`. It can be of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined ` or `R`. The method ensures that
823
- * both `srcNode
824
- * @returns The `_swapProperties` method returns either the `destNode` with its key and value swapped
825
- * with the `srcNode`, or `undefined` if either `srcNode` or `destNode` is falsy.
826
- */
827
- protected _swapProperties(srcNode: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, destNode: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): BinaryTreeNode<K, V> | undefined;
828
- /**
829
- * Time Complexity: O(1)
830
- * Space Complexity: O(1)
831
- *
832
- * The _replaceNode function replaces an old node with a new node in a binary tree structure.
833
- * @param {BinaryTreeNode<K, V>} oldNode - The `oldNode` parameter represents the node that you want to replace in a
834
- * tree data structure.
835
- * @param {BinaryTreeNode<K, V>} newNode - The `newNode` parameter in the `_replaceNode` function represents the node
836
- * that will replace the `oldNode` in a tree data structure. This function is responsible for
837
- * updating the parent, left child, right child, and root (if necessary) references when replacing a
838
- * node in the tree.
839
- * @returns The method `_replaceNode` is returning the `newNode` that was passed as a parameter after
840
- * replacing the `oldNode` with it in the binary tree structure.
841
- */
842
- protected _replaceNode(oldNode: BinaryTreeNode<K, V>, newNode: BinaryTreeNode<K, V>): BinaryTreeNode<K, V>;
843
- /**
844
- * Time Complexity: O(1)
845
- * Space Complexity: O(1)
846
- *
847
- * The function _setRoot sets the root node of a data structure while updating the parent reference
848
- * of the previous root node.
849
- * @param v - The parameter `v` in the `_setRoot` method is of type `BinaryTreeNode<K, V> | null | undefined`, which means
850
- * it can either be an optional `BinaryTreeNode<K, V>` type or `null`.
851
- */
852
- protected _setRoot(v: BinaryTreeNode<K, V> | null | undefined): void;
853
- protected _ensurePredicate(keyNodeEntryOrPredicate: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | NodePredicate<BinaryTreeNode<K, V>>): NodePredicate<BinaryTreeNode<K, V>>;
854
- /**
855
- * Time Complexity: O(1)
856
- * Space Complexity: O(1)
857
- *
858
- * The function `_isPredicate` checks if a given parameter is a function.
859
- * @param {any} p - The parameter `p` is a variable of type `any`, which means it can hold any type
860
- * of value. In this context, the function `_isPredicate` is checking if `p` is a function that
861
- * satisfies the type `NodePredicate<BinaryTreeNode<K, V>>`.
862
- * @returns The function is checking if the input `p` is a function and returning a boolean value
863
- * based on that check. If `p` is a function, it will return `true`, indicating that `p` is a
864
- * predicate function for a binary tree node. If `p` is not a function, it will return `false`.
865
- */
866
- protected _isPredicate(p: any): p is NodePredicate<BinaryTreeNode<K, V>>;
867
- /**
868
- * Time Complexity: O(1)
869
- * Space Complexity: O(1)
870
- *
871
- * The function `_extractKey` in TypeScript returns the key from a given input, which can be a node,
872
- * entry, raw data, or null/undefined.
873
- * @param {K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined } keyNodeOrEntry - The `_extractKey` method you provided is a
874
- * TypeScript method that takes in a parameter `keyNodeOrEntry` of type `K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined `,
875
- * where `BTNRep` is a generic type with keys `K`, `V`, and `BinaryTreeNode<K, V>`, and `
876
- * @returns The `_extractKey` method returns the key value extracted from the `keyNodeOrEntry`
877
- * parameter. The return value can be a key value of type `K`, `null`, or `undefined`, depending on
878
- * the conditions checked in the method.
879
- */
880
- protected _extractKey(keyNodeOrEntry: K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): K | null | undefined;
881
- /**
882
- * Time Complexity: O(1)
883
- * Space Complexity: O(1)
884
- *
885
- * The function `_setValue` sets a value in a store based on a key, handling cases where the key or
886
- * value is null or undefined.
887
- * @param {K | null | undefined} key - The `key` parameter can be of type `K`, `null`, or
888
- * `undefined`.
889
- * @param {V | undefined} value - The `value` parameter in the `_setValue` method can be of type `V`
890
- * or `undefined`.
891
- * @returns The method `_setValue` returns `false` if either the `key` is `null` or `undefined`, or
892
- * if the `value` is `undefined`. Otherwise, it returns the result of calling the `set` method on the
893
- * `_store` object with the `key` and `value` arguments.
894
- */
895
- protected _setValue(key: K | null | undefined, value: V | undefined): false | Map<K, V | undefined>;
896
- /**
897
- * Time Complexity: O(1)
898
- * Space Complexity: O(1)
899
- *
900
- * The _clearNodes function sets the root node to undefined and resets the size to 0.
901
- */
902
- protected _clearNodes(): void;
903
- /**
904
- * Time Complexity: O(1)
905
- * Space Complexity: O(1)
906
- *
907
- * The _clearValues function clears all values stored in the _store object.
908
- */
909
- protected _clearValues(): void;
910
- }