data-structure-typed 1.40.0-rc → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1065) hide show
  1. package/.eslintrc.js +7 -5
  2. package/.github/workflows/ci.yml +2 -20
  3. package/.travis.yml +3 -4
  4. package/CHANGELOG.md +22 -1
  5. package/CONTRIBUTING.md +13 -0
  6. package/README.md +20 -11
  7. package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +106 -0
  8. package/dist/cjs/data-structures/binary-tree/avl-tree.js +348 -0
  9. package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -0
  10. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.d.ts +149 -0
  11. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +270 -0
  12. package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
  13. package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +355 -0
  14. package/dist/cjs/data-structures/binary-tree/binary-tree.js +1116 -0
  15. package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -0
  16. package/dist/cjs/data-structures/binary-tree/bst.d.ts +167 -0
  17. package/dist/cjs/data-structures/binary-tree/bst.js +513 -0
  18. package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -0
  19. package/dist/cjs/data-structures/binary-tree/index.d.ts +7 -0
  20. package/dist/cjs/data-structures/binary-tree/index.js +24 -0
  21. package/dist/cjs/data-structures/binary-tree/index.js.map +1 -0
  22. package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +11 -0
  23. package/dist/cjs/data-structures/binary-tree/rb-tree.js +22 -0
  24. package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -0
  25. package/dist/cjs/data-structures/binary-tree/segment-tree.d.ts +67 -0
  26. package/dist/cjs/data-structures/binary-tree/segment-tree.js +181 -0
  27. package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -0
  28. package/dist/cjs/data-structures/binary-tree/tree-multiset.d.ts +126 -0
  29. package/dist/cjs/data-structures/binary-tree/tree-multiset.js +356 -0
  30. package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -0
  31. package/dist/cjs/data-structures/graph/abstract-graph.d.ts +313 -0
  32. package/dist/cjs/data-structures/graph/abstract-graph.js +885 -0
  33. package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -0
  34. package/dist/cjs/data-structures/graph/directed-graph.d.ts +194 -0
  35. package/dist/cjs/data-structures/graph/directed-graph.js +405 -0
  36. package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -0
  37. package/dist/cjs/data-structures/graph/index.js.map +1 -0
  38. package/dist/cjs/data-structures/graph/map-graph.d.ts +73 -0
  39. package/dist/cjs/data-structures/graph/map-graph.js +94 -0
  40. package/dist/cjs/data-structures/graph/map-graph.js.map +1 -0
  41. package/dist/cjs/data-structures/graph/undirected-graph.d.ts +120 -0
  42. package/dist/cjs/data-structures/graph/undirected-graph.js +240 -0
  43. package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -0
  44. package/dist/cjs/data-structures/hash/coordinate-map.d.ts +44 -0
  45. package/dist/cjs/data-structures/hash/coordinate-map.js +63 -0
  46. package/dist/cjs/data-structures/hash/coordinate-map.js.map +1 -0
  47. package/dist/cjs/data-structures/hash/coordinate-set.d.ts +36 -0
  48. package/dist/cjs/data-structures/hash/coordinate-set.js +53 -0
  49. package/dist/cjs/data-structures/hash/coordinate-set.js.map +1 -0
  50. package/dist/cjs/data-structures/hash/hash-map.d.ts +50 -0
  51. package/dist/cjs/data-structures/hash/hash-map.js +154 -0
  52. package/dist/cjs/data-structures/hash/hash-map.js.map +1 -0
  53. package/dist/cjs/data-structures/hash/hash-table.d.ts +103 -0
  54. package/dist/cjs/data-structures/hash/hash-table.js +237 -0
  55. package/dist/cjs/data-structures/hash/hash-table.js.map +1 -0
  56. package/dist/cjs/data-structures/hash/index.d.ts +6 -0
  57. package/dist/cjs/data-structures/hash/index.js +23 -0
  58. package/dist/cjs/data-structures/hash/index.js.map +1 -0
  59. package/dist/cjs/data-structures/hash/tree-map.js.map +1 -0
  60. package/dist/cjs/data-structures/hash/tree-set.js.map +1 -0
  61. package/dist/cjs/data-structures/heap/heap.d.ts +235 -0
  62. package/dist/cjs/data-structures/heap/heap.js +516 -0
  63. package/dist/cjs/data-structures/heap/heap.js.map +1 -0
  64. package/dist/cjs/data-structures/heap/index.js.map +1 -0
  65. package/dist/cjs/data-structures/heap/max-heap.d.ts +15 -0
  66. package/dist/cjs/data-structures/heap/max-heap.js +27 -0
  67. package/dist/cjs/data-structures/heap/max-heap.js.map +1 -0
  68. package/dist/cjs/data-structures/heap/min-heap.d.ts +15 -0
  69. package/dist/cjs/data-structures/heap/min-heap.js +27 -0
  70. package/dist/cjs/data-structures/heap/min-heap.js.map +1 -0
  71. package/dist/cjs/data-structures/index.js.map +1 -0
  72. package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +253 -0
  73. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +570 -0
  74. package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -0
  75. package/dist/cjs/data-structures/linked-list/index.js.map +1 -0
  76. package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +232 -0
  77. package/dist/cjs/data-structures/linked-list/singly-linked-list.js +534 -0
  78. package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -0
  79. package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +80 -0
  80. package/dist/cjs/data-structures/linked-list/skip-linked-list.js +188 -0
  81. package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -0
  82. package/dist/cjs/data-structures/matrix/index.js.map +1 -0
  83. package/dist/cjs/data-structures/matrix/matrix.d.ts +21 -0
  84. package/dist/cjs/data-structures/matrix/matrix.js.map +1 -0
  85. package/dist/cjs/data-structures/matrix/matrix2d.d.ts +107 -0
  86. package/dist/cjs/data-structures/matrix/matrix2d.js +200 -0
  87. package/dist/cjs/data-structures/matrix/matrix2d.js.map +1 -0
  88. package/dist/cjs/data-structures/matrix/navigator.d.ts +52 -0
  89. package/dist/cjs/data-structures/matrix/navigator.js.map +1 -0
  90. package/dist/cjs/data-structures/matrix/vector2d.d.ts +200 -0
  91. package/dist/cjs/data-structures/matrix/vector2d.js +291 -0
  92. package/dist/cjs/data-structures/matrix/vector2d.js.map +1 -0
  93. package/dist/cjs/data-structures/priority-queue/index.js.map +1 -0
  94. package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
  95. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +27 -0
  96. package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -0
  97. package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
  98. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +27 -0
  99. package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -0
  100. package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +15 -0
  101. package/dist/cjs/data-structures/priority-queue/priority-queue.js +18 -0
  102. package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -0
  103. package/dist/cjs/data-structures/queue/deque.d.ts +161 -0
  104. package/dist/cjs/data-structures/queue/deque.js +265 -0
  105. package/dist/cjs/data-structures/queue/deque.js.map +1 -0
  106. package/dist/cjs/data-structures/queue/index.js.map +1 -0
  107. package/dist/cjs/data-structures/queue/queue.d.ts +122 -0
  108. package/dist/cjs/data-structures/queue/queue.js +188 -0
  109. package/dist/cjs/data-structures/queue/queue.js.map +1 -0
  110. package/dist/cjs/data-structures/stack/index.js.map +1 -0
  111. package/dist/cjs/data-structures/stack/stack.d.ts +64 -0
  112. package/dist/cjs/data-structures/stack/stack.js +95 -0
  113. package/dist/cjs/data-structures/stack/stack.js.map +1 -0
  114. package/dist/cjs/data-structures/tree/index.js.map +1 -0
  115. package/dist/cjs/data-structures/tree/tree.d.ts +8 -0
  116. package/dist/cjs/data-structures/tree/tree.js +41 -0
  117. package/dist/cjs/data-structures/tree/tree.js.map +1 -0
  118. package/dist/cjs/data-structures/trie/index.js.map +1 -0
  119. package/dist/cjs/data-structures/trie/trie.d.ts +79 -0
  120. package/dist/cjs/data-structures/trie/trie.js +252 -0
  121. package/dist/cjs/data-structures/trie/trie.js.map +1 -0
  122. package/dist/cjs/index.js.map +1 -0
  123. package/dist/cjs/interfaces/binary-tree.d.ts +7 -0
  124. package/dist/cjs/interfaces/binary-tree.js.map +1 -0
  125. package/dist/cjs/interfaces/doubly-linked-list.js.map +1 -0
  126. package/dist/cjs/interfaces/graph.d.ts +5 -0
  127. package/dist/cjs/interfaces/graph.js +3 -0
  128. package/dist/cjs/interfaces/graph.js.map +1 -0
  129. package/dist/cjs/interfaces/heap.js.map +1 -0
  130. package/dist/cjs/interfaces/index.d.ts +8 -0
  131. package/dist/cjs/interfaces/index.js +25 -0
  132. package/dist/cjs/interfaces/index.js.map +1 -0
  133. package/dist/cjs/interfaces/navigator.js.map +1 -0
  134. package/dist/cjs/interfaces/priority-queue.js.map +1 -0
  135. package/dist/cjs/interfaces/segment-tree.js.map +1 -0
  136. package/dist/cjs/interfaces/singly-linked-list.js.map +1 -0
  137. package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
  138. package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +1 -0
  139. package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js +3 -0
  140. package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
  141. package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
  142. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +25 -0
  143. package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -0
  144. package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +7 -0
  145. package/dist/cjs/types/data-structures/binary-tree/bst.js.map +1 -0
  146. package/dist/cjs/types/data-structures/binary-tree/index.d.ts +6 -0
  147. package/dist/cjs/types/data-structures/binary-tree/index.js +23 -0
  148. package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -0
  149. package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +8 -0
  150. package/dist/cjs/types/data-structures/binary-tree/rb-tree.js.map +1 -0
  151. package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +1 -0
  152. package/dist/cjs/types/data-structures/binary-tree/tree-multiset.d.ts +4 -0
  153. package/dist/cjs/types/data-structures/binary-tree/tree-multiset.js.map +1 -0
  154. package/dist/cjs/types/data-structures/graph/abstract-graph.d.ts +10 -0
  155. package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +1 -0
  156. package/dist/cjs/types/data-structures/graph/directed-graph.js.map +1 -0
  157. package/dist/cjs/types/data-structures/graph/index.d.ts +3 -0
  158. package/dist/cjs/types/data-structures/graph/index.js +20 -0
  159. package/dist/cjs/types/data-structures/graph/index.js.map +1 -0
  160. package/dist/cjs/types/data-structures/graph/map-graph.js.map +1 -0
  161. package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +1 -0
  162. package/dist/cjs/types/data-structures/hash/coordinate-map.js +3 -0
  163. package/dist/cjs/types/data-structures/hash/coordinate-map.js.map +1 -0
  164. package/dist/cjs/types/data-structures/hash/coordinate-set.js +3 -0
  165. package/dist/cjs/types/data-structures/hash/coordinate-set.js.map +1 -0
  166. package/dist/cjs/types/data-structures/hash/hash-map.js +3 -0
  167. package/dist/cjs/types/data-structures/hash/hash-map.js.map +1 -0
  168. package/dist/cjs/types/data-structures/hash/hash-table.js +3 -0
  169. package/dist/cjs/types/data-structures/hash/hash-table.js.map +1 -0
  170. package/dist/cjs/types/data-structures/hash/index.js +3 -0
  171. package/dist/cjs/types/data-structures/hash/index.js.map +1 -0
  172. package/dist/cjs/types/data-structures/hash/tree-map.js +3 -0
  173. package/dist/cjs/types/data-structures/hash/tree-map.js.map +1 -0
  174. package/dist/cjs/types/data-structures/hash/tree-set.js +3 -0
  175. package/dist/cjs/types/data-structures/hash/tree-set.js.map +1 -0
  176. package/dist/cjs/types/data-structures/heap/heap.js.map +1 -0
  177. package/dist/cjs/types/data-structures/heap/index.d.ts +1 -0
  178. package/dist/cjs/types/data-structures/heap/index.js +18 -0
  179. package/dist/cjs/types/data-structures/heap/index.js.map +1 -0
  180. package/dist/cjs/types/data-structures/heap/max-heap.js +3 -0
  181. package/dist/cjs/types/data-structures/heap/max-heap.js.map +1 -0
  182. package/dist/cjs/types/data-structures/heap/min-heap.js +3 -0
  183. package/dist/cjs/types/data-structures/heap/min-heap.js.map +1 -0
  184. package/dist/cjs/types/data-structures/index.d.ts +11 -0
  185. package/dist/cjs/types/data-structures/index.js +28 -0
  186. package/dist/cjs/types/data-structures/index.js.map +1 -0
  187. package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +1 -0
  188. package/dist/cjs/types/data-structures/linked-list/index.d.ts +2 -0
  189. package/dist/cjs/types/data-structures/linked-list/index.js +19 -0
  190. package/dist/cjs/types/data-structures/linked-list/index.js.map +1 -0
  191. package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +1 -0
  192. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js +3 -0
  193. package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +1 -0
  194. package/dist/cjs/types/data-structures/matrix/index.d.ts +1 -0
  195. package/dist/cjs/types/data-structures/matrix/index.js +18 -0
  196. package/dist/cjs/types/data-structures/matrix/index.js.map +1 -0
  197. package/dist/cjs/types/data-structures/matrix/matrix.js +3 -0
  198. package/dist/cjs/types/data-structures/matrix/matrix.js.map +1 -0
  199. package/dist/cjs/types/data-structures/matrix/matrix2d.js +3 -0
  200. package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +1 -0
  201. package/dist/cjs/types/data-structures/matrix/navigator.js.map +1 -0
  202. package/dist/cjs/types/data-structures/matrix/vector2d.js +3 -0
  203. package/dist/cjs/types/data-structures/matrix/vector2d.js.map +1 -0
  204. package/dist/cjs/types/data-structures/priority-queue/index.js +20 -0
  205. package/dist/cjs/types/data-structures/priority-queue/index.js.map +1 -0
  206. package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js +3 -0
  207. package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +1 -0
  208. package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js +3 -0
  209. package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +1 -0
  210. package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +1 -0
  211. package/dist/cjs/types/data-structures/queue/deque.js +3 -0
  212. package/dist/cjs/types/data-structures/queue/deque.js.map +1 -0
  213. package/dist/cjs/types/data-structures/queue/index.js +19 -0
  214. package/dist/cjs/types/data-structures/queue/index.js.map +1 -0
  215. package/dist/cjs/types/data-structures/queue/queue.js +3 -0
  216. package/dist/cjs/types/data-structures/queue/queue.js.map +1 -0
  217. package/dist/cjs/types/data-structures/stack/index.js +18 -0
  218. package/dist/cjs/types/data-structures/stack/index.js.map +1 -0
  219. package/dist/cjs/types/data-structures/stack/stack.js +3 -0
  220. package/dist/cjs/types/data-structures/stack/stack.js.map +1 -0
  221. package/dist/cjs/types/data-structures/tree/index.js +18 -0
  222. package/dist/cjs/types/data-structures/tree/index.js.map +1 -0
  223. package/dist/cjs/types/data-structures/tree/tree.js +3 -0
  224. package/dist/cjs/types/data-structures/tree/tree.js.map +1 -0
  225. package/dist/cjs/types/data-structures/trie/index.js +18 -0
  226. package/dist/cjs/types/data-structures/trie/index.js.map +1 -0
  227. package/dist/cjs/types/data-structures/trie/trie.js +3 -0
  228. package/dist/cjs/types/data-structures/trie/trie.js.map +1 -0
  229. package/dist/cjs/types/helpers.d.ts +8 -0
  230. package/dist/cjs/types/helpers.js +10 -0
  231. package/dist/cjs/types/helpers.js.map +1 -0
  232. package/dist/cjs/types/index.js.map +1 -0
  233. package/dist/cjs/types/utils/index.js.map +1 -0
  234. package/dist/cjs/types/utils/utils.js.map +1 -0
  235. package/dist/cjs/types/utils/validate-type.js.map +1 -0
  236. package/dist/cjs/utils/index.js.map +1 -0
  237. package/dist/cjs/utils/utils.d.ts +20 -0
  238. package/dist/cjs/utils/utils.js +74 -0
  239. package/dist/cjs/utils/utils.js.map +1 -0
  240. package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +106 -0
  241. package/dist/mjs/data-structures/binary-tree/avl-tree.js +348 -0
  242. package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.d.ts +149 -0
  243. package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.js +274 -0
  244. package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +355 -0
  245. package/dist/mjs/data-structures/binary-tree/binary-tree.js +1127 -0
  246. package/dist/mjs/data-structures/binary-tree/bst.d.ts +167 -0
  247. package/dist/mjs/data-structures/binary-tree/bst.js +509 -0
  248. package/dist/mjs/data-structures/binary-tree/index.d.ts +7 -0
  249. package/dist/mjs/data-structures/binary-tree/index.js +23 -0
  250. package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +11 -0
  251. package/dist/mjs/data-structures/binary-tree/rb-tree.js +22 -0
  252. package/dist/mjs/data-structures/binary-tree/segment-tree.d.ts +67 -0
  253. package/dist/mjs/data-structures/binary-tree/segment-tree.js +182 -0
  254. package/dist/mjs/data-structures/binary-tree/tree-multiset.d.ts +126 -0
  255. package/dist/mjs/data-structures/binary-tree/tree-multiset.js +356 -0
  256. package/dist/mjs/data-structures/graph/abstract-graph.d.ts +313 -0
  257. package/dist/mjs/data-structures/graph/abstract-graph.js +883 -0
  258. package/dist/mjs/data-structures/graph/directed-graph.d.ts +194 -0
  259. package/dist/mjs/data-structures/graph/directed-graph.js +406 -0
  260. package/dist/mjs/data-structures/graph/index.js +20 -0
  261. package/dist/mjs/data-structures/graph/map-graph.d.ts +73 -0
  262. package/dist/mjs/data-structures/graph/map-graph.js +96 -0
  263. package/dist/mjs/data-structures/graph/undirected-graph.d.ts +120 -0
  264. package/dist/mjs/data-structures/graph/undirected-graph.js +239 -0
  265. package/dist/mjs/data-structures/hash/coordinate-map.d.ts +44 -0
  266. package/dist/mjs/data-structures/hash/coordinate-map.js +62 -0
  267. package/dist/mjs/data-structures/hash/coordinate-set.d.ts +36 -0
  268. package/dist/mjs/data-structures/hash/coordinate-set.js +52 -0
  269. package/dist/mjs/data-structures/hash/hash-map.d.ts +50 -0
  270. package/dist/mjs/data-structures/hash/hash-map.js +159 -0
  271. package/dist/mjs/data-structures/hash/hash-table.d.ts +103 -0
  272. package/dist/mjs/data-structures/hash/hash-table.js +243 -0
  273. package/dist/mjs/data-structures/hash/index.d.ts +6 -0
  274. package/dist/mjs/data-structures/hash/index.js +22 -0
  275. package/dist/mjs/data-structures/hash/tree-map.js +6 -0
  276. package/dist/mjs/data-structures/hash/tree-set.js +6 -0
  277. package/dist/mjs/data-structures/heap/heap.d.ts +235 -0
  278. package/dist/mjs/data-structures/heap/heap.js +525 -0
  279. package/dist/mjs/data-structures/heap/index.js +19 -0
  280. package/dist/mjs/data-structures/heap/max-heap.d.ts +15 -0
  281. package/dist/mjs/data-structures/heap/max-heap.js +26 -0
  282. package/dist/mjs/data-structures/heap/min-heap.d.ts +15 -0
  283. package/dist/mjs/data-structures/heap/min-heap.js +26 -0
  284. package/dist/mjs/data-structures/index.js +27 -0
  285. package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +253 -0
  286. package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +573 -0
  287. package/dist/mjs/data-structures/linked-list/index.js +19 -0
  288. package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +232 -0
  289. package/dist/mjs/data-structures/linked-list/singly-linked-list.js +538 -0
  290. package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +80 -0
  291. package/dist/mjs/data-structures/linked-list/skip-linked-list.js +194 -0
  292. package/dist/mjs/data-structures/matrix/index.js +20 -0
  293. package/dist/mjs/data-structures/matrix/matrix.d.ts +21 -0
  294. package/dist/mjs/data-structures/matrix/matrix.js +29 -0
  295. package/dist/mjs/data-structures/matrix/matrix2d.d.ts +107 -0
  296. package/dist/mjs/data-structures/matrix/matrix2d.js +200 -0
  297. package/dist/mjs/data-structures/matrix/navigator.d.ts +52 -0
  298. package/dist/mjs/data-structures/matrix/navigator.js +113 -0
  299. package/dist/mjs/data-structures/matrix/vector2d.d.ts +200 -0
  300. package/dist/mjs/data-structures/matrix/vector2d.js +293 -0
  301. package/dist/mjs/data-structures/priority-queue/index.js +19 -0
  302. package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
  303. package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +26 -0
  304. package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
  305. package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +26 -0
  306. package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +15 -0
  307. package/dist/mjs/data-structures/priority-queue/priority-queue.js +17 -0
  308. package/dist/mjs/data-structures/queue/deque.d.ts +161 -0
  309. package/dist/mjs/data-structures/queue/deque.js +257 -0
  310. package/dist/mjs/data-structures/queue/index.js +18 -0
  311. package/dist/mjs/data-structures/queue/queue.d.ts +122 -0
  312. package/dist/mjs/data-structures/queue/queue.js +188 -0
  313. package/dist/mjs/data-structures/stack/index.js +17 -0
  314. package/dist/mjs/data-structures/stack/stack.d.ts +64 -0
  315. package/dist/mjs/data-structures/stack/stack.js +95 -0
  316. package/dist/mjs/data-structures/tree/index.js +17 -0
  317. package/dist/mjs/data-structures/tree/tree.d.ts +8 -0
  318. package/dist/mjs/data-structures/tree/tree.js +43 -0
  319. package/dist/mjs/data-structures/trie/index.js +17 -0
  320. package/dist/mjs/data-structures/trie/trie.d.ts +79 -0
  321. package/dist/mjs/data-structures/trie/trie.js +256 -0
  322. package/dist/mjs/index.js +20 -0
  323. package/dist/mjs/interfaces/binary-tree.d.ts +7 -0
  324. package/dist/mjs/interfaces/binary-tree.js +2 -0
  325. package/dist/mjs/interfaces/doubly-linked-list.js +2 -0
  326. package/dist/mjs/interfaces/graph.d.ts +5 -0
  327. package/dist/mjs/interfaces/graph.js +2 -0
  328. package/dist/mjs/interfaces/heap.js +2 -0
  329. package/dist/mjs/interfaces/index.d.ts +8 -0
  330. package/dist/mjs/interfaces/index.js +24 -0
  331. package/dist/mjs/interfaces/navigator.js +2 -0
  332. package/dist/mjs/interfaces/priority-queue.js +2 -0
  333. package/dist/mjs/interfaces/segment-tree.js +2 -0
  334. package/dist/mjs/interfaces/singly-linked-list.js +2 -0
  335. package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
  336. package/dist/mjs/types/data-structures/binary-tree/avl-tree.js +2 -0
  337. package/dist/mjs/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
  338. package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
  339. package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +24 -0
  340. package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +7 -0
  341. package/dist/mjs/types/data-structures/binary-tree/bst.js +2 -0
  342. package/dist/mjs/types/data-structures/binary-tree/index.d.ts +6 -0
  343. package/dist/mjs/types/data-structures/binary-tree/index.js +22 -0
  344. package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +8 -0
  345. package/dist/mjs/types/data-structures/binary-tree/rb-tree.js +8 -0
  346. package/dist/mjs/types/data-structures/binary-tree/segment-tree.js +2 -0
  347. package/dist/mjs/types/data-structures/binary-tree/tree-multiset.d.ts +4 -0
  348. package/dist/mjs/types/data-structures/binary-tree/tree-multiset.js +2 -0
  349. package/dist/mjs/types/data-structures/graph/abstract-graph.d.ts +10 -0
  350. package/dist/mjs/types/data-structures/graph/abstract-graph.js +2 -0
  351. package/dist/mjs/types/data-structures/graph/directed-graph.js +9 -0
  352. package/dist/mjs/types/data-structures/graph/index.d.ts +3 -0
  353. package/dist/mjs/types/data-structures/graph/index.js +19 -0
  354. package/dist/mjs/types/data-structures/graph/map-graph.js +2 -0
  355. package/dist/mjs/types/data-structures/graph/undirected-graph.js +2 -0
  356. package/dist/mjs/types/data-structures/hash/coordinate-map.js +2 -0
  357. package/dist/mjs/types/data-structures/hash/coordinate-set.js +2 -0
  358. package/dist/mjs/types/data-structures/hash/hash-map.js +2 -0
  359. package/dist/mjs/types/data-structures/hash/hash-table.js +2 -0
  360. package/dist/mjs/types/data-structures/hash/index.js +2 -0
  361. package/dist/mjs/types/data-structures/hash/tree-map.js +2 -0
  362. package/dist/mjs/types/data-structures/hash/tree-set.js +2 -0
  363. package/dist/mjs/types/data-structures/heap/heap.js +2 -0
  364. package/dist/mjs/types/data-structures/heap/index.d.ts +1 -0
  365. package/dist/mjs/types/data-structures/heap/index.js +17 -0
  366. package/dist/mjs/types/data-structures/heap/max-heap.js +2 -0
  367. package/dist/mjs/types/data-structures/heap/min-heap.js +2 -0
  368. package/dist/mjs/types/data-structures/index.d.ts +11 -0
  369. package/dist/mjs/types/data-structures/index.js +27 -0
  370. package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.js +2 -0
  371. package/dist/mjs/types/data-structures/linked-list/index.d.ts +2 -0
  372. package/dist/mjs/types/data-structures/linked-list/index.js +18 -0
  373. package/dist/mjs/types/data-structures/linked-list/singly-linked-list.js +2 -0
  374. package/dist/mjs/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
  375. package/dist/mjs/types/data-structures/linked-list/skip-linked-list.js +2 -0
  376. package/dist/mjs/types/data-structures/matrix/index.d.ts +1 -0
  377. package/dist/mjs/types/data-structures/matrix/index.js +17 -0
  378. package/dist/mjs/types/data-structures/matrix/matrix.d.ts +1 -0
  379. package/dist/mjs/types/data-structures/matrix/matrix.js +2 -0
  380. package/dist/mjs/types/data-structures/matrix/matrix2d.d.ts +1 -0
  381. package/dist/mjs/types/data-structures/matrix/matrix2d.js +2 -0
  382. package/dist/mjs/types/data-structures/matrix/navigator.js +2 -0
  383. package/dist/mjs/types/data-structures/matrix/vector2d.d.ts +1 -0
  384. package/dist/mjs/types/data-structures/matrix/vector2d.js +2 -0
  385. package/dist/mjs/types/data-structures/priority-queue/index.d.ts +3 -0
  386. package/dist/mjs/types/data-structures/priority-queue/index.js +19 -0
  387. package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
  388. package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.js +2 -0
  389. package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
  390. package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.js +2 -0
  391. package/dist/mjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  392. package/dist/mjs/types/data-structures/priority-queue/priority-queue.js +2 -0
  393. package/dist/mjs/types/data-structures/queue/deque.d.ts +1 -0
  394. package/dist/mjs/types/data-structures/queue/deque.js +2 -0
  395. package/dist/mjs/types/data-structures/queue/index.d.ts +2 -0
  396. package/dist/mjs/types/data-structures/queue/index.js +18 -0
  397. package/dist/mjs/types/data-structures/queue/queue.d.ts +1 -0
  398. package/dist/mjs/types/data-structures/queue/queue.js +2 -0
  399. package/dist/mjs/types/data-structures/stack/index.d.ts +1 -0
  400. package/dist/mjs/types/data-structures/stack/index.js +17 -0
  401. package/dist/mjs/types/data-structures/stack/stack.d.ts +1 -0
  402. package/dist/mjs/types/data-structures/stack/stack.js +2 -0
  403. package/dist/mjs/types/data-structures/tree/index.d.ts +1 -0
  404. package/dist/mjs/types/data-structures/tree/index.js +17 -0
  405. package/dist/mjs/types/data-structures/tree/tree.d.ts +1 -0
  406. package/dist/mjs/types/data-structures/tree/tree.js +2 -0
  407. package/dist/mjs/types/data-structures/trie/index.d.ts +1 -0
  408. package/dist/mjs/types/data-structures/trie/index.js +17 -0
  409. package/dist/mjs/types/data-structures/trie/trie.d.ts +1 -0
  410. package/dist/mjs/types/data-structures/trie/trie.js +2 -0
  411. package/dist/mjs/types/helpers.d.ts +8 -0
  412. package/dist/mjs/types/helpers.js +9 -0
  413. package/dist/mjs/types/index.js +19 -0
  414. package/dist/mjs/types/utils/index.js +18 -0
  415. package/dist/mjs/types/utils/utils.js +2 -0
  416. package/dist/mjs/types/utils/validate-type.js +2 -0
  417. package/dist/mjs/utils/index.js +17 -0
  418. package/dist/mjs/utils/utils.d.ts +20 -0
  419. package/dist/mjs/utils/utils.js +64 -0
  420. package/dist/umd/data-structure-typed.min.js +27 -0
  421. package/dist/umd/data-structure-typed.min.js.map +1 -0
  422. package/package.json +28 -22
  423. package/src/data-structures/binary-tree/avl-tree.ts +88 -74
  424. package/src/data-structures/binary-tree/binary-indexed-tree.ts +265 -35
  425. package/src/data-structures/binary-tree/binary-tree.ts +1241 -26
  426. package/src/data-structures/binary-tree/bst.ts +217 -237
  427. package/src/data-structures/binary-tree/index.ts +0 -5
  428. package/src/data-structures/binary-tree/rb-tree.ts +28 -36
  429. package/src/data-structures/binary-tree/segment-tree.ts +25 -92
  430. package/src/data-structures/binary-tree/tree-multiset.ts +113 -422
  431. package/src/data-structures/graph/abstract-graph.ts +169 -214
  432. package/src/data-structures/graph/directed-graph.ts +105 -126
  433. package/src/data-structures/graph/map-graph.ts +29 -57
  434. package/src/data-structures/graph/undirected-graph.ts +67 -82
  435. package/src/data-structures/hash/coordinate-map.ts +0 -4
  436. package/src/data-structures/hash/coordinate-set.ts +0 -4
  437. package/src/data-structures/hash/hash-map.ts +65 -83
  438. package/src/data-structures/hash/hash-table.ts +109 -118
  439. package/src/data-structures/hash/index.ts +0 -1
  440. package/src/data-structures/hash/tree-map.ts +2 -1
  441. package/src/data-structures/hash/tree-set.ts +2 -1
  442. package/src/data-structures/heap/heap.ts +505 -128
  443. package/src/data-structures/heap/max-heap.ts +16 -21
  444. package/src/data-structures/heap/min-heap.ts +16 -22
  445. package/src/data-structures/linked-list/doubly-linked-list.ts +143 -174
  446. package/src/data-structures/linked-list/singly-linked-list.ts +174 -99
  447. package/src/data-structures/linked-list/skip-linked-list.ts +104 -49
  448. package/src/data-structures/matrix/matrix.ts +2 -2
  449. package/src/data-structures/matrix/matrix2d.ts +12 -14
  450. package/src/data-structures/matrix/navigator.ts +4 -4
  451. package/src/data-structures/matrix/vector2d.ts +2 -3
  452. package/src/data-structures/priority-queue/max-priority-queue.ts +15 -46
  453. package/src/data-structures/priority-queue/min-priority-queue.ts +15 -47
  454. package/src/data-structures/priority-queue/priority-queue.ts +7 -350
  455. package/src/data-structures/queue/deque.ts +62 -77
  456. package/src/data-structures/queue/queue.ts +39 -21
  457. package/src/data-structures/stack/stack.ts +13 -9
  458. package/src/data-structures/tree/tree.ts +10 -38
  459. package/src/data-structures/trie/trie.ts +108 -71
  460. package/src/interfaces/binary-tree.ts +7 -4
  461. package/src/interfaces/graph.ts +7 -0
  462. package/src/interfaces/index.ts +1 -8
  463. package/src/types/data-structures/binary-tree/avl-tree.ts +5 -0
  464. package/src/types/data-structures/binary-tree/binary-indexed-tree.ts +1 -0
  465. package/src/types/data-structures/binary-tree/binary-tree.ts +31 -0
  466. package/src/types/data-structures/binary-tree/bst.ts +11 -0
  467. package/src/types/data-structures/binary-tree/index.ts +6 -0
  468. package/src/types/data-structures/binary-tree/rb-tree.ts +8 -0
  469. package/src/types/data-structures/binary-tree/tree-multiset.ts +6 -0
  470. package/src/types/data-structures/graph/abstract-graph.ts +11 -0
  471. package/src/types/data-structures/graph/index.ts +3 -0
  472. package/src/types/data-structures/graph/undirected-graph.ts +1 -0
  473. package/src/types/data-structures/hash/coordinate-map.ts +1 -0
  474. package/src/types/data-structures/hash/coordinate-set.ts +1 -0
  475. package/src/types/data-structures/hash/hash-map.ts +1 -0
  476. package/src/types/data-structures/hash/hash-table.ts +1 -0
  477. package/src/types/data-structures/hash/tree-map.ts +1 -0
  478. package/src/types/data-structures/hash/tree-set.ts +1 -0
  479. package/src/types/data-structures/heap/heap.ts +1 -0
  480. package/src/types/data-structures/heap/index.ts +1 -0
  481. package/src/types/data-structures/heap/max-heap.ts +1 -0
  482. package/src/types/data-structures/heap/min-heap.ts +1 -0
  483. package/src/types/data-structures/index.ts +8 -13
  484. package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -0
  485. package/src/types/data-structures/linked-list/index.ts +2 -0
  486. package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -0
  487. package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
  488. package/src/types/data-structures/matrix/index.ts +1 -0
  489. package/src/types/data-structures/matrix/matrix.ts +1 -0
  490. package/src/types/data-structures/matrix/matrix2d.ts +1 -0
  491. package/src/types/data-structures/matrix/navigator.ts +14 -0
  492. package/src/types/data-structures/matrix/vector2d.ts +1 -0
  493. package/src/types/data-structures/priority-queue/index.ts +3 -0
  494. package/src/types/data-structures/priority-queue/max-priority-queue.ts +1 -0
  495. package/src/types/data-structures/priority-queue/min-priority-queue.ts +1 -0
  496. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  497. package/src/types/data-structures/queue/deque.ts +1 -0
  498. package/src/types/data-structures/queue/index.ts +2 -0
  499. package/src/types/data-structures/queue/queue.ts +1 -0
  500. package/src/types/data-structures/stack/index.ts +1 -0
  501. package/src/types/data-structures/stack/stack.ts +1 -0
  502. package/src/types/data-structures/tree/index.ts +1 -0
  503. package/src/types/data-structures/tree/tree.ts +1 -0
  504. package/src/types/data-structures/trie/index.ts +1 -0
  505. package/src/types/data-structures/trie/trie.ts +1 -0
  506. package/src/types/helpers.ts +11 -1
  507. package/src/types/utils/utils.ts +1 -1
  508. package/src/types/utils/validate-type.ts +2 -2
  509. package/src/utils/utils.ts +7 -0
  510. package/test/config.js +4 -0
  511. package/test/config.ts +1 -0
  512. package/test/integration/avl-tree.test.ts +24 -22
  513. package/test/integration/bst.test.ts +52 -47
  514. package/test/integration/index.html +3 -4
  515. package/test/types/index.js +29 -0
  516. package/test/types/utils/big-o.js +2 -0
  517. package/test/types/utils/big-o.ts +1 -0
  518. package/test/types/utils/index.js +29 -0
  519. package/test/types/utils/index.ts +1 -0
  520. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +184 -23
  521. package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +320 -0
  522. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +393 -40
  523. package/test/unit/data-structures/binary-tree/bst.test.ts +506 -48
  524. package/test/unit/data-structures/binary-tree/overall.test.ts +8 -7
  525. package/test/unit/data-structures/binary-tree/rb-tree.test.ts +79 -13
  526. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +296 -215
  527. package/test/unit/data-structures/graph/abstract-graph.test.ts +97 -2
  528. package/test/unit/data-structures/graph/directed-graph.test.ts +76 -31
  529. package/test/unit/data-structures/graph/map-graph.test.ts +93 -12
  530. package/test/unit/data-structures/graph/overall.test.ts +2 -2
  531. package/test/unit/data-structures/graph/undirected-graph.test.ts +93 -3
  532. package/test/unit/data-structures/hash/coordinate-map.test.ts +20 -0
  533. package/test/unit/data-structures/hash/coordinate-set.test.ts +25 -0
  534. package/test/unit/data-structures/hash/hash-map.test.ts +2 -3
  535. package/test/unit/data-structures/hash/hash-table.test.ts +10 -8
  536. package/test/unit/data-structures/heap/heap.test.ts +218 -20
  537. package/test/unit/data-structures/heap/max-heap.test.ts +50 -42
  538. package/test/unit/data-structures/heap/min-heap.test.ts +38 -68
  539. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +86 -27
  540. package/test/unit/data-structures/linked-list/linked-list.test.ts +4 -4
  541. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +71 -27
  542. package/test/unit/data-structures/linked-list/skip-list.test.ts +33 -2
  543. package/test/unit/data-structures/matrix/matrix2d.test.ts +207 -0
  544. package/test/unit/data-structures/matrix/navigator.test.ts +167 -2
  545. package/test/unit/data-structures/matrix/vector2d.test.ts +171 -0
  546. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +10 -11
  547. package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +1 -1
  548. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +14 -30
  549. package/test/unit/data-structures/queue/deque.test.ts +303 -23
  550. package/test/unit/data-structures/queue/queue.test.ts +52 -8
  551. package/test/unit/data-structures/tree/tree.test.ts +2 -2
  552. package/test/unit/data-structures/trie/trie.test.ts +743 -13
  553. package/test/utils/big-o.js +212 -0
  554. package/test/utils/big-o.ts +201 -0
  555. package/test/utils/index.js +30 -0
  556. package/test/utils/index.ts +1 -1
  557. package/test/utils/number.js +14 -0
  558. package/tsconfig-base.json +27 -0
  559. package/tsconfig-cjs.json +9 -0
  560. package/tsup.config.js +18 -0
  561. package/umd/bundle.min.js +1 -1
  562. package/umd/bundle.min.js.LICENSE.txt +15 -0
  563. package/umd/bundle.min.js.map +1 -1
  564. package/dist/data-structures/binary-tree/aa-tree.d.ts +0 -2
  565. package/dist/data-structures/binary-tree/aa-tree.js +0 -7
  566. package/dist/data-structures/binary-tree/aa-tree.js.map +0 -1
  567. package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +0 -527
  568. package/dist/data-structures/binary-tree/abstract-binary-tree.js +0 -1199
  569. package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +0 -1
  570. package/dist/data-structures/binary-tree/avl-tree.d.ts +0 -94
  571. package/dist/data-structures/binary-tree/avl-tree.js +0 -336
  572. package/dist/data-structures/binary-tree/avl-tree.js.map +0 -1
  573. package/dist/data-structures/binary-tree/b-tree.d.ts +0 -2
  574. package/dist/data-structures/binary-tree/b-tree.js +0 -7
  575. package/dist/data-structures/binary-tree/b-tree.js.map +0 -1
  576. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -46
  577. package/dist/data-structures/binary-tree/binary-indexed-tree.js +0 -74
  578. package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
  579. package/dist/data-structures/binary-tree/binary-tree.d.ts +0 -31
  580. package/dist/data-structures/binary-tree/binary-tree.js +0 -41
  581. package/dist/data-structures/binary-tree/binary-tree.js.map +0 -1
  582. package/dist/data-structures/binary-tree/bst.d.ts +0 -133
  583. package/dist/data-structures/binary-tree/bst.js +0 -554
  584. package/dist/data-structures/binary-tree/bst.js.map +0 -1
  585. package/dist/data-structures/binary-tree/index.d.ts +0 -12
  586. package/dist/data-structures/binary-tree/index.js +0 -29
  587. package/dist/data-structures/binary-tree/index.js.map +0 -1
  588. package/dist/data-structures/binary-tree/rb-tree.d.ts +0 -13
  589. package/dist/data-structures/binary-tree/rb-tree.js +0 -28
  590. package/dist/data-structures/binary-tree/rb-tree.js.map +0 -1
  591. package/dist/data-structures/binary-tree/segment-tree.d.ts +0 -83
  592. package/dist/data-structures/binary-tree/segment-tree.js +0 -229
  593. package/dist/data-structures/binary-tree/segment-tree.js.map +0 -1
  594. package/dist/data-structures/binary-tree/splay-tree.d.ts +0 -2
  595. package/dist/data-structures/binary-tree/splay-tree.js +0 -7
  596. package/dist/data-structures/binary-tree/splay-tree.js.map +0 -1
  597. package/dist/data-structures/binary-tree/tree-multiset.d.ts +0 -209
  598. package/dist/data-structures/binary-tree/tree-multiset.js +0 -669
  599. package/dist/data-structures/binary-tree/tree-multiset.js.map +0 -1
  600. package/dist/data-structures/binary-tree/two-three-tree.d.ts +0 -2
  601. package/dist/data-structures/binary-tree/two-three-tree.js +0 -7
  602. package/dist/data-structures/binary-tree/two-three-tree.js.map +0 -1
  603. package/dist/data-structures/graph/abstract-graph.d.ts +0 -332
  604. package/dist/data-structures/graph/abstract-graph.js +0 -925
  605. package/dist/data-structures/graph/abstract-graph.js.map +0 -1
  606. package/dist/data-structures/graph/directed-graph.d.ts +0 -200
  607. package/dist/data-structures/graph/directed-graph.js +0 -423
  608. package/dist/data-structures/graph/directed-graph.js.map +0 -1
  609. package/dist/data-structures/graph/index.js.map +0 -1
  610. package/dist/data-structures/graph/map-graph.d.ts +0 -79
  611. package/dist/data-structures/graph/map-graph.js +0 -112
  612. package/dist/data-structures/graph/map-graph.js.map +0 -1
  613. package/dist/data-structures/graph/undirected-graph.d.ts +0 -127
  614. package/dist/data-structures/graph/undirected-graph.js +0 -253
  615. package/dist/data-structures/graph/undirected-graph.js.map +0 -1
  616. package/dist/data-structures/hash/coordinate-map.d.ts +0 -45
  617. package/dist/data-structures/hash/coordinate-map.js +0 -66
  618. package/dist/data-structures/hash/coordinate-map.js.map +0 -1
  619. package/dist/data-structures/hash/coordinate-set.d.ts +0 -37
  620. package/dist/data-structures/hash/coordinate-set.js +0 -56
  621. package/dist/data-structures/hash/coordinate-set.js.map +0 -1
  622. package/dist/data-structures/hash/hash-map.d.ts +0 -56
  623. package/dist/data-structures/hash/hash-map.js +0 -172
  624. package/dist/data-structures/hash/hash-map.js.map +0 -1
  625. package/dist/data-structures/hash/hash-table.d.ts +0 -106
  626. package/dist/data-structures/hash/hash-table.js +0 -246
  627. package/dist/data-structures/hash/hash-table.js.map +0 -1
  628. package/dist/data-structures/hash/index.d.ts +0 -7
  629. package/dist/data-structures/hash/index.js +0 -24
  630. package/dist/data-structures/hash/index.js.map +0 -1
  631. package/dist/data-structures/hash/pair.d.ts +0 -2
  632. package/dist/data-structures/hash/pair.js +0 -7
  633. package/dist/data-structures/hash/pair.js.map +0 -1
  634. package/dist/data-structures/hash/tree-map.js.map +0 -1
  635. package/dist/data-structures/hash/tree-set.js.map +0 -1
  636. package/dist/data-structures/heap/heap.d.ts +0 -83
  637. package/dist/data-structures/heap/heap.js +0 -158
  638. package/dist/data-structures/heap/heap.js.map +0 -1
  639. package/dist/data-structures/heap/index.js.map +0 -1
  640. package/dist/data-structures/heap/max-heap.d.ts +0 -23
  641. package/dist/data-structures/heap/max-heap.js +0 -31
  642. package/dist/data-structures/heap/max-heap.js.map +0 -1
  643. package/dist/data-structures/heap/min-heap.d.ts +0 -24
  644. package/dist/data-structures/heap/min-heap.js +0 -32
  645. package/dist/data-structures/heap/min-heap.js.map +0 -1
  646. package/dist/data-structures/index.js.map +0 -1
  647. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +0 -234
  648. package/dist/data-structures/linked-list/doubly-linked-list.js +0 -584
  649. package/dist/data-structures/linked-list/doubly-linked-list.js.map +0 -1
  650. package/dist/data-structures/linked-list/index.js.map +0 -1
  651. package/dist/data-structures/linked-list/singly-linked-list.d.ts +0 -157
  652. package/dist/data-structures/linked-list/singly-linked-list.js +0 -449
  653. package/dist/data-structures/linked-list/singly-linked-list.js.map +0 -1
  654. package/dist/data-structures/linked-list/skip-linked-list.d.ts +0 -61
  655. package/dist/data-structures/linked-list/skip-linked-list.js +0 -143
  656. package/dist/data-structures/linked-list/skip-linked-list.js.map +0 -1
  657. package/dist/data-structures/matrix/index.js.map +0 -1
  658. package/dist/data-structures/matrix/matrix.d.ts +0 -21
  659. package/dist/data-structures/matrix/matrix.js.map +0 -1
  660. package/dist/data-structures/matrix/matrix2d.d.ts +0 -108
  661. package/dist/data-structures/matrix/matrix2d.js +0 -201
  662. package/dist/data-structures/matrix/matrix2d.js.map +0 -1
  663. package/dist/data-structures/matrix/navigator.d.ts +0 -52
  664. package/dist/data-structures/matrix/navigator.js.map +0 -1
  665. package/dist/data-structures/matrix/vector2d.d.ts +0 -201
  666. package/dist/data-structures/matrix/vector2d.js +0 -292
  667. package/dist/data-structures/matrix/vector2d.js.map +0 -1
  668. package/dist/data-structures/priority-queue/index.js.map +0 -1
  669. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +0 -15
  670. package/dist/data-structures/priority-queue/max-priority-queue.js +0 -44
  671. package/dist/data-structures/priority-queue/max-priority-queue.js.map +0 -1
  672. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +0 -15
  673. package/dist/data-structures/priority-queue/min-priority-queue.js +0 -45
  674. package/dist/data-structures/priority-queue/min-priority-queue.js.map +0 -1
  675. package/dist/data-structures/priority-queue/priority-queue.d.ts +0 -180
  676. package/dist/data-structures/priority-queue/priority-queue.js +0 -322
  677. package/dist/data-structures/priority-queue/priority-queue.js.map +0 -1
  678. package/dist/data-structures/queue/deque.d.ts +0 -165
  679. package/dist/data-structures/queue/deque.js +0 -277
  680. package/dist/data-structures/queue/deque.js.map +0 -1
  681. package/dist/data-structures/queue/index.js.map +0 -1
  682. package/dist/data-structures/queue/queue.d.ts +0 -107
  683. package/dist/data-structures/queue/queue.js +0 -171
  684. package/dist/data-structures/queue/queue.js.map +0 -1
  685. package/dist/data-structures/stack/index.js.map +0 -1
  686. package/dist/data-structures/stack/stack.d.ts +0 -63
  687. package/dist/data-structures/stack/stack.js +0 -92
  688. package/dist/data-structures/stack/stack.js.map +0 -1
  689. package/dist/data-structures/tree/index.js.map +0 -1
  690. package/dist/data-structures/tree/tree.d.ts +0 -14
  691. package/dist/data-structures/tree/tree.js +0 -61
  692. package/dist/data-structures/tree/tree.js.map +0 -1
  693. package/dist/data-structures/trie/index.js.map +0 -1
  694. package/dist/data-structures/trie/trie.d.ts +0 -61
  695. package/dist/data-structures/trie/trie.js +0 -211
  696. package/dist/data-structures/trie/trie.js.map +0 -1
  697. package/dist/index.js.map +0 -1
  698. package/dist/interfaces/abstract-binary-tree.d.ts +0 -7
  699. package/dist/interfaces/abstract-binary-tree.js +0 -3
  700. package/dist/interfaces/abstract-binary-tree.js.map +0 -1
  701. package/dist/interfaces/abstract-graph.d.ts +0 -5
  702. package/dist/interfaces/abstract-graph.js.map +0 -1
  703. package/dist/interfaces/avl-tree.d.ts +0 -7
  704. package/dist/interfaces/avl-tree.js.map +0 -1
  705. package/dist/interfaces/binary-tree.d.ts +0 -6
  706. package/dist/interfaces/binary-tree.js.map +0 -1
  707. package/dist/interfaces/bst.d.ts +0 -6
  708. package/dist/interfaces/bst.js.map +0 -1
  709. package/dist/interfaces/directed-graph.d.ts +0 -3
  710. package/dist/interfaces/directed-graph.js +0 -3
  711. package/dist/interfaces/directed-graph.js.map +0 -1
  712. package/dist/interfaces/doubly-linked-list.js.map +0 -1
  713. package/dist/interfaces/heap.js.map +0 -1
  714. package/dist/interfaces/index.d.ts +0 -15
  715. package/dist/interfaces/index.js +0 -32
  716. package/dist/interfaces/index.js.map +0 -1
  717. package/dist/interfaces/navigator.js.map +0 -1
  718. package/dist/interfaces/priority-queue.js.map +0 -1
  719. package/dist/interfaces/rb-tree.d.ts +0 -6
  720. package/dist/interfaces/rb-tree.js +0 -3
  721. package/dist/interfaces/rb-tree.js.map +0 -1
  722. package/dist/interfaces/segment-tree.js.map +0 -1
  723. package/dist/interfaces/singly-linked-list.js.map +0 -1
  724. package/dist/interfaces/tree-multiset.d.ts +0 -6
  725. package/dist/interfaces/tree-multiset.js.map +0 -1
  726. package/dist/interfaces/undirected-graph.d.ts +0 -3
  727. package/dist/interfaces/undirected-graph.js.map +0 -1
  728. package/dist/types/data-structures/abstract-binary-tree.d.ts +0 -34
  729. package/dist/types/data-structures/abstract-binary-tree.js +0 -25
  730. package/dist/types/data-structures/abstract-binary-tree.js.map +0 -1
  731. package/dist/types/data-structures/abstract-graph.d.ts +0 -11
  732. package/dist/types/data-structures/abstract-graph.js +0 -3
  733. package/dist/types/data-structures/abstract-graph.js.map +0 -1
  734. package/dist/types/data-structures/avl-tree.d.ts +0 -4
  735. package/dist/types/data-structures/avl-tree.js +0 -3
  736. package/dist/types/data-structures/avl-tree.js.map +0 -1
  737. package/dist/types/data-structures/binary-tree.d.ts +0 -4
  738. package/dist/types/data-structures/binary-tree.js +0 -3
  739. package/dist/types/data-structures/binary-tree.js.map +0 -1
  740. package/dist/types/data-structures/bst.d.ts +0 -13
  741. package/dist/types/data-structures/bst.js +0 -10
  742. package/dist/types/data-structures/bst.js.map +0 -1
  743. package/dist/types/data-structures/directed-graph.js.map +0 -1
  744. package/dist/types/data-structures/doubly-linked-list.js.map +0 -1
  745. package/dist/types/data-structures/hash.js +0 -3
  746. package/dist/types/data-structures/hash.js.map +0 -1
  747. package/dist/types/data-structures/heap.d.ts +0 -3
  748. package/dist/types/data-structures/heap.js.map +0 -1
  749. package/dist/types/data-structures/index.d.ts +0 -16
  750. package/dist/types/data-structures/index.js +0 -33
  751. package/dist/types/data-structures/index.js.map +0 -1
  752. package/dist/types/data-structures/map-graph.js.map +0 -1
  753. package/dist/types/data-structures/navigator.js.map +0 -1
  754. package/dist/types/data-structures/priority-queue.d.ts +0 -7
  755. package/dist/types/data-structures/priority-queue.js.map +0 -1
  756. package/dist/types/data-structures/rb-tree.d.ts +0 -8
  757. package/dist/types/data-structures/rb-tree.js.map +0 -1
  758. package/dist/types/data-structures/segment-tree.js.map +0 -1
  759. package/dist/types/data-structures/singly-linked-list.js.map +0 -1
  760. package/dist/types/data-structures/tree-multiset.d.ts +0 -4
  761. package/dist/types/data-structures/tree-multiset.js +0 -3
  762. package/dist/types/data-structures/tree-multiset.js.map +0 -1
  763. package/dist/types/helpers.js +0 -3
  764. package/dist/types/helpers.js.map +0 -1
  765. package/dist/types/index.js.map +0 -1
  766. package/dist/types/utils/index.js.map +0 -1
  767. package/dist/types/utils/utils.js.map +0 -1
  768. package/dist/types/utils/validate-type.js.map +0 -1
  769. package/dist/utils/index.js.map +0 -1
  770. package/dist/utils/utils.d.ts +0 -19
  771. package/dist/utils/utils.js +0 -67
  772. package/dist/utils/utils.js.map +0 -1
  773. package/lib/data-structures/binary-tree/aa-tree.d.ts +0 -2
  774. package/lib/data-structures/binary-tree/aa-tree.js +0 -2
  775. package/lib/data-structures/binary-tree/abstract-binary-tree.d.ts +0 -527
  776. package/lib/data-structures/binary-tree/abstract-binary-tree.js +0 -1193
  777. package/lib/data-structures/binary-tree/avl-tree.d.ts +0 -94
  778. package/lib/data-structures/binary-tree/avl-tree.js +0 -330
  779. package/lib/data-structures/binary-tree/b-tree.d.ts +0 -2
  780. package/lib/data-structures/binary-tree/b-tree.js +0 -2
  781. package/lib/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -46
  782. package/lib/data-structures/binary-tree/binary-indexed-tree.js +0 -69
  783. package/lib/data-structures/binary-tree/binary-tree.d.ts +0 -31
  784. package/lib/data-structures/binary-tree/binary-tree.js +0 -35
  785. package/lib/data-structures/binary-tree/bst.d.ts +0 -133
  786. package/lib/data-structures/binary-tree/bst.js +0 -548
  787. package/lib/data-structures/binary-tree/index.d.ts +0 -12
  788. package/lib/data-structures/binary-tree/index.js +0 -12
  789. package/lib/data-structures/binary-tree/rb-tree.d.ts +0 -13
  790. package/lib/data-structures/binary-tree/rb-tree.js +0 -22
  791. package/lib/data-structures/binary-tree/segment-tree.d.ts +0 -83
  792. package/lib/data-structures/binary-tree/segment-tree.js +0 -223
  793. package/lib/data-structures/binary-tree/splay-tree.d.ts +0 -2
  794. package/lib/data-structures/binary-tree/splay-tree.js +0 -2
  795. package/lib/data-structures/binary-tree/tree-multiset.d.ts +0 -209
  796. package/lib/data-structures/binary-tree/tree-multiset.js +0 -663
  797. package/lib/data-structures/binary-tree/two-three-tree.d.ts +0 -2
  798. package/lib/data-structures/binary-tree/two-three-tree.js +0 -2
  799. package/lib/data-structures/graph/abstract-graph.d.ts +0 -332
  800. package/lib/data-structures/graph/abstract-graph.js +0 -918
  801. package/lib/data-structures/graph/directed-graph.d.ts +0 -200
  802. package/lib/data-structures/graph/directed-graph.js +0 -416
  803. package/lib/data-structures/graph/index.js +0 -4
  804. package/lib/data-structures/graph/map-graph.d.ts +0 -79
  805. package/lib/data-structures/graph/map-graph.js +0 -105
  806. package/lib/data-structures/graph/undirected-graph.d.ts +0 -127
  807. package/lib/data-structures/graph/undirected-graph.js +0 -246
  808. package/lib/data-structures/hash/coordinate-map.d.ts +0 -45
  809. package/lib/data-structures/hash/coordinate-map.js +0 -61
  810. package/lib/data-structures/hash/coordinate-set.d.ts +0 -37
  811. package/lib/data-structures/hash/coordinate-set.js +0 -51
  812. package/lib/data-structures/hash/hash-map.d.ts +0 -56
  813. package/lib/data-structures/hash/hash-map.js +0 -167
  814. package/lib/data-structures/hash/hash-table.d.ts +0 -106
  815. package/lib/data-structures/hash/hash-table.js +0 -240
  816. package/lib/data-structures/hash/index.d.ts +0 -7
  817. package/lib/data-structures/hash/index.js +0 -7
  818. package/lib/data-structures/hash/pair.d.ts +0 -2
  819. package/lib/data-structures/hash/pair.js +0 -2
  820. package/lib/data-structures/hash/tree-map.js +0 -2
  821. package/lib/data-structures/hash/tree-set.js +0 -2
  822. package/lib/data-structures/heap/heap.d.ts +0 -83
  823. package/lib/data-structures/heap/heap.js +0 -152
  824. package/lib/data-structures/heap/index.js +0 -3
  825. package/lib/data-structures/heap/max-heap.d.ts +0 -23
  826. package/lib/data-structures/heap/max-heap.js +0 -26
  827. package/lib/data-structures/heap/min-heap.d.ts +0 -24
  828. package/lib/data-structures/heap/min-heap.js +0 -27
  829. package/lib/data-structures/index.js +0 -11
  830. package/lib/data-structures/linked-list/doubly-linked-list.d.ts +0 -234
  831. package/lib/data-structures/linked-list/doubly-linked-list.js +0 -578
  832. package/lib/data-structures/linked-list/index.js +0 -3
  833. package/lib/data-structures/linked-list/singly-linked-list.d.ts +0 -157
  834. package/lib/data-structures/linked-list/singly-linked-list.js +0 -443
  835. package/lib/data-structures/linked-list/skip-linked-list.d.ts +0 -61
  836. package/lib/data-structures/linked-list/skip-linked-list.js +0 -137
  837. package/lib/data-structures/matrix/index.js +0 -4
  838. package/lib/data-structures/matrix/matrix.d.ts +0 -21
  839. package/lib/data-structures/matrix/matrix.js +0 -24
  840. package/lib/data-structures/matrix/matrix2d.d.ts +0 -108
  841. package/lib/data-structures/matrix/matrix2d.js +0 -196
  842. package/lib/data-structures/matrix/navigator.d.ts +0 -52
  843. package/lib/data-structures/matrix/navigator.js +0 -101
  844. package/lib/data-structures/matrix/vector2d.d.ts +0 -201
  845. package/lib/data-structures/matrix/vector2d.js +0 -287
  846. package/lib/data-structures/priority-queue/max-priority-queue.d.ts +0 -15
  847. package/lib/data-structures/priority-queue/max-priority-queue.js +0 -39
  848. package/lib/data-structures/priority-queue/min-priority-queue.d.ts +0 -15
  849. package/lib/data-structures/priority-queue/min-priority-queue.js +0 -40
  850. package/lib/data-structures/priority-queue/priority-queue.d.ts +0 -180
  851. package/lib/data-structures/priority-queue/priority-queue.js +0 -317
  852. package/lib/data-structures/queue/deque.d.ts +0 -165
  853. package/lib/data-structures/queue/deque.js +0 -270
  854. package/lib/data-structures/queue/queue.d.ts +0 -107
  855. package/lib/data-structures/queue/queue.js +0 -165
  856. package/lib/data-structures/stack/stack.d.ts +0 -63
  857. package/lib/data-structures/stack/stack.js +0 -87
  858. package/lib/data-structures/tree/tree.d.ts +0 -14
  859. package/lib/data-structures/tree/tree.js +0 -56
  860. package/lib/data-structures/trie/trie.d.ts +0 -61
  861. package/lib/data-structures/trie/trie.js +0 -205
  862. package/lib/index.js +0 -4
  863. package/lib/interfaces/abstract-binary-tree.d.ts +0 -7
  864. package/lib/interfaces/abstract-graph.d.ts +0 -5
  865. package/lib/interfaces/avl-tree.d.ts +0 -7
  866. package/lib/interfaces/binary-tree.d.ts +0 -6
  867. package/lib/interfaces/bst.d.ts +0 -6
  868. package/lib/interfaces/directed-graph.d.ts +0 -3
  869. package/lib/interfaces/index.d.ts +0 -15
  870. package/lib/interfaces/index.js +0 -15
  871. package/lib/interfaces/rb-tree.d.ts +0 -6
  872. package/lib/interfaces/tree-multiset.d.ts +0 -6
  873. package/lib/interfaces/undirected-graph.d.ts +0 -3
  874. package/lib/types/data-structures/abstract-binary-tree.d.ts +0 -34
  875. package/lib/types/data-structures/abstract-binary-tree.js +0 -21
  876. package/lib/types/data-structures/abstract-graph.d.ts +0 -11
  877. package/lib/types/data-structures/avl-tree.d.ts +0 -4
  878. package/lib/types/data-structures/binary-tree.d.ts +0 -4
  879. package/lib/types/data-structures/bst.d.ts +0 -13
  880. package/lib/types/data-structures/bst.js +0 -6
  881. package/lib/types/data-structures/directed-graph.js +0 -6
  882. package/lib/types/data-structures/heap.d.ts +0 -3
  883. package/lib/types/data-structures/index.d.ts +0 -16
  884. package/lib/types/data-structures/index.js +0 -16
  885. package/lib/types/data-structures/priority-queue.d.ts +0 -7
  886. package/lib/types/data-structures/rb-tree.d.ts +0 -8
  887. package/lib/types/data-structures/rb-tree.js +0 -5
  888. package/lib/types/data-structures/tree-multiset.d.ts +0 -4
  889. package/lib/types/index.js +0 -3
  890. package/lib/types/utils/index.js +0 -2
  891. package/lib/utils/utils.d.ts +0 -19
  892. package/lib/utils/utils.js +0 -57
  893. package/scripts/rename_clear_files.sh +0 -29
  894. package/src/data-structures/binary-tree/aa-tree.ts +0 -1
  895. package/src/data-structures/binary-tree/abstract-binary-tree.ts +0 -1556
  896. package/src/data-structures/binary-tree/b-tree.ts +0 -1
  897. package/src/data-structures/binary-tree/splay-tree.ts +0 -1
  898. package/src/data-structures/binary-tree/two-three-tree.ts +0 -1
  899. package/src/data-structures/hash/pair.ts +0 -1
  900. package/src/interfaces/abstract-binary-tree.ts +0 -8
  901. package/src/interfaces/abstract-graph.ts +0 -7
  902. package/src/interfaces/avl-tree.ts +0 -8
  903. package/src/interfaces/bst.ts +0 -6
  904. package/src/interfaces/directed-graph.ts +0 -3
  905. package/src/interfaces/rb-tree.ts +0 -6
  906. package/src/interfaces/tree-multiset.ts +0 -7
  907. package/src/interfaces/undirected-graph.ts +0 -3
  908. package/src/types/data-structures/abstract-binary-tree.ts +0 -49
  909. package/src/types/data-structures/abstract-graph.ts +0 -11
  910. package/src/types/data-structures/avl-tree.ts +0 -5
  911. package/src/types/data-structures/binary-tree.ts +0 -5
  912. package/src/types/data-structures/bst.ts +0 -13
  913. package/src/types/data-structures/heap.ts +0 -5
  914. package/src/types/data-structures/navigator.ts +0 -13
  915. package/src/types/data-structures/priority-queue.ts +0 -9
  916. package/src/types/data-structures/rb-tree.ts +0 -8
  917. package/src/types/data-structures/tree-multiset.ts +0 -6
  918. package/test/utils/magnitude.ts +0 -21
  919. /package/dist/{data-structures → cjs/data-structures}/graph/index.d.ts +0 -0
  920. /package/dist/{data-structures → cjs/data-structures}/graph/index.js +0 -0
  921. /package/dist/{data-structures → cjs/data-structures}/hash/tree-map.d.ts +0 -0
  922. /package/dist/{data-structures → cjs/data-structures}/hash/tree-map.js +0 -0
  923. /package/dist/{data-structures → cjs/data-structures}/hash/tree-set.d.ts +0 -0
  924. /package/dist/{data-structures → cjs/data-structures}/hash/tree-set.js +0 -0
  925. /package/dist/{data-structures → cjs/data-structures}/heap/index.d.ts +0 -0
  926. /package/dist/{data-structures → cjs/data-structures}/heap/index.js +0 -0
  927. /package/dist/{data-structures → cjs/data-structures}/index.d.ts +0 -0
  928. /package/dist/{data-structures → cjs/data-structures}/index.js +0 -0
  929. /package/dist/{data-structures → cjs/data-structures}/linked-list/index.d.ts +0 -0
  930. /package/dist/{data-structures → cjs/data-structures}/linked-list/index.js +0 -0
  931. /package/dist/{data-structures → cjs/data-structures}/matrix/index.d.ts +0 -0
  932. /package/dist/{data-structures → cjs/data-structures}/matrix/index.js +0 -0
  933. /package/dist/{data-structures → cjs/data-structures}/matrix/matrix.js +0 -0
  934. /package/dist/{data-structures → cjs/data-structures}/matrix/navigator.js +0 -0
  935. /package/dist/{data-structures → cjs/data-structures}/priority-queue/index.d.ts +0 -0
  936. /package/dist/{data-structures → cjs/data-structures}/priority-queue/index.js +0 -0
  937. /package/dist/{data-structures → cjs/data-structures}/queue/index.d.ts +0 -0
  938. /package/dist/{data-structures → cjs/data-structures}/queue/index.js +0 -0
  939. /package/dist/{data-structures → cjs/data-structures}/stack/index.d.ts +0 -0
  940. /package/dist/{data-structures → cjs/data-structures}/stack/index.js +0 -0
  941. /package/dist/{data-structures → cjs/data-structures}/tree/index.d.ts +0 -0
  942. /package/dist/{data-structures → cjs/data-structures}/tree/index.js +0 -0
  943. /package/dist/{data-structures → cjs/data-structures}/trie/index.d.ts +0 -0
  944. /package/dist/{data-structures → cjs/data-structures}/trie/index.js +0 -0
  945. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  946. /package/dist/{index.js → cjs/index.js} +0 -0
  947. /package/dist/{interfaces → cjs/interfaces}/binary-tree.js +0 -0
  948. /package/dist/{interfaces → cjs/interfaces}/doubly-linked-list.d.ts +0 -0
  949. /package/dist/{interfaces → cjs/interfaces}/doubly-linked-list.js +0 -0
  950. /package/dist/{interfaces → cjs/interfaces}/heap.d.ts +0 -0
  951. /package/dist/{interfaces → cjs/interfaces}/heap.js +0 -0
  952. /package/dist/{interfaces → cjs/interfaces}/navigator.d.ts +0 -0
  953. /package/dist/{interfaces → cjs/interfaces}/navigator.js +0 -0
  954. /package/dist/{interfaces → cjs/interfaces}/priority-queue.d.ts +0 -0
  955. /package/dist/{interfaces → cjs/interfaces}/priority-queue.js +0 -0
  956. /package/dist/{interfaces → cjs/interfaces}/segment-tree.d.ts +0 -0
  957. /package/dist/{interfaces → cjs/interfaces}/segment-tree.js +0 -0
  958. /package/dist/{interfaces → cjs/interfaces}/singly-linked-list.d.ts +0 -0
  959. /package/dist/{interfaces → cjs/interfaces}/singly-linked-list.js +0 -0
  960. /package/dist/{interfaces → cjs/types/data-structures/binary-tree}/avl-tree.js +0 -0
  961. /package/dist/{types/data-structures/doubly-linked-list.d.ts → cjs/types/data-structures/binary-tree/binary-indexed-tree.d.ts} +0 -0
  962. /package/dist/{interfaces → cjs/types/data-structures/binary-tree}/bst.js +0 -0
  963. /package/dist/{types/data-structures → cjs/types/data-structures/binary-tree}/rb-tree.js +0 -0
  964. /package/dist/{types/data-structures → cjs/types/data-structures/binary-tree}/segment-tree.d.ts +0 -0
  965. /package/dist/{types/data-structures → cjs/types/data-structures/binary-tree}/segment-tree.js +0 -0
  966. /package/dist/{interfaces → cjs/types/data-structures/binary-tree}/tree-multiset.js +0 -0
  967. /package/dist/{interfaces → cjs/types/data-structures/graph}/abstract-graph.js +0 -0
  968. /package/dist/{types/data-structures → cjs/types/data-structures/graph}/directed-graph.d.ts +0 -0
  969. /package/dist/{types/data-structures → cjs/types/data-structures/graph}/directed-graph.js +0 -0
  970. /package/dist/{types/data-structures → cjs/types/data-structures/graph}/map-graph.d.ts +0 -0
  971. /package/dist/{types/data-structures → cjs/types/data-structures/graph}/map-graph.js +0 -0
  972. /package/dist/{types/data-structures/singly-linked-list.d.ts → cjs/types/data-structures/graph/undirected-graph.d.ts} +0 -0
  973. /package/dist/{interfaces → cjs/types/data-structures/graph}/undirected-graph.js +0 -0
  974. /package/dist/{types/helpers.d.ts → cjs/types/data-structures/hash/coordinate-map.d.ts} +0 -0
  975. /package/{lib/interfaces/abstract-binary-tree.js → dist/cjs/types/data-structures/hash/coordinate-set.d.ts} +0 -0
  976. /package/{lib/interfaces/abstract-graph.js → dist/cjs/types/data-structures/hash/hash-map.d.ts} +0 -0
  977. /package/{lib/interfaces/avl-tree.js → dist/cjs/types/data-structures/hash/hash-table.d.ts} +0 -0
  978. /package/dist/{types/data-structures/hash.d.ts → cjs/types/data-structures/hash/index.d.ts} +0 -0
  979. /package/{lib/interfaces/binary-tree.js → dist/cjs/types/data-structures/hash/tree-map.d.ts} +0 -0
  980. /package/{lib/interfaces/bst.js → dist/cjs/types/data-structures/hash/tree-set.d.ts} +0 -0
  981. /package/{lib/interfaces → dist/cjs/types/data-structures/heap}/heap.d.ts +0 -0
  982. /package/dist/{types/data-structures → cjs/types/data-structures/heap}/heap.js +0 -0
  983. /package/{lib/interfaces/directed-graph.js → dist/cjs/types/data-structures/heap/max-heap.d.ts} +0 -0
  984. /package/{lib/interfaces/doubly-linked-list.d.ts → dist/cjs/types/data-structures/heap/min-heap.d.ts} +0 -0
  985. /package/{lib/types/data-structures → dist/cjs/types/data-structures/linked-list}/doubly-linked-list.d.ts +0 -0
  986. /package/dist/{types/data-structures → cjs/types/data-structures/linked-list}/doubly-linked-list.js +0 -0
  987. /package/{lib/interfaces → dist/cjs/types/data-structures/linked-list}/singly-linked-list.d.ts +0 -0
  988. /package/dist/{types/data-structures → cjs/types/data-structures/linked-list}/singly-linked-list.js +0 -0
  989. /package/{lib/interfaces/doubly-linked-list.js → dist/cjs/types/data-structures/linked-list/skip-linked-list.d.ts} +0 -0
  990. /package/{lib/interfaces/heap.js → dist/cjs/types/data-structures/matrix/matrix.d.ts} +0 -0
  991. /package/{lib/interfaces/navigator.d.ts → dist/cjs/types/data-structures/matrix/matrix2d.d.ts} +0 -0
  992. /package/dist/{types/data-structures → cjs/types/data-structures/matrix}/navigator.d.ts +0 -0
  993. /package/dist/{types/data-structures → cjs/types/data-structures/matrix}/navigator.js +0 -0
  994. /package/{lib/interfaces/navigator.js → dist/cjs/types/data-structures/matrix/vector2d.d.ts} +0 -0
  995. /package/{lib → dist/cjs/types}/data-structures/priority-queue/index.d.ts +0 -0
  996. /package/{lib/interfaces/priority-queue.d.ts → dist/cjs/types/data-structures/priority-queue/max-priority-queue.d.ts} +0 -0
  997. /package/{lib/interfaces/priority-queue.js → dist/cjs/types/data-structures/priority-queue/min-priority-queue.d.ts} +0 -0
  998. /package/{lib/interfaces/rb-tree.js → dist/cjs/types/data-structures/priority-queue/priority-queue.d.ts} +0 -0
  999. /package/dist/{types/data-structures → cjs/types/data-structures/priority-queue}/priority-queue.js +0 -0
  1000. /package/{lib/interfaces/segment-tree.d.ts → dist/cjs/types/data-structures/queue/deque.d.ts} +0 -0
  1001. /package/{lib → dist/cjs/types}/data-structures/queue/index.d.ts +0 -0
  1002. /package/{lib/interfaces/segment-tree.js → dist/cjs/types/data-structures/queue/queue.d.ts} +0 -0
  1003. /package/{lib → dist/cjs/types}/data-structures/stack/index.d.ts +0 -0
  1004. /package/{lib/interfaces/singly-linked-list.js → dist/cjs/types/data-structures/stack/stack.d.ts} +0 -0
  1005. /package/{lib → dist/cjs/types}/data-structures/tree/index.d.ts +0 -0
  1006. /package/{lib/interfaces/tree-multiset.js → dist/cjs/types/data-structures/tree/tree.d.ts} +0 -0
  1007. /package/{lib → dist/cjs/types}/data-structures/trie/index.d.ts +0 -0
  1008. /package/{lib/interfaces/undirected-graph.js → dist/cjs/types/data-structures/trie/trie.d.ts} +0 -0
  1009. /package/dist/{types → cjs/types}/index.d.ts +0 -0
  1010. /package/dist/{types → cjs/types}/index.js +0 -0
  1011. /package/dist/{types → cjs/types}/utils/index.d.ts +0 -0
  1012. /package/dist/{types → cjs/types}/utils/index.js +0 -0
  1013. /package/dist/{types → cjs/types}/utils/utils.d.ts +0 -0
  1014. /package/dist/{types → cjs/types}/utils/utils.js +0 -0
  1015. /package/dist/{types → cjs/types}/utils/validate-type.d.ts +0 -0
  1016. /package/dist/{types → cjs/types}/utils/validate-type.js +0 -0
  1017. /package/dist/{utils → cjs/utils}/index.d.ts +0 -0
  1018. /package/dist/{utils → cjs/utils}/index.js +0 -0
  1019. /package/{lib → dist/mjs}/data-structures/graph/index.d.ts +0 -0
  1020. /package/{lib → dist/mjs}/data-structures/hash/tree-map.d.ts +0 -0
  1021. /package/{lib → dist/mjs}/data-structures/hash/tree-set.d.ts +0 -0
  1022. /package/{lib → dist/mjs}/data-structures/heap/index.d.ts +0 -0
  1023. /package/{lib → dist/mjs}/data-structures/index.d.ts +0 -0
  1024. /package/{lib → dist/mjs}/data-structures/linked-list/index.d.ts +0 -0
  1025. /package/{lib → dist/mjs}/data-structures/matrix/index.d.ts +0 -0
  1026. /package/{lib/data-structures/priority-queue/index.js → dist/mjs/data-structures/priority-queue/index.d.ts} +0 -0
  1027. /package/{lib/data-structures/queue/index.js → dist/mjs/data-structures/queue/index.d.ts} +0 -0
  1028. /package/{lib/data-structures/stack/index.js → dist/mjs/data-structures/stack/index.d.ts} +0 -0
  1029. /package/{lib/data-structures/tree/index.js → dist/mjs/data-structures/tree/index.d.ts} +0 -0
  1030. /package/{lib/data-structures/trie/index.js → dist/mjs/data-structures/trie/index.d.ts} +0 -0
  1031. /package/{lib → dist/mjs}/index.d.ts +0 -0
  1032. /package/{lib/types/data-structures/abstract-graph.js → dist/mjs/interfaces/doubly-linked-list.d.ts} +0 -0
  1033. /package/{lib/types/data-structures/avl-tree.js → dist/mjs/interfaces/heap.d.ts} +0 -0
  1034. /package/{lib/types/data-structures/binary-tree.js → dist/mjs/interfaces/navigator.d.ts} +0 -0
  1035. /package/{lib/types/data-structures/doubly-linked-list.js → dist/mjs/interfaces/priority-queue.d.ts} +0 -0
  1036. /package/{lib/types/data-structures/hash.js → dist/mjs/interfaces/segment-tree.d.ts} +0 -0
  1037. /package/{lib/types/data-structures → dist/mjs/interfaces}/singly-linked-list.d.ts +0 -0
  1038. /package/{lib/types/data-structures/heap.js → dist/mjs/types/data-structures/binary-tree/binary-indexed-tree.d.ts} +0 -0
  1039. /package/{lib/types/data-structures → dist/mjs/types/data-structures/binary-tree}/segment-tree.d.ts +0 -0
  1040. /package/{lib/types/data-structures → dist/mjs/types/data-structures/graph}/directed-graph.d.ts +0 -0
  1041. /package/{lib/types/data-structures → dist/mjs/types/data-structures/graph}/map-graph.d.ts +0 -0
  1042. /package/{lib/types/data-structures/map-graph.js → dist/mjs/types/data-structures/graph/undirected-graph.d.ts} +0 -0
  1043. /package/{lib/types/data-structures/navigator.js → dist/mjs/types/data-structures/hash/coordinate-map.d.ts} +0 -0
  1044. /package/{lib/types/data-structures/priority-queue.js → dist/mjs/types/data-structures/hash/coordinate-set.d.ts} +0 -0
  1045. /package/{lib/types/data-structures/segment-tree.js → dist/mjs/types/data-structures/hash/hash-map.d.ts} +0 -0
  1046. /package/{lib/types/data-structures/singly-linked-list.js → dist/mjs/types/data-structures/hash/hash-table.d.ts} +0 -0
  1047. /package/{lib/types/data-structures/hash.d.ts → dist/mjs/types/data-structures/hash/index.d.ts} +0 -0
  1048. /package/{lib/types/data-structures/tree-multiset.js → dist/mjs/types/data-structures/hash/tree-map.d.ts} +0 -0
  1049. /package/{lib/types/helpers.d.ts → dist/mjs/types/data-structures/hash/tree-set.d.ts} +0 -0
  1050. /package/{lib/types/helpers.js → dist/mjs/types/data-structures/heap/heap.d.ts} +0 -0
  1051. /package/{lib/types/utils/utils.js → dist/mjs/types/data-structures/heap/max-heap.d.ts} +0 -0
  1052. /package/{lib/types/utils/validate-type.js → dist/mjs/types/data-structures/heap/min-heap.d.ts} +0 -0
  1053. /package/{src/types/data-structures/doubly-linked-list.ts → dist/mjs/types/data-structures/linked-list/doubly-linked-list.d.ts} +0 -0
  1054. /package/{src/types/data-structures/singly-linked-list.ts → dist/mjs/types/data-structures/linked-list/singly-linked-list.d.ts} +0 -0
  1055. /package/{lib/types/data-structures → dist/mjs/types/data-structures/matrix}/navigator.d.ts +0 -0
  1056. /package/{lib → dist/mjs}/types/index.d.ts +0 -0
  1057. /package/{lib → dist/mjs}/types/utils/index.d.ts +0 -0
  1058. /package/{lib → dist/mjs}/types/utils/utils.d.ts +0 -0
  1059. /package/{lib → dist/mjs}/types/utils/validate-type.d.ts +0 -0
  1060. /package/{lib → dist/mjs}/utils/index.d.ts +0 -0
  1061. /package/src/types/data-structures/{segment-tree.ts → binary-tree/segment-tree.ts} +0 -0
  1062. /package/src/types/data-structures/{directed-graph.ts → graph/directed-graph.ts} +0 -0
  1063. /package/src/types/data-structures/{map-graph.ts → graph/map-graph.ts} +0 -0
  1064. /package/src/types/data-structures/{hash.ts → hash/index.ts} +0 -0
  1065. /package/{lib/utils/index.js → test/types/index.ts} +0 -0
@@ -1,180 +0,0 @@
1
- /**
2
- * data-structure-typed
3
- *
4
- * @author Tyler Zeng
5
- * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
- * @license MIT License
7
- */
8
- import type { PriorityQueueComparator, PriorityQueueDFSOrderPattern, PriorityQueueOptions } from '../../types';
9
- export declare class PriorityQueue<E = any> {
10
- /**
11
- * The constructor initializes a priority queue with the given options, including an array of nodes and a comparator
12
- * function.
13
- * @param options - The `options` parameter is an object that contains the following properties:
14
- */
15
- constructor(options: PriorityQueueOptions<E>);
16
- protected _nodes: E[];
17
- get nodes(): E[];
18
- get size(): number;
19
- /**
20
- * The `heapify` function creates a new PriorityQueue instance and fixes the heap property.
21
- * @param options - The "options" parameter is an object that contains the configuration options for the PriorityQueue.
22
- * It can include properties such as "comparator" which specifies the comparison function used to order the elements in
23
- * the priority queue, and "initialValues" which is an array of initial values to be added to the priority
24
- * @returns a new instance of the PriorityQueue class after performing the heapify operation on it.
25
- */
26
- static heapify<E>(options: PriorityQueueOptions<E>): PriorityQueue<E>;
27
- /**
28
- * The function checks if a priority queue is valid by creating a new priority queue with a fix option and then calling
29
- * the isValid method.
30
- * @param options - An object containing options for creating a priority queue. The options object should have the
31
- * following properties:
32
- * @returns the result of calling the `isValid()` method on a new instance of the `PriorityQueue` class.
33
- */
34
- static isPriorityQueueified<E>(options: Omit<PriorityQueueOptions<E>, 'isFix'>): boolean;
35
- /**
36
- * Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
37
- */
38
- getNodes(): E[];
39
- /**
40
- * The "add" function adds a node to the heap and ensures that the heap property is maintained.
41
- * @param {E} node - The parameter "node" is of type E, which means it can be any data type. It represents the node
42
- * that needs to be added to the heap.
43
- */
44
- add(node: E): void;
45
- /**
46
- * The "has" function checks if a given node is present in the list of nodes.
47
- * @param {E} node - The parameter `node` is of type `E`, which means it can be any type. It represents the node that
48
- * we want to check if it exists in the `nodes` array.
49
- * @returns a boolean value indicating whether the given node is included in the array of nodes.
50
- */
51
- has(node: E): boolean;
52
- /**
53
- * The `peek` function returns the first element of the `nodes` array if it exists, otherwise it returns `null`.
54
- * @returns The `peek()` function is returning the first element (`E`) of the `nodes` array if the `size` is not zero.
55
- * Otherwise, it returns `null`.
56
- */
57
- peek(): E | null;
58
- /**
59
- * The `poll` function removes and returns the top element from a heap data structure.
60
- * @returns The `poll()` method returns a value of type `E` or `null`.
61
- */
62
- poll(): E | null;
63
- /**
64
- * The `leaf` function returns the last element in the `nodes` array or `null` if the array is empty.
65
- * @returns The method `leaf()` is returning the last element (`E`) in the `nodes` array if it exists. If the array is
66
- * empty or the last element is `null`, then it returns `null`.
67
- */
68
- leaf(): E | null;
69
- /**
70
- * The function checks if the size of an object is equal to zero and returns a boolean value indicating whether the
71
- * object is empty or not.
72
- * @returns The method `isEmpty()` is returning a boolean value indicating whether the size of the object is equal to
73
- * 0.
74
- */
75
- isEmpty(): boolean;
76
- /**
77
- * The clear function clears the nodes array.
78
- */
79
- clear(): void;
80
- /**
81
- * The toArray function returns an array containing all the elements in the nodes property.
82
- * @returns An array of type E, which is the elements of the nodes property.
83
- */
84
- toArray(): E[];
85
- /**
86
- * The `clone` function returns a new instance of the `PriorityQueue` class with the same nodes and comparator as the
87
- * original instance.
88
- * @returns The `clone()` method is returning a new instance of the `PriorityQueue` class with the same `nodes` and
89
- * `comparator` properties as the original instance.
90
- */
91
- clone(): PriorityQueue<E>;
92
- /**
93
- * The `isValid` function recursively checks if a binary tree satisfies a certain condition.
94
- * @returns The function `isValid()` returns a boolean value.
95
- */
96
- isValid(): boolean;
97
- /**
98
- * O(n log n), In scenarios with smaller data sizes, heap sort is generally expected to be slower than QuickSort or MergeSort.
99
- */
100
- /**
101
- * The function sorts the elements in a data structure and returns them in an array.
102
- * Plan to support sorting of duplicate elements.
103
- * @returns The `sort()` method is returning an array of type `E[]`.
104
- */
105
- sort(): E[];
106
- /**
107
- * The dfs function performs a depth-first search traversal on a binary tree and returns an array of visited nodes
108
- * based on the specified traversal order.
109
- * @param {PriorityQueueDFSOrderPattern} dfsMode - The dfsMode parameter is a string that specifies the order in which
110
- * the nodes should be visited during the Depth-First Search (dfs) traversal. It can have one of the following values:
111
- * @returns an array of type `(E | null)[]`.
112
- */
113
- dfs(dfsMode: PriorityQueueDFSOrderPattern): (E | null)[];
114
- protected _setNodes(value: E[]): void;
115
- protected readonly _comparator: PriorityQueueComparator<E>;
116
- /**
117
- * The function compares two numbers using a custom comparator function.
118
- * @param {number} a - The parameter "a" is a number that represents the index of a node in an array.
119
- * @param {number} b - The parameter "b" is a number.
120
- * @returns the result of the comparison between the elements at indices `a` and `b` in the `nodes` array. The
121
- * comparison is done using the `_comparator` function, and if the result is greater than 0, `true` is returned,
122
- * indicating that the element at index `a` is greater than the element at index `b`.
123
- */
124
- protected _compare(a: number, b: number): boolean;
125
- /**
126
- * The function swaps two elements in an array.
127
- * @param {number} a - The parameter "a" is a number that represents the index of an element in an array.
128
- * @param {number} b - The parameter "b" is a number.
129
- */
130
- protected _swap(a: number, b: number): void;
131
- /**
132
- * The function checks if a given index is valid within an array.
133
- * @param {number} index - The parameter "index" is of type number and represents the index value that needs to be
134
- * checked for validity.
135
- * @returns A boolean value indicating whether the given index is valid or not.
136
- */
137
- protected _isValidIndex(index: number): boolean;
138
- /**
139
- * The function returns the index of the parent node given the index of a child node in a binary tree.
140
- * @param {number} child - The "child" parameter is a number representing the index of a child node in a binary tree.
141
- * @returns the parent of the given child node.
142
- */
143
- protected _getParent(child: number): number;
144
- /**
145
- * The function returns the index of the left child node in a binary tree given the index of its parent node.
146
- * @param {number} parent - The parameter "parent" is a number that represents the index of a node in a binary tree.
147
- * @returns the left child of a given parent node in a binary tree.
148
- */
149
- protected _getLeft(parent: number): number;
150
- /**
151
- * The function returns the index of the right child node in a binary tree given the index of its parent node.
152
- * @param {number} parent - The parameter "parent" is a number that represents the index of a node in a binary tree.
153
- * @returns the right child of a given parent node in a binary tree.
154
- */
155
- protected _getRight(parent: number): number;
156
- /**
157
- * The function returns the index of the smallest child node of a given parent node.
158
- * @param {number} parent - The parent parameter is a number that represents the index of the parent node in a binary
159
- * tree.
160
- * @returns the minimum value between the parent node and its left and right child nodes.
161
- */
162
- protected _getComparedChild(parent: number): number;
163
- /**
164
- * The function `_heapifyUp` is used to maintain the heap property by moving an element up the heap until it is in the
165
- * correct position.
166
- * @param {number} start - The start parameter is the index of the element that needs to be moved up in the heap.
167
- */
168
- protected _heapifyUp(start: number): void;
169
- /**
170
- * The function performs a heapify operation by comparing and swapping elements in a binary heap.
171
- * @param {number} start - The start parameter is the index of the element in the heap from where the heapifyDown
172
- * operation should start.
173
- */
174
- protected _heapifyDown(start: number): void;
175
- /**
176
- * The _fix function performs a heapify operation on the elements of the heap starting from the middle and moving
177
- * towards the root.
178
- */
179
- protected _fix(): void;
180
- }
@@ -1,317 +0,0 @@
1
- export class PriorityQueue {
2
- /**
3
- * The constructor initializes a priority queue with the given options, including an array of nodes and a comparator
4
- * function.
5
- * @param options - The `options` parameter is an object that contains the following properties:
6
- */
7
- constructor(options) {
8
- this._nodes = [];
9
- this._comparator = (a, b) => {
10
- const aKey = a, bKey = b;
11
- return aKey - bKey;
12
- };
13
- const { nodes, comparator, isFix = true } = options;
14
- this._comparator = comparator;
15
- if (nodes && Array.isArray(nodes) && nodes.length > 0) {
16
- // TODO support distinct
17
- this._nodes = [...nodes];
18
- isFix && this._fix();
19
- }
20
- }
21
- get nodes() {
22
- return this._nodes;
23
- }
24
- get size() {
25
- return this.nodes.length;
26
- }
27
- /**
28
- * The `heapify` function creates a new PriorityQueue instance and fixes the heap property.
29
- * @param options - The "options" parameter is an object that contains the configuration options for the PriorityQueue.
30
- * It can include properties such as "comparator" which specifies the comparison function used to order the elements in
31
- * the priority queue, and "initialValues" which is an array of initial values to be added to the priority
32
- * @returns a new instance of the PriorityQueue class after performing the heapify operation on it.
33
- */
34
- static heapify(options) {
35
- const heap = new PriorityQueue(options);
36
- heap._fix();
37
- return heap;
38
- }
39
- /**
40
- * The function checks if a priority queue is valid by creating a new priority queue with a fix option and then calling
41
- * the isValid method.
42
- * @param options - An object containing options for creating a priority queue. The options object should have the
43
- * following properties:
44
- * @returns the result of calling the `isValid()` method on a new instance of the `PriorityQueue` class.
45
- */
46
- static isPriorityQueueified(options) {
47
- return new PriorityQueue(Object.assign(Object.assign({}, options), { isFix: false })).isValid();
48
- }
49
- /**
50
- * Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
51
- */
52
- getNodes() {
53
- return this._nodes;
54
- }
55
- /**
56
- * The "add" function adds a node to the heap and ensures that the heap property is maintained.
57
- * @param {E} node - The parameter "node" is of type E, which means it can be any data type. It represents the node
58
- * that needs to be added to the heap.
59
- */
60
- add(node) {
61
- this.nodes.push(node);
62
- this._heapifyUp(this.size - 1);
63
- }
64
- /**
65
- * The "has" function checks if a given node is present in the list of nodes.
66
- * @param {E} node - The parameter `node` is of type `E`, which means it can be any type. It represents the node that
67
- * we want to check if it exists in the `nodes` array.
68
- * @returns a boolean value indicating whether the given node is included in the array of nodes.
69
- */
70
- has(node) {
71
- return this.nodes.includes(node);
72
- }
73
- /**
74
- * The `peek` function returns the first element of the `nodes` array if it exists, otherwise it returns `null`.
75
- * @returns The `peek()` function is returning the first element (`E`) of the `nodes` array if the `size` is not zero.
76
- * Otherwise, it returns `null`.
77
- */
78
- peek() {
79
- return this.size ? this.nodes[0] : null;
80
- }
81
- /**
82
- * The `poll` function removes and returns the top element from a heap data structure.
83
- * @returns The `poll()` method returns a value of type `E` or `null`.
84
- */
85
- poll() {
86
- var _a, _b;
87
- let res = null;
88
- if (this.size > 1) {
89
- this._swap(0, this.nodes.length - 1);
90
- res = (_a = this.nodes.pop()) !== null && _a !== void 0 ? _a : null;
91
- this._heapifyDown(0);
92
- }
93
- else if (this.size === 1) {
94
- res = (_b = this.nodes.pop()) !== null && _b !== void 0 ? _b : null;
95
- }
96
- return res;
97
- }
98
- /**
99
- * The `leaf` function returns the last element in the `nodes` array or `null` if the array is empty.
100
- * @returns The method `leaf()` is returning the last element (`E`) in the `nodes` array if it exists. If the array is
101
- * empty or the last element is `null`, then it returns `null`.
102
- */
103
- leaf() {
104
- var _a;
105
- return (_a = this.nodes[this.size - 1]) !== null && _a !== void 0 ? _a : null;
106
- }
107
- /**
108
- * The function checks if the size of an object is equal to zero and returns a boolean value indicating whether the
109
- * object is empty or not.
110
- * @returns The method `isEmpty()` is returning a boolean value indicating whether the size of the object is equal to
111
- * 0.
112
- */
113
- isEmpty() {
114
- return this.size === 0;
115
- }
116
- /**
117
- * The clear function clears the nodes array.
118
- */
119
- clear() {
120
- this._setNodes([]);
121
- }
122
- /**
123
- * The toArray function returns an array containing all the elements in the nodes property.
124
- * @returns An array of type E, which is the elements of the nodes property.
125
- */
126
- toArray() {
127
- return [...this.nodes];
128
- }
129
- /**
130
- * The `clone` function returns a new instance of the `PriorityQueue` class with the same nodes and comparator as the
131
- * original instance.
132
- * @returns The `clone()` method is returning a new instance of the `PriorityQueue` class with the same `nodes` and
133
- * `comparator` properties as the original instance.
134
- */
135
- clone() {
136
- return new PriorityQueue({
137
- nodes: this.nodes,
138
- comparator: this._comparator
139
- });
140
- }
141
- // --- start additional methods ---
142
- /**
143
- * The `isValid` function recursively checks if a binary tree satisfies a certain condition.
144
- * @returns The function `isValid()` returns a boolean value.
145
- */
146
- isValid() {
147
- for (let i = 0; i < this.nodes.length; i++) {
148
- const leftChildIndex = this._getLeft(i);
149
- const rightChildIndex = this._getRight(i);
150
- if (this._isValidIndex(leftChildIndex) && !this._compare(leftChildIndex, i)) {
151
- return false;
152
- }
153
- if (this._isValidIndex(rightChildIndex) && !this._compare(rightChildIndex, i)) {
154
- return false;
155
- }
156
- }
157
- return true;
158
- }
159
- /**
160
- * O(n log n), In scenarios with smaller data sizes, heap sort is generally expected to be slower than QuickSort or MergeSort.
161
- */
162
- /**
163
- * The function sorts the elements in a data structure and returns them in an array.
164
- * Plan to support sorting of duplicate elements.
165
- * @returns The `sort()` method is returning an array of type `E[]`.
166
- */
167
- sort() {
168
- const visitedNode = [];
169
- while (this.size !== 0) {
170
- const top = this.poll();
171
- if (top)
172
- visitedNode.push(top);
173
- }
174
- return visitedNode;
175
- }
176
- /**
177
- * The dfs function performs a depth-first search traversal on a binary tree and returns an array of visited nodes
178
- * based on the specified traversal order.
179
- * @param {PriorityQueueDFSOrderPattern} dfsMode - The dfsMode parameter is a string that specifies the order in which
180
- * the nodes should be visited during the Depth-First Search (dfs) traversal. It can have one of the following values:
181
- * @returns an array of type `(E | null)[]`.
182
- */
183
- dfs(dfsMode) {
184
- const visitedNode = [];
185
- const traverse = (cur) => {
186
- var _a, _b, _c;
187
- const leftChildIndex = this._getLeft(cur);
188
- const rightChildIndex = this._getRight(cur);
189
- switch (dfsMode) {
190
- case 'in':
191
- this._isValidIndex(leftChildIndex) && traverse(leftChildIndex);
192
- visitedNode.push((_a = this.nodes[cur]) !== null && _a !== void 0 ? _a : null);
193
- this._isValidIndex(rightChildIndex) && traverse(rightChildIndex);
194
- break;
195
- case 'pre':
196
- visitedNode.push((_b = this.nodes[cur]) !== null && _b !== void 0 ? _b : null);
197
- this._isValidIndex(leftChildIndex) && traverse(leftChildIndex);
198
- this._isValidIndex(rightChildIndex) && traverse(rightChildIndex);
199
- break;
200
- case 'post':
201
- this._isValidIndex(leftChildIndex) && traverse(leftChildIndex);
202
- this._isValidIndex(rightChildIndex) && traverse(rightChildIndex);
203
- visitedNode.push((_c = this.nodes[cur]) !== null && _c !== void 0 ? _c : null);
204
- break;
205
- }
206
- };
207
- this._isValidIndex(0) && traverse(0);
208
- return visitedNode;
209
- }
210
- _setNodes(value) {
211
- this._nodes = value;
212
- }
213
- /**
214
- * The function compares two numbers using a custom comparator function.
215
- * @param {number} a - The parameter "a" is a number that represents the index of a node in an array.
216
- * @param {number} b - The parameter "b" is a number.
217
- * @returns the result of the comparison between the elements at indices `a` and `b` in the `nodes` array. The
218
- * comparison is done using the `_comparator` function, and if the result is greater than 0, `true` is returned,
219
- * indicating that the element at index `a` is greater than the element at index `b`.
220
- */
221
- _compare(a, b) {
222
- return this._comparator(this.nodes[a], this.nodes[b]) > 0;
223
- }
224
- /**
225
- * The function swaps two elements in an array.
226
- * @param {number} a - The parameter "a" is a number that represents the index of an element in an array.
227
- * @param {number} b - The parameter "b" is a number.
228
- */
229
- _swap(a, b) {
230
- const temp = this.nodes[a];
231
- this.nodes[a] = this.nodes[b];
232
- this.nodes[b] = temp;
233
- }
234
- /**
235
- * The function checks if a given index is valid within an array.
236
- * @param {number} index - The parameter "index" is of type number and represents the index value that needs to be
237
- * checked for validity.
238
- * @returns A boolean value indicating whether the given index is valid or not.
239
- */
240
- _isValidIndex(index) {
241
- return index > -1 && index < this.nodes.length;
242
- }
243
- /**
244
- * The function returns the index of the parent node given the index of a child node in a binary tree.
245
- * @param {number} child - The "child" parameter is a number representing the index of a child node in a binary tree.
246
- * @returns the parent of the given child node.
247
- */
248
- _getParent(child) {
249
- return Math.floor((child - 1) / 2);
250
- }
251
- /**
252
- * The function returns the index of the left child node in a binary tree given the index of its parent node.
253
- * @param {number} parent - The parameter "parent" is a number that represents the index of a node in a binary tree.
254
- * @returns the left child of a given parent node in a binary tree.
255
- */
256
- _getLeft(parent) {
257
- return 2 * parent + 1;
258
- }
259
- /**
260
- * The function returns the index of the right child node in a binary tree given the index of its parent node.
261
- * @param {number} parent - The parameter "parent" is a number that represents the index of a node in a binary tree.
262
- * @returns the right child of a given parent node in a binary tree.
263
- */
264
- _getRight(parent) {
265
- return 2 * parent + 2;
266
- }
267
- /**
268
- * The function returns the index of the smallest child node of a given parent node.
269
- * @param {number} parent - The parent parameter is a number that represents the index of the parent node in a binary
270
- * tree.
271
- * @returns the minimum value between the parent node and its left and right child nodes.
272
- */
273
- _getComparedChild(parent) {
274
- let min = parent;
275
- const left = this._getLeft(parent), right = this._getRight(parent);
276
- if (left < this.size && this._compare(min, left)) {
277
- min = left;
278
- }
279
- if (right < this.size && this._compare(min, right)) {
280
- min = right;
281
- }
282
- return min;
283
- }
284
- /**
285
- * The function `_heapifyUp` is used to maintain the heap property by moving an element up the heap until it is in the
286
- * correct position.
287
- * @param {number} start - The start parameter is the index of the element that needs to be moved up in the heap.
288
- */
289
- _heapifyUp(start) {
290
- while (start > 0 && this._compare(this._getParent(start), start)) {
291
- const parent = this._getParent(start);
292
- this._swap(start, parent);
293
- start = parent;
294
- }
295
- }
296
- /**
297
- * The function performs a heapify operation by comparing and swapping elements in a binary heap.
298
- * @param {number} start - The start parameter is the index of the element in the heap from where the heapifyDown
299
- * operation should start.
300
- */
301
- _heapifyDown(start) {
302
- let min = this._getComparedChild(start);
303
- while (this._compare(start, min)) {
304
- this._swap(min, start);
305
- start = min;
306
- min = this._getComparedChild(start);
307
- }
308
- }
309
- /**
310
- * The _fix function performs a heapify operation on the elements of the heap starting from the middle and moving
311
- * towards the root.
312
- */
313
- _fix() {
314
- for (let i = Math.floor(this.size / 2); i > -1; i--)
315
- this._heapifyDown(i);
316
- }
317
- }
@@ -1,165 +0,0 @@
1
- /**
2
- * data-structure-typed
3
- *
4
- * @author Tyler Zeng
5
- * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
- * @license MIT License
7
- */
8
- import { DoublyLinkedList } from '../linked-list';
9
- export declare class Deque<E = any> extends DoublyLinkedList<E> {
10
- }
11
- export declare class ObjectDeque<E = number> {
12
- constructor(capacity?: number);
13
- private _nodes;
14
- get nodes(): {
15
- [p: number]: E;
16
- };
17
- private _capacity;
18
- get capacity(): number;
19
- set capacity(value: number);
20
- private _first;
21
- get first(): number;
22
- set first(value: number);
23
- private _last;
24
- get last(): number;
25
- set last(value: number);
26
- private _size;
27
- get size(): number;
28
- /**
29
- * The "addFirst" function adds a value to the beginning of an array-like data structure.
30
- * @param {E} value - The `value` parameter represents the value that you want to add to the beginning of the data
31
- * structure.
32
- */
33
- addFirst(value: E): void;
34
- /**
35
- * The addLast function adds a value to the end of an array-like data structure.
36
- * @param {E} value - The `value` parameter represents the value that you want to add to the end of the data structure.
37
- */
38
- addLast(value: E): void;
39
- /**
40
- * The function `pollFirst()` removes and returns the first element in a data structure.
41
- * @returns The value of the first element in the data structure.
42
- */
43
- pollFirst(): E | undefined;
44
- /**
45
- * The `peekFirst` function returns the first element in an array-like data structure if it exists.
46
- * @returns The element at the first position of the `_nodes` array.
47
- */
48
- peekFirst(): E | undefined;
49
- /**
50
- * The `pollLast()` function removes and returns the last element in a data structure.
51
- * @returns The value that was removed from the data structure.
52
- */
53
- pollLast(): E | undefined;
54
- /**
55
- * The `peekLast()` function returns the last element in an array-like data structure.
56
- * @returns The last element in the array "_nodes" is being returned.
57
- */
58
- peekLast(): E | undefined;
59
- /**
60
- * The get function returns the element at the specified index in an array-like data structure.
61
- * @param {number} index - The index parameter is a number that represents the position of the element you want to
62
- * retrieve from the array.
63
- * @returns The element at the specified index in the `_nodes` array is being returned. If there is no element at that
64
- * index, `null` is returned.
65
- */
66
- get(index: number): NonNullable<E> | null;
67
- /**
68
- * The function checks if the size of a data structure is less than or equal to zero.
69
- * @returns The method is returning a boolean value indicating whether the size of the object is less than or equal to 0.
70
- */
71
- isEmpty(): boolean;
72
- protected _seNodes(value: {
73
- [p: number]: E;
74
- }): void;
75
- protected _setSize(value: number): void;
76
- }
77
- export declare class ArrayDeque<E> {
78
- protected _nodes: E[];
79
- get size(): number;
80
- /**
81
- * O(n) time complexity of adding at the beginning and the end
82
- */
83
- /**
84
- * The function "addLast" adds a value to the end of an array.
85
- * @param {E} value - The value parameter represents the value that you want to add to the end of the array.
86
- * @returns The return value is the new length of the array after the value has been added.
87
- */
88
- addLast(value: E): number;
89
- /**
90
- * The function "pollLast" returns and removes the last element from an array, or returns null if the array is empty.
91
- * @returns The method `pollLast()` returns the last element of the `_nodes` array, or `null` if the array is empty.
92
- */
93
- pollLast(): E | null;
94
- /**
95
- * The `pollFirst` function removes and returns the first element from an array, or returns null if the array is empty.
96
- * @returns The `pollFirst()` function returns the first element of the `_nodes` array, or `null` if the array is
97
- * empty.
98
- */
99
- pollFirst(): E | null;
100
- /**
101
- * O(n) time complexity of adding at the beginning and the end
102
- */
103
- /**
104
- * The function "addFirst" adds a value to the beginning of an array.
105
- * @param {E} value - The value parameter represents the value that you want to add to the beginning of the array.
106
- * @returns The return value of the `addFirst` function is the new length of the array `_nodes` after adding the
107
- * `value` at the beginning.
108
- */
109
- addFirst(value: E): number;
110
- /**
111
- * The `peekFirst` function returns the first element of an array or null if the array is empty.
112
- * @returns The function `peekFirst()` is returning the first element (`E`) of the `_nodes` array. If the array is
113
- * empty, it will return `null`.
114
- */
115
- peekFirst(): E | null;
116
- /**
117
- * The `peekLast` function returns the last element of an array or null if the array is empty.
118
- * @returns The method `peekLast()` returns the last element of the `_nodes` array, or `null` if the array is empty.
119
- */
120
- peekLast(): E | null;
121
- /**
122
- * O(1) time complexity of obtaining the value
123
- */
124
- /**
125
- * The get function returns the element at the specified index in an array, or null if the index is out of bounds.
126
- * @param {number} index - The index parameter is a number that represents the position of the element you want to
127
- * retrieve from the array.
128
- * @returns The method is returning the element at the specified index in the `_nodes` array. If the element exists, it
129
- * will be returned. If the element does not exist (i.e., the index is out of bounds), `null` will be returned.
130
- */
131
- get(index: number): E | null;
132
- /**
133
- * The set function assigns a value to a specific index in an array.
134
- * @param {number} index - The index parameter is a number that represents the position of the element in the array
135
- * that you want to set a new value for.
136
- * @param {E} value - The value parameter represents the new value that you want to set at the specified index in the
137
- * _nodes array.
138
- * @returns The value that is being set at the specified index in the `_nodes` array.
139
- */
140
- set(index: number, value: E): E;
141
- /**
142
- * The insert function adds a value at a specified index in an array.
143
- * @param {number} index - The index parameter specifies the position at which the value should be inserted in the
144
- * array. It is a number that represents the index of the array where the value should be inserted. The index starts
145
- * from 0, so the first element of the array has an index of 0, the second element has
146
- * @param {E} value - The value parameter represents the value that you want to insert into the array at the specified
147
- * index.
148
- * @returns The splice method returns an array containing the removed elements, if any. In this case, since no elements
149
- * are being removed, an empty array will be returned.
150
- */
151
- insert(index: number, value: E): E[];
152
- /**
153
- * The remove function removes an element from an array at a specified index.
154
- * @param {number} index - The index parameter specifies the position of the element to be removed from the array. It
155
- * is a number that represents the index of the element to be removed.
156
- * @returns The method is returning an array containing the removed element.
157
- */
158
- remove(index: number): E[];
159
- /**
160
- * The function checks if an array called "_nodes" is empty.
161
- * @returns The method `isEmpty()` is returning a boolean value. It returns `true` if the length of the `_nodes` array
162
- * is 0, indicating that the array is empty. Otherwise, it returns `false`.
163
- */
164
- isEmpty(): boolean;
165
- }