data-structure-typed 2.1.0 → 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 (704) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/COMMANDS.md +13 -3
  3. package/README.md +5 -34
  4. package/benchmark/report.html +1 -1
  5. package/benchmark/report.json +101 -101
  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/{cjs → types}/data-structures/binary-tree/avl-tree-counter.d.ts +4 -4
  15. package/dist/{esm → types}/data-structures/binary-tree/avl-tree-multi-map.d.ts +5 -5
  16. package/dist/{esm → types}/data-structures/binary-tree/avl-tree.d.ts +4 -4
  17. package/dist/{esm → types}/data-structures/binary-tree/binary-tree.d.ts +5 -5
  18. package/dist/{esm → types}/data-structures/binary-tree/bst.d.ts +5 -5
  19. package/dist/{esm → types}/data-structures/binary-tree/red-black-tree.d.ts +5 -5
  20. package/dist/{cjs → types}/data-structures/binary-tree/tree-counter.d.ts +4 -4
  21. package/dist/{cjs → types}/data-structures/binary-tree/tree-multi-map.d.ts +5 -5
  22. package/dist/{esm → types}/interfaces/binary-tree.d.ts +2 -2
  23. package/dist/umd/data-structure-typed.js +12 -11
  24. package/dist/umd/data-structure-typed.js.map +1 -0
  25. package/dist/umd/data-structure-typed.min.js +2 -2
  26. package/dist/umd/data-structure-typed.min.js.map +1 -1
  27. package/jest.integration.config.js +3 -0
  28. package/package.json +13 -11
  29. package/src/data-structures/binary-tree/avl-tree-counter.ts +4 -7
  30. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +5 -10
  31. package/src/data-structures/binary-tree/avl-tree.ts +4 -6
  32. package/src/data-structures/binary-tree/binary-tree.ts +14 -16
  33. package/src/data-structures/binary-tree/bst.ts +5 -10
  34. package/src/data-structures/binary-tree/red-black-tree.ts +5 -10
  35. package/src/data-structures/binary-tree/tree-counter.ts +4 -9
  36. package/src/data-structures/binary-tree/tree-multi-map.ts +5 -10
  37. package/src/interfaces/binary-tree.ts +2 -2
  38. package/test/integration/all-in-one.test.ts +1 -1
  39. package/test/performance/data-structures/comparison/comparison.test.ts +27 -57
  40. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +109 -1
  41. package/tsconfig-base.json +20 -20
  42. package/tsconfig-types.json +17 -0
  43. package/tsconfig.test.json +8 -0
  44. package/tsup.config.js +11 -22
  45. package/tsup.node.config.ts +37 -0
  46. package/dist/cjs/common/index.js +0 -29
  47. package/dist/cjs/common/index.js.map +0 -1
  48. package/dist/cjs/data-structures/base/index.js +0 -19
  49. package/dist/cjs/data-structures/base/index.js.map +0 -1
  50. package/dist/cjs/data-structures/base/iterable-element-base.js +0 -244
  51. package/dist/cjs/data-structures/base/iterable-element-base.js.map +0 -1
  52. package/dist/cjs/data-structures/base/iterable-entry-base.js +0 -184
  53. package/dist/cjs/data-structures/base/iterable-entry-base.js.map +0 -1
  54. package/dist/cjs/data-structures/base/linear-base.js +0 -416
  55. package/dist/cjs/data-structures/base/linear-base.js.map +0 -1
  56. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +0 -375
  57. package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  58. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -135
  59. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +0 -251
  60. package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  61. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -291
  62. package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -612
  63. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +0 -1
  64. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +0 -295
  65. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  66. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +0 -754
  67. package/dist/cjs/data-structures/binary-tree/binary-tree.js +0 -1926
  68. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +0 -1
  69. package/dist/cjs/data-structures/binary-tree/bst.d.ts +0 -413
  70. package/dist/cjs/data-structures/binary-tree/bst.js +0 -904
  71. package/dist/cjs/data-structures/binary-tree/bst.js.map +0 -1
  72. package/dist/cjs/data-structures/binary-tree/index.js +0 -27
  73. package/dist/cjs/data-structures/binary-tree/index.js.map +0 -1
  74. package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +0 -208
  75. package/dist/cjs/data-structures/binary-tree/red-black-tree.js +0 -547
  76. package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +0 -1
  77. package/dist/cjs/data-structures/binary-tree/segment-tree.js +0 -298
  78. package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +0 -1
  79. package/dist/cjs/data-structures/binary-tree/tree-counter.js +0 -414
  80. package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +0 -1
  81. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +0 -385
  82. package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  83. package/dist/cjs/data-structures/graph/abstract-graph.js +0 -897
  84. package/dist/cjs/data-structures/graph/abstract-graph.js.map +0 -1
  85. package/dist/cjs/data-structures/graph/directed-graph.js +0 -526
  86. package/dist/cjs/data-structures/graph/directed-graph.js.map +0 -1
  87. package/dist/cjs/data-structures/graph/index.js +0 -21
  88. package/dist/cjs/data-structures/graph/index.js.map +0 -1
  89. package/dist/cjs/data-structures/graph/map-graph.js +0 -108
  90. package/dist/cjs/data-structures/graph/map-graph.js.map +0 -1
  91. package/dist/cjs/data-structures/graph/undirected-graph.js +0 -425
  92. package/dist/cjs/data-structures/graph/undirected-graph.js.map +0 -1
  93. package/dist/cjs/data-structures/hash/hash-map.js +0 -693
  94. package/dist/cjs/data-structures/hash/hash-map.js.map +0 -1
  95. package/dist/cjs/data-structures/hash/index.js +0 -18
  96. package/dist/cjs/data-structures/hash/index.js.map +0 -1
  97. package/dist/cjs/data-structures/heap/heap.js +0 -902
  98. package/dist/cjs/data-structures/heap/heap.js.map +0 -1
  99. package/dist/cjs/data-structures/heap/index.js +0 -20
  100. package/dist/cjs/data-structures/heap/index.js.map +0 -1
  101. package/dist/cjs/data-structures/heap/max-heap.js +0 -41
  102. package/dist/cjs/data-structures/heap/max-heap.js.map +0 -1
  103. package/dist/cjs/data-structures/heap/min-heap.js +0 -32
  104. package/dist/cjs/data-structures/heap/min-heap.js.map +0 -1
  105. package/dist/cjs/data-structures/index.js +0 -29
  106. package/dist/cjs/data-structures/index.js.map +0 -1
  107. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +0 -1112
  108. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  109. package/dist/cjs/data-structures/linked-list/index.js +0 -20
  110. package/dist/cjs/data-structures/linked-list/index.js.map +0 -1
  111. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +0 -851
  112. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
  113. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +0 -145
  114. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
  115. package/dist/cjs/data-structures/matrix/index.js +0 -19
  116. package/dist/cjs/data-structures/matrix/index.js.map +0 -1
  117. package/dist/cjs/data-structures/matrix/matrix.js +0 -449
  118. package/dist/cjs/data-structures/matrix/matrix.js.map +0 -1
  119. package/dist/cjs/data-structures/matrix/navigator.js +0 -112
  120. package/dist/cjs/data-structures/matrix/navigator.js.map +0 -1
  121. package/dist/cjs/data-structures/priority-queue/index.js +0 -20
  122. package/dist/cjs/data-structures/priority-queue/index.js.map +0 -1
  123. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +0 -35
  124. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  125. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +0 -25
  126. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  127. package/dist/cjs/data-structures/priority-queue/priority-queue.js +0 -21
  128. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +0 -1
  129. package/dist/cjs/data-structures/queue/deque.js +0 -880
  130. package/dist/cjs/data-structures/queue/deque.js.map +0 -1
  131. package/dist/cjs/data-structures/queue/index.js +0 -19
  132. package/dist/cjs/data-structures/queue/index.js.map +0 -1
  133. package/dist/cjs/data-structures/queue/queue.js +0 -474
  134. package/dist/cjs/data-structures/queue/queue.js.map +0 -1
  135. package/dist/cjs/data-structures/stack/index.js +0 -18
  136. package/dist/cjs/data-structures/stack/index.js.map +0 -1
  137. package/dist/cjs/data-structures/stack/stack.js +0 -402
  138. package/dist/cjs/data-structures/stack/stack.js.map +0 -1
  139. package/dist/cjs/data-structures/tree/index.js +0 -18
  140. package/dist/cjs/data-structures/tree/index.js.map +0 -1
  141. package/dist/cjs/data-structures/tree/tree.js +0 -108
  142. package/dist/cjs/data-structures/tree/tree.js.map +0 -1
  143. package/dist/cjs/data-structures/trie/index.js +0 -18
  144. package/dist/cjs/data-structures/trie/index.js.map +0 -1
  145. package/dist/cjs/data-structures/trie/trie.js +0 -611
  146. package/dist/cjs/data-structures/trie/trie.js.map +0 -1
  147. package/dist/cjs/index.js +0 -22
  148. package/dist/cjs/index.js.map +0 -1
  149. package/dist/cjs/interfaces/binary-tree.d.ts +0 -59
  150. package/dist/cjs/interfaces/binary-tree.js +0 -3
  151. package/dist/cjs/interfaces/binary-tree.js.map +0 -1
  152. package/dist/cjs/interfaces/doubly-linked-list.js +0 -3
  153. package/dist/cjs/interfaces/doubly-linked-list.js.map +0 -1
  154. package/dist/cjs/interfaces/graph.js +0 -3
  155. package/dist/cjs/interfaces/graph.js.map +0 -1
  156. package/dist/cjs/interfaces/heap.js +0 -3
  157. package/dist/cjs/interfaces/heap.js.map +0 -1
  158. package/dist/cjs/interfaces/index.js +0 -25
  159. package/dist/cjs/interfaces/index.js.map +0 -1
  160. package/dist/cjs/interfaces/navigator.js +0 -3
  161. package/dist/cjs/interfaces/navigator.js.map +0 -1
  162. package/dist/cjs/interfaces/priority-queue.js +0 -3
  163. package/dist/cjs/interfaces/priority-queue.js.map +0 -1
  164. package/dist/cjs/interfaces/segment-tree.js +0 -3
  165. package/dist/cjs/interfaces/segment-tree.js.map +0 -1
  166. package/dist/cjs/interfaces/singly-linked-list.js +0 -3
  167. package/dist/cjs/interfaces/singly-linked-list.js.map +0 -1
  168. package/dist/cjs/types/common.js +0 -3
  169. package/dist/cjs/types/common.js.map +0 -1
  170. package/dist/cjs/types/data-structures/base/base.js +0 -3
  171. package/dist/cjs/types/data-structures/base/base.js.map +0 -1
  172. package/dist/cjs/types/data-structures/base/index.js +0 -18
  173. package/dist/cjs/types/data-structures/base/index.js.map +0 -1
  174. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js +0 -3
  175. package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  176. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -3
  177. package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  178. package/dist/cjs/types/data-structures/binary-tree/avl-tree.js +0 -3
  179. package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +0 -1
  180. package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js +0 -3
  181. package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  182. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +0 -3
  183. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +0 -1
  184. package/dist/cjs/types/data-structures/binary-tree/bst.js +0 -3
  185. package/dist/cjs/types/data-structures/binary-tree/bst.js.map +0 -1
  186. package/dist/cjs/types/data-structures/binary-tree/index.js +0 -26
  187. package/dist/cjs/types/data-structures/binary-tree/index.js.map +0 -1
  188. package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js +0 -3
  189. package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
  190. package/dist/cjs/types/data-structures/binary-tree/segment-tree.js +0 -3
  191. package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +0 -1
  192. package/dist/cjs/types/data-structures/binary-tree/tree-counter.js +0 -3
  193. package/dist/cjs/types/data-structures/binary-tree/tree-counter.js.map +0 -1
  194. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js +0 -3
  195. package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  196. package/dist/cjs/types/data-structures/graph/abstract-graph.js +0 -3
  197. package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +0 -1
  198. package/dist/cjs/types/data-structures/graph/directed-graph.js +0 -3
  199. package/dist/cjs/types/data-structures/graph/directed-graph.js.map +0 -1
  200. package/dist/cjs/types/data-structures/graph/index.js +0 -20
  201. package/dist/cjs/types/data-structures/graph/index.js.map +0 -1
  202. package/dist/cjs/types/data-structures/graph/map-graph.js +0 -3
  203. package/dist/cjs/types/data-structures/graph/map-graph.js.map +0 -1
  204. package/dist/cjs/types/data-structures/graph/undirected-graph.js +0 -3
  205. package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +0 -1
  206. package/dist/cjs/types/data-structures/hash/hash-map.js +0 -3
  207. package/dist/cjs/types/data-structures/hash/hash-map.js.map +0 -1
  208. package/dist/cjs/types/data-structures/hash/index.js +0 -18
  209. package/dist/cjs/types/data-structures/hash/index.js.map +0 -1
  210. package/dist/cjs/types/data-structures/heap/heap.js +0 -3
  211. package/dist/cjs/types/data-structures/heap/heap.js.map +0 -1
  212. package/dist/cjs/types/data-structures/heap/index.js +0 -18
  213. package/dist/cjs/types/data-structures/heap/index.js.map +0 -1
  214. package/dist/cjs/types/data-structures/heap/max-heap.js +0 -3
  215. package/dist/cjs/types/data-structures/heap/max-heap.js.map +0 -1
  216. package/dist/cjs/types/data-structures/heap/min-heap.js +0 -3
  217. package/dist/cjs/types/data-structures/heap/min-heap.js.map +0 -1
  218. package/dist/cjs/types/data-structures/index.js +0 -29
  219. package/dist/cjs/types/data-structures/index.js.map +0 -1
  220. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js +0 -3
  221. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  222. package/dist/cjs/types/data-structures/linked-list/index.js +0 -20
  223. package/dist/cjs/types/data-structures/linked-list/index.js.map +0 -1
  224. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js +0 -3
  225. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
  226. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js +0 -3
  227. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
  228. package/dist/cjs/types/data-structures/matrix/index.js +0 -19
  229. package/dist/cjs/types/data-structures/matrix/index.js.map +0 -1
  230. package/dist/cjs/types/data-structures/matrix/matrix.js +0 -3
  231. package/dist/cjs/types/data-structures/matrix/matrix.js.map +0 -1
  232. package/dist/cjs/types/data-structures/matrix/navigator.js +0 -3
  233. package/dist/cjs/types/data-structures/matrix/navigator.js.map +0 -1
  234. package/dist/cjs/types/data-structures/priority-queue/index.js +0 -20
  235. package/dist/cjs/types/data-structures/priority-queue/index.js.map +0 -1
  236. package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js +0 -3
  237. package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  238. package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js +0 -3
  239. package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  240. package/dist/cjs/types/data-structures/priority-queue/priority-queue.js +0 -3
  241. package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +0 -1
  242. package/dist/cjs/types/data-structures/queue/deque.js +0 -3
  243. package/dist/cjs/types/data-structures/queue/deque.js.map +0 -1
  244. package/dist/cjs/types/data-structures/queue/index.js +0 -19
  245. package/dist/cjs/types/data-structures/queue/index.js.map +0 -1
  246. package/dist/cjs/types/data-structures/queue/queue.js +0 -3
  247. package/dist/cjs/types/data-structures/queue/queue.js.map +0 -1
  248. package/dist/cjs/types/data-structures/stack/index.js +0 -18
  249. package/dist/cjs/types/data-structures/stack/index.js.map +0 -1
  250. package/dist/cjs/types/data-structures/stack/stack.js +0 -3
  251. package/dist/cjs/types/data-structures/stack/stack.js.map +0 -1
  252. package/dist/cjs/types/data-structures/tree/index.js +0 -18
  253. package/dist/cjs/types/data-structures/tree/index.js.map +0 -1
  254. package/dist/cjs/types/data-structures/tree/tree.js +0 -3
  255. package/dist/cjs/types/data-structures/tree/tree.js.map +0 -1
  256. package/dist/cjs/types/data-structures/trie/index.js +0 -18
  257. package/dist/cjs/types/data-structures/trie/index.js.map +0 -1
  258. package/dist/cjs/types/data-structures/trie/trie.js +0 -3
  259. package/dist/cjs/types/data-structures/trie/trie.js.map +0 -1
  260. package/dist/cjs/types/index.js +0 -20
  261. package/dist/cjs/types/index.js.map +0 -1
  262. package/dist/cjs/types/utils/index.js +0 -19
  263. package/dist/cjs/types/utils/index.js.map +0 -1
  264. package/dist/cjs/types/utils/utils.js +0 -3
  265. package/dist/cjs/types/utils/utils.js.map +0 -1
  266. package/dist/cjs/types/utils/validate-type.js +0 -3
  267. package/dist/cjs/types/utils/validate-type.js.map +0 -1
  268. package/dist/cjs/utils/index.js +0 -19
  269. package/dist/cjs/utils/index.js.map +0 -1
  270. package/dist/cjs/utils/number.js +0 -24
  271. package/dist/cjs/utils/number.js.map +0 -1
  272. package/dist/cjs/utils/utils.js +0 -354
  273. package/dist/cjs/utils/utils.js.map +0 -1
  274. package/dist/esm/common/index.d.ts +0 -12
  275. package/dist/esm/common/index.js +0 -29
  276. package/dist/esm/common/index.js.map +0 -1
  277. package/dist/esm/data-structures/base/index.d.ts +0 -2
  278. package/dist/esm/data-structures/base/index.js +0 -3
  279. package/dist/esm/data-structures/base/index.js.map +0 -1
  280. package/dist/esm/data-structures/base/iterable-element-base.d.ts +0 -219
  281. package/dist/esm/data-structures/base/iterable-element-base.js +0 -247
  282. package/dist/esm/data-structures/base/iterable-element-base.js.map +0 -1
  283. package/dist/esm/data-structures/base/iterable-entry-base.d.ts +0 -144
  284. package/dist/esm/data-structures/base/iterable-entry-base.js +0 -180
  285. package/dist/esm/data-structures/base/iterable-entry-base.js.map +0 -1
  286. package/dist/esm/data-structures/base/linear-base.d.ts +0 -335
  287. package/dist/esm/data-structures/base/linear-base.js +0 -412
  288. package/dist/esm/data-structures/base/linear-base.js.map +0 -1
  289. package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +0 -182
  290. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +0 -369
  291. package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  292. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +0 -244
  293. package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  294. package/dist/esm/data-structures/binary-tree/avl-tree.js +0 -607
  295. package/dist/esm/data-structures/binary-tree/avl-tree.js.map +0 -1
  296. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -174
  297. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js +0 -296
  298. package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  299. package/dist/esm/data-structures/binary-tree/binary-tree.js +0 -1922
  300. package/dist/esm/data-structures/binary-tree/binary-tree.js.map +0 -1
  301. package/dist/esm/data-structures/binary-tree/bst.js +0 -901
  302. package/dist/esm/data-structures/binary-tree/bst.js.map +0 -1
  303. package/dist/esm/data-structures/binary-tree/index.d.ts +0 -10
  304. package/dist/esm/data-structures/binary-tree/index.js +0 -11
  305. package/dist/esm/data-structures/binary-tree/index.js.map +0 -1
  306. package/dist/esm/data-structures/binary-tree/red-black-tree.js +0 -540
  307. package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +0 -1
  308. package/dist/esm/data-structures/binary-tree/segment-tree.d.ts +0 -160
  309. package/dist/esm/data-structures/binary-tree/segment-tree.js +0 -295
  310. package/dist/esm/data-structures/binary-tree/segment-tree.js.map +0 -1
  311. package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +0 -190
  312. package/dist/esm/data-structures/binary-tree/tree-counter.js +0 -412
  313. package/dist/esm/data-structures/binary-tree/tree-counter.js.map +0 -1
  314. package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +0 -270
  315. package/dist/esm/data-structures/binary-tree/tree-multi-map.js +0 -378
  316. package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  317. package/dist/esm/data-structures/graph/abstract-graph.d.ts +0 -340
  318. package/dist/esm/data-structures/graph/abstract-graph.js +0 -892
  319. package/dist/esm/data-structures/graph/abstract-graph.js.map +0 -1
  320. package/dist/esm/data-structures/graph/directed-graph.d.ts +0 -207
  321. package/dist/esm/data-structures/graph/directed-graph.js +0 -521
  322. package/dist/esm/data-structures/graph/directed-graph.js.map +0 -1
  323. package/dist/esm/data-structures/graph/index.d.ts +0 -4
  324. package/dist/esm/data-structures/graph/index.js +0 -5
  325. package/dist/esm/data-structures/graph/index.js.map +0 -1
  326. package/dist/esm/data-structures/graph/map-graph.d.ts +0 -78
  327. package/dist/esm/data-structures/graph/map-graph.js +0 -105
  328. package/dist/esm/data-structures/graph/map-graph.js.map +0 -1
  329. package/dist/esm/data-structures/graph/undirected-graph.d.ts +0 -188
  330. package/dist/esm/data-structures/graph/undirected-graph.js +0 -418
  331. package/dist/esm/data-structures/graph/undirected-graph.js.map +0 -1
  332. package/dist/esm/data-structures/hash/hash-map.d.ts +0 -345
  333. package/dist/esm/data-structures/hash/hash-map.js +0 -691
  334. package/dist/esm/data-structures/hash/hash-map.js.map +0 -1
  335. package/dist/esm/data-structures/hash/index.d.ts +0 -1
  336. package/dist/esm/data-structures/hash/index.js +0 -2
  337. package/dist/esm/data-structures/hash/index.js.map +0 -1
  338. package/dist/esm/data-structures/heap/heap.d.ts +0 -503
  339. package/dist/esm/data-structures/heap/heap.js +0 -894
  340. package/dist/esm/data-structures/heap/heap.js.map +0 -1
  341. package/dist/esm/data-structures/heap/index.d.ts +0 -3
  342. package/dist/esm/data-structures/heap/index.js +0 -4
  343. package/dist/esm/data-structures/heap/index.js.map +0 -1
  344. package/dist/esm/data-structures/heap/max-heap.d.ts +0 -32
  345. package/dist/esm/data-structures/heap/max-heap.js +0 -40
  346. package/dist/esm/data-structures/heap/max-heap.js.map +0 -1
  347. package/dist/esm/data-structures/heap/min-heap.d.ts +0 -33
  348. package/dist/esm/data-structures/heap/min-heap.js +0 -28
  349. package/dist/esm/data-structures/heap/min-heap.js.map +0 -1
  350. package/dist/esm/data-structures/index.d.ts +0 -12
  351. package/dist/esm/data-structures/index.js +0 -13
  352. package/dist/esm/data-structures/index.js.map +0 -1
  353. package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +0 -769
  354. package/dist/esm/data-structures/linked-list/doubly-linked-list.js +0 -1109
  355. package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  356. package/dist/esm/data-structures/linked-list/index.d.ts +0 -3
  357. package/dist/esm/data-structures/linked-list/index.js +0 -4
  358. package/dist/esm/data-structures/linked-list/index.js.map +0 -1
  359. package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +0 -451
  360. package/dist/esm/data-structures/linked-list/singly-linked-list.js +0 -847
  361. package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +0 -1
  362. package/dist/esm/data-structures/linked-list/skip-linked-list.d.ts +0 -27
  363. package/dist/esm/data-structures/linked-list/skip-linked-list.js +0 -143
  364. package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +0 -1
  365. package/dist/esm/data-structures/matrix/index.d.ts +0 -2
  366. package/dist/esm/data-structures/matrix/index.js +0 -3
  367. package/dist/esm/data-structures/matrix/index.js.map +0 -1
  368. package/dist/esm/data-structures/matrix/matrix.d.ts +0 -168
  369. package/dist/esm/data-structures/matrix/matrix.js +0 -444
  370. package/dist/esm/data-structures/matrix/matrix.js.map +0 -1
  371. package/dist/esm/data-structures/matrix/navigator.d.ts +0 -55
  372. package/dist/esm/data-structures/matrix/navigator.js +0 -114
  373. package/dist/esm/data-structures/matrix/navigator.js.map +0 -1
  374. package/dist/esm/data-structures/priority-queue/index.d.ts +0 -3
  375. package/dist/esm/data-structures/priority-queue/index.js +0 -4
  376. package/dist/esm/data-structures/priority-queue/index.js.map +0 -1
  377. package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +0 -27
  378. package/dist/esm/data-structures/priority-queue/max-priority-queue.js +0 -34
  379. package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  380. package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +0 -26
  381. package/dist/esm/data-structures/priority-queue/min-priority-queue.js +0 -21
  382. package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  383. package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +0 -15
  384. package/dist/esm/data-structures/priority-queue/priority-queue.js +0 -17
  385. package/dist/esm/data-structures/priority-queue/priority-queue.js.map +0 -1
  386. package/dist/esm/data-structures/queue/deque.d.ts +0 -431
  387. package/dist/esm/data-structures/queue/deque.js +0 -880
  388. package/dist/esm/data-structures/queue/deque.js.map +0 -1
  389. package/dist/esm/data-structures/queue/index.d.ts +0 -2
  390. package/dist/esm/data-structures/queue/index.js +0 -3
  391. package/dist/esm/data-structures/queue/index.js.map +0 -1
  392. package/dist/esm/data-structures/queue/queue.d.ts +0 -308
  393. package/dist/esm/data-structures/queue/queue.js +0 -467
  394. package/dist/esm/data-structures/queue/queue.js.map +0 -1
  395. package/dist/esm/data-structures/stack/index.d.ts +0 -1
  396. package/dist/esm/data-structures/stack/index.js +0 -2
  397. package/dist/esm/data-structures/stack/index.js.map +0 -1
  398. package/dist/esm/data-structures/stack/stack.d.ts +0 -306
  399. package/dist/esm/data-structures/stack/stack.js +0 -398
  400. package/dist/esm/data-structures/stack/stack.js.map +0 -1
  401. package/dist/esm/data-structures/tree/index.d.ts +0 -1
  402. package/dist/esm/data-structures/tree/index.js +0 -2
  403. package/dist/esm/data-structures/tree/index.js.map +0 -1
  404. package/dist/esm/data-structures/tree/tree.d.ts +0 -62
  405. package/dist/esm/data-structures/tree/tree.js +0 -107
  406. package/dist/esm/data-structures/tree/tree.js.map +0 -1
  407. package/dist/esm/data-structures/trie/index.d.ts +0 -1
  408. package/dist/esm/data-structures/trie/index.js +0 -2
  409. package/dist/esm/data-structures/trie/index.js.map +0 -1
  410. package/dist/esm/data-structures/trie/trie.d.ts +0 -350
  411. package/dist/esm/data-structures/trie/trie.js +0 -613
  412. package/dist/esm/data-structures/trie/trie.js.map +0 -1
  413. package/dist/esm/index.d.ts +0 -5
  414. package/dist/esm/index.js +0 -6
  415. package/dist/esm/index.js.map +0 -1
  416. package/dist/esm/interfaces/binary-tree.js +0 -2
  417. package/dist/esm/interfaces/binary-tree.js.map +0 -1
  418. package/dist/esm/interfaces/doubly-linked-list.d.ts +0 -1
  419. package/dist/esm/interfaces/doubly-linked-list.js +0 -2
  420. package/dist/esm/interfaces/doubly-linked-list.js.map +0 -1
  421. package/dist/esm/interfaces/graph.d.ts +0 -21
  422. package/dist/esm/interfaces/graph.js +0 -2
  423. package/dist/esm/interfaces/graph.js.map +0 -1
  424. package/dist/esm/interfaces/heap.d.ts +0 -1
  425. package/dist/esm/interfaces/heap.js +0 -2
  426. package/dist/esm/interfaces/heap.js.map +0 -1
  427. package/dist/esm/interfaces/index.d.ts +0 -8
  428. package/dist/esm/interfaces/index.js +0 -9
  429. package/dist/esm/interfaces/index.js.map +0 -1
  430. package/dist/esm/interfaces/navigator.d.ts +0 -1
  431. package/dist/esm/interfaces/navigator.js +0 -2
  432. package/dist/esm/interfaces/navigator.js.map +0 -1
  433. package/dist/esm/interfaces/priority-queue.d.ts +0 -1
  434. package/dist/esm/interfaces/priority-queue.js +0 -2
  435. package/dist/esm/interfaces/priority-queue.js.map +0 -1
  436. package/dist/esm/interfaces/segment-tree.d.ts +0 -1
  437. package/dist/esm/interfaces/segment-tree.js +0 -2
  438. package/dist/esm/interfaces/segment-tree.js.map +0 -1
  439. package/dist/esm/interfaces/singly-linked-list.d.ts +0 -1
  440. package/dist/esm/interfaces/singly-linked-list.js +0 -2
  441. package/dist/esm/interfaces/singly-linked-list.js.map +0 -1
  442. package/dist/esm/types/common.d.ts +0 -15
  443. package/dist/esm/types/common.js +0 -2
  444. package/dist/esm/types/common.js.map +0 -1
  445. package/dist/esm/types/data-structures/base/base.d.ts +0 -13
  446. package/dist/esm/types/data-structures/base/base.js +0 -2
  447. package/dist/esm/types/data-structures/base/base.js.map +0 -1
  448. package/dist/esm/types/data-structures/base/index.d.ts +0 -1
  449. package/dist/esm/types/data-structures/base/index.js +0 -2
  450. package/dist/esm/types/data-structures/base/index.js.map +0 -1
  451. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -2
  452. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js +0 -2
  453. package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
  454. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -2
  455. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -2
  456. package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
  457. package/dist/esm/types/data-structures/binary-tree/avl-tree.d.ts +0 -2
  458. package/dist/esm/types/data-structures/binary-tree/avl-tree.js +0 -2
  459. package/dist/esm/types/data-structures/binary-tree/avl-tree.js.map +0 -1
  460. package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -1
  461. package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
  462. package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  463. package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +0 -29
  464. package/dist/esm/types/data-structures/binary-tree/binary-tree.js +0 -2
  465. package/dist/esm/types/data-structures/binary-tree/binary-tree.js.map +0 -1
  466. package/dist/esm/types/data-structures/binary-tree/bst.d.ts +0 -12
  467. package/dist/esm/types/data-structures/binary-tree/bst.js +0 -2
  468. package/dist/esm/types/data-structures/binary-tree/bst.js.map +0 -1
  469. package/dist/esm/types/data-structures/binary-tree/index.d.ts +0 -9
  470. package/dist/esm/types/data-structures/binary-tree/index.js +0 -10
  471. package/dist/esm/types/data-structures/binary-tree/index.js.map +0 -1
  472. package/dist/esm/types/data-structures/binary-tree/red-black-tree.d.ts +0 -3
  473. package/dist/esm/types/data-structures/binary-tree/red-black-tree.js +0 -2
  474. package/dist/esm/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
  475. package/dist/esm/types/data-structures/binary-tree/segment-tree.d.ts +0 -1
  476. package/dist/esm/types/data-structures/binary-tree/segment-tree.js +0 -2
  477. package/dist/esm/types/data-structures/binary-tree/segment-tree.js.map +0 -1
  478. package/dist/esm/types/data-structures/binary-tree/tree-counter.d.ts +0 -2
  479. package/dist/esm/types/data-structures/binary-tree/tree-counter.js +0 -2
  480. package/dist/esm/types/data-structures/binary-tree/tree-counter.js.map +0 -1
  481. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -2
  482. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js +0 -2
  483. package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
  484. package/dist/esm/types/data-structures/graph/abstract-graph.d.ts +0 -14
  485. package/dist/esm/types/data-structures/graph/abstract-graph.js +0 -2
  486. package/dist/esm/types/data-structures/graph/abstract-graph.js.map +0 -1
  487. package/dist/esm/types/data-structures/graph/directed-graph.d.ts +0 -1
  488. package/dist/esm/types/data-structures/graph/directed-graph.js +0 -2
  489. package/dist/esm/types/data-structures/graph/directed-graph.js.map +0 -1
  490. package/dist/esm/types/data-structures/graph/index.d.ts +0 -3
  491. package/dist/esm/types/data-structures/graph/index.js +0 -4
  492. package/dist/esm/types/data-structures/graph/index.js.map +0 -1
  493. package/dist/esm/types/data-structures/graph/map-graph.d.ts +0 -1
  494. package/dist/esm/types/data-structures/graph/map-graph.js +0 -2
  495. package/dist/esm/types/data-structures/graph/map-graph.js.map +0 -1
  496. package/dist/esm/types/data-structures/graph/undirected-graph.d.ts +0 -1
  497. package/dist/esm/types/data-structures/graph/undirected-graph.js +0 -2
  498. package/dist/esm/types/data-structures/graph/undirected-graph.js.map +0 -1
  499. package/dist/esm/types/data-structures/hash/hash-map.d.ts +0 -19
  500. package/dist/esm/types/data-structures/hash/hash-map.js +0 -2
  501. package/dist/esm/types/data-structures/hash/hash-map.js.map +0 -1
  502. package/dist/esm/types/data-structures/hash/index.d.ts +0 -2
  503. package/dist/esm/types/data-structures/hash/index.js +0 -2
  504. package/dist/esm/types/data-structures/hash/index.js.map +0 -1
  505. package/dist/esm/types/data-structures/heap/heap.d.ts +0 -5
  506. package/dist/esm/types/data-structures/heap/heap.js +0 -2
  507. package/dist/esm/types/data-structures/heap/heap.js.map +0 -1
  508. package/dist/esm/types/data-structures/heap/index.d.ts +0 -1
  509. package/dist/esm/types/data-structures/heap/index.js +0 -2
  510. package/dist/esm/types/data-structures/heap/index.js.map +0 -1
  511. package/dist/esm/types/data-structures/heap/max-heap.d.ts +0 -1
  512. package/dist/esm/types/data-structures/heap/max-heap.js +0 -2
  513. package/dist/esm/types/data-structures/heap/max-heap.js.map +0 -1
  514. package/dist/esm/types/data-structures/heap/min-heap.d.ts +0 -1
  515. package/dist/esm/types/data-structures/heap/min-heap.js +0 -2
  516. package/dist/esm/types/data-structures/heap/min-heap.js.map +0 -1
  517. package/dist/esm/types/data-structures/index.d.ts +0 -12
  518. package/dist/esm/types/data-structures/index.js +0 -13
  519. package/dist/esm/types/data-structures/index.js.map +0 -1
  520. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -2
  521. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js +0 -2
  522. package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  523. package/dist/esm/types/data-structures/linked-list/index.d.ts +0 -3
  524. package/dist/esm/types/data-structures/linked-list/index.js +0 -4
  525. package/dist/esm/types/data-structures/linked-list/index.js.map +0 -1
  526. package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +0 -2
  527. package/dist/esm/types/data-structures/linked-list/singly-linked-list.js +0 -2
  528. package/dist/esm/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
  529. package/dist/esm/types/data-structures/linked-list/skip-linked-list.d.ts +0 -4
  530. package/dist/esm/types/data-structures/linked-list/skip-linked-list.js +0 -2
  531. package/dist/esm/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
  532. package/dist/esm/types/data-structures/matrix/index.d.ts +0 -2
  533. package/dist/esm/types/data-structures/matrix/index.js +0 -3
  534. package/dist/esm/types/data-structures/matrix/index.js.map +0 -1
  535. package/dist/esm/types/data-structures/matrix/matrix.d.ts +0 -7
  536. package/dist/esm/types/data-structures/matrix/matrix.js +0 -2
  537. package/dist/esm/types/data-structures/matrix/matrix.js.map +0 -1
  538. package/dist/esm/types/data-structures/matrix/navigator.d.ts +0 -14
  539. package/dist/esm/types/data-structures/matrix/navigator.js +0 -2
  540. package/dist/esm/types/data-structures/matrix/navigator.js.map +0 -1
  541. package/dist/esm/types/data-structures/priority-queue/index.d.ts +0 -3
  542. package/dist/esm/types/data-structures/priority-queue/index.js +0 -4
  543. package/dist/esm/types/data-structures/priority-queue/index.js.map +0 -1
  544. package/dist/esm/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -1
  545. package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js +0 -2
  546. package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  547. package/dist/esm/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -1
  548. package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js +0 -2
  549. package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  550. package/dist/esm/types/data-structures/priority-queue/priority-queue.d.ts +0 -2
  551. package/dist/esm/types/data-structures/priority-queue/priority-queue.js +0 -2
  552. package/dist/esm/types/data-structures/priority-queue/priority-queue.js.map +0 -1
  553. package/dist/esm/types/data-structures/queue/deque.d.ts +0 -4
  554. package/dist/esm/types/data-structures/queue/deque.js +0 -2
  555. package/dist/esm/types/data-structures/queue/deque.js.map +0 -1
  556. package/dist/esm/types/data-structures/queue/index.d.ts +0 -2
  557. package/dist/esm/types/data-structures/queue/index.js +0 -3
  558. package/dist/esm/types/data-structures/queue/index.js.map +0 -1
  559. package/dist/esm/types/data-structures/queue/queue.d.ts +0 -4
  560. package/dist/esm/types/data-structures/queue/queue.js +0 -2
  561. package/dist/esm/types/data-structures/queue/queue.js.map +0 -1
  562. package/dist/esm/types/data-structures/stack/index.d.ts +0 -1
  563. package/dist/esm/types/data-structures/stack/index.js +0 -2
  564. package/dist/esm/types/data-structures/stack/index.js.map +0 -1
  565. package/dist/esm/types/data-structures/stack/stack.d.ts +0 -2
  566. package/dist/esm/types/data-structures/stack/stack.js +0 -2
  567. package/dist/esm/types/data-structures/stack/stack.js.map +0 -1
  568. package/dist/esm/types/data-structures/tree/index.d.ts +0 -1
  569. package/dist/esm/types/data-structures/tree/index.js +0 -2
  570. package/dist/esm/types/data-structures/tree/index.js.map +0 -1
  571. package/dist/esm/types/data-structures/tree/tree.d.ts +0 -1
  572. package/dist/esm/types/data-structures/tree/tree.js +0 -2
  573. package/dist/esm/types/data-structures/tree/tree.js.map +0 -1
  574. package/dist/esm/types/data-structures/trie/index.d.ts +0 -1
  575. package/dist/esm/types/data-structures/trie/index.js +0 -2
  576. package/dist/esm/types/data-structures/trie/index.js.map +0 -1
  577. package/dist/esm/types/data-structures/trie/trie.d.ts +0 -4
  578. package/dist/esm/types/data-structures/trie/trie.js +0 -2
  579. package/dist/esm/types/data-structures/trie/trie.js.map +0 -1
  580. package/dist/esm/types/index.d.ts +0 -3
  581. package/dist/esm/types/index.js +0 -4
  582. package/dist/esm/types/index.js.map +0 -1
  583. package/dist/esm/types/utils/index.d.ts +0 -2
  584. package/dist/esm/types/utils/index.js +0 -3
  585. package/dist/esm/types/utils/index.js.map +0 -1
  586. package/dist/esm/types/utils/utils.d.ts +0 -22
  587. package/dist/esm/types/utils/utils.js +0 -2
  588. package/dist/esm/types/utils/utils.js.map +0 -1
  589. package/dist/esm/types/utils/validate-type.d.ts +0 -19
  590. package/dist/esm/types/utils/validate-type.js +0 -2
  591. package/dist/esm/types/utils/validate-type.js.map +0 -1
  592. package/dist/esm/utils/index.d.ts +0 -2
  593. package/dist/esm/utils/index.js +0 -3
  594. package/dist/esm/utils/index.js.map +0 -1
  595. package/dist/esm/utils/number.d.ts +0 -14
  596. package/dist/esm/utils/number.js +0 -21
  597. package/dist/esm/utils/number.js.map +0 -1
  598. package/dist/esm/utils/utils.d.ts +0 -209
  599. package/dist/esm/utils/utils.js +0 -325
  600. package/dist/esm/utils/utils.js.map +0 -1
  601. package/tsconfig-cjs.json +0 -14
  602. package/tsconfig-esm.json +0 -14
  603. /package/dist/{cjs → types}/common/index.d.ts +0 -0
  604. /package/dist/{cjs → types}/data-structures/base/index.d.ts +0 -0
  605. /package/dist/{cjs → types}/data-structures/base/iterable-element-base.d.ts +0 -0
  606. /package/dist/{cjs → types}/data-structures/base/iterable-entry-base.d.ts +0 -0
  607. /package/dist/{cjs → types}/data-structures/base/linear-base.d.ts +0 -0
  608. /package/dist/{cjs → types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
  609. /package/dist/{cjs → types}/data-structures/binary-tree/index.d.ts +0 -0
  610. /package/dist/{cjs → types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
  611. /package/dist/{cjs → types}/data-structures/graph/abstract-graph.d.ts +0 -0
  612. /package/dist/{cjs → types}/data-structures/graph/directed-graph.d.ts +0 -0
  613. /package/dist/{cjs → types}/data-structures/graph/index.d.ts +0 -0
  614. /package/dist/{cjs → types}/data-structures/graph/map-graph.d.ts +0 -0
  615. /package/dist/{cjs → types}/data-structures/graph/undirected-graph.d.ts +0 -0
  616. /package/dist/{cjs → types}/data-structures/hash/hash-map.d.ts +0 -0
  617. /package/dist/{cjs → types}/data-structures/hash/index.d.ts +0 -0
  618. /package/dist/{cjs → types}/data-structures/heap/heap.d.ts +0 -0
  619. /package/dist/{cjs → types}/data-structures/heap/index.d.ts +0 -0
  620. /package/dist/{cjs → types}/data-structures/heap/max-heap.d.ts +0 -0
  621. /package/dist/{cjs → types}/data-structures/heap/min-heap.d.ts +0 -0
  622. /package/dist/{cjs → types}/data-structures/index.d.ts +0 -0
  623. /package/dist/{cjs → types}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
  624. /package/dist/{cjs → types}/data-structures/linked-list/index.d.ts +0 -0
  625. /package/dist/{cjs → types}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
  626. /package/dist/{cjs → types}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
  627. /package/dist/{cjs → types}/data-structures/matrix/index.d.ts +0 -0
  628. /package/dist/{cjs → types}/data-structures/matrix/matrix.d.ts +0 -0
  629. /package/dist/{cjs → types}/data-structures/matrix/navigator.d.ts +0 -0
  630. /package/dist/{cjs → types}/data-structures/priority-queue/index.d.ts +0 -0
  631. /package/dist/{cjs → types}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
  632. /package/dist/{cjs → types}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
  633. /package/dist/{cjs → types}/data-structures/priority-queue/priority-queue.d.ts +0 -0
  634. /package/dist/{cjs → types}/data-structures/queue/deque.d.ts +0 -0
  635. /package/dist/{cjs → types}/data-structures/queue/index.d.ts +0 -0
  636. /package/dist/{cjs → types}/data-structures/queue/queue.d.ts +0 -0
  637. /package/dist/{cjs → types}/data-structures/stack/index.d.ts +0 -0
  638. /package/dist/{cjs → types}/data-structures/stack/stack.d.ts +0 -0
  639. /package/dist/{cjs → types}/data-structures/tree/index.d.ts +0 -0
  640. /package/dist/{cjs → types}/data-structures/tree/tree.d.ts +0 -0
  641. /package/dist/{cjs → types}/data-structures/trie/index.d.ts +0 -0
  642. /package/dist/{cjs → types}/data-structures/trie/trie.d.ts +0 -0
  643. /package/dist/{cjs → types}/index.d.ts +0 -0
  644. /package/dist/{cjs → types}/interfaces/doubly-linked-list.d.ts +0 -0
  645. /package/dist/{cjs → types}/interfaces/graph.d.ts +0 -0
  646. /package/dist/{cjs → types}/interfaces/heap.d.ts +0 -0
  647. /package/dist/{cjs → types}/interfaces/index.d.ts +0 -0
  648. /package/dist/{cjs → types}/interfaces/navigator.d.ts +0 -0
  649. /package/dist/{cjs → types}/interfaces/priority-queue.d.ts +0 -0
  650. /package/dist/{cjs → types}/interfaces/segment-tree.d.ts +0 -0
  651. /package/dist/{cjs → types}/interfaces/singly-linked-list.d.ts +0 -0
  652. /package/dist/{cjs → types}/types/common.d.ts +0 -0
  653. /package/dist/{cjs → types}/types/data-structures/base/base.d.ts +0 -0
  654. /package/dist/{cjs → types}/types/data-structures/base/index.d.ts +0 -0
  655. /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -0
  656. /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -0
  657. /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree.d.ts +0 -0
  658. /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
  659. /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-tree.d.ts +0 -0
  660. /package/dist/{cjs → types}/types/data-structures/binary-tree/bst.d.ts +0 -0
  661. /package/dist/{cjs → types}/types/data-structures/binary-tree/index.d.ts +0 -0
  662. /package/dist/{cjs → types}/types/data-structures/binary-tree/red-black-tree.d.ts +0 -0
  663. /package/dist/{cjs → types}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
  664. /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-counter.d.ts +0 -0
  665. /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -0
  666. /package/dist/{cjs → types}/types/data-structures/graph/abstract-graph.d.ts +0 -0
  667. /package/dist/{cjs → types}/types/data-structures/graph/directed-graph.d.ts +0 -0
  668. /package/dist/{cjs → types}/types/data-structures/graph/index.d.ts +0 -0
  669. /package/dist/{cjs → types}/types/data-structures/graph/map-graph.d.ts +0 -0
  670. /package/dist/{cjs → types}/types/data-structures/graph/undirected-graph.d.ts +0 -0
  671. /package/dist/{cjs → types}/types/data-structures/hash/hash-map.d.ts +0 -0
  672. /package/dist/{cjs → types}/types/data-structures/hash/index.d.ts +0 -0
  673. /package/dist/{cjs → types}/types/data-structures/heap/heap.d.ts +0 -0
  674. /package/dist/{cjs → types}/types/data-structures/heap/index.d.ts +0 -0
  675. /package/dist/{cjs → types}/types/data-structures/heap/max-heap.d.ts +0 -0
  676. /package/dist/{cjs → types}/types/data-structures/heap/min-heap.d.ts +0 -0
  677. /package/dist/{cjs → types}/types/data-structures/index.d.ts +0 -0
  678. /package/dist/{cjs → types}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
  679. /package/dist/{cjs → types}/types/data-structures/linked-list/index.d.ts +0 -0
  680. /package/dist/{cjs → types}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
  681. /package/dist/{cjs → types}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
  682. /package/dist/{cjs → types}/types/data-structures/matrix/index.d.ts +0 -0
  683. /package/dist/{cjs → types}/types/data-structures/matrix/matrix.d.ts +0 -0
  684. /package/dist/{cjs → types}/types/data-structures/matrix/navigator.d.ts +0 -0
  685. /package/dist/{cjs → types}/types/data-structures/priority-queue/index.d.ts +0 -0
  686. /package/dist/{cjs → types}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
  687. /package/dist/{cjs → types}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
  688. /package/dist/{cjs → types}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
  689. /package/dist/{cjs → types}/types/data-structures/queue/deque.d.ts +0 -0
  690. /package/dist/{cjs → types}/types/data-structures/queue/index.d.ts +0 -0
  691. /package/dist/{cjs → types}/types/data-structures/queue/queue.d.ts +0 -0
  692. /package/dist/{cjs → types}/types/data-structures/stack/index.d.ts +0 -0
  693. /package/dist/{cjs → types}/types/data-structures/stack/stack.d.ts +0 -0
  694. /package/dist/{cjs → types}/types/data-structures/tree/index.d.ts +0 -0
  695. /package/dist/{cjs → types}/types/data-structures/tree/tree.d.ts +0 -0
  696. /package/dist/{cjs → types}/types/data-structures/trie/index.d.ts +0 -0
  697. /package/dist/{cjs → types}/types/data-structures/trie/trie.d.ts +0 -0
  698. /package/dist/{cjs → types}/types/index.d.ts +0 -0
  699. /package/dist/{cjs → types}/types/utils/index.d.ts +0 -0
  700. /package/dist/{cjs → types}/types/utils/utils.d.ts +0 -0
  701. /package/dist/{cjs → types}/types/utils/validate-type.d.ts +0 -0
  702. /package/dist/{cjs → types}/utils/index.d.ts +0 -0
  703. /package/dist/{cjs → types}/utils/number.d.ts +0 -0
  704. /package/dist/{cjs → types}/utils/utils.d.ts +0 -0
@@ -1,160 +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 { SegmentTreeNodeVal } from '../../types';
9
- export declare class SegmentTreeNode {
10
- /**
11
- * The constructor initializes the properties of a SegmentTreeNode object.
12
- * @param {number} start - The `start` parameter represents the starting index of the segment covered
13
- * by this node in a segment tree.
14
- * @param {number} end - The `end` parameter represents the end index of the segment covered by this
15
- * node in a segment tree.
16
- * @param {number} sum - The `sum` parameter represents the sum of the values in the range covered by
17
- * the segment tree node.
18
- * @param {SegmentTreeNodeVal | undefined} [value] - The `value` parameter is an optional parameter
19
- * of type `SegmentTreeNodeVal`. It represents the value associated with the segment tree node.
20
- */
21
- constructor(start: number, end: number, sum: number, value?: SegmentTreeNodeVal | undefined);
22
- protected _start: number;
23
- /**
24
- * The function returns the value of the protected variable _start.
25
- * @returns The start value, which is of type number.
26
- */
27
- get start(): number;
28
- /**
29
- * The above function sets the value of the "start" property.
30
- * @param {number} value - The value parameter is of type number.
31
- */
32
- set start(value: number);
33
- protected _end: number;
34
- /**
35
- * The function returns the value of the protected variable `_end`.
36
- * @returns The value of the protected property `_end`.
37
- */
38
- get end(): number;
39
- /**
40
- * The above function sets the value of the "end" property.
41
- * @param {number} value - The value parameter is a number that represents the new value for the end
42
- * property.
43
- */
44
- set end(value: number);
45
- protected _value: SegmentTreeNodeVal | undefined;
46
- /**
47
- * The function returns the value of a segment tree node.
48
- * @returns The value being returned is either a `SegmentTreeNodeVal` object or `undefined`.
49
- */
50
- get value(): SegmentTreeNodeVal | undefined;
51
- /**
52
- * The function sets the value of a segment tree node.
53
- * @param {SegmentTreeNodeVal | undefined} value - The `value` parameter is of type
54
- * `SegmentTreeNodeVal` or `undefined`.
55
- */
56
- set value(value: SegmentTreeNodeVal | undefined);
57
- protected _sum: number;
58
- /**
59
- * The function returns the value of the sum property.
60
- * @returns The method is returning the value of the variable `_sum`.
61
- */
62
- get sum(): number;
63
- /**
64
- * The above function sets the value of the sum property.
65
- * @param {number} value - The parameter "value" is of type "number".
66
- */
67
- set sum(value: number);
68
- protected _left: SegmentTreeNode | undefined;
69
- /**
70
- * The function returns the left child of a segment tree node.
71
- * @returns The `left` property of the `SegmentTreeNode` object is being returned. It is of type
72
- * `SegmentTreeNode` or `undefined`.
73
- */
74
- get left(): SegmentTreeNode | undefined;
75
- /**
76
- * The function sets the value of the left property of a SegmentTreeNode object.
77
- * @param {SegmentTreeNode | undefined} value - The value parameter is of type SegmentTreeNode or
78
- * undefined.
79
- */
80
- set left(value: SegmentTreeNode | undefined);
81
- protected _right: SegmentTreeNode | undefined;
82
- /**
83
- * The function returns the right child of a segment tree node.
84
- * @returns The `getRight()` method is returning a value of type `SegmentTreeNode` or `undefined`.
85
- */
86
- get right(): SegmentTreeNode | undefined;
87
- /**
88
- * The function sets the right child of a segment tree node.
89
- * @param {SegmentTreeNode | undefined} value - The `value` parameter is of type `SegmentTreeNode |
90
- * undefined`. This means that it can accept either a `SegmentTreeNode` object or `undefined` as its
91
- * value.
92
- */
93
- set right(value: SegmentTreeNode | undefined);
94
- }
95
- export declare class SegmentTree {
96
- /**
97
- * The constructor initializes the values, start, end, and root properties of an object.
98
- * @param {number[]} values - An array of numbers that will be used to build a binary search tree.
99
- * @param {number} [start] - The `start` parameter is the index of the first element in the `values` array that should
100
- * be included in the range. If no value is provided for `start`, it defaults to 0, which means the range starts from
101
- * the beginning of the array.
102
- * @param {number} [end] - The "end" parameter is the index of the last element in the "values" array that should be
103
- * included in the range. If not provided, it defaults to the index of the last element in the "values" array.
104
- */
105
- constructor(values: number[], start?: number, end?: number);
106
- protected _values: number[];
107
- /**
108
- * The function returns an array of numbers.
109
- * @returns An array of numbers is being returned.
110
- */
111
- get values(): number[];
112
- protected _start: number;
113
- /**
114
- * The function returns the value of the protected variable _start.
115
- * @returns The start value, which is of type number.
116
- */
117
- get start(): number;
118
- protected _end: number;
119
- /**
120
- * The function returns the value of the protected variable `_end`.
121
- * @returns The value of the protected property `_end`.
122
- */
123
- get end(): number;
124
- protected _root: SegmentTreeNode | undefined;
125
- /**
126
- * The function returns the root node of a segment tree.
127
- * @returns The `root` property of the class `SegmentTreeNode` or `undefined` if it is not defined.
128
- */
129
- get root(): SegmentTreeNode | undefined;
130
- /**
131
- * The build function creates a segment tree by recursively dividing the given range into smaller segments and assigning
132
- * the sum of values to each segment.
133
- * @param {number} start - The `start` parameter represents the starting index of the segment or range for which we are
134
- * building the segment tree.
135
- * @param {number} end - The "end" parameter represents the ending index of the segment or range for which we want to
136
- * build a segment tree.
137
- * @returns a SegmentTreeNode object.
138
- */
139
- build(start: number, end: number): SegmentTreeNode;
140
- /**
141
- * The function updates the value of a node in a segment tree and recalculates the sum of its children if they exist.
142
- * @param {number} index - The index parameter represents the index of the node in the segment tree that needs to be
143
- * updated.
144
- * @param {number} sum - The `sum` parameter represents the new value that should be assigned to the `sum` property of
145
- * the `SegmentTreeNode` at the specified `index`.
146
- * @param {SegmentTreeNodeVal} [value] - The `value` parameter is an optional value that can be assigned to the `value`
147
- * property of the `SegmentTreeNode` object. It is not currently used in the code, but you can uncomment the line `//
148
- * cur.value = value;` and pass a value for `value` in the
149
- * @returns The function does not return anything.
150
- */
151
- updateNode(index: number, sum: number, value?: SegmentTreeNodeVal): void;
152
- /**
153
- * The function `querySumByRange` calculates the sum of values within a given range in a segment tree.
154
- * @param {number} indexA - The starting index of the range for which you want to calculate the sum.
155
- * @param {number} indexB - The parameter `indexB` represents the ending index of the range for which you want to
156
- * calculate the sum.
157
- * @returns The function `querySumByRange` returns a number.
158
- */
159
- querySumByRange(indexA: number, indexB: number): number;
160
- }
@@ -1,295 +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
- export class SegmentTreeNode {
9
- /**
10
- * The constructor initializes the properties of a SegmentTreeNode object.
11
- * @param {number} start - The `start` parameter represents the starting index of the segment covered
12
- * by this node in a segment tree.
13
- * @param {number} end - The `end` parameter represents the end index of the segment covered by this
14
- * node in a segment tree.
15
- * @param {number} sum - The `sum` parameter represents the sum of the values in the range covered by
16
- * the segment tree node.
17
- * @param {SegmentTreeNodeVal | undefined} [value] - The `value` parameter is an optional parameter
18
- * of type `SegmentTreeNodeVal`. It represents the value associated with the segment tree node.
19
- */
20
- constructor(start, end, sum, value) {
21
- this._start = start;
22
- this._end = end;
23
- this._sum = sum;
24
- this._value = value || undefined;
25
- }
26
- _start = 0;
27
- /**
28
- * The function returns the value of the protected variable _start.
29
- * @returns The start value, which is of type number.
30
- */
31
- get start() {
32
- return this._start;
33
- }
34
- /**
35
- * The above function sets the value of the "start" property.
36
- * @param {number} value - The value parameter is of type number.
37
- */
38
- set start(value) {
39
- this._start = value;
40
- }
41
- _end = 0;
42
- /**
43
- * The function returns the value of the protected variable `_end`.
44
- * @returns The value of the protected property `_end`.
45
- */
46
- get end() {
47
- return this._end;
48
- }
49
- /**
50
- * The above function sets the value of the "end" property.
51
- * @param {number} value - The value parameter is a number that represents the new value for the end
52
- * property.
53
- */
54
- set end(value) {
55
- this._end = value;
56
- }
57
- _value = undefined;
58
- /**
59
- * The function returns the value of a segment tree node.
60
- * @returns The value being returned is either a `SegmentTreeNodeVal` object or `undefined`.
61
- */
62
- get value() {
63
- return this._value;
64
- }
65
- /**
66
- * The function sets the value of a segment tree node.
67
- * @param {SegmentTreeNodeVal | undefined} value - The `value` parameter is of type
68
- * `SegmentTreeNodeVal` or `undefined`.
69
- */
70
- set value(value) {
71
- this._value = value;
72
- }
73
- _sum = 0;
74
- /**
75
- * The function returns the value of the sum property.
76
- * @returns The method is returning the value of the variable `_sum`.
77
- */
78
- get sum() {
79
- return this._sum;
80
- }
81
- /**
82
- * The above function sets the value of the sum property.
83
- * @param {number} value - The parameter "value" is of type "number".
84
- */
85
- set sum(value) {
86
- this._sum = value;
87
- }
88
- _left = undefined;
89
- /**
90
- * The function returns the left child of a segment tree node.
91
- * @returns The `left` property of the `SegmentTreeNode` object is being returned. It is of type
92
- * `SegmentTreeNode` or `undefined`.
93
- */
94
- get left() {
95
- return this._left;
96
- }
97
- /**
98
- * The function sets the value of the left property of a SegmentTreeNode object.
99
- * @param {SegmentTreeNode | undefined} value - The value parameter is of type SegmentTreeNode or
100
- * undefined.
101
- */
102
- set left(value) {
103
- this._left = value;
104
- }
105
- _right = undefined;
106
- /**
107
- * The function returns the right child of a segment tree node.
108
- * @returns The `getRight()` method is returning a value of type `SegmentTreeNode` or `undefined`.
109
- */
110
- get right() {
111
- return this._right;
112
- }
113
- /**
114
- * The function sets the right child of a segment tree node.
115
- * @param {SegmentTreeNode | undefined} value - The `value` parameter is of type `SegmentTreeNode |
116
- * undefined`. This means that it can accept either a `SegmentTreeNode` object or `undefined` as its
117
- * value.
118
- */
119
- set right(value) {
120
- this._right = value;
121
- }
122
- }
123
- export class SegmentTree {
124
- /**
125
- * The constructor initializes the values, start, end, and root properties of an object.
126
- * @param {number[]} values - An array of numbers that will be used to build a binary search tree.
127
- * @param {number} [start] - The `start` parameter is the index of the first element in the `values` array that should
128
- * be included in the range. If no value is provided for `start`, it defaults to 0, which means the range starts from
129
- * the beginning of the array.
130
- * @param {number} [end] - The "end" parameter is the index of the last element in the "values" array that should be
131
- * included in the range. If not provided, it defaults to the index of the last element in the "values" array.
132
- */
133
- constructor(values, start, end) {
134
- start = start || 0;
135
- end = end || values.length - 1;
136
- this._values = values;
137
- this._start = start;
138
- this._end = end;
139
- if (values.length > 0) {
140
- this._root = this.build(start, end);
141
- }
142
- else {
143
- this._root = undefined;
144
- this._values = [];
145
- }
146
- }
147
- _values = [];
148
- /**
149
- * The function returns an array of numbers.
150
- * @returns An array of numbers is being returned.
151
- */
152
- get values() {
153
- return this._values;
154
- }
155
- _start = 0;
156
- /**
157
- * The function returns the value of the protected variable _start.
158
- * @returns The start value, which is of type number.
159
- */
160
- get start() {
161
- return this._start;
162
- }
163
- _end;
164
- /**
165
- * The function returns the value of the protected variable `_end`.
166
- * @returns The value of the protected property `_end`.
167
- */
168
- get end() {
169
- return this._end;
170
- }
171
- _root;
172
- /**
173
- * The function returns the root node of a segment tree.
174
- * @returns The `root` property of the class `SegmentTreeNode` or `undefined` if it is not defined.
175
- */
176
- get root() {
177
- return this._root;
178
- }
179
- /**
180
- * The build function creates a segment tree by recursively dividing the given range into smaller segments and assigning
181
- * the sum of values to each segment.
182
- * @param {number} start - The `start` parameter represents the starting index of the segment or range for which we are
183
- * building the segment tree.
184
- * @param {number} end - The "end" parameter represents the ending index of the segment or range for which we want to
185
- * build a segment tree.
186
- * @returns a SegmentTreeNode object.
187
- */
188
- build(start, end) {
189
- if (start > end) {
190
- return new SegmentTreeNode(start, end, 0);
191
- }
192
- if (start === end)
193
- return new SegmentTreeNode(start, end, this._values[start]);
194
- const mid = start + Math.floor((end - start) / 2);
195
- const left = this.build(start, mid);
196
- const right = this.build(mid + 1, end);
197
- const cur = new SegmentTreeNode(start, end, left.sum + right.sum);
198
- cur.left = left;
199
- cur.right = right;
200
- return cur;
201
- }
202
- /**
203
- * The function updates the value of a node in a segment tree and recalculates the sum of its children if they exist.
204
- * @param {number} index - The index parameter represents the index of the node in the segment tree that needs to be
205
- * updated.
206
- * @param {number} sum - The `sum` parameter represents the new value that should be assigned to the `sum` property of
207
- * the `SegmentTreeNode` at the specified `index`.
208
- * @param {SegmentTreeNodeVal} [value] - The `value` parameter is an optional value that can be assigned to the `value`
209
- * property of the `SegmentTreeNode` object. It is not currently used in the code, but you can uncomment the line `//
210
- * cur.value = value;` and pass a value for `value` in the
211
- * @returns The function does not return anything.
212
- */
213
- updateNode(index, sum, value) {
214
- const root = this.root || undefined;
215
- if (!root) {
216
- return;
217
- }
218
- const dfs = (cur, index, sum, value) => {
219
- if (cur.start === cur.end && cur.start === index) {
220
- cur.sum = sum;
221
- if (value !== undefined)
222
- cur.value = value;
223
- return;
224
- }
225
- const mid = cur.start + Math.floor((cur.end - cur.start) / 2);
226
- if (index <= mid) {
227
- if (cur.left) {
228
- dfs(cur.left, index, sum, value);
229
- }
230
- }
231
- else {
232
- if (cur.right) {
233
- dfs(cur.right, index, sum, value);
234
- }
235
- }
236
- if (cur.left && cur.right) {
237
- cur.sum = cur.left.sum + cur.right.sum;
238
- }
239
- };
240
- dfs(root, index, sum, value);
241
- }
242
- /**
243
- * The function `querySumByRange` calculates the sum of values within a given range in a segment tree.
244
- * @param {number} indexA - The starting index of the range for which you want to calculate the sum.
245
- * @param {number} indexB - The parameter `indexB` represents the ending index of the range for which you want to
246
- * calculate the sum.
247
- * @returns The function `querySumByRange` returns a number.
248
- */
249
- querySumByRange(indexA, indexB) {
250
- const root = this.root || undefined;
251
- if (!root) {
252
- return 0;
253
- }
254
- if (indexA < 0 || indexB >= this.values.length || indexA > indexB) {
255
- return NaN;
256
- }
257
- const dfs = (cur, i, j) => {
258
- if (i <= cur.start && j >= cur.end) {
259
- // The range [i, j] completely covers the current node's range [cur.start, cur.end]
260
- return cur.sum;
261
- }
262
- const mid = cur.start + Math.floor((cur.end - cur.start) / 2);
263
- if (j <= mid) {
264
- if (cur.left) {
265
- return dfs(cur.left, i, j);
266
- }
267
- else {
268
- return NaN;
269
- }
270
- }
271
- else if (i > mid) {
272
- if (cur.right) {
273
- return dfs(cur.right, i, j);
274
- }
275
- else {
276
- return NaN;
277
- }
278
- }
279
- else {
280
- // Query both left and right subtrees
281
- let leftSum = 0;
282
- let rightSum = 0;
283
- if (cur.left) {
284
- leftSum = dfs(cur.left, i, mid);
285
- }
286
- if (cur.right) {
287
- rightSum = dfs(cur.right, mid + 1, j);
288
- }
289
- return leftSum + rightSum;
290
- }
291
- };
292
- return dfs(root, indexA, indexB);
293
- }
294
- }
295
- //# sourceMappingURL=segment-tree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"segment-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/segment-tree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,OAAO,eAAe;IAC1B;;;;;;;;;;OAUG;IACH,YAAY,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,KAAsC;QACzF,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,SAAS,CAAC;IACnC,CAAC;IAES,MAAM,GAAG,CAAC,CAAC;IAErB;;;OAGG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAES,IA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E,CAAC;gBACb,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;oBACb,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7B,CAAC;qBAAM,CAAC;oBACN,OAAO,GAAG,CAAC;gBACb,CAAC;YACH,CAAC;iBAAM,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;gBACnB,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;oBACd,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9B,CAAC;qBAAM,CAAC;oBACN,OAAO,GAAG,CAAC;gBACb,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,qCAAqC;gBACrC,IAAI,OAAO,GAAG,CAAC,CAAC;gBAChB,IAAI,QAAQ,GAAG,CAAC,CAAC;gBACjB,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;oBACb,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;oBACd,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxC,CAAC;gBACD,OAAO,OAAO,GAAG,QAAQ,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC;QACF,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -1,190 +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, BSTNOptKeyOrNode, EntryCallback, IterationType, RBTNColor, TreeCounterOptions } from '../../types';
9
- import { BSTOptions } from '../../types';
10
- import { BSTNode } from './bst';
11
- import { IBinaryTree } from '../../interfaces';
12
- import { RedBlackTree, RedBlackTreeNode } from './red-black-tree';
13
- /**
14
- * RB-tree node with an extra 'count' field; keeps parent/child links.
15
- * @remarks Time O(1), Space O(1)
16
- * @template K
17
- * @template V
18
- */
19
- export declare class TreeCounterNode<K = any, V = any> extends RedBlackTreeNode<K, V> {
20
- parent?: TreeCounterNode<K, V>;
21
- /**
22
- * Create a tree counter node.
23
- * @remarks Time O(1), Space O(1)
24
- * @param key - Key of the node.
25
- * @param [value] - Value associated with the key (ignored in map mode).
26
- * @param [count] - Initial count for this node (default 1).
27
- * @param color - Initial color ('RED' or 'BLACK').
28
- * @returns New TreeCounterNode instance.
29
- */
30
- constructor(key: K, value?: V, count?: number, color?: RBTNColor);
31
- _left?: TreeCounterNode<K, V> | null | undefined;
32
- /**
33
- * Get the left child pointer.
34
- * @remarks Time O(1), Space O(1)
35
- * @returns Left child node, or null/undefined.
36
- */
37
- get left(): TreeCounterNode<K, V> | null | undefined;
38
- /**
39
- * Set the left child and update its parent pointer.
40
- * @remarks Time O(1), Space O(1)
41
- * @param v - New left child node, or null/undefined.
42
- * @returns void
43
- */
44
- set left(v: TreeCounterNode<K, V> | null | undefined);
45
- _right?: TreeCounterNode<K, V> | null | undefined;
46
- /**
47
- * Get the right child pointer.
48
- * @remarks Time O(1), Space O(1)
49
- * @returns Right child node, or null/undefined.
50
- */
51
- get right(): TreeCounterNode<K, V> | null | undefined;
52
- /**
53
- * Set the right child and update its parent pointer.
54
- * @remarks Time O(1), Space O(1)
55
- * @param v - New right child node, or null/undefined.
56
- * @returns void
57
- */
58
- set right(v: TreeCounterNode<K, V> | null | undefined);
59
- }
60
- /**
61
- * Red-Black Tree–based counter map (key → value with per-node count). Supports O(log N) updates and map-like mode.
62
- * @remarks Time O(1), Space O(1)
63
- * @template K
64
- * @template V
65
- * @template R
66
- */
67
- export declare class TreeCounter<K = any, V = any, R extends object = object> extends RedBlackTree<K, V, R> implements IBinaryTree<K, V, R> {
68
- /**
69
- * Create a TreeCounter and optionally bulk-insert items.
70
- * @remarks Time O(N log N), Space O(N)
71
- * @param [keysNodesEntriesOrRaws] - Iterable of keys/nodes/entries/raw items to insert.
72
- * @param [options] - Options for TreeCounter (comparator, reverse, map mode).
73
- * @returns New TreeCounter instance.
74
- */
75
- constructor(keysNodesEntriesOrRaws?: Iterable<K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, options?: TreeCounterOptions<K, V, R>);
76
- protected _count: number;
77
- /**
78
- * Get the total aggregate count across all nodes.
79
- * @remarks Time O(1), Space O(1)
80
- * @returns Total count.
81
- */
82
- get count(): number;
83
- /**
84
- * Compute the total count by traversing the tree (sums node.count).
85
- * @remarks Time O(N), Space O(H)
86
- * @returns Total count recomputed from nodes.
87
- */
88
- getComputedCount(): number;
89
- _createNode(key: K, value?: V, color?: RBTNColor, count?: number): TreeCounterNode<K, V>;
90
- /**
91
- * Type guard: check whether the input is a TreeCounterNode.
92
- * @remarks Time O(1), Space O(1)
93
- * @returns True if the value is a TreeCounterNode.
94
- */
95
- isNode(keyNodeOrEntry: K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined): keyNodeOrEntry is TreeCounterNode<K, V>;
96
- /**
97
- * Insert or increment a node and update aggregate count.
98
- * @remarks Time O(log N), Space O(1)
99
- * @param keyNodeOrEntry - Key, node, or [key, value] entry to insert.
100
- * @param [value] - Value when a bare key is provided (ignored in map mode).
101
- * @param [count] - How much to increase the node's count (default 1).
102
- * @returns True if inserted/updated; false if ignored.
103
- */
104
- add(keyNodeOrEntry: K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): boolean;
105
- /**
106
- * Delete a node (or decrement its count) and rebalance if needed.
107
- * @remarks Time O(log N), Space O(1)
108
- * @param keyNodeOrEntry - Key, node, or [key, value] entry identifying the node.
109
- * @param [ignoreCount] - If true, remove the node regardless of its count.
110
- * @returns Array of deletion results including deleted node and a rebalance hint when present.
111
- */
112
- delete(keyNodeOrEntry: K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, ignoreCount?: boolean): BinaryTreeDeleteResult<TreeCounterNode<K, V>>[];
113
- /**
114
- * Remove all nodes and reset aggregate counters.
115
- * @remarks Time O(N), Space O(1)
116
- * @returns void
117
- */
118
- clear(): void;
119
- /**
120
- * Rebuild the tree into a perfectly balanced form using in-order nodes.
121
- * @remarks Time O(N), Space O(N)
122
- * @param [iterationType] - Traversal style to use when constructing the balanced tree.
123
- * @returns True if rebalancing succeeded (tree not empty).
124
- */
125
- perfectlyBalance(iterationType?: IterationType): boolean;
126
- /**
127
- * Create a new TreeCounter by mapping each [key, value] entry.
128
- * @remarks Time O(N log N), Space O(N)
129
- * @template MK
130
- * @template MV
131
- * @template MR
132
- * @param callback - Function mapping (key, value, index, tree) → [newKey, newValue].
133
- * @param [options] - Options for the output tree.
134
- * @param [thisArg] - Value for `this` inside the callback.
135
- * @returns A new TreeCounter with mapped entries.
136
- */
137
- map<MK = K, MV = V, MR extends object = object>(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: Partial<BinaryTreeOptions<MK, MV, MR>>, thisArg?: unknown): TreeCounter<MK, MV, MR>;
138
- /**
139
- * Deep copy this tree, preserving map mode and aggregate counts.
140
- * @remarks Time O(N), Space O(N)
141
- * @returns A deep copy of this tree.
142
- */
143
- clone(): this;
144
- /**
145
- * (Protected) Create an empty instance of the same concrete class.
146
- * @remarks Time O(1), Space O(1)
147
- * @template TK
148
- * @template TV
149
- * @template TR
150
- * @param [options] - Optional constructor options for the like-kind instance.
151
- * @returns An empty like-kind instance.
152
- */
153
- protected _createInstance<TK = K, TV = V, TR extends object = R>(options?: Partial<BSTOptions<TK, TV, TR>>): this;
154
- /**
155
- * (Protected) Create a like-kind instance and seed it from an iterable.
156
- * @remarks Time O(N log N), Space O(N)
157
- * @template TK
158
- * @template TV
159
- * @template TR
160
- * @param iter - Iterable used to seed the new tree.
161
- * @param [options] - Options merged with the current snapshot.
162
- * @returns A like-kind TreeCounter built from the iterable.
163
- */
164
- protected _createLike<TK = K, TV = V, TR extends object = R>(iter?: Iterable<TK | BSTNode<TK, TV> | [TK | null | undefined, TV | undefined] | null | undefined | TR>, options?: Partial<BSTOptions<TK, TV, TR>>): TreeCounter<TK, TV, TR>;
165
- /**
166
- * (Protected) Normalize input into a node plus its effective value and count.
167
- * @remarks Time O(1), Space O(1)
168
- * @param keyNodeOrEntry - Key, node, or [key, value] entry.
169
- * @param [value] - Value used when a bare key is provided.
170
- * @param [count] - Count increment to apply (default 1).
171
- * @returns Tuple [node, value] where node may be undefined.
172
- */
173
- protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry: K | TreeCounterNode<K, V> | [K | null | undefined, V | undefined] | null | undefined, value?: V, count?: number): [TreeCounterNode<K, V> | undefined, V | undefined];
174
- /**
175
- * (Protected) Swap keys/values/counters between the source and destination nodes.
176
- * @remarks Time O(1), Space O(1)
177
- * @param srcNode - Source node (or key) whose properties will be moved.
178
- * @param destNode - Destination node (or key) to receive properties.
179
- * @returns Destination node after swap, or undefined.
180
- */
181
- protected _swapProperties(srcNode: BSTNOptKeyOrNode<K, TreeCounterNode<K, V>>, destNode: BSTNOptKeyOrNode<K, TreeCounterNode<K, V>>): TreeCounterNode<K, V> | undefined;
182
- /**
183
- * (Protected) Replace one node by another and adjust counters accordingly.
184
- * @remarks Time O(1), Space O(1)
185
- * @param oldNode - Node being replaced.
186
- * @param newNode - Replacement node.
187
- * @returns The new node after replacement.
188
- */
189
- protected _replaceNode(oldNode: TreeCounterNode<K, V>, newNode: TreeCounterNode<K, V>): TreeCounterNode<K, V>;
190
- }