min-heap-typed 1.38.0 → 1.38.2

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 +374 -0
  232. package/src/data-structures/graph/abstract-graph.ts +1043 -0
  233. package/src/data-structures/graph/directed-graph.ts +469 -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 +273 -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 +2 -0
  243. package/src/data-structures/hash/tree-set.ts +2 -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 +317 -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 +298 -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,234 @@
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
+ export declare class DoublyLinkedListNode<E = any> {
9
+ /**
10
+ * The constructor function initializes the value, next, and previous properties of an object.
11
+ * @param {E} val - The "val" parameter is the value that will be stored in the node. It can be of any data type, as it
12
+ * is defined as a generic type "E".
13
+ */
14
+ constructor(val: E);
15
+ private _val;
16
+ get val(): E;
17
+ set val(value: E);
18
+ private _next;
19
+ get next(): DoublyLinkedListNode<E> | null;
20
+ set next(value: DoublyLinkedListNode<E> | null);
21
+ private _prev;
22
+ get prev(): DoublyLinkedListNode<E> | null;
23
+ set prev(value: DoublyLinkedListNode<E> | null);
24
+ }
25
+ export declare class DoublyLinkedList<E = any> {
26
+ /**
27
+ * The constructor initializes the linked list with an empty head, tail, and length.
28
+ */
29
+ constructor();
30
+ private _head;
31
+ get head(): DoublyLinkedListNode<E> | null;
32
+ set head(value: DoublyLinkedListNode<E> | null);
33
+ private _tail;
34
+ get tail(): DoublyLinkedListNode<E> | null;
35
+ set tail(value: DoublyLinkedListNode<E> | null);
36
+ private _length;
37
+ get length(): number;
38
+ get size(): number;
39
+ /**
40
+ * The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
41
+ * given array.
42
+ * @param {E[]} data - The `data` parameter is an array of elements of type `E`.
43
+ * @returns The `fromArray` function returns a DoublyLinkedList object.
44
+ */
45
+ static fromArray<E>(data: E[]): DoublyLinkedList<E>;
46
+ /**
47
+ * The push function adds a new node with the given value to the end of the doubly linked list.
48
+ * @param {E} val - The value to be added to the linked list.
49
+ */
50
+ push(val: E): void;
51
+ /**
52
+ * The addLast function adds a new node with the given value to the end of the doubly linked list.
53
+ * @param {E} val - The value to be added to the linked list.
54
+ */
55
+ addLast(val: E): void;
56
+ /**
57
+ * The `pop()` function removes and returns the value of the last node in a doubly linked list.
58
+ * @returns The method is returning the value of the removed node (removedNode.val) if the list is not empty. If the
59
+ * list is empty, it returns null.
60
+ */
61
+ pop(): E | undefined;
62
+ /**
63
+ * The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
64
+ * @returns The method is returning the value of the removed node (removedNode.val) if the list is not empty. If the
65
+ * list is empty, it returns null.
66
+ */
67
+ pollLast(): E | undefined;
68
+ /**
69
+ * The `shift()` function removes and returns the value of the first node in a doubly linked list.
70
+ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
71
+ * list.
72
+ */
73
+ shift(): E | undefined;
74
+ /**
75
+ * The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
76
+ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
77
+ * list.
78
+ */
79
+ pollFirst(): E | undefined;
80
+ /**
81
+ * The unshift function adds a new node with the given value to the beginning of a doubly linked list.
82
+ * @param {E} val - The `val` parameter represents the value of the new node that will be added to the beginning of the
83
+ * doubly linked list.
84
+ */
85
+ unshift(val: E): void;
86
+ /**
87
+ * The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
88
+ * @param {E} val - The `val` parameter represents the value of the new node that will be added to the beginning of the
89
+ * doubly linked list.
90
+ */
91
+ addFirst(val: E): void;
92
+ /**
93
+ * The `peekFirst` function returns the first node in a doubly linked list, or null if the list is empty.
94
+ * @returns The method `peekFirst()` returns the first node of the doubly linked list, or `null` if the list is empty.
95
+ */
96
+ peekFirst(): E | undefined;
97
+ /**
98
+ * The `peekLast` function returns the last node in a doubly linked list, or null if the list is empty.
99
+ * @returns The method `peekLast()` returns the last node of the doubly linked list, or `null` if the list is empty.
100
+ */
101
+ peekLast(): E | undefined;
102
+ /**
103
+ * The `getAt` function returns the value at a specified index in a linked list, or null if the index is out of bounds.
104
+ * @param {number} index - The index parameter is a number that represents the position of the element we want to
105
+ * retrieve from the list.
106
+ * @returns The method is returning the value at the specified index in the linked list. If the index is out of bounds
107
+ * or the linked list is empty, it will return null.
108
+ */
109
+ getAt(index: number): E | undefined;
110
+ /**
111
+ * The function `getNodeAt` returns the node at a given index in a doubly linked list, or null if the index is out of
112
+ * range.
113
+ * @param {number} index - The `index` parameter is a number that represents the position of the node we want to
114
+ * retrieve from the doubly linked list. It indicates the zero-based index of the node we want to access.
115
+ * @returns The method `getNodeAt(index: number)` returns a `DoublyLinkedListNode<E>` object if the index is within the
116
+ * valid range of the linked list, otherwise it returns `null`.
117
+ */
118
+ getNodeAt(index: number): DoublyLinkedListNode<E> | null;
119
+ /**
120
+ * The function `findNodeByValue` searches for a node with a specific value in a doubly linked list and returns the
121
+ * node if found, otherwise it returns null.
122
+ * @param {E} val - The `val` parameter is the value that we want to search for in the doubly linked list.
123
+ * @returns The function `findNodeByValue` returns a `DoublyLinkedListNode<E>` if a node with the specified value `val`
124
+ * is found in the linked list. If no such node is found, it returns `null`.
125
+ */
126
+ findNode(val: E): DoublyLinkedListNode<E> | null;
127
+ /**
128
+ * The `insert` function inserts a value at a specified index in a doubly linked list.
129
+ * @param {number} index - The index parameter represents the position at which the new value should be inserted in the
130
+ * DoublyLinkedList. It is of type number.
131
+ * @param {E} val - The `val` parameter represents the value that you want to insert into the Doubly Linked List at the
132
+ * specified index.
133
+ * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
134
+ * if the index is out of bounds.
135
+ */
136
+ insertAt(index: number, val: E): boolean;
137
+ /**
138
+ * The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.
139
+ * @param {number} index - The index parameter represents the position of the element that needs to be deleted in the
140
+ * data structure. It is of type number.
141
+ * @returns The method `deleteAt` returns the value of the node that was deleted, or `null` if the index is out of
142
+ * bounds.
143
+ */
144
+ deleteAt(index: number): E | undefined;
145
+ delete(valOrNode: E): boolean;
146
+ delete(valOrNode: DoublyLinkedListNode<E>): boolean;
147
+ /**
148
+ * The `toArray` function converts a linked list into an array.
149
+ * @returns The `toArray()` method is returning an array of type `E[]`.
150
+ */
151
+ toArray(): E[];
152
+ /**
153
+ * The function checks if a variable has a length greater than zero and returns a boolean value.
154
+ * @returns A boolean value is being returned.
155
+ */
156
+ isEmpty(): boolean;
157
+ /**
158
+ * The `clear` function resets the linked list by setting the head, tail, and length to null and 0 respectively.
159
+ */
160
+ clear(): void;
161
+ /**
162
+ * The `find` function iterates through a linked list and returns the first element that satisfies a given condition.
163
+ * @param callback - A function that takes a value of type E as its parameter and returns a boolean value. This
164
+ * function is used to determine whether a particular value in the linked list satisfies a certain condition.
165
+ * @returns The method `find` returns the first element in the linked list that satisfies the condition specified by
166
+ * the callback function. If no element satisfies the condition, it returns `null`.
167
+ */
168
+ find(callback: (val: E) => boolean): E | null;
169
+ /**
170
+ * The function returns the index of the first occurrence of a given value in a linked list.
171
+ * @param {E} val - The parameter `val` is of type `E`, which means it can be any data type. It represents the value
172
+ * that we are searching for in the linked list.
173
+ * @returns The method `indexOf` returns the index of the first occurrence of the specified value `val` in the linked
174
+ * list. If the value is not found, it returns -1.
175
+ */
176
+ indexOf(val: E): number;
177
+ /**
178
+ * The `findLast` function iterates through a linked list from the last node to the first node and returns the last
179
+ * value that satisfies the given callback function, or null if no value satisfies the callback.
180
+ * @param callback - A function that takes a value of type E as its parameter and returns a boolean value. This
181
+ * function is used to determine whether a given value satisfies a certain condition.
182
+ * @returns The method `findLast` returns the last value in the linked list that satisfies the condition specified by
183
+ * the callback function. If no value satisfies the condition, it returns `null`.
184
+ */
185
+ findLast(callback: (val: E) => boolean): E | null;
186
+ /**
187
+ * The `toArrayReverse` function converts a doubly linked list into an array in reverse order.
188
+ * @returns The `toArrayReverse()` function returns an array of type `E[]`.
189
+ */
190
+ toArrayReverse(): E[];
191
+ /**
192
+ * The `reverse` function reverses the order of the elements in a doubly linked list.
193
+ */
194
+ reverse(): void;
195
+ /**
196
+ * The `forEach` function iterates over each element in a linked list and applies a callback function to each element.
197
+ * @param callback - The callback parameter is a function that takes two arguments: val and index. The val argument
198
+ * represents the value of the current node in the linked list, and the index argument represents the index of the
199
+ * current node in the linked list.
200
+ */
201
+ forEach(callback: (val: E, index: number) => void): void;
202
+ /**
203
+ * The `map` function takes a callback function and applies it to each element in the DoublyLinkedList, returning a new
204
+ * DoublyLinkedList with the transformed values.
205
+ * @param callback - The callback parameter is a function that takes a value of type E (the type of values stored in
206
+ * the original DoublyLinkedList) and returns a value of type U (the type of values that will be stored in the mapped
207
+ * DoublyLinkedList).
208
+ * @returns The `map` function is returning a new instance of `DoublyLinkedList<U>` that contains the mapped values.
209
+ */
210
+ map<U>(callback: (val: E) => U): DoublyLinkedList<U>;
211
+ /**
212
+ * The `filter` function iterates through a DoublyLinkedList and returns a new DoublyLinkedList containing only the
213
+ * elements that satisfy the given callback function.
214
+ * @param callback - The `callback` parameter is a function that takes a value of type `E` and returns a boolean value.
215
+ * It is used to determine whether a value should be included in the filtered list or not.
216
+ * @returns The filtered list, which is an instance of the DoublyLinkedList class.
217
+ */
218
+ filter(callback: (val: E) => boolean): DoublyLinkedList<E>;
219
+ /**
220
+ * The `reduce` function iterates over a linked list and applies a callback function to each element, accumulating a
221
+ * single value.
222
+ * @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `val`. It is
223
+ * used to perform a specific operation on each element of the linked list.
224
+ * @param {U} initialValue - The `initialValue` parameter is the initial value of the accumulator. It is the starting
225
+ * point for the reduction operation.
226
+ * @returns The `reduce` method is returning the final value of the accumulator after iterating through all the
227
+ * elements in the linked list.
228
+ */
229
+ reduce<U>(callback: (accumulator: U, val: E) => U, initialValue: U): U;
230
+ insertAfter(existingValueOrNode: E, newValue: E): boolean;
231
+ insertAfter(existingValueOrNode: DoublyLinkedListNode<E>, newValue: E): boolean;
232
+ insertBefore(existingValueOrNode: E, newValue: E): boolean;
233
+ insertBefore(existingValueOrNode: DoublyLinkedListNode<E>, newValue: E): boolean;
234
+ }