red-black-tree-typed 1.47.3

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 (341) hide show
  1. package/.eslintrc.js +61 -0
  2. package/.prettierignore +6 -0
  3. package/.prettierrc.js +16 -0
  4. package/LICENSE +21 -0
  5. package/README.md +713 -0
  6. package/coverage/clover.xml +13 -0
  7. package/coverage/coverage-final.json +96 -0
  8. package/coverage/coverage-summary.json +60 -0
  9. package/coverage/lcov-report/base.css +403 -0
  10. package/coverage/lcov-report/block-navigation.js +87 -0
  11. package/coverage/lcov-report/favicon.png +0 -0
  12. package/coverage/lcov-report/index.html +119 -0
  13. package/coverage/lcov-report/index.ts.html +109 -0
  14. package/coverage/lcov-report/prettify.css +1 -0
  15. package/coverage/lcov-report/prettify.js +2 -0
  16. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  17. package/coverage/lcov-report/sorter.js +206 -0
  18. package/coverage/lcov.info +14 -0
  19. package/dist/data-structures/binary-tree/avl-tree.d.ts +173 -0
  20. package/dist/data-structures/binary-tree/avl-tree.js +429 -0
  21. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +149 -0
  22. package/dist/data-structures/binary-tree/binary-indexed-tree.js +269 -0
  23. package/dist/data-structures/binary-tree/binary-tree.d.ts +515 -0
  24. package/dist/data-structures/binary-tree/binary-tree.js +1665 -0
  25. package/dist/data-structures/binary-tree/bst.d.ts +253 -0
  26. package/dist/data-structures/binary-tree/bst.js +651 -0
  27. package/dist/data-structures/binary-tree/index.d.ts +7 -0
  28. package/dist/data-structures/binary-tree/index.js +23 -0
  29. package/dist/data-structures/binary-tree/rb-tree.d.ts +169 -0
  30. package/dist/data-structures/binary-tree/rb-tree.js +524 -0
  31. package/dist/data-structures/binary-tree/segment-tree.d.ts +67 -0
  32. package/dist/data-structures/binary-tree/segment-tree.js +180 -0
  33. package/dist/data-structures/binary-tree/tree-multimap.d.ts +162 -0
  34. package/dist/data-structures/binary-tree/tree-multimap.js +407 -0
  35. package/dist/data-structures/graph/abstract-graph.d.ts +450 -0
  36. package/dist/data-structures/graph/abstract-graph.js +1047 -0
  37. package/dist/data-structures/graph/directed-graph.d.ts +320 -0
  38. package/dist/data-structures/graph/directed-graph.js +530 -0
  39. package/dist/data-structures/graph/index.d.ts +4 -0
  40. package/dist/data-structures/graph/index.js +20 -0
  41. package/dist/data-structures/graph/map-graph.d.ts +73 -0
  42. package/dist/data-structures/graph/map-graph.js +93 -0
  43. package/dist/data-structures/graph/undirected-graph.d.ts +183 -0
  44. package/dist/data-structures/graph/undirected-graph.js +302 -0
  45. package/dist/data-structures/hash/hash-map.d.ts +186 -0
  46. package/dist/data-structures/hash/hash-map.js +367 -0
  47. package/dist/data-structures/hash/hash-table.d.ts +103 -0
  48. package/dist/data-structures/hash/hash-table.js +236 -0
  49. package/dist/data-structures/hash/index.d.ts +2 -0
  50. package/dist/data-structures/hash/index.js +18 -0
  51. package/dist/data-structures/heap/heap.d.ts +410 -0
  52. package/dist/data-structures/heap/heap.js +697 -0
  53. package/dist/data-structures/heap/index.d.ts +3 -0
  54. package/dist/data-structures/heap/index.js +19 -0
  55. package/dist/data-structures/heap/max-heap.d.ts +15 -0
  56. package/dist/data-structures/heap/max-heap.js +26 -0
  57. package/dist/data-structures/heap/min-heap.d.ts +15 -0
  58. package/dist/data-structures/heap/min-heap.js +26 -0
  59. package/dist/data-structures/index.d.ts +11 -0
  60. package/dist/data-structures/index.js +27 -0
  61. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +456 -0
  62. package/dist/data-structures/linked-list/doubly-linked-list.js +772 -0
  63. package/dist/data-structures/linked-list/index.d.ts +3 -0
  64. package/dist/data-structures/linked-list/index.js +19 -0
  65. package/dist/data-structures/linked-list/singly-linked-list.d.ts +414 -0
  66. package/dist/data-structures/linked-list/singly-linked-list.js +715 -0
  67. package/dist/data-structures/linked-list/skip-linked-list.d.ts +144 -0
  68. package/dist/data-structures/linked-list/skip-linked-list.js +251 -0
  69. package/dist/data-structures/matrix/index.d.ts +4 -0
  70. package/dist/data-structures/matrix/index.js +20 -0
  71. package/dist/data-structures/matrix/matrix.d.ts +21 -0
  72. package/dist/data-structures/matrix/matrix.js +28 -0
  73. package/dist/data-structures/matrix/matrix2d.d.ts +107 -0
  74. package/dist/data-structures/matrix/matrix2d.js +199 -0
  75. package/dist/data-structures/matrix/navigator.d.ts +52 -0
  76. package/dist/data-structures/matrix/navigator.js +106 -0
  77. package/dist/data-structures/matrix/vector2d.d.ts +200 -0
  78. package/dist/data-structures/matrix/vector2d.js +290 -0
  79. package/dist/data-structures/priority-queue/index.d.ts +3 -0
  80. package/dist/data-structures/priority-queue/index.js +19 -0
  81. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
  82. package/dist/data-structures/priority-queue/max-priority-queue.js +26 -0
  83. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
  84. package/dist/data-structures/priority-queue/min-priority-queue.js +26 -0
  85. package/dist/data-structures/priority-queue/priority-queue.d.ts +15 -0
  86. package/dist/data-structures/priority-queue/priority-queue.js +17 -0
  87. package/dist/data-structures/queue/deque.d.ts +572 -0
  88. package/dist/data-structures/queue/deque.js +990 -0
  89. package/dist/data-structures/queue/index.d.ts +2 -0
  90. package/dist/data-structures/queue/index.js +18 -0
  91. package/dist/data-structures/queue/queue.d.ts +209 -0
  92. package/dist/data-structures/queue/queue.js +274 -0
  93. package/dist/data-structures/stack/index.d.ts +1 -0
  94. package/dist/data-structures/stack/index.js +17 -0
  95. package/dist/data-structures/stack/stack.d.ts +106 -0
  96. package/dist/data-structures/stack/stack.js +136 -0
  97. package/dist/data-structures/tree/index.d.ts +1 -0
  98. package/dist/data-structures/tree/index.js +17 -0
  99. package/dist/data-structures/tree/tree.d.ts +8 -0
  100. package/dist/data-structures/tree/tree.js +40 -0
  101. package/dist/data-structures/trie/index.d.ts +1 -0
  102. package/dist/data-structures/trie/index.js +17 -0
  103. package/dist/data-structures/trie/trie.d.ts +155 -0
  104. package/dist/data-structures/trie/trie.js +326 -0
  105. package/dist/index.d.ts +10 -0
  106. package/dist/index.js +27 -0
  107. package/dist/interfaces/binary-tree.d.ts +7 -0
  108. package/dist/interfaces/binary-tree.js +2 -0
  109. package/dist/interfaces/doubly-linked-list.d.ts +1 -0
  110. package/dist/interfaces/doubly-linked-list.js +2 -0
  111. package/dist/interfaces/graph.d.ts +5 -0
  112. package/dist/interfaces/graph.js +2 -0
  113. package/dist/interfaces/heap.d.ts +1 -0
  114. package/dist/interfaces/heap.js +2 -0
  115. package/dist/interfaces/index.d.ts +8 -0
  116. package/dist/interfaces/index.js +24 -0
  117. package/dist/interfaces/navigator.d.ts +1 -0
  118. package/dist/interfaces/navigator.js +2 -0
  119. package/dist/interfaces/priority-queue.d.ts +1 -0
  120. package/dist/interfaces/priority-queue.js +2 -0
  121. package/dist/interfaces/segment-tree.d.ts +1 -0
  122. package/dist/interfaces/segment-tree.js +2 -0
  123. package/dist/interfaces/singly-linked-list.d.ts +1 -0
  124. package/dist/interfaces/singly-linked-list.js +2 -0
  125. package/dist/types/common.d.ts +20 -0
  126. package/dist/types/common.js +9 -0
  127. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +5 -0
  128. package/dist/types/data-structures/binary-tree/avl-tree.js +2 -0
  129. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
  130. package/dist/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
  131. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +31 -0
  132. package/dist/types/data-structures/binary-tree/binary-tree.js +24 -0
  133. package/dist/types/data-structures/binary-tree/bst.d.ts +8 -0
  134. package/dist/types/data-structures/binary-tree/bst.js +2 -0
  135. package/dist/types/data-structures/binary-tree/index.d.ts +6 -0
  136. package/dist/types/data-structures/binary-tree/index.js +22 -0
  137. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +9 -0
  138. package/dist/types/data-structures/binary-tree/rb-tree.js +8 -0
  139. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
  140. package/dist/types/data-structures/binary-tree/segment-tree.js +2 -0
  141. package/dist/types/data-structures/binary-tree/tree-multimap.d.ts +5 -0
  142. package/dist/types/data-structures/binary-tree/tree-multimap.js +2 -0
  143. package/dist/types/data-structures/graph/abstract-graph.d.ts +10 -0
  144. package/dist/types/data-structures/graph/abstract-graph.js +2 -0
  145. package/dist/types/data-structures/graph/directed-graph.d.ts +1 -0
  146. package/dist/types/data-structures/graph/directed-graph.js +2 -0
  147. package/dist/types/data-structures/graph/index.d.ts +3 -0
  148. package/dist/types/data-structures/graph/index.js +19 -0
  149. package/dist/types/data-structures/graph/map-graph.d.ts +1 -0
  150. package/dist/types/data-structures/graph/map-graph.js +2 -0
  151. package/dist/types/data-structures/graph/undirected-graph.d.ts +1 -0
  152. package/dist/types/data-structures/graph/undirected-graph.js +2 -0
  153. package/dist/types/data-structures/hash/hash-map.d.ts +11 -0
  154. package/dist/types/data-structures/hash/hash-map.js +2 -0
  155. package/dist/types/data-structures/hash/hash-table.d.ts +1 -0
  156. package/dist/types/data-structures/hash/hash-table.js +2 -0
  157. package/dist/types/data-structures/hash/index.d.ts +3 -0
  158. package/dist/types/data-structures/hash/index.js +18 -0
  159. package/dist/types/data-structures/heap/heap.d.ts +1 -0
  160. package/dist/types/data-structures/heap/heap.js +2 -0
  161. package/dist/types/data-structures/heap/index.d.ts +1 -0
  162. package/dist/types/data-structures/heap/index.js +17 -0
  163. package/dist/types/data-structures/heap/max-heap.d.ts +1 -0
  164. package/dist/types/data-structures/heap/max-heap.js +2 -0
  165. package/dist/types/data-structures/heap/min-heap.d.ts +1 -0
  166. package/dist/types/data-structures/heap/min-heap.js +2 -0
  167. package/dist/types/data-structures/index.d.ts +11 -0
  168. package/dist/types/data-structures/index.js +27 -0
  169. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -0
  170. package/dist/types/data-structures/linked-list/doubly-linked-list.js +2 -0
  171. package/dist/types/data-structures/linked-list/index.d.ts +2 -0
  172. package/dist/types/data-structures/linked-list/index.js +18 -0
  173. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -0
  174. package/dist/types/data-structures/linked-list/singly-linked-list.js +2 -0
  175. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
  176. package/dist/types/data-structures/linked-list/skip-linked-list.js +2 -0
  177. package/dist/types/data-structures/matrix/index.d.ts +1 -0
  178. package/dist/types/data-structures/matrix/index.js +17 -0
  179. package/dist/types/data-structures/matrix/matrix.d.ts +1 -0
  180. package/dist/types/data-structures/matrix/matrix.js +2 -0
  181. package/dist/types/data-structures/matrix/matrix2d.d.ts +1 -0
  182. package/dist/types/data-structures/matrix/matrix2d.js +2 -0
  183. package/dist/types/data-structures/matrix/navigator.d.ts +14 -0
  184. package/dist/types/data-structures/matrix/navigator.js +2 -0
  185. package/dist/types/data-structures/matrix/vector2d.d.ts +1 -0
  186. package/dist/types/data-structures/matrix/vector2d.js +2 -0
  187. package/dist/types/data-structures/priority-queue/index.d.ts +3 -0
  188. package/dist/types/data-structures/priority-queue/index.js +19 -0
  189. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
  190. package/dist/types/data-structures/priority-queue/max-priority-queue.js +2 -0
  191. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
  192. package/dist/types/data-structures/priority-queue/min-priority-queue.js +2 -0
  193. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  194. package/dist/types/data-structures/priority-queue/priority-queue.js +2 -0
  195. package/dist/types/data-structures/queue/deque.d.ts +1 -0
  196. package/dist/types/data-structures/queue/deque.js +2 -0
  197. package/dist/types/data-structures/queue/index.d.ts +2 -0
  198. package/dist/types/data-structures/queue/index.js +18 -0
  199. package/dist/types/data-structures/queue/queue.d.ts +1 -0
  200. package/dist/types/data-structures/queue/queue.js +2 -0
  201. package/dist/types/data-structures/stack/index.d.ts +1 -0
  202. package/dist/types/data-structures/stack/index.js +17 -0
  203. package/dist/types/data-structures/stack/stack.d.ts +1 -0
  204. package/dist/types/data-structures/stack/stack.js +2 -0
  205. package/dist/types/data-structures/tree/index.d.ts +1 -0
  206. package/dist/types/data-structures/tree/index.js +17 -0
  207. package/dist/types/data-structures/tree/tree.d.ts +1 -0
  208. package/dist/types/data-structures/tree/tree.js +2 -0
  209. package/dist/types/data-structures/trie/index.d.ts +1 -0
  210. package/dist/types/data-structures/trie/index.js +17 -0
  211. package/dist/types/data-structures/trie/trie.d.ts +1 -0
  212. package/dist/types/data-structures/trie/trie.js +2 -0
  213. package/dist/types/index.d.ts +3 -0
  214. package/dist/types/index.js +19 -0
  215. package/dist/types/utils/index.d.ts +2 -0
  216. package/dist/types/utils/index.js +18 -0
  217. package/dist/types/utils/utils.d.ts +7 -0
  218. package/dist/types/utils/utils.js +2 -0
  219. package/dist/types/utils/validate-type.d.ts +19 -0
  220. package/dist/types/utils/validate-type.js +2 -0
  221. package/dist/utils/index.d.ts +1 -0
  222. package/dist/utils/index.js +17 -0
  223. package/dist/utils/utils.d.ts +24 -0
  224. package/dist/utils/utils.js +89 -0
  225. package/docs/.nojekyll +1 -0
  226. package/docs/assets/highlight.css +92 -0
  227. package/docs/assets/main.js +59 -0
  228. package/docs/assets/navigation.js +1 -0
  229. package/docs/assets/search.js +1 -0
  230. package/docs/assets/style.css +1383 -0
  231. package/docs/classes/AVLTree.html +2046 -0
  232. package/docs/classes/AVLTreeNode.html +263 -0
  233. package/docs/index.html +523 -0
  234. package/docs/modules.html +45 -0
  235. package/jest.config.js +8 -0
  236. package/package.json +147 -0
  237. package/src/data-structures/binary-tree/avl-tree.ts +443 -0
  238. package/src/data-structures/binary-tree/binary-indexed-tree.ts +306 -0
  239. package/src/data-structures/binary-tree/binary-tree.ts +1974 -0
  240. package/src/data-structures/binary-tree/bst.ts +676 -0
  241. package/src/data-structures/binary-tree/index.ts +7 -0
  242. package/src/data-structures/binary-tree/rb-tree.ts +585 -0
  243. package/src/data-structures/binary-tree/segment-tree.ts +190 -0
  244. package/src/data-structures/binary-tree/tree-multimap.ts +435 -0
  245. package/src/data-structures/graph/abstract-graph.ts +1181 -0
  246. package/src/data-structures/graph/directed-graph.ts +593 -0
  247. package/src/data-structures/graph/index.ts +4 -0
  248. package/src/data-structures/graph/map-graph.ts +106 -0
  249. package/src/data-structures/graph/undirected-graph.ts +331 -0
  250. package/src/data-structures/hash/hash-map.ts +401 -0
  251. package/src/data-structures/hash/hash-table.ts +268 -0
  252. package/src/data-structures/hash/index.ts +2 -0
  253. package/src/data-structures/heap/heap.ts +790 -0
  254. package/src/data-structures/heap/index.ts +3 -0
  255. package/src/data-structures/heap/max-heap.ts +26 -0
  256. package/src/data-structures/heap/min-heap.ts +26 -0
  257. package/src/data-structures/index.ts +11 -0
  258. package/src/data-structures/linked-list/doubly-linked-list.ts +837 -0
  259. package/src/data-structures/linked-list/index.ts +3 -0
  260. package/src/data-structures/linked-list/singly-linked-list.ts +784 -0
  261. package/src/data-structures/linked-list/skip-linked-list.ts +295 -0
  262. package/src/data-structures/matrix/index.ts +4 -0
  263. package/src/data-structures/matrix/matrix.ts +27 -0
  264. package/src/data-structures/matrix/matrix2d.ts +211 -0
  265. package/src/data-structures/matrix/navigator.ts +121 -0
  266. package/src/data-structures/matrix/vector2d.ts +315 -0
  267. package/src/data-structures/priority-queue/index.ts +3 -0
  268. package/src/data-structures/priority-queue/max-priority-queue.ts +25 -0
  269. package/src/data-structures/priority-queue/min-priority-queue.ts +25 -0
  270. package/src/data-structures/priority-queue/priority-queue.ts +16 -0
  271. package/src/data-structures/queue/deque.ts +1073 -0
  272. package/src/data-structures/queue/index.ts +2 -0
  273. package/src/data-structures/queue/queue.ts +308 -0
  274. package/src/data-structures/stack/index.ts +1 -0
  275. package/src/data-structures/stack/stack.ts +150 -0
  276. package/src/data-structures/tree/index.ts +1 -0
  277. package/src/data-structures/tree/tree.ts +41 -0
  278. package/src/data-structures/trie/index.ts +1 -0
  279. package/src/data-structures/trie/trie.ts +345 -0
  280. package/src/index.ts +11 -0
  281. package/src/interfaces/binary-tree.ts +10 -0
  282. package/src/interfaces/doubly-linked-list.ts +1 -0
  283. package/src/interfaces/graph.ts +7 -0
  284. package/src/interfaces/heap.ts +1 -0
  285. package/src/interfaces/index.ts +8 -0
  286. package/src/interfaces/navigator.ts +1 -0
  287. package/src/interfaces/priority-queue.ts +1 -0
  288. package/src/interfaces/segment-tree.ts +1 -0
  289. package/src/interfaces/singly-linked-list.ts +1 -0
  290. package/src/types/common.ts +23 -0
  291. package/src/types/data-structures/binary-tree/avl-tree.ts +9 -0
  292. package/src/types/data-structures/binary-tree/binary-indexed-tree.ts +1 -0
  293. package/src/types/data-structures/binary-tree/binary-tree.ts +35 -0
  294. package/src/types/data-structures/binary-tree/bst.ts +13 -0
  295. package/src/types/data-structures/binary-tree/index.ts +6 -0
  296. package/src/types/data-structures/binary-tree/rb-tree.ts +10 -0
  297. package/src/types/data-structures/binary-tree/segment-tree.ts +1 -0
  298. package/src/types/data-structures/binary-tree/tree-multimap.ts +8 -0
  299. package/src/types/data-structures/graph/abstract-graph.ts +11 -0
  300. package/src/types/data-structures/graph/directed-graph.ts +2 -0
  301. package/src/types/data-structures/graph/index.ts +3 -0
  302. package/src/types/data-structures/graph/map-graph.ts +1 -0
  303. package/src/types/data-structures/graph/undirected-graph.ts +1 -0
  304. package/src/types/data-structures/hash/hash-map.ts +12 -0
  305. package/src/types/data-structures/hash/hash-table.ts +1 -0
  306. package/src/types/data-structures/hash/index.ts +4 -0
  307. package/src/types/data-structures/heap/heap.ts +1 -0
  308. package/src/types/data-structures/heap/index.ts +1 -0
  309. package/src/types/data-structures/heap/max-heap.ts +1 -0
  310. package/src/types/data-structures/heap/min-heap.ts +1 -0
  311. package/src/types/data-structures/index.ts +11 -0
  312. package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -0
  313. package/src/types/data-structures/linked-list/index.ts +2 -0
  314. package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -0
  315. package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
  316. package/src/types/data-structures/matrix/index.ts +1 -0
  317. package/src/types/data-structures/matrix/matrix.ts +1 -0
  318. package/src/types/data-structures/matrix/matrix2d.ts +1 -0
  319. package/src/types/data-structures/matrix/navigator.ts +14 -0
  320. package/src/types/data-structures/matrix/vector2d.ts +1 -0
  321. package/src/types/data-structures/priority-queue/index.ts +3 -0
  322. package/src/types/data-structures/priority-queue/max-priority-queue.ts +1 -0
  323. package/src/types/data-structures/priority-queue/min-priority-queue.ts +1 -0
  324. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  325. package/src/types/data-structures/queue/deque.ts +1 -0
  326. package/src/types/data-structures/queue/index.ts +2 -0
  327. package/src/types/data-structures/queue/queue.ts +1 -0
  328. package/src/types/data-structures/stack/index.ts +1 -0
  329. package/src/types/data-structures/stack/stack.ts +1 -0
  330. package/src/types/data-structures/tree/index.ts +1 -0
  331. package/src/types/data-structures/tree/tree.ts +1 -0
  332. package/src/types/data-structures/trie/index.ts +1 -0
  333. package/src/types/data-structures/trie/trie.ts +1 -0
  334. package/src/types/index.ts +3 -0
  335. package/src/types/utils/index.ts +2 -0
  336. package/src/types/utils/utils.ts +6 -0
  337. package/src/types/utils/validate-type.ts +35 -0
  338. package/src/utils/index.ts +1 -0
  339. package/src/utils/utils.ts +101 -0
  340. package/test/index.test.ts +111 -0
  341. package/tsconfig.json +38 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Kirk Qi
5
+ * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import { Heap } from './heap';
9
+ import type { Comparator } from '../../types';
10
+ export declare class MaxHeap<E = any> extends Heap<E> {
11
+ constructor(options?: {
12
+ comparator: Comparator<E>;
13
+ nodes?: E[];
14
+ });
15
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * data-structure-typed
4
+ *
5
+ * @author Kirk Qi
6
+ * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
7
+ * @license MIT License
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MaxHeap = void 0;
11
+ const heap_1 = require("./heap");
12
+ class MaxHeap extends heap_1.Heap {
13
+ constructor(options = {
14
+ comparator: (a, b) => {
15
+ if (!(typeof a === 'number' && typeof b === 'number')) {
16
+ throw new Error('The a, b params of compare function must be number');
17
+ }
18
+ else {
19
+ return b - a;
20
+ }
21
+ }
22
+ }) {
23
+ super(options);
24
+ }
25
+ }
26
+ exports.MaxHeap = MaxHeap;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Kirk Qi
5
+ * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import { Heap } from './heap';
9
+ import type { Comparator } from '../../types';
10
+ export declare class MinHeap<E = any> extends Heap<E> {
11
+ constructor(options?: {
12
+ comparator: Comparator<E>;
13
+ nodes?: E[];
14
+ });
15
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * data-structure-typed
4
+ *
5
+ * @author Kirk Qi
6
+ * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
7
+ * @license MIT License
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MinHeap = void 0;
11
+ const heap_1 = require("./heap");
12
+ class MinHeap extends heap_1.Heap {
13
+ constructor(options = {
14
+ comparator: (a, b) => {
15
+ if (!(typeof a === 'number' && typeof b === 'number')) {
16
+ throw new Error('The a, b params of compare function must be number');
17
+ }
18
+ else {
19
+ return a - b;
20
+ }
21
+ }
22
+ }) {
23
+ super(options);
24
+ }
25
+ }
26
+ exports.MinHeap = MinHeap;
@@ -0,0 +1,11 @@
1
+ export * from './hash';
2
+ export * from './linked-list';
3
+ export * from './stack';
4
+ export * from './queue';
5
+ export * from './graph';
6
+ export * from './binary-tree';
7
+ export * from './tree';
8
+ export * from './heap';
9
+ export * from './priority-queue';
10
+ export * from './matrix';
11
+ export * from './trie';
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./hash"), exports);
18
+ __exportStar(require("./linked-list"), exports);
19
+ __exportStar(require("./stack"), exports);
20
+ __exportStar(require("./queue"), exports);
21
+ __exportStar(require("./graph"), exports);
22
+ __exportStar(require("./binary-tree"), exports);
23
+ __exportStar(require("./tree"), exports);
24
+ __exportStar(require("./heap"), exports);
25
+ __exportStar(require("./priority-queue"), exports);
26
+ __exportStar(require("./matrix"), exports);
27
+ __exportStar(require("./trie"), exports);
@@ -0,0 +1,456 @@
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
+ value: E;
10
+ next: DoublyLinkedListNode<E> | null;
11
+ prev: DoublyLinkedListNode<E> | null;
12
+ /**
13
+ * The constructor function initializes the value, next, and previous properties of an object.
14
+ * @param {E} value - The "value" parameter is the value that will be stored in the node. It can be of any data type, as it
15
+ * is defined as a generic type "E".
16
+ */
17
+ constructor(value: E);
18
+ }
19
+ export declare class DoublyLinkedList<E = any> {
20
+ /**
21
+ * The constructor initializes the linked list with an empty head, tail, and length.
22
+ */
23
+ constructor();
24
+ protected _head: DoublyLinkedListNode<E> | null;
25
+ get head(): DoublyLinkedListNode<E> | null;
26
+ protected _tail: DoublyLinkedListNode<E> | null;
27
+ get tail(): DoublyLinkedListNode<E> | null;
28
+ protected _length: number;
29
+ get length(): number;
30
+ get size(): number;
31
+ /**
32
+ * Time Complexity: O(n), where n is the length of the input array.
33
+ * Space Complexity: O(n)
34
+ */
35
+ /**
36
+ * Time Complexity: O(n), where n is the length of the input array.
37
+ * Space Complexity: O(n)
38
+ *
39
+ * The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
40
+ * given array.
41
+ * @param {E[]} data - The `data` parameter is an array of elements of type `E`.
42
+ * @returns The `fromArray` function returns a DoublyLinkedList object.
43
+ */
44
+ static fromArray<E>(data: E[]): DoublyLinkedList<E>;
45
+ /**
46
+ * Time Complexity: O(1)
47
+ * Space Complexity: O(1)
48
+ */
49
+ /**
50
+ * Time Complexity: O(1)
51
+ * Space Complexity: O(1)
52
+ *
53
+ * The push function adds a new node with the given value to the end of the doubly linked list.
54
+ * @param {E} value - The value to be added to the linked list.
55
+ */
56
+ push(value: E): void;
57
+ /**
58
+ * Time Complexity: O(1)
59
+ * Space Complexity: O(1)
60
+ */
61
+ /**
62
+ * Time Complexity: O(1)
63
+ * Space Complexity: O(1)
64
+ *
65
+ * The addLast function adds a new node with the given value to the end of the doubly linked list.
66
+ * @param {E} value - The value to be added to the linked list.
67
+ */
68
+ addLast(value: E): void;
69
+ /**
70
+ * Time Complexity: O(1)
71
+ * Space Complexity: O(1)
72
+ */
73
+ /**
74
+ * Time Complexity: O(1)
75
+ * Space Complexity: O(1)
76
+ *
77
+ * The `pop()` function removes and returns the value of the last node in a doubly linked list.
78
+ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
79
+ * list is empty, it returns null.
80
+ */
81
+ pop(): E | undefined;
82
+ /**
83
+ * Time Complexity: O(1)
84
+ * Space Complexity: O(1)
85
+ */
86
+ /**
87
+ * Time Complexity: O(1)
88
+ * Space Complexity: O(1)
89
+ *
90
+ * The `popLast()` function removes and returns the value of the last node in a doubly linked list.
91
+ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
92
+ * list is empty, it returns null.
93
+ */
94
+ popLast(): E | undefined;
95
+ /**
96
+ * Time Complexity: O(1)
97
+ * Space Complexity: O(1)
98
+ */
99
+ /**
100
+ * Time Complexity: O(1)
101
+ * Space Complexity: O(1)
102
+ *
103
+ * The `shift()` function removes and returns the value of the first node in a doubly linked list.
104
+ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
105
+ * list.
106
+ */
107
+ shift(): E | undefined;
108
+ /**
109
+ * Time Complexity: O(1)
110
+ * Space Complexity: O(1)
111
+ */
112
+ /**
113
+ * Time Complexity: O(1)
114
+ * Space Complexity: O(1)
115
+ *
116
+ * The `popFirst()` function removes and returns the value of the first node in a doubly linked list.
117
+ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
118
+ * list.
119
+ */
120
+ popFirst(): E | undefined;
121
+ /**
122
+ * Time Complexity: O(1)
123
+ * Space Complexity: O(1)
124
+ */
125
+ /**
126
+ * Time Complexity: O(1)
127
+ * Space Complexity: O(1)
128
+ *
129
+ * The unshift function adds a new node with the given value to the beginning of a doubly linked list.
130
+ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
131
+ * doubly linked list.
132
+ */
133
+ unshift(value: E): void;
134
+ /**
135
+ * Time Complexity: O(1)
136
+ * Space Complexity: O(1)
137
+ */
138
+ /**
139
+ * Time Complexity: O(1)
140
+ * Space Complexity: O(1)
141
+ *
142
+ * The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
143
+ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
144
+ * doubly linked list.
145
+ */
146
+ addFirst(value: E): void;
147
+ /**
148
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
149
+ * Space Complexity: O(1)
150
+ */
151
+ /**
152
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
153
+ * Space Complexity: O(1)
154
+ *
155
+ * The `getFirst` function returns the first node in a doubly linked list, or null if the list is empty.
156
+ * @returns The method `getFirst()` returns the first node of the doubly linked list, or `null` if the list is empty.
157
+ */
158
+ getFirst(): E | undefined;
159
+ /**
160
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
161
+ * Space Complexity: O(1)
162
+ */
163
+ /**
164
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
165
+ * Space Complexity: O(1)
166
+ *
167
+ * The `getLast` function returns the last node in a doubly linked list, or null if the list is empty.
168
+ * @returns The method `getLast()` returns the last node of the doubly linked list, or `null` if the list is empty.
169
+ */
170
+ getLast(): E | undefined;
171
+ /**
172
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
173
+ * Space Complexity: O(1)
174
+ */
175
+ /**
176
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
177
+ * Space Complexity: O(1)
178
+ *
179
+ * The `getAt` function returns the value at a specified index in a linked list, or null if the index is out of bounds.
180
+ * @param {number} index - The index parameter is a number that represents the position of the element we want to
181
+ * retrieve from the list.
182
+ * @returns The method is returning the value at the specified index in the linked list. If the index is out of bounds
183
+ * or the linked list is empty, it will return null.
184
+ */
185
+ getAt(index: number): E | undefined;
186
+ /**
187
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
188
+ * Space Complexity: O(1)
189
+ */
190
+ /**
191
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
192
+ * Space Complexity: O(1)
193
+ *
194
+ * The function `getNodeAt` returns the node at a given index in a doubly linked list, or null if the index is out of
195
+ * range.
196
+ * @param {number} index - The `index` parameter is a number that represents the position of the node we want to
197
+ * retrieve from the doubly linked list. It indicates the zero-based index of the node we want to access.
198
+ * @returns The method `getNodeAt(index: number)` returns a `DoublyLinkedListNode<E>` object if the index is within the
199
+ * valid range of the linked list, otherwise it returns `null`.
200
+ */
201
+ getNodeAt(index: number): DoublyLinkedListNode<E> | null;
202
+ /**
203
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
204
+ * Space Complexity: O(1)
205
+ */
206
+ /**
207
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
208
+ * Space Complexity: O(1)
209
+ *
210
+ * The function `findNodeByValue` searches for a node with a specific value in a doubly linked list and returns the
211
+ * node if found, otherwise it returns null.
212
+ * @param {E} value - The `value` parameter is the value that we want to search for in the doubly linked list.
213
+ * @returns The function `findNodeByValue` returns a `DoublyLinkedListNode<E>` if a node with the specified value `value`
214
+ * is found in the linked list. If no such node is found, it returns `null`.
215
+ */
216
+ getNode(value: E | null): DoublyLinkedListNode<E> | null;
217
+ /**
218
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
219
+ * Space Complexity: O(1)
220
+ */
221
+ /**
222
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
223
+ * Space Complexity: O(1)
224
+ *
225
+ * The `insert` function inserts a value at a specified index in a doubly linked list.
226
+ * @param {number} index - The index parameter represents the position at which the new value should be inserted in the
227
+ * DoublyLinkedList. It is of type number.
228
+ * @param {E} value - The `value` parameter represents the value that you want to insert into the Doubly Linked List at the
229
+ * specified index.
230
+ * @returns The `insert` method returns a boolean value. It returns `true` if the insertion is successful, and `false`
231
+ * if the index is out of bounds.
232
+ */
233
+ insertAt(index: number, value: E): boolean;
234
+ /**
235
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
236
+ * Space Complexity: O(1)
237
+ */
238
+ /**
239
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
240
+ * Space Complexity: O(1)
241
+ *
242
+ * The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
243
+ * @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list
244
+ * before which the new value will be inserted. It can be either the value of the existing node or the existing node
245
+ * itself.
246
+ * @param {E} newValue - The `newValue` parameter represents the value that you want to insert into the doubly linked
247
+ * list.
248
+ * @returns The method returns a boolean value. It returns `true` if the insertion is successful, and `false` if the
249
+ * insertion fails.
250
+ */
251
+ insertBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
252
+ /**
253
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
254
+ * Space Complexity: O(1)
255
+ */
256
+ /**
257
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
258
+ * Space Complexity: O(1)
259
+ *
260
+ * The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.
261
+ * @param {number} index - The index parameter represents the position of the element that needs to be deleted in the
262
+ * data structure. It is of type number.
263
+ * @returns The method `deleteAt` returns the value of the node that was deleted, or `null` if the index is out of
264
+ * bounds.
265
+ */
266
+ deleteAt(index: number): E | undefined;
267
+ /**
268
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
269
+ * Space Complexity: O(1)
270
+ */
271
+ /**
272
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
273
+ * Space Complexity: O(1)
274
+ *
275
+ * The `delete` function removes a node from a doubly linked list based on either the node itself or its value.
276
+ * @param {E | DoublyLinkedListNode<E>} valOrNode - The `valOrNode` parameter can accept either a value of type `E` or
277
+ * a `DoublyLinkedListNode<E>` object.
278
+ * @returns The `delete` method returns a boolean value. It returns `true` if the value or node was successfully
279
+ * deleted from the doubly linked list, and `false` if the value or node was not found in the list.
280
+ */
281
+ delete(valOrNode: E | DoublyLinkedListNode<E> | null): boolean;
282
+ /**
283
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
284
+ * Space Complexity: O(n)
285
+ */
286
+ /**
287
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
288
+ * Space Complexity: O(n)
289
+ *
290
+ * The `toArray` function converts a linked list into an array.
291
+ * @returns The `toArray()` method is returning an array of type `E[]`.
292
+ */
293
+ toArray(): E[];
294
+ /**
295
+ * The function checks if a variable has a length greater than zero and returns a boolean value.
296
+ * @returns A boolean value is being returned.
297
+ */
298
+ isEmpty(): boolean;
299
+ /**
300
+ * The `clear` function resets the linked list by setting the head, tail, and length to null and 0 respectively.
301
+ */
302
+ clear(): void;
303
+ /**
304
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
305
+ * Space Complexity: O(1)
306
+ */
307
+ /**
308
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
309
+ * Space Complexity: O(1)
310
+ *
311
+ * The `find` function iterates through a linked list and returns the first element that satisfies a given condition.
312
+ * @param callback - A function that takes a value of type E as its parameter and returns a boolean value. This
313
+ * function is used to determine whether a particular value in the linked list satisfies a certain condition.
314
+ * @returns The method `find` returns the first element in the linked list that satisfies the condition specified by
315
+ * the callback function. If no element satisfies the condition, it returns `null`.
316
+ */
317
+ find(callback: (value: E) => boolean): E | null;
318
+ /**
319
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
320
+ * Space Complexity: O(1)
321
+ */
322
+ /**
323
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
324
+ * Space Complexity: O(1)
325
+ *
326
+ * The function returns the index of the first occurrence of a given value in a linked list.
327
+ * @param {E} value - The parameter `value` is of type `E`, which means it can be any data type. It represents the value
328
+ * that we are searching for in the linked list.
329
+ * @returns The method `indexOf` returns the index of the first occurrence of the specified value `value` in the linked
330
+ * list. If the value is not found, it returns -1.
331
+ */
332
+ indexOf(value: E): number;
333
+ /**
334
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
335
+ * Space Complexity: O(1)
336
+ */
337
+ /**
338
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
339
+ * Space Complexity: O(1)
340
+ *
341
+ * The `findBackward` function iterates through a linked list from the last node to the first node and returns the last
342
+ * value that satisfies the given callback function, or null if no value satisfies the callback.
343
+ * @param callback - A function that takes a value of type E as its parameter and returns a boolean value. This
344
+ * function is used to determine whether a given value satisfies a certain condition.
345
+ * @returns The method `findBackward` returns the last value in the linked list that satisfies the condition specified by
346
+ * the callback function. If no value satisfies the condition, it returns `null`.
347
+ */
348
+ findBackward(callback: (value: E) => boolean): E | null;
349
+ /**
350
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
351
+ * Space Complexity: O(n)
352
+ */
353
+ /**
354
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
355
+ * Space Complexity: O(n)
356
+ *
357
+ * The `toArrayBackward` function converts a doubly linked list into an array in reverse order.
358
+ * @returns The `toArrayBackward()` function returns an array of type `E[]`.
359
+ */
360
+ toArrayBackward(): E[];
361
+ /**
362
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
363
+ * Space Complexity: O(1)
364
+ */
365
+ /**
366
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
367
+ * Space Complexity: O(1)
368
+ *
369
+ * The `reverse` function reverses the order of the elements in a doubly linked list.
370
+ */
371
+ reverse(): void;
372
+ /**
373
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
374
+ * Space Complexity: O(1)
375
+ */
376
+ /**
377
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
378
+ * Space Complexity: O(1)
379
+ *
380
+ * The `forEach` function iterates over each element in a linked list and applies a callback function to each element.
381
+ * @param callback - The callback parameter is a function that takes two arguments: value and index. The value argument
382
+ * represents the value of the current node in the linked list, and the index argument represents the index of the
383
+ * current node in the linked list.
384
+ */
385
+ forEach(callback: (value: E, index: number) => void): void;
386
+ /**
387
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
388
+ * Space Complexity: O(n)
389
+ */
390
+ /**
391
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
392
+ * Space Complexity: O(n)
393
+ *
394
+ * The `map` function takes a callback function and applies it to each element in the DoublyLinkedList, returning a new
395
+ * DoublyLinkedList with the transformed values.
396
+ * @param callback - The callback parameter is a function that takes a value of type E (the type of values stored in
397
+ * the original DoublyLinkedList) and returns a value of type U (the type of values that will be stored in the mapped
398
+ * DoublyLinkedList).
399
+ * @returns The `map` function is returning a new instance of `DoublyLinkedList<U>` that contains the mapped values.
400
+ */
401
+ map<U>(callback: (value: E) => U): DoublyLinkedList<U>;
402
+ /**
403
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
404
+ * Space Complexity: O(n)
405
+ */
406
+ /**
407
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
408
+ * Space Complexity: O(n)
409
+ *
410
+ * The `filter` function iterates through a DoublyLinkedList and returns a new DoublyLinkedList containing only the
411
+ * elements that satisfy the given callback function.
412
+ * @param callback - The `callback` parameter is a function that takes a value of type `E` and returns a boolean value.
413
+ * It is used to determine whether a value should be included in the filtered list or not.
414
+ * @returns The filtered list, which is an instance of the DoublyLinkedList class.
415
+ */
416
+ filter(callback: (value: E) => boolean): DoublyLinkedList<E>;
417
+ /**
418
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
419
+ * Space Complexity: O(n)
420
+ */
421
+ /**
422
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
423
+ * Space Complexity: O(n)
424
+ *
425
+ * The `reduce` function iterates over a linked list and applies a callback function to each element, accumulating a
426
+ * single value.
427
+ * @param callback - The `callback` parameter is a function that takes two arguments: `accumulator` and `value`. It is
428
+ * used to perform a specific operation on each element of the linked list.
429
+ * @param {U} initialValue - The `initialValue` parameter is the initial value of the accumulator. It is the starting
430
+ * point for the reduction operation.
431
+ * @returns The `reduce` method is returning the final value of the accumulator after iterating through all the
432
+ * elements in the linked list.
433
+ */
434
+ reduce<U>(callback: (accumulator: U, value: E) => U, initialValue: U): U;
435
+ /**
436
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
437
+ * Space Complexity: O(1)
438
+ */
439
+ /**
440
+ * Time Complexity: O(n), where n is the number of elements in the linked list.
441
+ * Space Complexity: O(1)
442
+ *
443
+ * The `insertAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
444
+ * @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list
445
+ * after which the new value will be inserted. It can be either the value of the existing node or the existing node
446
+ * itself.
447
+ * @param {E} newValue - The value that you want to insert into the doubly linked list.
448
+ * @returns The method returns a boolean value. It returns true if the insertion is successful, and false if the
449
+ * existing value or node is not found in the doubly linked list.
450
+ */
451
+ insertAfter(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
452
+ /**
453
+ * The function returns an iterator that iterates over the values of a linked list.
454
+ */
455
+ [Symbol.iterator](): Generator<E, void, unknown>;
456
+ }