linked-list-typed 1.38.0 → 1.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.d.ts +100 -0
  2. package/dist/data-structures/binary-tree/avl-tree.js +341 -0
  3. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +144 -0
  4. package/dist/data-structures/binary-tree/binary-indexed-tree.js +261 -0
  5. package/dist/data-structures/binary-tree/binary-tree.d.ts +409 -0
  6. package/dist/data-structures/binary-tree/binary-tree.js +1065 -0
  7. package/dist/data-structures/binary-tree/bst.d.ts +167 -0
  8. package/dist/data-structures/binary-tree/bst.js +512 -0
  9. package/dist/data-structures/binary-tree/index.d.ts +7 -0
  10. package/dist/data-structures/binary-tree/index.js +23 -0
  11. package/dist/data-structures/binary-tree/rb-tree.d.ts +13 -0
  12. package/dist/data-structures/binary-tree/rb-tree.js +27 -0
  13. package/dist/data-structures/binary-tree/segment-tree.d.ts +83 -0
  14. package/dist/data-structures/binary-tree/segment-tree.js +228 -0
  15. package/dist/data-structures/binary-tree/tree-multiset.d.ts +122 -0
  16. package/dist/data-structures/binary-tree/tree-multiset.js +351 -0
  17. package/dist/data-structures/graph/abstract-graph.d.ts +332 -0
  18. package/dist/data-structures/graph/abstract-graph.js +923 -0
  19. package/dist/data-structures/graph/directed-graph.d.ts +200 -0
  20. package/dist/data-structures/graph/directed-graph.js +422 -0
  21. package/dist/data-structures/graph/index.d.ts +4 -0
  22. package/dist/data-structures/graph/index.js +20 -0
  23. package/dist/data-structures/graph/map-graph.d.ts +79 -0
  24. package/dist/data-structures/graph/map-graph.js +111 -0
  25. package/dist/data-structures/graph/undirected-graph.d.ts +127 -0
  26. package/dist/data-structures/graph/undirected-graph.js +252 -0
  27. package/dist/data-structures/hash/coordinate-map.d.ts +45 -0
  28. package/dist/data-structures/hash/coordinate-map.js +65 -0
  29. package/dist/data-structures/hash/coordinate-set.d.ts +37 -0
  30. package/dist/data-structures/hash/coordinate-set.js +55 -0
  31. package/dist/data-structures/hash/hash-map.d.ts +56 -0
  32. package/dist/data-structures/hash/hash-map.js +171 -0
  33. package/dist/data-structures/hash/hash-table.d.ts +106 -0
  34. package/dist/data-structures/hash/hash-table.js +245 -0
  35. package/dist/data-structures/hash/index.d.ts +6 -0
  36. package/dist/data-structures/hash/index.js +22 -0
  37. package/dist/data-structures/hash/tree-map.d.ts +2 -0
  38. package/dist/data-structures/hash/tree-map.js +6 -0
  39. package/dist/data-structures/hash/tree-set.d.ts +2 -0
  40. package/dist/data-structures/hash/tree-set.js +6 -0
  41. package/dist/data-structures/heap/heap.d.ts +224 -0
  42. package/dist/data-structures/heap/heap.js +497 -0
  43. package/dist/data-structures/heap/index.d.ts +3 -0
  44. package/dist/data-structures/heap/index.js +19 -0
  45. package/dist/data-structures/heap/max-heap.d.ts +12 -0
  46. package/dist/data-structures/heap/max-heap.js +24 -0
  47. package/dist/data-structures/heap/min-heap.d.ts +12 -0
  48. package/dist/data-structures/heap/min-heap.js +24 -0
  49. package/dist/data-structures/index.d.ts +11 -0
  50. package/dist/data-structures/index.js +27 -0
  51. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +234 -0
  52. package/dist/data-structures/linked-list/doubly-linked-list.js +583 -0
  53. package/dist/data-structures/linked-list/index.d.ts +3 -0
  54. package/dist/data-structures/linked-list/index.js +19 -0
  55. package/dist/data-structures/linked-list/singly-linked-list.d.ts +157 -0
  56. package/dist/data-structures/linked-list/singly-linked-list.js +448 -0
  57. package/dist/data-structures/linked-list/skip-linked-list.d.ts +61 -0
  58. package/dist/data-structures/linked-list/skip-linked-list.js +142 -0
  59. package/dist/data-structures/matrix/index.d.ts +4 -0
  60. package/dist/data-structures/matrix/index.js +20 -0
  61. package/dist/data-structures/matrix/matrix.d.ts +21 -0
  62. package/dist/data-structures/matrix/matrix.js +28 -0
  63. package/dist/data-structures/matrix/matrix2d.d.ts +108 -0
  64. package/dist/data-structures/matrix/matrix2d.js +203 -0
  65. package/dist/data-structures/matrix/navigator.d.ts +52 -0
  66. package/dist/data-structures/matrix/navigator.js +106 -0
  67. package/dist/data-structures/matrix/vector2d.d.ts +201 -0
  68. package/dist/data-structures/matrix/vector2d.js +291 -0
  69. package/dist/data-structures/priority-queue/index.d.ts +3 -0
  70. package/dist/data-structures/priority-queue/index.js +19 -0
  71. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +12 -0
  72. package/dist/data-structures/priority-queue/max-priority-queue.js +24 -0
  73. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +12 -0
  74. package/dist/data-structures/priority-queue/min-priority-queue.js +24 -0
  75. package/dist/data-structures/priority-queue/priority-queue.d.ts +12 -0
  76. package/dist/data-structures/priority-queue/priority-queue.js +17 -0
  77. package/dist/data-structures/queue/deque.d.ts +165 -0
  78. package/dist/data-structures/queue/deque.js +276 -0
  79. package/dist/data-structures/queue/index.d.ts +2 -0
  80. package/dist/data-structures/queue/index.js +18 -0
  81. package/dist/data-structures/queue/queue.d.ts +107 -0
  82. package/dist/data-structures/queue/queue.js +170 -0
  83. package/dist/data-structures/stack/index.d.ts +1 -0
  84. package/dist/data-structures/stack/index.js +17 -0
  85. package/dist/data-structures/stack/stack.d.ts +63 -0
  86. package/dist/data-structures/stack/stack.js +91 -0
  87. package/dist/data-structures/tree/index.d.ts +1 -0
  88. package/dist/data-structures/tree/index.js +17 -0
  89. package/dist/data-structures/tree/tree.d.ts +14 -0
  90. package/dist/data-structures/tree/tree.js +58 -0
  91. package/dist/data-structures/trie/index.d.ts +1 -0
  92. package/dist/data-structures/trie/index.js +17 -0
  93. package/dist/data-structures/trie/trie.d.ts +84 -0
  94. package/dist/data-structures/trie/trie.js +268 -0
  95. package/dist/index.d.ts +3 -3
  96. package/dist/index.js +3 -3
  97. package/dist/interfaces/binary-tree.d.ts +7 -0
  98. package/dist/interfaces/binary-tree.js +2 -0
  99. package/dist/interfaces/doubly-linked-list.d.ts +1 -0
  100. package/dist/interfaces/doubly-linked-list.js +2 -0
  101. package/dist/interfaces/graph.d.ts +5 -0
  102. package/dist/interfaces/graph.js +2 -0
  103. package/dist/interfaces/heap.d.ts +1 -0
  104. package/dist/interfaces/heap.js +2 -0
  105. package/dist/interfaces/index.d.ts +8 -0
  106. package/dist/interfaces/index.js +24 -0
  107. package/dist/interfaces/navigator.d.ts +1 -0
  108. package/dist/interfaces/navigator.js +2 -0
  109. package/dist/interfaces/priority-queue.d.ts +1 -0
  110. package/dist/interfaces/priority-queue.js +2 -0
  111. package/dist/interfaces/segment-tree.d.ts +1 -0
  112. package/dist/interfaces/segment-tree.js +2 -0
  113. package/dist/interfaces/singly-linked-list.d.ts +1 -0
  114. package/dist/interfaces/singly-linked-list.js +2 -0
  115. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
  116. package/dist/types/data-structures/binary-tree/avl-tree.js +2 -0
  117. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
  118. package/dist/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
  119. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +31 -0
  120. package/dist/types/data-structures/binary-tree/binary-tree.js +24 -0
  121. package/dist/types/data-structures/binary-tree/bst.d.ts +7 -0
  122. package/dist/types/data-structures/binary-tree/bst.js +2 -0
  123. package/dist/types/data-structures/binary-tree/index.d.ts +6 -0
  124. package/dist/types/data-structures/binary-tree/index.js +22 -0
  125. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +8 -0
  126. package/dist/types/data-structures/binary-tree/rb-tree.js +8 -0
  127. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
  128. package/dist/types/data-structures/binary-tree/segment-tree.js +2 -0
  129. package/dist/types/data-structures/binary-tree/tree-multiset.d.ts +4 -0
  130. package/dist/types/data-structures/binary-tree/tree-multiset.js +2 -0
  131. package/dist/types/data-structures/graph/abstract-graph.d.ts +10 -0
  132. package/dist/types/data-structures/graph/abstract-graph.js +2 -0
  133. package/dist/types/data-structures/graph/directed-graph.d.ts +6 -0
  134. package/dist/types/data-structures/graph/directed-graph.js +9 -0
  135. package/dist/types/data-structures/graph/index.d.ts +3 -0
  136. package/dist/types/data-structures/graph/index.js +19 -0
  137. package/dist/types/data-structures/graph/map-graph.d.ts +1 -0
  138. package/dist/types/data-structures/graph/map-graph.js +2 -0
  139. package/dist/types/data-structures/graph/undirected-graph.d.ts +1 -0
  140. package/dist/types/data-structures/graph/undirected-graph.js +2 -0
  141. package/dist/types/data-structures/hash/coordinate-map.d.ts +1 -0
  142. package/dist/types/data-structures/hash/coordinate-map.js +2 -0
  143. package/dist/types/data-structures/hash/coordinate-set.d.ts +1 -0
  144. package/dist/types/data-structures/hash/coordinate-set.js +2 -0
  145. package/dist/types/data-structures/hash/hash-map.d.ts +1 -0
  146. package/dist/types/data-structures/hash/hash-map.js +2 -0
  147. package/dist/types/data-structures/hash/hash-table.d.ts +1 -0
  148. package/dist/types/data-structures/hash/hash-table.js +2 -0
  149. package/dist/types/data-structures/hash/index.d.ts +1 -0
  150. package/dist/types/data-structures/hash/index.js +2 -0
  151. package/dist/types/data-structures/hash/tree-map.d.ts +1 -0
  152. package/dist/types/data-structures/hash/tree-map.js +2 -0
  153. package/dist/types/data-structures/hash/tree-set.d.ts +1 -0
  154. package/dist/types/data-structures/hash/tree-set.js +2 -0
  155. package/dist/types/data-structures/heap/heap.d.ts +1 -0
  156. package/dist/types/data-structures/heap/heap.js +2 -0
  157. package/dist/types/data-structures/heap/index.d.ts +1 -0
  158. package/dist/types/data-structures/heap/index.js +17 -0
  159. package/dist/types/data-structures/heap/max-heap.d.ts +1 -0
  160. package/dist/types/data-structures/heap/max-heap.js +2 -0
  161. package/dist/types/data-structures/heap/min-heap.d.ts +1 -0
  162. package/dist/types/data-structures/heap/min-heap.js +2 -0
  163. package/dist/types/data-structures/index.d.ts +11 -0
  164. package/dist/types/data-structures/index.js +27 -0
  165. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -0
  166. package/dist/types/data-structures/linked-list/doubly-linked-list.js +2 -0
  167. package/dist/types/data-structures/linked-list/index.d.ts +2 -0
  168. package/dist/types/data-structures/linked-list/index.js +18 -0
  169. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -0
  170. package/dist/types/data-structures/linked-list/singly-linked-list.js +2 -0
  171. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
  172. package/dist/types/data-structures/linked-list/skip-linked-list.js +2 -0
  173. package/dist/types/data-structures/matrix/index.d.ts +1 -0
  174. package/dist/types/data-structures/matrix/index.js +17 -0
  175. package/dist/types/data-structures/matrix/matrix.d.ts +1 -0
  176. package/dist/types/data-structures/matrix/matrix.js +2 -0
  177. package/dist/types/data-structures/matrix/matrix2d.d.ts +1 -0
  178. package/dist/types/data-structures/matrix/matrix2d.js +2 -0
  179. package/dist/types/data-structures/matrix/navigator.d.ts +14 -0
  180. package/dist/types/data-structures/matrix/navigator.js +2 -0
  181. package/dist/types/data-structures/matrix/vector2d.d.ts +1 -0
  182. package/dist/types/data-structures/matrix/vector2d.js +2 -0
  183. package/dist/types/data-structures/priority-queue/index.d.ts +3 -0
  184. package/dist/types/data-structures/priority-queue/index.js +19 -0
  185. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
  186. package/dist/types/data-structures/priority-queue/max-priority-queue.js +2 -0
  187. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
  188. package/dist/types/data-structures/priority-queue/min-priority-queue.js +2 -0
  189. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  190. package/dist/types/data-structures/priority-queue/priority-queue.js +2 -0
  191. package/dist/types/data-structures/queue/deque.d.ts +1 -0
  192. package/dist/types/data-structures/queue/deque.js +2 -0
  193. package/dist/types/data-structures/queue/index.d.ts +2 -0
  194. package/dist/types/data-structures/queue/index.js +18 -0
  195. package/dist/types/data-structures/queue/queue.d.ts +1 -0
  196. package/dist/types/data-structures/queue/queue.js +2 -0
  197. package/dist/types/data-structures/stack/index.d.ts +1 -0
  198. package/dist/types/data-structures/stack/index.js +17 -0
  199. package/dist/types/data-structures/stack/stack.d.ts +1 -0
  200. package/dist/types/data-structures/stack/stack.js +2 -0
  201. package/dist/types/data-structures/tree/index.d.ts +1 -0
  202. package/dist/types/data-structures/tree/index.js +17 -0
  203. package/dist/types/data-structures/tree/tree.d.ts +1 -0
  204. package/dist/types/data-structures/tree/tree.js +2 -0
  205. package/dist/types/data-structures/trie/index.d.ts +1 -0
  206. package/dist/types/data-structures/trie/index.js +17 -0
  207. package/dist/types/data-structures/trie/trie.d.ts +1 -0
  208. package/dist/types/data-structures/trie/trie.js +2 -0
  209. package/dist/types/helpers.d.ts +9 -0
  210. package/dist/types/helpers.js +9 -0
  211. package/dist/types/index.d.ts +3 -0
  212. package/dist/types/index.js +19 -0
  213. package/dist/types/utils/index.d.ts +2 -0
  214. package/dist/types/utils/index.js +18 -0
  215. package/dist/types/utils/utils.d.ts +7 -0
  216. package/dist/types/utils/utils.js +2 -0
  217. package/dist/types/utils/validate-type.d.ts +19 -0
  218. package/dist/types/utils/validate-type.js +2 -0
  219. package/dist/utils/index.d.ts +1 -0
  220. package/dist/utils/index.js +17 -0
  221. package/dist/utils/utils.d.ts +20 -0
  222. package/dist/utils/utils.js +73 -0
  223. package/package.json +1 -4
  224. package/src/data-structures/binary-tree/avl-tree.ts +342 -0
  225. package/src/data-structures/binary-tree/binary-indexed-tree.ts +298 -0
  226. package/src/data-structures/binary-tree/binary-tree.ts +1141 -0
  227. package/src/data-structures/binary-tree/bst.ts +529 -0
  228. package/src/data-structures/binary-tree/index.ts +7 -0
  229. package/src/data-structures/binary-tree/rb-tree.ts +366 -0
  230. package/src/data-structures/binary-tree/segment-tree.ts +257 -0
  231. package/src/data-structures/binary-tree/tree-multiset.ts +375 -0
  232. package/src/data-structures/graph/abstract-graph.ts +1044 -0
  233. package/src/data-structures/graph/directed-graph.ts +470 -0
  234. package/src/data-structures/graph/index.ts +4 -0
  235. package/src/data-structures/graph/map-graph.ts +134 -0
  236. package/src/data-structures/graph/undirected-graph.ts +274 -0
  237. package/src/data-structures/hash/coordinate-map.ts +67 -0
  238. package/src/data-structures/hash/coordinate-set.ts +56 -0
  239. package/src/data-structures/hash/hash-map.ts +209 -0
  240. package/src/data-structures/hash/hash-table.ts +280 -0
  241. package/src/data-structures/hash/index.ts +6 -0
  242. package/src/data-structures/hash/tree-map.ts +1 -0
  243. package/src/data-structures/hash/tree-set.ts +1 -0
  244. package/src/data-structures/heap/heap.ts +561 -0
  245. package/src/data-structures/heap/index.ts +3 -0
  246. package/src/data-structures/heap/max-heap.ts +24 -0
  247. package/src/data-structures/heap/min-heap.ts +24 -0
  248. package/src/data-structures/index.ts +11 -0
  249. package/src/data-structures/linked-list/doubly-linked-list.ts +636 -0
  250. package/src/data-structures/linked-list/index.ts +3 -0
  251. package/src/data-structures/linked-list/singly-linked-list.ts +501 -0
  252. package/src/data-structures/linked-list/skip-linked-list.ts +173 -0
  253. package/src/data-structures/matrix/index.ts +4 -0
  254. package/src/data-structures/matrix/matrix.ts +27 -0
  255. package/src/data-structures/matrix/matrix2d.ts +213 -0
  256. package/src/data-structures/matrix/navigator.ts +121 -0
  257. package/src/data-structures/matrix/vector2d.ts +316 -0
  258. package/src/data-structures/priority-queue/index.ts +3 -0
  259. package/src/data-structures/priority-queue/max-priority-queue.ts +23 -0
  260. package/src/data-structures/priority-queue/min-priority-queue.ts +23 -0
  261. package/src/data-structures/priority-queue/priority-queue.ts +16 -0
  262. package/src/data-structures/queue/deque.ts +297 -0
  263. package/src/data-structures/queue/index.ts +2 -0
  264. package/src/data-structures/queue/queue.ts +191 -0
  265. package/src/data-structures/stack/index.ts +1 -0
  266. package/src/data-structures/stack/stack.ts +98 -0
  267. package/src/data-structures/tree/index.ts +1 -0
  268. package/src/data-structures/tree/tree.ts +67 -0
  269. package/src/data-structures/trie/index.ts +1 -0
  270. package/src/data-structures/trie/trie.ts +286 -0
  271. package/src/index.ts +3 -3
  272. package/src/interfaces/binary-tree.ts +10 -0
  273. package/src/interfaces/doubly-linked-list.ts +1 -0
  274. package/src/interfaces/graph.ts +7 -0
  275. package/src/interfaces/heap.ts +1 -0
  276. package/src/interfaces/index.ts +8 -0
  277. package/src/interfaces/navigator.ts +1 -0
  278. package/src/interfaces/priority-queue.ts +1 -0
  279. package/src/interfaces/segment-tree.ts +1 -0
  280. package/src/interfaces/singly-linked-list.ts +1 -0
  281. package/src/types/data-structures/binary-tree/avl-tree.ts +5 -0
  282. package/src/types/data-structures/binary-tree/binary-indexed-tree.ts +1 -0
  283. package/src/types/data-structures/binary-tree/binary-tree.ts +35 -0
  284. package/src/types/data-structures/binary-tree/bst.ts +11 -0
  285. package/src/types/data-structures/binary-tree/index.ts +6 -0
  286. package/src/types/data-structures/binary-tree/rb-tree.ts +8 -0
  287. package/src/types/data-structures/binary-tree/segment-tree.ts +1 -0
  288. package/src/types/data-structures/binary-tree/tree-multiset.ts +6 -0
  289. package/src/types/data-structures/graph/abstract-graph.ts +11 -0
  290. package/src/types/data-structures/graph/directed-graph.ts +8 -0
  291. package/src/types/data-structures/graph/index.ts +3 -0
  292. package/src/types/data-structures/graph/map-graph.ts +1 -0
  293. package/src/types/data-structures/graph/undirected-graph.ts +1 -0
  294. package/src/types/data-structures/hash/coordinate-map.ts +1 -0
  295. package/src/types/data-structures/hash/coordinate-set.ts +1 -0
  296. package/src/types/data-structures/hash/hash-map.ts +1 -0
  297. package/src/types/data-structures/hash/hash-table.ts +1 -0
  298. package/src/types/data-structures/hash/index.ts +1 -0
  299. package/src/types/data-structures/hash/tree-map.ts +1 -0
  300. package/src/types/data-structures/hash/tree-set.ts +1 -0
  301. package/src/types/data-structures/heap/heap.ts +1 -0
  302. package/src/types/data-structures/heap/index.ts +1 -0
  303. package/src/types/data-structures/heap/max-heap.ts +1 -0
  304. package/src/types/data-structures/heap/min-heap.ts +1 -0
  305. package/src/types/data-structures/index.ts +11 -0
  306. package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -0
  307. package/src/types/data-structures/linked-list/index.ts +2 -0
  308. package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -0
  309. package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
  310. package/src/types/data-structures/matrix/index.ts +1 -0
  311. package/src/types/data-structures/matrix/matrix.ts +1 -0
  312. package/src/types/data-structures/matrix/matrix2d.ts +1 -0
  313. package/src/types/data-structures/matrix/navigator.ts +14 -0
  314. package/src/types/data-structures/matrix/vector2d.ts +1 -0
  315. package/src/types/data-structures/priority-queue/index.ts +3 -0
  316. package/src/types/data-structures/priority-queue/max-priority-queue.ts +1 -0
  317. package/src/types/data-structures/priority-queue/min-priority-queue.ts +1 -0
  318. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  319. package/src/types/data-structures/queue/deque.ts +1 -0
  320. package/src/types/data-structures/queue/index.ts +2 -0
  321. package/src/types/data-structures/queue/queue.ts +1 -0
  322. package/src/types/data-structures/stack/index.ts +1 -0
  323. package/src/types/data-structures/stack/stack.ts +1 -0
  324. package/src/types/data-structures/tree/index.ts +1 -0
  325. package/src/types/data-structures/tree/tree.ts +1 -0
  326. package/src/types/data-structures/trie/index.ts +1 -0
  327. package/src/types/data-structures/trie/trie.ts +1 -0
  328. package/src/types/helpers.ts +13 -0
  329. package/src/types/index.ts +3 -0
  330. package/src/types/utils/index.ts +2 -0
  331. package/src/types/utils/utils.ts +6 -0
  332. package/src/types/utils/validate-type.ts +35 -0
  333. package/src/utils/index.ts +1 -0
  334. package/src/utils/utils.ts +86 -0
@@ -0,0 +1,286 @@
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
+
9
+ /**
10
+ * TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
11
+ * and a flag indicating whether it's the end of a word.
12
+ */
13
+ export class TrieNode {
14
+ constructor(key: string) {
15
+ this._key = key;
16
+ this._isEnd = false;
17
+ this._children = new Map<string, TrieNode>();
18
+ }
19
+
20
+ private _key;
21
+
22
+ get key(): string {
23
+ return this._key;
24
+ }
25
+
26
+ set key(v: string) {
27
+ this._key = v;
28
+ }
29
+
30
+ protected _children: Map<string, TrieNode>;
31
+
32
+ get children(): Map<string, TrieNode> {
33
+ return this._children;
34
+ }
35
+
36
+ set children(v: Map<string, TrieNode>) {
37
+ this._children = v;
38
+ }
39
+
40
+ protected _isEnd: boolean;
41
+
42
+ get isEnd(): boolean {
43
+ return this._isEnd;
44
+ }
45
+
46
+ set isEnd(v: boolean) {
47
+ this._isEnd = v;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Trie represents a Trie data structure. It provides basic Trie operations and additional methods.
53
+ */
54
+ export class Trie {
55
+ private readonly _caseSensitive: boolean;
56
+
57
+ constructor(words?: string[], caseSensitive = true) {
58
+ this._root = new TrieNode('');
59
+ this._caseSensitive = caseSensitive;
60
+ if (words) {
61
+ for (const i of words) {
62
+ this.add(i);
63
+ }
64
+ }
65
+ }
66
+
67
+ protected _root: TrieNode;
68
+
69
+ get root() {
70
+ return this._root;
71
+ }
72
+
73
+ set root(v: TrieNode) {
74
+ this._root = v;
75
+ }
76
+
77
+ /**
78
+ * Add a word to the Trie structure.
79
+ * @param {string} word - The word to add.
80
+ * @returns {boolean} True if the word was successfully added.
81
+ */
82
+ add(word: string): boolean {
83
+ word = this._caseProcess(word);
84
+ let cur = this.root;
85
+ for (const c of word) {
86
+ let nodeC = cur.children.get(c);
87
+ if (!nodeC) {
88
+ nodeC = new TrieNode(c);
89
+ cur.children.set(c, nodeC);
90
+ }
91
+ cur = nodeC;
92
+ }
93
+ cur.isEnd = true;
94
+ return true;
95
+ }
96
+
97
+ /**
98
+ * Check if the Trie contains a given word.
99
+ * @param {string} word - The word to check for.
100
+ * @returns {boolean} True if the word is present in the Trie.
101
+ */
102
+ has(word: string): boolean {
103
+ word = this._caseProcess(word);
104
+ let cur = this.root;
105
+ for (const c of word) {
106
+ const nodeC = cur.children.get(c);
107
+ if (!nodeC) return false;
108
+ cur = nodeC;
109
+ }
110
+ return cur.isEnd;
111
+ }
112
+
113
+ /**
114
+ * Remove a word from the Trie structure.
115
+ * @param{string} word - The word to delete.
116
+ * @returns {boolean} True if the word was successfully removed.
117
+ */
118
+ delete(word: string) {
119
+ word = this._caseProcess(word);
120
+ let isDeleted = false;
121
+ const dfs = (cur: TrieNode, i: number): boolean => {
122
+ const char = word[i];
123
+ const child = cur.children.get(char);
124
+ if (child) {
125
+ if (i === word.length - 1) {
126
+ if (child.isEnd) {
127
+ if (child.children.size > 0) {
128
+ child.isEnd = false;
129
+ } else {
130
+ cur.children.delete(char);
131
+ }
132
+ isDeleted = true;
133
+ return true;
134
+ }
135
+ return false;
136
+ }
137
+ const res = dfs(child, i + 1);
138
+ if (res && !cur.isEnd && child.children.size === 0) {
139
+ cur.children.delete(char);
140
+ return true;
141
+ }
142
+ return false;
143
+ }
144
+ return false;
145
+ };
146
+
147
+ dfs(this.root, 0);
148
+ return isDeleted;
149
+ }
150
+
151
+ getHeight() {
152
+ const beginRoot = this.root;
153
+ let maxDepth = 0;
154
+ if (beginRoot) {
155
+ const bfs = (node: TrieNode, level: number) => {
156
+ if (level > maxDepth) {
157
+ maxDepth = level;
158
+ }
159
+ const {children} = node;
160
+ if (children) {
161
+ for (const child of children.entries()) {
162
+ bfs(child[1], level + 1);
163
+ }
164
+ }
165
+ };
166
+ bfs(beginRoot, 0);
167
+ }
168
+ return maxDepth;
169
+ }
170
+
171
+ // --- start additional methods ---
172
+ /**
173
+ * Check if a given input string has an absolute prefix in the Trie, meaning it's not a complete word.
174
+ * @param {string} input - The input string to check.
175
+ * @returns {boolean} True if it's an absolute prefix in the Trie.
176
+ */
177
+ hasPurePrefix(input: string): boolean {
178
+ input = this._caseProcess(input);
179
+ let cur = this.root;
180
+ for (const c of input) {
181
+ const nodeC = cur.children.get(c);
182
+ if (!nodeC) return false;
183
+ cur = nodeC;
184
+ }
185
+ return !cur.isEnd;
186
+ }
187
+
188
+ /**
189
+ * Check if a given input string is a prefix of any existing word in the Trie, whether as an absolute prefix or a complete word.
190
+ * @param {string} input - The input string representing the prefix to check.
191
+ * @returns {boolean} True if it's a prefix in the Trie.
192
+ */
193
+ hasPrefix(input: string): boolean {
194
+ input = this._caseProcess(input);
195
+ let cur = this.root;
196
+ for (const c of input) {
197
+ const nodeC = cur.children.get(c);
198
+ if (!nodeC) return false;
199
+ cur = nodeC;
200
+ }
201
+ return true;
202
+ }
203
+
204
+ /**
205
+ * Check if the input string is a common prefix in the Trie, meaning it's a prefix shared by all words in the Trie.
206
+ * @param {string} input - The input string representing the common prefix to check for.
207
+ * @returns {boolean} True if it's a common prefix in the Trie.
208
+ */
209
+ hasCommonPrefix(input: string): boolean {
210
+ input = this._caseProcess(input);
211
+ let commonPre = '';
212
+ const dfs = (cur: TrieNode) => {
213
+ commonPre += cur.key;
214
+ if (commonPre === input) return;
215
+ if (cur.isEnd) return;
216
+ if (cur && cur.children && cur.children.size === 1) dfs(Array.from(cur.children.values())[0]);
217
+ else return;
218
+ };
219
+ dfs(this.root);
220
+ return commonPre === input;
221
+ }
222
+
223
+ /**
224
+ * Get the longest common prefix among all the words stored in the Trie.
225
+ * @returns {string} The longest common prefix found in the Trie.
226
+ */
227
+ getLongestCommonPrefix(): string {
228
+ let commonPre = '';
229
+ const dfs = (cur: TrieNode) => {
230
+ commonPre += cur.key;
231
+ if (cur.isEnd) return;
232
+ if (cur && cur.children && cur.children.size === 1) dfs(Array.from(cur.children.values())[0]);
233
+ else return;
234
+ };
235
+ dfs(this.root);
236
+ return commonPre;
237
+ }
238
+
239
+ /**
240
+ * The `getAll` function returns an array of all words in a Trie data structure that start with a given prefix.
241
+ * @param {string} prefix - The `prefix` parameter is a string that represents the prefix that we want to search for in the
242
+ * trie. It is an optional parameter, so if no prefix is provided, it will default to an empty string.
243
+ * @param {number} max - The max count of words will be found
244
+ * @returns {string[]} an array of strings.
245
+ */
246
+ getWords(prefix = '', max = Number.MAX_SAFE_INTEGER): string[] {
247
+ prefix = this._caseProcess(prefix);
248
+ const words: string[] = [];
249
+ let found = 0;
250
+
251
+ function dfs(node: TrieNode, word: string) {
252
+ for (const char of node.children.keys()) {
253
+ const charNode = node.children.get(char);
254
+ if (charNode !== undefined) {
255
+ dfs(charNode, word.concat(char));
256
+ }
257
+ }
258
+ if (node.isEnd) {
259
+ if (found > max - 1) return;
260
+ words.push(word);
261
+ found++;
262
+ }
263
+ }
264
+
265
+ let startNode = this.root;
266
+
267
+ if (prefix) {
268
+ for (const c of prefix) {
269
+ const nodeC = startNode.children.get(c);
270
+ if (nodeC) startNode = nodeC;
271
+ }
272
+ }
273
+ if (startNode !== this.root) dfs(startNode, prefix);
274
+
275
+ return words;
276
+ }
277
+
278
+ private _caseProcess(str: string) {
279
+ if (!this._caseSensitive) {
280
+ str = str.toLowerCase(); // Convert str to lowercase if case-insensitive
281
+ }
282
+ return str;
283
+ }
284
+
285
+ // --- end additional methods ---
286
+ }
package/src/index.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  * @license MIT License
7
7
  */
8
8
  // export { DoublyLinkedListNode, DoublyLinkedList, SinglyLinkedListNode, SinglyLinkedList } from 'data-structure-typed';
9
- export * from 'data-structure-typed/src/data-structures/linked-list';
10
- export * from 'data-structure-typed/src/types/data-structures/linked-list';
11
- export * from 'data-structure-typed/src/types/helpers';
9
+ export * from './data-structures/linked-list';
10
+ export * from './types/data-structures/linked-list';
11
+ export * from './types/helpers';
@@ -0,0 +1,10 @@
1
+ import {BinaryTreeNode} from '../data-structures';
2
+ import {BinaryTreeDeletedResult, BinaryTreeNodeKey} from '../types';
3
+
4
+ export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> {
5
+ createNode(key: BinaryTreeNodeKey, val?: N['val']): N;
6
+
7
+ add(keyOrNode: BinaryTreeNodeKey | N | null, val?: N['val']): N | null | undefined;
8
+
9
+ delete(nodeOrKey: N | BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import {VertexKey} from '../types';
2
+
3
+ export interface IGraph<V, E> {
4
+ createVertex(key: VertexKey, val?: V): V;
5
+
6
+ createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): E;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export * from './graph';
2
+ export * from './binary-tree';
3
+ export * from './doubly-linked-list';
4
+ export * from './heap';
5
+ export * from './navigator';
6
+ export * from './priority-queue';
7
+ export * from './segment-tree';
8
+ export * from './singly-linked-list';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import {AVLTreeNode} from '../../../data-structures';
2
+ import {BSTOptions} from './bst';
3
+
4
+ export type AVLTreeNodeNested<T> = AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
5
+ export type AVLTreeOptions = BSTOptions & {};
@@ -0,0 +1,35 @@
1
+ import {BinaryTreeNode} from '../../../data-structures';
2
+
3
+ /**
4
+ * Enum representing different loop types.
5
+ *
6
+ * - `iterative`: Indicates the iterative loop type (with loops that use iterations).
7
+ * - `recursive`: Indicates the recursive loop type (with loops that call themselves).
8
+ */
9
+
10
+ export enum IterationType {
11
+ ITERATIVE = 'ITERATIVE',
12
+ RECURSIVE = 'RECURSIVE'
13
+ }
14
+
15
+ export enum FamilyPosition {
16
+ ROOT = 'ROOT',
17
+ LEFT = 'LEFT',
18
+ RIGHT = 'RIGHT',
19
+ ROOT_LEFT = 'ROOT_LEFT',
20
+ ROOT_RIGHT = 'ROOT_RIGHT',
21
+ ISOLATED = 'ISOLATED',
22
+ MAL_NODE = 'MAL_NODE'
23
+ }
24
+
25
+ export type BinaryTreeNodeKey = number;
26
+
27
+ export type BFSCallback<N> = (node: N, level?: number) => any;
28
+
29
+ export type BFSCallbackReturn<N> = ReturnType<BFSCallback<N>>;
30
+
31
+ export type BinaryTreeDeletedResult<N> = { deleted: N | null | undefined; needBalanced: N | null };
32
+
33
+ export type BinaryTreeNodeNested<T> = BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
34
+
35
+ export type BinaryTreeOptions = { iterationType?: IterationType }
@@ -0,0 +1,11 @@
1
+ import {BSTNode} from '../../../data-structures';
2
+ import type {BinaryTreeNodeKey, BinaryTreeOptions} from './binary-tree';
3
+
4
+ export type BSTComparator = (a: BinaryTreeNodeKey, b: BinaryTreeNodeKey) => number;
5
+
6
+ // prettier-ignore
7
+ export type BSTNodeNested<T> = BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
8
+
9
+ export type BSTOptions = BinaryTreeOptions & {
10
+ comparator?: BSTComparator,
11
+ }
@@ -0,0 +1,6 @@
1
+ export * from './binary-tree';
2
+ export * from './bst';
3
+ export * from './avl-tree';
4
+ export * from './segment-tree';
5
+ export * from './tree-multiset';
6
+ export * from './rb-tree';
@@ -0,0 +1,8 @@
1
+ import {BinaryTreeOptions} from './binary-tree';
2
+ import {RBTreeNode} from '../../../data-structures';
3
+
4
+ export enum RBColor { RED = 'RED', BLACK = 'BLACK'}
5
+
6
+ export type RBTreeNodeNested<T> = RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, RBTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
7
+
8
+ export type RBTreeOptions = BinaryTreeOptions & {}
@@ -0,0 +1 @@
1
+ export type SegmentTreeNodeVal = number;
@@ -0,0 +1,6 @@
1
+ import {TreeMultisetNode} from '../../../data-structures';
2
+ import {AVLTreeOptions} from './avl-tree';
3
+
4
+ export type TreeMultisetNodeNested<T> = TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, TreeMultisetNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
5
+
6
+ export type TreeMultisetOptions = Omit<AVLTreeOptions, 'isMergeDuplicatedNodeByKey'> & {}
@@ -0,0 +1,11 @@
1
+ export type VertexKey = string | number;
2
+
3
+ export type DijkstraResult<V> = {
4
+ distMap: Map<V, number>;
5
+ distPaths?: Map<V, V[]>;
6
+ preMap: Map<V, V | null>;
7
+ seen: Set<V>;
8
+ paths: V[][];
9
+ minDist: number;
10
+ minPath: V[];
11
+ } | null;
@@ -0,0 +1,8 @@
1
+ // 0 means unknown, 1 means visiting, 2 means visited;
2
+ export type TopologicalStatus = 0 | 1 | 2;
3
+
4
+ export enum TopologicalProperty {
5
+ VAL = 'VAL',
6
+ NODE = 'NODE',
7
+ ID = 'ID'
8
+ }
@@ -0,0 +1,3 @@
1
+ export * from './abstract-graph';
2
+ export * from './map-graph';
3
+ export * from './directed-graph';
@@ -0,0 +1 @@
1
+ export type MapGraphCoordinate = [number, number];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type HashFunction<K> = (key: K) => number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './heap';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export * from './binary-tree';
2
+ export * from './graph';
3
+ export * from './linked-list';
4
+ export * from './heap';
5
+ export * from './matrix';
6
+ export * from './hash';
7
+ export * from './priority-queue';
8
+ export * from './queue';
9
+ export * from './stack';
10
+ export * from './tree';
11
+ export * from './trie';
@@ -0,0 +1,2 @@
1
+ export * from './singly-linked-list';
2
+ export * from './doubly-linked-list';
@@ -0,0 +1 @@
1
+ export * from './navigator';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ export type Direction = 'up' | 'right' | 'down' | 'left';
2
+
3
+ export type Turning = {[key in Direction]: Direction};
4
+
5
+ export type NavigatorParams<T = any> = {
6
+ matrix: T[][];
7
+ turning: Turning;
8
+ onMove: (cur: [number, number]) => void;
9
+ init: {
10
+ cur: [number, number];
11
+ charDir: Direction;
12
+ VISITED: T;
13
+ };
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './priority-queue';
2
+ export * from './min-priority-queue';
3
+ export * from './max-priority-queue';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './queue';
2
+ export * from './deque';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './stack';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './tree';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './trie';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export type Comparator<T> = (a: T, b: T) => number;
2
+
3
+ export type DFSOrderPattern = 'pre' | 'in' | 'post';
4
+
5
+ export type MapCallback<N> = (node: N) => any;
6
+
7
+ export type MapCallbackReturn<N> = ReturnType<MapCallback<N>>;
8
+
9
+ export enum CP {
10
+ lt = 'lt',
11
+ eq = 'eq',
12
+ gt = 'gt'
13
+ }
@@ -0,0 +1,3 @@
1
+ export * from './data-structures';
2
+ export * from './helpers';
3
+ export * from './utils';
@@ -0,0 +1,2 @@
1
+ export * from './utils';
2
+ export * from './validate-type';
@@ -0,0 +1,6 @@
1
+ export type ToThunkFn = () => ReturnType<TrlFn>;
2
+ export type Thunk = () => ReturnType<ToThunkFn> & {__THUNK__: symbol};
3
+ export type TrlFn = (...args: any[]) => any;
4
+ export type TrlAsyncFn = (...args: any[]) => any;
5
+
6
+ export type SpecifyOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;