data-structure-typed 1.21.4 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (660) hide show
  1. package/.auto-changelog +9 -0
  2. package/.auto-changelog-template.hbs +36 -0
  3. package/.eslintrc.js +61 -0
  4. package/.gitattributes +112 -0
  5. package/.github/workflows/ci.yml +30 -0
  6. package/.prettierignore +6 -0
  7. package/.prettierrc.js +16 -0
  8. package/CHANGELOG.md +17 -0
  9. package/CODE-OF-CONDUCT.md +80 -0
  10. package/COMMANDS.md +28 -0
  11. package/README.md +147 -95
  12. package/SECURITY.md +15 -0
  13. package/coverage/clover.xml +3393 -0
  14. package/coverage/coverage-final.json +67 -0
  15. package/coverage/lcov-report/base.css +224 -0
  16. package/coverage/lcov-report/block-navigation.js +87 -0
  17. package/coverage/lcov-report/favicon.png +0 -0
  18. package/coverage/lcov-report/index.html +386 -0
  19. package/coverage/lcov-report/prettify.css +1 -0
  20. package/coverage/lcov-report/prettify.js +2 -0
  21. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  22. package/coverage/lcov-report/sorter.js +196 -0
  23. package/coverage/lcov-report/src/data-structures/binary-tree/aa-tree.ts.html +88 -0
  24. package/coverage/lcov-report/src/data-structures/binary-tree/abstract-binary-tree.ts.html +4966 -0
  25. package/coverage/lcov-report/src/data-structures/binary-tree/avl-tree.ts.html +1015 -0
  26. package/coverage/lcov-report/src/data-structures/binary-tree/b-tree.ts.html +88 -0
  27. package/coverage/lcov-report/src/data-structures/binary-tree/binary-indexed-tree.ts.html +313 -0
  28. package/coverage/lcov-report/src/data-structures/binary-tree/binary-tree.ts.html +226 -0
  29. package/coverage/lcov-report/src/data-structures/binary-tree/bst.ts.html +1714 -0
  30. package/coverage/lcov-report/src/data-structures/binary-tree/index.html +296 -0
  31. package/coverage/lcov-report/src/data-structures/binary-tree/index.ts.html +121 -0
  32. package/coverage/lcov-report/src/data-structures/binary-tree/rb-tree.ts.html +388 -0
  33. package/coverage/lcov-report/src/data-structures/binary-tree/segment-tree.ts.html +811 -0
  34. package/coverage/lcov-report/src/data-structures/binary-tree/splay-tree.ts.html +88 -0
  35. package/coverage/lcov-report/src/data-structures/binary-tree/tree-multiset.ts.html +2185 -0
  36. package/coverage/lcov-report/src/data-structures/binary-tree/two-three-tree.ts.html +88 -0
  37. package/coverage/lcov-report/src/data-structures/graph/abstract-graph.ts.html +3205 -0
  38. package/coverage/lcov-report/src/data-structures/graph/directed-graph.ts.html +1495 -0
  39. package/coverage/lcov-report/src/data-structures/graph/index.html +176 -0
  40. package/coverage/lcov-report/src/data-structures/graph/index.ts.html +97 -0
  41. package/coverage/lcov-report/src/data-structures/graph/map-graph.ts.html +472 -0
  42. package/coverage/lcov-report/src/data-structures/graph/undirected-graph.ts.html +907 -0
  43. package/coverage/lcov-report/src/data-structures/hash/coordinate-map.ts.html +286 -0
  44. package/coverage/lcov-report/src/data-structures/hash/coordinate-set.ts.html +253 -0
  45. package/coverage/lcov-report/src/data-structures/hash/hash-table.ts.html +88 -0
  46. package/coverage/lcov-report/src/data-structures/hash/index.html +206 -0
  47. package/coverage/lcov-report/src/data-structures/hash/index.ts.html +103 -0
  48. package/coverage/lcov-report/src/data-structures/hash/pair.ts.html +88 -0
  49. package/coverage/lcov-report/src/data-structures/hash/tree-map.ts.html +88 -0
  50. package/coverage/lcov-report/src/data-structures/hash/tree-set.ts.html +88 -0
  51. package/coverage/lcov-report/src/data-structures/heap/heap.ts.html +721 -0
  52. package/coverage/lcov-report/src/data-structures/heap/index.html +161 -0
  53. package/coverage/lcov-report/src/data-structures/heap/index.ts.html +94 -0
  54. package/coverage/lcov-report/src/data-structures/heap/max-heap.ts.html +178 -0
  55. package/coverage/lcov-report/src/data-structures/heap/min-heap.ts.html +181 -0
  56. package/coverage/lcov-report/src/data-structures/index.html +116 -0
  57. package/coverage/lcov-report/src/data-structures/index.ts.html +118 -0
  58. package/coverage/lcov-report/src/data-structures/linked-list/doubly-linked-list.ts.html +1804 -0
  59. package/coverage/lcov-report/src/data-structures/linked-list/index.html +161 -0
  60. package/coverage/lcov-report/src/data-structures/linked-list/index.ts.html +94 -0
  61. package/coverage/lcov-report/src/data-structures/linked-list/singly-linked-list.ts.html +1588 -0
  62. package/coverage/lcov-report/src/data-structures/linked-list/skip-linked-list.ts.html +88 -0
  63. package/coverage/lcov-report/src/data-structures/matrix/index.html +176 -0
  64. package/coverage/lcov-report/src/data-structures/matrix/index.ts.html +97 -0
  65. package/coverage/lcov-report/src/data-structures/matrix/matrix.ts.html +166 -0
  66. package/coverage/lcov-report/src/data-structures/matrix/matrix2d.ts.html +721 -0
  67. package/coverage/lcov-report/src/data-structures/matrix/navigator.ts.html +448 -0
  68. package/coverage/lcov-report/src/data-structures/matrix/vector2d.ts.html +1033 -0
  69. package/coverage/lcov-report/src/data-structures/priority-queue/index.html +161 -0
  70. package/coverage/lcov-report/src/data-structures/priority-queue/index.ts.html +94 -0
  71. package/coverage/lcov-report/src/data-structures/priority-queue/max-priority-queue.ts.html +253 -0
  72. package/coverage/lcov-report/src/data-structures/priority-queue/min-priority-queue.ts.html +256 -0
  73. package/coverage/lcov-report/src/data-structures/priority-queue/priority-queue.ts.html +1162 -0
  74. package/coverage/lcov-report/src/data-structures/queue/deque.ts.html +976 -0
  75. package/coverage/lcov-report/src/data-structures/queue/index.html +146 -0
  76. package/coverage/lcov-report/src/data-structures/queue/index.ts.html +91 -0
  77. package/coverage/lcov-report/src/data-structures/queue/queue.ts.html +658 -0
  78. package/coverage/lcov-report/src/data-structures/stack/index.html +131 -0
  79. package/coverage/lcov-report/src/data-structures/stack/index.ts.html +88 -0
  80. package/coverage/lcov-report/src/data-structures/stack/stack.ts.html +379 -0
  81. package/coverage/lcov-report/src/data-structures/tree/index.html +131 -0
  82. package/coverage/lcov-report/src/data-structures/tree/index.ts.html +88 -0
  83. package/coverage/lcov-report/src/data-structures/tree/tree.ts.html +292 -0
  84. package/coverage/lcov-report/src/data-structures/trie/index.html +131 -0
  85. package/coverage/lcov-report/src/data-structures/trie/index.ts.html +88 -0
  86. package/coverage/lcov-report/src/data-structures/trie/trie.ts.html +760 -0
  87. package/coverage/lcov-report/src/index.html +116 -0
  88. package/coverage/lcov-report/src/index.ts.html +97 -0
  89. package/coverage/lcov-report/src/interfaces/index.html +116 -0
  90. package/coverage/lcov-report/src/interfaces/index.ts.html +130 -0
  91. package/coverage/lcov-report/src/types/data-structures/abstract-binary-tree.ts.html +235 -0
  92. package/coverage/lcov-report/src/types/data-structures/bst.ts.html +124 -0
  93. package/coverage/lcov-report/src/types/data-structures/directed-graph.ts.html +109 -0
  94. package/coverage/lcov-report/src/types/data-structures/index.html +176 -0
  95. package/coverage/lcov-report/src/types/data-structures/index.ts.html +130 -0
  96. package/coverage/lcov-report/src/types/data-structures/rb-tree.ts.html +106 -0
  97. package/coverage/lcov-report/src/types/index.html +116 -0
  98. package/coverage/lcov-report/src/types/index.ts.html +94 -0
  99. package/coverage/lcov-report/src/types/utils/index.html +116 -0
  100. package/coverage/lcov-report/src/types/utils/index.ts.html +91 -0
  101. package/coverage/lcov-report/src/utils/index.html +131 -0
  102. package/coverage/lcov-report/src/utils/index.ts.html +88 -0
  103. package/coverage/lcov-report/src/utils/utils.ts.html +322 -0
  104. package/coverage/lcov-report/test/utils/index.html +146 -0
  105. package/coverage/lcov-report/test/utils/index.ts.html +91 -0
  106. package/coverage/lcov-report/test/utils/magnitude.ts.html +148 -0
  107. package/coverage/lcov-report/test/utils/number.ts.html +94 -0
  108. package/coverage/lcov.info +6676 -0
  109. package/dist/data-structures/binary-tree/aa-tree.js +6 -2
  110. package/dist/data-structures/binary-tree/aa-tree.js.map +1 -0
  111. package/dist/data-structures/binary-tree/abstract-binary-tree.js +398 -672
  112. package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +1 -0
  113. package/dist/data-structures/binary-tree/avl-tree.js +122 -151
  114. package/dist/data-structures/binary-tree/avl-tree.js.map +1 -0
  115. package/dist/data-structures/binary-tree/b-tree.js +6 -2
  116. package/dist/data-structures/binary-tree/b-tree.js.map +1 -0
  117. package/dist/data-structures/binary-tree/binary-indexed-tree.js +24 -54
  118. package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
  119. package/dist/data-structures/binary-tree/binary-tree.js +31 -32
  120. package/dist/data-structures/binary-tree/binary-tree.js.map +1 -0
  121. package/dist/data-structures/binary-tree/bst.js +266 -208
  122. package/dist/data-structures/binary-tree/bst.js.map +1 -0
  123. package/dist/data-structures/binary-tree/index.js +1 -0
  124. package/dist/data-structures/binary-tree/index.js.map +1 -0
  125. package/dist/data-structures/binary-tree/rb-tree.js +46 -37
  126. package/dist/data-structures/binary-tree/rb-tree.js.map +1 -0
  127. package/dist/data-structures/binary-tree/segment-tree.js +124 -127
  128. package/dist/data-structures/binary-tree/segment-tree.js.map +1 -0
  129. package/dist/data-structures/binary-tree/splay-tree.js +6 -2
  130. package/dist/data-structures/binary-tree/splay-tree.js.map +1 -0
  131. package/dist/data-structures/binary-tree/tree-multiset.js +227 -354
  132. package/dist/data-structures/binary-tree/tree-multiset.js.map +1 -0
  133. package/dist/data-structures/binary-tree/two-three-tree.js +6 -2
  134. package/dist/data-structures/binary-tree/two-three-tree.js.map +1 -0
  135. package/dist/data-structures/graph/abstract-graph.js +582 -609
  136. package/dist/data-structures/graph/abstract-graph.js.map +1 -0
  137. package/dist/data-structures/graph/directed-graph.js +276 -312
  138. package/dist/data-structures/graph/directed-graph.js.map +1 -0
  139. package/dist/data-structures/graph/index.js +1 -0
  140. package/dist/data-structures/graph/index.js.map +1 -0
  141. package/dist/data-structures/graph/map-graph.js +88 -100
  142. package/dist/data-structures/graph/map-graph.js.map +1 -0
  143. package/dist/data-structures/graph/undirected-graph.js +180 -195
  144. package/dist/data-structures/graph/undirected-graph.js.map +1 -0
  145. package/dist/data-structures/hash/coordinate-map.js +46 -58
  146. package/dist/data-structures/hash/coordinate-map.js.map +1 -0
  147. package/dist/data-structures/hash/coordinate-set.js +43 -48
  148. package/dist/data-structures/hash/coordinate-set.js.map +1 -0
  149. package/dist/data-structures/hash/hash-table.js +6 -2
  150. package/dist/data-structures/hash/hash-table.js.map +1 -0
  151. package/dist/data-structures/hash/index.js +1 -0
  152. package/dist/data-structures/hash/index.js.map +1 -0
  153. package/dist/data-structures/hash/pair.js +6 -2
  154. package/dist/data-structures/hash/pair.js.map +1 -0
  155. package/dist/data-structures/hash/tree-map.js +6 -2
  156. package/dist/data-structures/hash/tree-map.js.map +1 -0
  157. package/dist/data-structures/hash/tree-set.js +6 -2
  158. package/dist/data-structures/hash/tree-set.js.map +1 -0
  159. package/dist/data-structures/heap/heap.js +83 -120
  160. package/dist/data-structures/heap/heap.js.map +1 -0
  161. package/dist/data-structures/heap/index.js +1 -0
  162. package/dist/data-structures/heap/index.js.map +1 -0
  163. package/dist/data-structures/heap/max-heap.js +27 -24
  164. package/dist/data-structures/heap/max-heap.js.map +1 -0
  165. package/dist/data-structures/heap/min-heap.js +27 -25
  166. package/dist/data-structures/heap/min-heap.js.map +1 -0
  167. package/dist/data-structures/index.js +1 -0
  168. package/dist/data-structures/index.js.map +1 -0
  169. package/dist/data-structures/linked-list/doubly-linked-list.js +202 -307
  170. package/dist/data-structures/linked-list/doubly-linked-list.js.map +1 -0
  171. package/dist/data-structures/linked-list/index.js +1 -0
  172. package/dist/data-structures/linked-list/index.js.map +1 -0
  173. package/dist/data-structures/linked-list/singly-linked-list.js +223 -251
  174. package/dist/data-structures/linked-list/singly-linked-list.js.map +1 -0
  175. package/dist/data-structures/linked-list/skip-linked-list.js +6 -2
  176. package/dist/data-structures/linked-list/skip-linked-list.js.map +1 -0
  177. package/dist/data-structures/matrix/index.js +1 -0
  178. package/dist/data-structures/matrix/index.js.map +1 -0
  179. package/dist/data-structures/matrix/matrix.js +9 -22
  180. package/dist/data-structures/matrix/matrix.js.map +1 -0
  181. package/dist/data-structures/matrix/matrix2d.js +75 -149
  182. package/dist/data-structures/matrix/matrix2d.js.map +1 -0
  183. package/dist/data-structures/matrix/navigator.js +38 -46
  184. package/dist/data-structures/matrix/navigator.js.map +1 -0
  185. package/dist/data-structures/matrix/vector2d.js +90 -254
  186. package/dist/data-structures/matrix/vector2d.js.map +1 -0
  187. package/dist/data-structures/priority-queue/index.js +1 -0
  188. package/dist/data-structures/priority-queue/index.js.map +1 -0
  189. package/dist/data-structures/priority-queue/max-priority-queue.js +47 -32
  190. package/dist/data-structures/priority-queue/max-priority-queue.js.map +1 -0
  191. package/dist/data-structures/priority-queue/min-priority-queue.js +47 -33
  192. package/dist/data-structures/priority-queue/min-priority-queue.js.map +1 -0
  193. package/dist/data-structures/priority-queue/priority-queue.js +150 -241
  194. package/dist/data-structures/priority-queue/priority-queue.js.map +1 -0
  195. package/dist/data-structures/queue/deque.js +130 -162
  196. package/dist/data-structures/queue/deque.js.map +1 -0
  197. package/dist/data-structures/queue/index.js +1 -0
  198. package/dist/data-structures/queue/index.js.map +1 -0
  199. package/dist/data-structures/queue/queue.js +181 -100
  200. package/dist/data-structures/queue/queue.js.map +1 -0
  201. package/dist/data-structures/stack/index.js +1 -0
  202. package/dist/data-structures/stack/index.js.map +1 -0
  203. package/dist/data-structures/stack/stack.js +23 -71
  204. package/dist/data-structures/stack/stack.js.map +1 -0
  205. package/dist/data-structures/tree/index.js +1 -0
  206. package/dist/data-structures/tree/index.js.map +1 -0
  207. package/dist/data-structures/tree/tree.js +46 -33
  208. package/dist/data-structures/tree/tree.js.map +1 -0
  209. package/dist/data-structures/trie/index.js +1 -0
  210. package/dist/data-structures/trie/index.js.map +1 -0
  211. package/dist/data-structures/trie/trie.js +201 -129
  212. package/dist/data-structures/trie/trie.js.map +1 -0
  213. package/dist/index.js +1 -0
  214. package/dist/index.js.map +1 -0
  215. package/dist/interfaces/abstract-binary-tree.js +1 -0
  216. package/dist/interfaces/abstract-binary-tree.js.map +1 -0
  217. package/dist/interfaces/abstract-graph.js +1 -0
  218. package/dist/interfaces/abstract-graph.js.map +1 -0
  219. package/dist/interfaces/avl-tree.js +1 -0
  220. package/dist/interfaces/avl-tree.js.map +1 -0
  221. package/dist/interfaces/binary-tree.js +1 -0
  222. package/dist/interfaces/binary-tree.js.map +1 -0
  223. package/dist/interfaces/bst.js +1 -0
  224. package/dist/interfaces/bst.js.map +1 -0
  225. package/dist/interfaces/directed-graph.js +1 -0
  226. package/dist/interfaces/directed-graph.js.map +1 -0
  227. package/dist/interfaces/doubly-linked-list.js +1 -0
  228. package/dist/interfaces/doubly-linked-list.js.map +1 -0
  229. package/dist/interfaces/heap.js +1 -0
  230. package/dist/interfaces/heap.js.map +1 -0
  231. package/dist/interfaces/index.js +1 -0
  232. package/dist/interfaces/index.js.map +1 -0
  233. package/dist/interfaces/navigator.js +1 -0
  234. package/dist/interfaces/navigator.js.map +1 -0
  235. package/dist/interfaces/priority-queue.js +1 -0
  236. package/dist/interfaces/priority-queue.js.map +1 -0
  237. package/dist/interfaces/rb-tree.js +1 -0
  238. package/dist/interfaces/rb-tree.js.map +1 -0
  239. package/dist/interfaces/segment-tree.js +1 -0
  240. package/dist/interfaces/segment-tree.js.map +1 -0
  241. package/dist/interfaces/singly-linked-list.js +1 -0
  242. package/dist/interfaces/singly-linked-list.js.map +1 -0
  243. package/dist/interfaces/tree-multiset.js +1 -0
  244. package/dist/interfaces/tree-multiset.js.map +1 -0
  245. package/dist/interfaces/undirected-graph.js +1 -0
  246. package/dist/interfaces/undirected-graph.js.map +1 -0
  247. package/dist/types/data-structures/abstract-binary-tree.js +1 -7
  248. package/dist/types/data-structures/abstract-binary-tree.js.map +1 -0
  249. package/dist/types/data-structures/abstract-graph.js +1 -0
  250. package/dist/types/data-structures/abstract-graph.js.map +1 -0
  251. package/dist/types/data-structures/avl-tree.js +1 -0
  252. package/dist/types/data-structures/avl-tree.js.map +1 -0
  253. package/dist/types/data-structures/binary-tree.js +1 -0
  254. package/dist/types/data-structures/binary-tree.js.map +1 -0
  255. package/dist/types/data-structures/bst.js +1 -0
  256. package/dist/types/data-structures/bst.js.map +1 -0
  257. package/dist/types/data-structures/directed-graph.js +1 -0
  258. package/dist/types/data-structures/directed-graph.js.map +1 -0
  259. package/dist/types/data-structures/doubly-linked-list.js +1 -0
  260. package/dist/types/data-structures/doubly-linked-list.js.map +1 -0
  261. package/dist/types/data-structures/heap.js +1 -0
  262. package/dist/types/data-structures/heap.js.map +1 -0
  263. package/dist/types/data-structures/index.js +1 -0
  264. package/dist/types/data-structures/index.js.map +1 -0
  265. package/dist/types/data-structures/map-graph.js +1 -0
  266. package/dist/types/data-structures/map-graph.js.map +1 -0
  267. package/dist/types/data-structures/navigator.js +1 -0
  268. package/dist/types/data-structures/navigator.js.map +1 -0
  269. package/dist/types/data-structures/priority-queue.js +1 -0
  270. package/dist/types/data-structures/priority-queue.js.map +1 -0
  271. package/dist/types/data-structures/rb-tree.js +1 -0
  272. package/dist/types/data-structures/rb-tree.js.map +1 -0
  273. package/dist/types/data-structures/segment-tree.js +1 -0
  274. package/dist/types/data-structures/segment-tree.js.map +1 -0
  275. package/dist/types/data-structures/singly-linked-list.js +1 -0
  276. package/dist/types/data-structures/singly-linked-list.js.map +1 -0
  277. package/dist/types/data-structures/tree-multiset.js +1 -0
  278. package/dist/types/data-structures/tree-multiset.js.map +1 -0
  279. package/dist/types/helpers.js +1 -0
  280. package/dist/types/helpers.js.map +1 -0
  281. package/dist/types/index.js +1 -0
  282. package/dist/types/index.js.map +1 -0
  283. package/dist/types/utils/index.js +1 -0
  284. package/dist/types/utils/index.js.map +1 -0
  285. package/dist/types/utils/utils.js +1 -0
  286. package/dist/types/utils/utils.js.map +1 -0
  287. package/dist/types/utils/validate-type.js +1 -0
  288. package/dist/types/utils/validate-type.js.map +1 -0
  289. package/dist/utils/index.js +1 -0
  290. package/dist/utils/index.js.map +1 -0
  291. package/dist/utils/utils.js +108 -22
  292. package/dist/utils/utils.js.map +1 -0
  293. package/docs/.nojekyll +1 -0
  294. package/docs/assets/highlight.css +127 -0
  295. package/docs/assets/main.js +58 -0
  296. package/docs/assets/search.js +1 -0
  297. package/docs/assets/style.css +1367 -0
  298. package/docs/classes/AVLTree.html +2182 -0
  299. package/docs/classes/AVLTreeNode.html +399 -0
  300. package/docs/classes/AaTree.html +202 -0
  301. package/docs/classes/AbstractBinaryTree.html +1836 -0
  302. package/docs/classes/AbstractBinaryTreeNode.html +441 -0
  303. package/docs/classes/AbstractEdge.html +345 -0
  304. package/docs/classes/AbstractGraph.html +1105 -0
  305. package/docs/classes/AbstractVertex.html +299 -0
  306. package/docs/classes/ArrayDeque.html +469 -0
  307. package/docs/classes/BST.html +2026 -0
  308. package/docs/classes/BSTNode.html +400 -0
  309. package/docs/classes/BTree.html +202 -0
  310. package/docs/classes/BinaryIndexedTree.html +371 -0
  311. package/docs/classes/BinaryTree.html +1867 -0
  312. package/docs/classes/BinaryTreeNode.html +399 -0
  313. package/docs/classes/Character.html +250 -0
  314. package/docs/classes/CoordinateMap.html +513 -0
  315. package/docs/classes/CoordinateSet.html +474 -0
  316. package/docs/classes/Deque.html +1005 -0
  317. package/docs/classes/DirectedEdge.html +404 -0
  318. package/docs/classes/DirectedGraph.html +1530 -0
  319. package/docs/classes/DirectedVertex.html +286 -0
  320. package/docs/classes/DoublyLinkedList.html +998 -0
  321. package/docs/classes/DoublyLinkedListNode.html +327 -0
  322. package/docs/classes/HashTable.html +202 -0
  323. package/docs/classes/Heap.html +647 -0
  324. package/docs/classes/HeapItem.html +296 -0
  325. package/docs/classes/LinkedListQueue.html +884 -0
  326. package/docs/classes/MapEdge.html +391 -0
  327. package/docs/classes/MapGraph.html +1583 -0
  328. package/docs/classes/MapVertex.html +356 -0
  329. package/docs/classes/Matrix2D.html +532 -0
  330. package/docs/classes/MatrixNTI2D.html +270 -0
  331. package/docs/classes/MaxHeap.html +671 -0
  332. package/docs/classes/MaxPriorityQueue.html +866 -0
  333. package/docs/classes/MinHeap.html +672 -0
  334. package/docs/classes/MinPriorityQueue.html +868 -0
  335. package/docs/classes/Navigator.html +343 -0
  336. package/docs/classes/ObjectDeque.html +527 -0
  337. package/docs/classes/Pair.html +202 -0
  338. package/docs/classes/PriorityQueue.html +790 -0
  339. package/docs/classes/Queue.html +521 -0
  340. package/docs/classes/RBTree.html +2024 -0
  341. package/docs/classes/RBTreeNode.html +431 -0
  342. package/docs/classes/SegmentTree.html +464 -0
  343. package/docs/classes/SegmentTreeNode.html +387 -0
  344. package/docs/classes/SinglyLinkedList.html +830 -0
  345. package/docs/classes/SinglyLinkedListNode.html +300 -0
  346. package/docs/classes/SkipLinkedList.html +202 -0
  347. package/docs/classes/SplayTree.html +202 -0
  348. package/docs/classes/Stack.html +398 -0
  349. package/docs/classes/TreeMap.html +202 -0
  350. package/docs/classes/TreeMultiset.html +2510 -0
  351. package/docs/classes/TreeMultisetNode.html +447 -0
  352. package/docs/classes/TreeNode.html +344 -0
  353. package/docs/classes/TreeSet.html +202 -0
  354. package/docs/classes/Trie.html +402 -0
  355. package/docs/classes/TrieNode.html +310 -0
  356. package/docs/classes/TwoThreeTree.html +202 -0
  357. package/docs/classes/UndirectedEdge.html +374 -0
  358. package/docs/classes/UndirectedGraph.html +1285 -0
  359. package/docs/classes/UndirectedVertex.html +284 -0
  360. package/docs/classes/Vector2D.html +835 -0
  361. package/docs/enums/CP.html +211 -0
  362. package/docs/enums/FamilyPosition.html +239 -0
  363. package/docs/enums/LoopType.html +212 -0
  364. package/docs/enums/RBColor.html +204 -0
  365. package/docs/enums/TopologicalProperty.html +211 -0
  366. package/docs/functions/arrayRemove.html +208 -0
  367. package/docs/functions/isThunk.html +186 -0
  368. package/docs/functions/toThunk.html +186 -0
  369. package/docs/functions/trampoline.html +186 -0
  370. package/docs/functions/trampolineAsync.html +186 -0
  371. package/docs/functions/uuidV4.html +181 -0
  372. package/docs/index.html +693 -0
  373. package/docs/interfaces/IAVLTree.html +1245 -0
  374. package/docs/interfaces/IAbstractBinaryTree.html +1101 -0
  375. package/docs/interfaces/IAbstractBinaryTreeNode.html +335 -0
  376. package/docs/interfaces/IAbstractGraph.html +433 -0
  377. package/docs/interfaces/IBST.html +1245 -0
  378. package/docs/interfaces/IDirectedGraph.html +570 -0
  379. package/docs/interfaces/IRBTree.html +1247 -0
  380. package/docs/interfaces/IUNDirectedGraph.html +463 -0
  381. package/docs/modules.html +328 -0
  382. package/docs/types/AVLTreeNodeNested.html +182 -0
  383. package/docs/types/AVLTreeOptions.html +180 -0
  384. package/docs/types/AbstractBinaryTreeNodeNested.html +182 -0
  385. package/docs/types/AbstractBinaryTreeNodeProperties.html +182 -0
  386. package/docs/types/AbstractBinaryTreeNodeProperty.html +182 -0
  387. package/docs/types/AbstractBinaryTreeOptions.html +182 -0
  388. package/docs/types/BSTComparator.html +192 -0
  389. package/docs/types/BSTNodeNested.html +182 -0
  390. package/docs/types/BSTOptions.html +182 -0
  391. package/docs/types/BinaryTreeDeletedResult.html +189 -0
  392. package/docs/types/BinaryTreeNodeId.html +177 -0
  393. package/docs/types/BinaryTreeNodeNested.html +182 -0
  394. package/docs/types/BinaryTreeNodePropertyName.html +177 -0
  395. package/docs/types/BinaryTreeOptions.html +180 -0
  396. package/docs/types/DFSOrderPattern.html +177 -0
  397. package/docs/types/DijkstraResult.html +199 -0
  398. package/docs/types/Direction.html +177 -0
  399. package/docs/types/DummyAny.html +190 -0
  400. package/docs/types/EdgeId.html +177 -0
  401. package/docs/types/HeapOptions.html +198 -0
  402. package/docs/types/IAVLTreeNode.html +184 -0
  403. package/docs/types/IBSTNode.html +184 -0
  404. package/docs/types/IBinaryTree.html +182 -0
  405. package/docs/types/IBinaryTreeNode.html +184 -0
  406. package/docs/types/IRBTreeNode.html +184 -0
  407. package/docs/types/ITreeMultiset.html +182 -0
  408. package/docs/types/ITreeMultisetNode.html +184 -0
  409. package/docs/types/KeyValueObject.html +182 -0
  410. package/docs/types/KeyValueObjectWithId.html +184 -0
  411. package/docs/types/MapGraphCoordinate.html +177 -0
  412. package/docs/types/NavigatorParams.html +211 -0
  413. package/docs/types/NodeOrPropertyName.html +177 -0
  414. package/docs/types/NonNumberNonObjectButDefined.html +177 -0
  415. package/docs/types/ObjectWithNonNumberId.html +184 -0
  416. package/docs/types/ObjectWithNumberId.html +184 -0
  417. package/docs/types/ObjectWithoutId.html +177 -0
  418. package/docs/types/PriorityQueueComparator.html +197 -0
  419. package/docs/types/PriorityQueueDFSOrderPattern.html +177 -0
  420. package/docs/types/PriorityQueueOptions.html +191 -0
  421. package/docs/types/RBTreeNodeNested.html +182 -0
  422. package/docs/types/RBTreeOptions.html +180 -0
  423. package/docs/types/RestrictValById.html +177 -0
  424. package/docs/types/SegmentTreeNodeVal.html +177 -0
  425. package/docs/types/SpecifyOptional.html +184 -0
  426. package/docs/types/Thunk.html +185 -0
  427. package/docs/types/ToThunkFn.html +185 -0
  428. package/docs/types/TopologicalStatus.html +177 -0
  429. package/docs/types/TreeMultisetNodeNested.html +182 -0
  430. package/docs/types/TreeMultisetOptions.html +180 -0
  431. package/docs/types/TrlAsyncFn.html +190 -0
  432. package/docs/types/TrlFn.html +190 -0
  433. package/docs/types/Turning.html +177 -0
  434. package/docs/types/VertexId.html +177 -0
  435. package/docs/variables/THUNK_SYMBOL.html +177 -0
  436. package/jest.config.js +7 -0
  437. package/lib/data-structures/binary-tree/aa-tree.js +2 -0
  438. package/{dist → lib}/data-structures/binary-tree/abstract-binary-tree.d.ts +194 -22
  439. package/lib/data-structures/binary-tree/abstract-binary-tree.js +1291 -0
  440. package/{dist → lib}/data-structures/binary-tree/avl-tree.d.ts +12 -12
  441. package/lib/data-structures/binary-tree/avl-tree.js +311 -0
  442. package/lib/data-structures/binary-tree/b-tree.js +2 -0
  443. package/lib/data-structures/binary-tree/binary-indexed-tree.js +69 -0
  444. package/lib/data-structures/binary-tree/binary-tree.js +35 -0
  445. package/{dist → lib}/data-structures/binary-tree/bst.d.ts +19 -8
  446. package/lib/data-structures/binary-tree/bst.js +551 -0
  447. package/lib/data-structures/binary-tree/index.js +12 -0
  448. package/{dist → lib}/data-structures/binary-tree/rb-tree.d.ts +0 -6
  449. package/lib/data-structures/binary-tree/rb-tree.js +22 -0
  450. package/lib/data-structures/binary-tree/segment-tree.js +210 -0
  451. package/lib/data-structures/binary-tree/splay-tree.js +2 -0
  452. package/{dist → lib}/data-structures/binary-tree/tree-multiset.d.ts +20 -23
  453. package/lib/data-structures/binary-tree/tree-multiset.js +673 -0
  454. package/lib/data-structures/binary-tree/two-three-tree.js +2 -0
  455. package/lib/data-structures/graph/abstract-graph.js +918 -0
  456. package/lib/data-structures/graph/directed-graph.js +416 -0
  457. package/lib/data-structures/graph/index.js +4 -0
  458. package/lib/data-structures/graph/map-graph.js +105 -0
  459. package/lib/data-structures/graph/undirected-graph.js +246 -0
  460. package/lib/data-structures/hash/coordinate-map.js +61 -0
  461. package/lib/data-structures/hash/coordinate-set.js +51 -0
  462. package/lib/data-structures/hash/hash-table.js +2 -0
  463. package/lib/data-structures/hash/index.js +6 -0
  464. package/lib/data-structures/hash/pair.js +2 -0
  465. package/lib/data-structures/hash/tree-map.js +2 -0
  466. package/lib/data-structures/hash/tree-set.js +2 -0
  467. package/lib/data-structures/heap/heap.js +152 -0
  468. package/lib/data-structures/heap/index.js +3 -0
  469. package/lib/data-structures/heap/max-heap.js +26 -0
  470. package/lib/data-structures/heap/min-heap.js +27 -0
  471. package/lib/data-structures/index.js +11 -0
  472. package/{dist → lib}/data-structures/linked-list/doubly-linked-list.d.ts +5 -5
  473. package/lib/data-structures/linked-list/doubly-linked-list.js +521 -0
  474. package/lib/data-structures/linked-list/index.js +3 -0
  475. package/{dist → lib}/data-structures/linked-list/singly-linked-list.d.ts +6 -5
  476. package/lib/data-structures/linked-list/singly-linked-list.js +443 -0
  477. package/lib/data-structures/linked-list/skip-linked-list.js +2 -0
  478. package/lib/data-structures/matrix/index.js +4 -0
  479. package/lib/data-structures/matrix/matrix.js +24 -0
  480. package/lib/data-structures/matrix/matrix2d.js +195 -0
  481. package/lib/data-structures/matrix/navigator.js +101 -0
  482. package/lib/data-structures/matrix/vector2d.js +287 -0
  483. package/lib/data-structures/priority-queue/index.js +3 -0
  484. package/lib/data-structures/priority-queue/max-priority-queue.js +39 -0
  485. package/lib/data-structures/priority-queue/min-priority-queue.js +40 -0
  486. package/lib/data-structures/priority-queue/priority-queue.js +317 -0
  487. package/{dist → lib}/data-structures/queue/deque.d.ts +45 -0
  488. package/lib/data-structures/queue/deque.js +270 -0
  489. package/lib/data-structures/queue/index.js +2 -0
  490. package/{dist → lib}/data-structures/queue/queue.d.ts +47 -13
  491. package/lib/data-structures/queue/queue.js +165 -0
  492. package/lib/data-structures/stack/index.js +1 -0
  493. package/lib/data-structures/stack/stack.js +87 -0
  494. package/lib/data-structures/tree/index.js +1 -0
  495. package/lib/data-structures/tree/tree.js +56 -0
  496. package/lib/data-structures/trie/index.js +1 -0
  497. package/lib/data-structures/trie/trie.js +205 -0
  498. package/lib/index.js +4 -0
  499. package/{dist → lib}/interfaces/avl-tree.d.ts +1 -9
  500. package/lib/interfaces/binary-tree.d.ts +4 -0
  501. package/{dist → lib}/interfaces/bst.d.ts +1 -2
  502. package/lib/interfaces/heap.js +1 -0
  503. package/lib/interfaces/index.js +15 -0
  504. package/lib/interfaces/navigator.d.ts +1 -0
  505. package/lib/interfaces/navigator.js +1 -0
  506. package/lib/interfaces/priority-queue.d.ts +1 -0
  507. package/lib/interfaces/priority-queue.js +1 -0
  508. package/{dist → lib}/interfaces/rb-tree.d.ts +1 -2
  509. package/lib/interfaces/rb-tree.js +1 -0
  510. package/lib/interfaces/segment-tree.d.ts +1 -0
  511. package/lib/interfaces/segment-tree.js +1 -0
  512. package/lib/interfaces/singly-linked-list.d.ts +1 -0
  513. package/lib/interfaces/singly-linked-list.js +1 -0
  514. package/lib/interfaces/tree-multiset.d.ts +5 -0
  515. package/lib/interfaces/tree-multiset.js +1 -0
  516. package/lib/interfaces/undirected-graph.js +1 -0
  517. package/{dist → lib}/types/data-structures/abstract-binary-tree.d.ts +1 -1
  518. package/lib/types/data-structures/abstract-binary-tree.js +22 -0
  519. package/lib/types/data-structures/abstract-graph.js +1 -0
  520. package/{dist → lib}/types/data-structures/avl-tree.d.ts +1 -1
  521. package/lib/types/data-structures/avl-tree.js +1 -0
  522. package/lib/types/data-structures/binary-tree.js +1 -0
  523. package/lib/types/data-structures/bst.js +6 -0
  524. package/lib/types/data-structures/directed-graph.js +6 -0
  525. package/lib/types/data-structures/doubly-linked-list.d.ts +1 -0
  526. package/lib/types/data-structures/doubly-linked-list.js +1 -0
  527. package/lib/types/data-structures/heap.js +1 -0
  528. package/lib/types/data-structures/index.js +15 -0
  529. package/lib/types/data-structures/map-graph.js +1 -0
  530. package/lib/types/data-structures/navigator.js +1 -0
  531. package/lib/types/data-structures/priority-queue.js +1 -0
  532. package/lib/types/data-structures/rb-tree.js +5 -0
  533. package/lib/types/data-structures/segment-tree.js +1 -0
  534. package/lib/types/data-structures/singly-linked-list.d.ts +1 -0
  535. package/lib/types/data-structures/singly-linked-list.js +1 -0
  536. package/lib/types/data-structures/tree-multiset.js +1 -0
  537. package/lib/types/helpers.d.ts +1 -0
  538. package/lib/types/helpers.js +1 -0
  539. package/lib/types/index.js +3 -0
  540. package/lib/types/utils/index.js +2 -0
  541. package/{dist → lib}/types/utils/utils.d.ts +1 -1
  542. package/lib/types/utils/utils.js +1 -0
  543. package/{dist → lib}/types/utils/validate-type.d.ts +1 -1
  544. package/lib/types/utils/validate-type.js +1 -0
  545. package/lib/utils/index.js +1 -0
  546. package/lib/utils/utils.js +57 -0
  547. package/package.json +150 -56
  548. package/rename_clear_files.sh +29 -0
  549. package/test/integration/avl-tree.test.ts +111 -0
  550. package/test/integration/bst.test.ts +371 -0
  551. package/test/integration/heap.test.js +19 -0
  552. package/test/integration/index.html +44 -0
  553. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +111 -0
  554. package/test/unit/data-structures/binary-tree/bst.test.ts +371 -0
  555. package/test/unit/data-structures/binary-tree/overall.test.ts +57 -0
  556. package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +405 -0
  557. package/test/unit/data-structures/graph/abstract-graph.test.ts +5 -0
  558. package/test/unit/data-structures/graph/directed-graph.test.ts +517 -0
  559. package/test/unit/data-structures/graph/index.ts +2 -0
  560. package/test/unit/data-structures/graph/map-graph.test.ts +46 -0
  561. package/test/unit/data-structures/graph/overall.test.ts +50 -0
  562. package/test/unit/data-structures/graph/undirected-graph.test.ts +60 -0
  563. package/test/unit/data-structures/heap/heap.test.ts +56 -0
  564. package/test/unit/data-structures/heap/max-heap.test.ts +42 -0
  565. package/test/unit/data-structures/heap/min-heap.test.ts +81 -0
  566. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +365 -0
  567. package/test/unit/data-structures/linked-list/index.ts +4 -0
  568. package/test/unit/data-structures/linked-list/linked-list.test.ts +37 -0
  569. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +401 -0
  570. package/test/unit/data-structures/linked-list/skip-linked-list.test.ts +13 -0
  571. package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +108 -0
  572. package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +105 -0
  573. package/test/unit/data-structures/priority-queue/priority-queue.test.ts +27 -0
  574. package/test/unit/data-structures/queue/queue.test.ts +36 -0
  575. package/test/utils/index.ts +2 -0
  576. package/test/utils/magnitude.ts +21 -0
  577. package/test/utils/number.ts +3 -0
  578. package/tsconfig.build.json +33 -0
  579. package/tsconfig.json +38 -0
  580. package/umd/bundle.min.js +3 -0
  581. package/umd/bundle.min.js.map +1 -0
  582. package/webpack.config.js +28 -0
  583. package/dist/bundle.js +0 -2
  584. package/dist/interfaces/binary-tree.d.ts +0 -6
  585. package/dist/interfaces/tree-multiset.d.ts +0 -7
  586. /package/{dist → lib}/data-structures/binary-tree/aa-tree.d.ts +0 -0
  587. /package/{dist → lib}/data-structures/binary-tree/b-tree.d.ts +0 -0
  588. /package/{dist → lib}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
  589. /package/{dist → lib}/data-structures/binary-tree/binary-tree.d.ts +0 -0
  590. /package/{dist → lib}/data-structures/binary-tree/index.d.ts +0 -0
  591. /package/{dist → lib}/data-structures/binary-tree/segment-tree.d.ts +0 -0
  592. /package/{dist → lib}/data-structures/binary-tree/splay-tree.d.ts +0 -0
  593. /package/{dist → lib}/data-structures/binary-tree/two-three-tree.d.ts +0 -0
  594. /package/{dist → lib}/data-structures/graph/abstract-graph.d.ts +0 -0
  595. /package/{dist → lib}/data-structures/graph/directed-graph.d.ts +0 -0
  596. /package/{dist → lib}/data-structures/graph/index.d.ts +0 -0
  597. /package/{dist → lib}/data-structures/graph/map-graph.d.ts +0 -0
  598. /package/{dist → lib}/data-structures/graph/undirected-graph.d.ts +0 -0
  599. /package/{dist → lib}/data-structures/hash/coordinate-map.d.ts +0 -0
  600. /package/{dist → lib}/data-structures/hash/coordinate-set.d.ts +0 -0
  601. /package/{dist → lib}/data-structures/hash/hash-table.d.ts +0 -0
  602. /package/{dist → lib}/data-structures/hash/index.d.ts +0 -0
  603. /package/{dist → lib}/data-structures/hash/pair.d.ts +0 -0
  604. /package/{dist → lib}/data-structures/hash/tree-map.d.ts +0 -0
  605. /package/{dist → lib}/data-structures/hash/tree-set.d.ts +0 -0
  606. /package/{dist → lib}/data-structures/heap/heap.d.ts +0 -0
  607. /package/{dist → lib}/data-structures/heap/index.d.ts +0 -0
  608. /package/{dist → lib}/data-structures/heap/max-heap.d.ts +0 -0
  609. /package/{dist → lib}/data-structures/heap/min-heap.d.ts +0 -0
  610. /package/{dist → lib}/data-structures/index.d.ts +0 -0
  611. /package/{dist → lib}/data-structures/linked-list/index.d.ts +0 -0
  612. /package/{dist → lib}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
  613. /package/{dist → lib}/data-structures/matrix/index.d.ts +0 -0
  614. /package/{dist → lib}/data-structures/matrix/matrix.d.ts +0 -0
  615. /package/{dist → lib}/data-structures/matrix/matrix2d.d.ts +0 -0
  616. /package/{dist → lib}/data-structures/matrix/navigator.d.ts +0 -0
  617. /package/{dist → lib}/data-structures/matrix/vector2d.d.ts +0 -0
  618. /package/{dist → lib}/data-structures/priority-queue/index.d.ts +0 -0
  619. /package/{dist → lib}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
  620. /package/{dist → lib}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
  621. /package/{dist → lib}/data-structures/priority-queue/priority-queue.d.ts +0 -0
  622. /package/{dist → lib}/data-structures/queue/index.d.ts +0 -0
  623. /package/{dist → lib}/data-structures/stack/index.d.ts +0 -0
  624. /package/{dist → lib}/data-structures/stack/stack.d.ts +0 -0
  625. /package/{dist → lib}/data-structures/tree/index.d.ts +0 -0
  626. /package/{dist → lib}/data-structures/tree/tree.d.ts +0 -0
  627. /package/{dist → lib}/data-structures/trie/index.d.ts +0 -0
  628. /package/{dist → lib}/data-structures/trie/trie.d.ts +0 -0
  629. /package/{dist → lib}/index.d.ts +0 -0
  630. /package/{dist → lib}/interfaces/abstract-binary-tree.d.ts +0 -0
  631. /package/{dist/interfaces/doubly-linked-list.d.ts → lib/interfaces/abstract-binary-tree.js} +0 -0
  632. /package/{dist → lib}/interfaces/abstract-graph.d.ts +0 -0
  633. /package/{dist/interfaces/heap.d.ts → lib/interfaces/abstract-graph.js} +0 -0
  634. /package/{dist/interfaces/navigator.d.ts → lib/interfaces/avl-tree.js} +0 -0
  635. /package/{dist/interfaces/priority-queue.d.ts → lib/interfaces/binary-tree.js} +0 -0
  636. /package/{dist/interfaces/segment-tree.d.ts → lib/interfaces/bst.js} +0 -0
  637. /package/{dist → lib}/interfaces/directed-graph.d.ts +0 -0
  638. /package/{dist/interfaces/singly-linked-list.d.ts → lib/interfaces/directed-graph.js} +0 -0
  639. /package/{dist/types/data-structures → lib/interfaces}/doubly-linked-list.d.ts +0 -0
  640. /package/{dist/types/data-structures/singly-linked-list.d.ts → lib/interfaces/doubly-linked-list.js} +0 -0
  641. /package/{dist/types/helpers.d.ts → lib/interfaces/heap.d.ts} +0 -0
  642. /package/{dist → lib}/interfaces/index.d.ts +0 -0
  643. /package/{dist → lib}/interfaces/undirected-graph.d.ts +0 -0
  644. /package/{dist → lib}/types/data-structures/abstract-graph.d.ts +0 -0
  645. /package/{dist → lib}/types/data-structures/binary-tree.d.ts +0 -0
  646. /package/{dist → lib}/types/data-structures/bst.d.ts +0 -0
  647. /package/{dist → lib}/types/data-structures/directed-graph.d.ts +0 -0
  648. /package/{dist → lib}/types/data-structures/heap.d.ts +0 -0
  649. /package/{dist → lib}/types/data-structures/index.d.ts +0 -0
  650. /package/{dist → lib}/types/data-structures/map-graph.d.ts +0 -0
  651. /package/{dist → lib}/types/data-structures/navigator.d.ts +0 -0
  652. /package/{dist → lib}/types/data-structures/priority-queue.d.ts +0 -0
  653. /package/{dist → lib}/types/data-structures/rb-tree.d.ts +0 -0
  654. /package/{dist → lib}/types/data-structures/segment-tree.d.ts +0 -0
  655. /package/{dist → lib}/types/data-structures/tree-multiset.d.ts +0 -0
  656. /package/{dist → lib}/types/index.d.ts +0 -0
  657. /package/{dist → lib}/types/utils/index.d.ts +0 -0
  658. /package/{dist → lib}/utils/index.d.ts +0 -0
  659. /package/{dist → lib}/utils/utils.d.ts +0 -0
  660. /package/{dist/bundle.js.LICENSE.txt → umd/bundle.min.js.LICENSE.txt} +0 -0
@@ -0,0 +1,246 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Tyler Zeng
5
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import { arrayRemove } from '../../utils';
9
+ import { AbstractEdge, AbstractGraph, AbstractVertex } from './abstract-graph';
10
+ export class UndirectedVertex extends AbstractVertex {
11
+ /**
12
+ * The constructor function initializes a vertex with an optional value.
13
+ * @param {VertexId} id - The `id` parameter is of type `VertexId` and represents the identifier of the vertex. It is
14
+ * used to uniquely identify the vertex within a graph or network.
15
+ * @param {T} [val] - The "val" parameter is an optional parameter of type T. It is used to initialize the value of the
16
+ * vertex. If no value is provided, the vertex will be initialized with a default value.
17
+ */
18
+ constructor(id, val) {
19
+ super(id, val);
20
+ }
21
+ }
22
+ export class UndirectedEdge extends AbstractEdge {
23
+ /**
24
+ * The constructor function creates an instance of a class with two vertex IDs, an optional weight, and an optional
25
+ * value.
26
+ * @param {VertexId} v1 - The first vertex ID of the edge.
27
+ * @param {VertexId} v2 - The parameter `v2` is a `VertexId`, which represents the identifier of the second vertex in a
28
+ * graph edge.
29
+ * @param {number} [weight] - The weight parameter is an optional number that represents the weight of the edge.
30
+ * @param {T} [val] - The "val" parameter is an optional parameter of type T. It is used to store a value associated
31
+ * with the edge.
32
+ */
33
+ constructor(v1, v2, weight, val) {
34
+ super(weight, val);
35
+ this._vertices = [v1, v2];
36
+ }
37
+ get vertices() {
38
+ return this._vertices;
39
+ }
40
+ set vertices(v) {
41
+ this._vertices = v;
42
+ }
43
+ }
44
+ export class UndirectedGraph extends AbstractGraph {
45
+ /**
46
+ * The constructor initializes a new Map object to store edges.
47
+ */
48
+ constructor() {
49
+ super();
50
+ this._edges = new Map();
51
+ }
52
+ get edges() {
53
+ return this._edges;
54
+ }
55
+ /**
56
+ * The function creates a new vertex with an optional value and returns it.
57
+ * @param {VertexId} id - The `id` parameter is the unique identifier for the vertex. It is used to distinguish one
58
+ * vertex from another in the graph.
59
+ * @param [val] - The `val` parameter is an optional value that can be assigned to the vertex. If a value is provided,
60
+ * it will be used as the value of the vertex. If no value is provided, the `id` parameter will be used as the value of
61
+ * the vertex.
62
+ * @returns The method is returning a new instance of the `UndirectedVertex` class, casted as type `V`.
63
+ */
64
+ createVertex(id, val) {
65
+ return new UndirectedVertex(id, val !== null && val !== void 0 ? val : id);
66
+ }
67
+ /**
68
+ * The function creates an undirected edge between two vertices with an optional weight and value.
69
+ * @param {VertexId} v1 - The parameter `v1` represents the first vertex of the edge.
70
+ * @param {VertexId} v2 - The parameter `v2` represents the second vertex of the edge.
71
+ * @param {number} [weight] - The `weight` parameter is an optional number that represents the weight of the edge. If
72
+ * no weight is provided, it defaults to 1.
73
+ * @param [val] - The `val` parameter is an optional value that can be assigned to the edge. It can be of any type and
74
+ * is used to store additional information or data associated with the edge.
75
+ * @returns a new instance of the `UndirectedEdge` class, which is casted as type `E`.
76
+ */
77
+ createEdge(v1, v2, weight, val) {
78
+ return new UndirectedEdge(v1, v2, weight !== null && weight !== void 0 ? weight : 1, val);
79
+ }
80
+ /**
81
+ * The function `getEdge` returns the first edge that connects two vertices, or null if no such edge exists.
82
+ * @param {V | null | VertexId} v1 - The parameter `v1` represents a vertex or vertex ID. It can be of type `V` (vertex
83
+ * object), `null`, or `VertexId` (a string or number representing the ID of a vertex).
84
+ * @param {V | null | VertexId} v2 - The parameter `v2` represents a vertex or vertex ID. It can be of type `V` (vertex
85
+ * object), `null`, or `VertexId` (vertex ID).
86
+ * @returns an edge (E) or null.
87
+ */
88
+ getEdge(v1, v2) {
89
+ var _a;
90
+ let edges = [];
91
+ if (v1 !== null && v2 !== null) {
92
+ const vertex1 = this._getVertex(v1);
93
+ const vertex2 = this._getVertex(v2);
94
+ if (vertex1 && vertex2) {
95
+ edges = (_a = this._edges.get(vertex1)) === null || _a === void 0 ? void 0 : _a.filter(e => e.vertices.includes(vertex2.id));
96
+ }
97
+ }
98
+ return edges ? edges[0] || null : null;
99
+ }
100
+ /**
101
+ * The function removes an edge between two vertices in a graph and returns the removed edge.
102
+ * @param {V | VertexId} v1 - The parameter `v1` represents either a vertex object (`V`) or a vertex ID (`VertexId`).
103
+ * @param {V | VertexId} v2 - V | VertexId - This parameter can be either a vertex object (V) or a vertex ID
104
+ * (VertexId). It represents the second vertex of the edge that needs to be removed.
105
+ * @returns the removed edge (E) if it exists, or null if either of the vertices (V) does not exist.
106
+ */
107
+ removeEdgeBetween(v1, v2) {
108
+ const vertex1 = this._getVertex(v1);
109
+ const vertex2 = this._getVertex(v2);
110
+ if (!vertex1 || !vertex2) {
111
+ return null;
112
+ }
113
+ const v1Edges = this._edges.get(vertex1);
114
+ let removed = null;
115
+ if (v1Edges) {
116
+ removed = arrayRemove(v1Edges, (e) => e.vertices.includes(vertex2.id))[0] || null;
117
+ }
118
+ const v2Edges = this._edges.get(vertex2);
119
+ if (v2Edges) {
120
+ arrayRemove(v2Edges, (e) => e.vertices.includes(vertex1.id));
121
+ }
122
+ return removed;
123
+ }
124
+ /**
125
+ * The removeEdge function removes an edge between two vertices in a graph.
126
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
127
+ * @returns The method is returning either the removed edge (of type E) or null if the edge was not found.
128
+ */
129
+ removeEdge(edge) {
130
+ return this.removeEdgeBetween(edge.vertices[0], edge.vertices[1]);
131
+ }
132
+ /**
133
+ * The function `degreeOf` returns the degree of a vertex in a graph, which is the number of edges connected to that
134
+ * vertex.
135
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
136
+ * @returns The function `degreeOf` returns the degree of a vertex in a graph. The degree of a vertex is the number of
137
+ * edges connected to that vertex.
138
+ */
139
+ degreeOf(vertexOrId) {
140
+ var _a;
141
+ const vertex = this._getVertex(vertexOrId);
142
+ if (vertex) {
143
+ return ((_a = this._edges.get(vertex)) === null || _a === void 0 ? void 0 : _a.length) || 0;
144
+ }
145
+ else {
146
+ return 0;
147
+ }
148
+ }
149
+ /**
150
+ * The function returns the edges of a given vertex or vertex ID.
151
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`. A `VertexId` is a
152
+ * unique identifier for a vertex in a graph, while `V` represents the type of the vertex.
153
+ * @returns an array of edges.
154
+ */
155
+ edgesOf(vertexOrId) {
156
+ const vertex = this._getVertex(vertexOrId);
157
+ if (vertex) {
158
+ return this._edges.get(vertex) || [];
159
+ }
160
+ else {
161
+ return [];
162
+ }
163
+ }
164
+ /**
165
+ * The function "edgeSet" returns an array of unique edges from a set of edges.
166
+ * @returns The method `edgeSet()` returns an array of type `E[]`.
167
+ */
168
+ edgeSet() {
169
+ const edgeSet = new Set();
170
+ this._edges.forEach(edges => {
171
+ edges.forEach(edge => {
172
+ edgeSet.add(edge);
173
+ });
174
+ });
175
+ return [...edgeSet];
176
+ }
177
+ /**
178
+ * The function "getNeighbors" returns an array of neighboring vertices for a given vertex or vertex ID.
179
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
180
+ * (`VertexId`).
181
+ * @returns an array of vertices (V[]).
182
+ */
183
+ getNeighbors(vertexOrId) {
184
+ const neighbors = [];
185
+ const vertex = this._getVertex(vertexOrId);
186
+ if (vertex) {
187
+ const neighborEdges = this.edgesOf(vertex);
188
+ for (const edge of neighborEdges) {
189
+ const neighbor = this._getVertex(edge.vertices.filter(e => e !== vertex.id)[0]);
190
+ if (neighbor) {
191
+ neighbors.push(neighbor);
192
+ }
193
+ }
194
+ }
195
+ return neighbors;
196
+ }
197
+ /**
198
+ * The function "getEndsOfEdge" returns the vertices at the ends of an edge if the edge exists in the graph, otherwise
199
+ * it returns null.
200
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
201
+ * @returns The function `getEndsOfEdge` returns an array containing two vertices `[V, V]` if the edge exists in the
202
+ * graph. If the edge does not exist, it returns `null`.
203
+ */
204
+ getEndsOfEdge(edge) {
205
+ if (!this.hasEdge(edge.vertices[0], edge.vertices[1])) {
206
+ return null;
207
+ }
208
+ const v1 = this._getVertex(edge.vertices[0]);
209
+ const v2 = this._getVertex(edge.vertices[1]);
210
+ if (v1 && v2) {
211
+ return [v1, v2];
212
+ }
213
+ else {
214
+ return null;
215
+ }
216
+ }
217
+ /**
218
+ * The function adds an edge to the graph by updating the adjacency list with the vertices of the edge.
219
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
220
+ * @returns a boolean value.
221
+ */
222
+ _addEdgeOnly(edge) {
223
+ for (const end of edge.vertices) {
224
+ const endVertex = this._getVertex(end);
225
+ if (endVertex === null)
226
+ return false;
227
+ if (endVertex) {
228
+ const edges = this._edges.get(endVertex);
229
+ if (edges) {
230
+ edges.push(edge);
231
+ }
232
+ else {
233
+ this._edges.set(endVertex, [edge]);
234
+ }
235
+ }
236
+ }
237
+ return true;
238
+ }
239
+ /**
240
+ * The function sets the edges of a graph.
241
+ * @param v - A map where the keys are of type V and the values are arrays of type E.
242
+ */
243
+ _setEdges(v) {
244
+ this._edges = v;
245
+ }
246
+ }
@@ -0,0 +1,61 @@
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 class CoordinateMap extends Map {
9
+ constructor(joint) {
10
+ super();
11
+ this._joint = '_';
12
+ if (joint !== undefined)
13
+ this._joint = joint;
14
+ }
15
+ get joint() {
16
+ return this._joint;
17
+ }
18
+ /**
19
+ * The "has" function overrides the base class's "has" function and checks if a key exists in the map by joining the
20
+ * key array with a specified delimiter.
21
+ * @param {number[]} key - The parameter "key" is an array of numbers.
22
+ * @returns The `has` method is being overridden to return the result of calling the `has` method of the superclass
23
+ * (`super.has`) with the `key` array joined together using the `_joint` property.
24
+ */
25
+ has(key) {
26
+ return super.has(key.join(this._joint));
27
+ }
28
+ /**
29
+ * The function overrides the set method of a Map object to convert the key from an array to a string using a specified
30
+ * delimiter before calling the original set method.
31
+ * @param {number[]} key - The key parameter is an array of numbers.
32
+ * @param {V} value - The value parameter is the value that you want to associate with the specified key.
33
+ * @returns The `set` method is returning the result of calling the `set` method of the superclass
34
+ * (`super.set(key.join(this._joint), value)`).
35
+ */
36
+ set(key, value) {
37
+ return super.set(key.join(this._joint), value);
38
+ }
39
+ /**
40
+ * The function overrides the get method to join the key array with a specified joint and then calls the super get
41
+ * method.
42
+ * @param {number[]} key - An array of numbers
43
+ * @returns The code is returning the value associated with the specified key in the map.
44
+ */
45
+ get(key) {
46
+ return super.get(key.join(this._joint));
47
+ }
48
+ /**
49
+ * The function overrides the delete method and joins the key array using a specified joint character before calling
50
+ * the super delete method.
51
+ * @param {number[]} key - An array of numbers that represents the key to be deleted.
52
+ * @returns The `delete` method is returning the result of calling the `delete` method on the superclass, with the
53
+ * `key` array joined together using the `_joint` property.
54
+ */
55
+ delete(key) {
56
+ return super.delete(key.join(this._joint));
57
+ }
58
+ _setJoint(v) {
59
+ this._joint = v;
60
+ }
61
+ }
@@ -0,0 +1,51 @@
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 class CoordinateSet extends Set {
9
+ constructor(joint) {
10
+ super();
11
+ this._joint = '_';
12
+ if (joint !== undefined)
13
+ this._joint = joint;
14
+ }
15
+ get joint() {
16
+ return this._joint;
17
+ }
18
+ /**
19
+ * The "has" function overrides the "has" method of the superclass and checks if a value exists in an array after
20
+ * joining its elements with a specified separator.
21
+ * @param {number[]} value - The parameter "value" is an array of numbers.
22
+ * @returns The overridden `has` method is returning the result of calling the `has` method of the superclass, passing
23
+ * in the joined value as an argument.
24
+ */
25
+ has(value) {
26
+ return super.has(value.join(this._joint));
27
+ }
28
+ /**
29
+ * The "add" function overrides the parent class's "add" function by joining the elements of the input array with a
30
+ * specified delimiter before calling the parent class's "add" function.
31
+ * @param {number[]} value - An array of numbers
32
+ * @returns The overridden `add` method is returning the result of calling the `add` method of the superclass
33
+ * (`super.add`) with the joined string representation of the `value` array (`value.join(this._joint)`).
34
+ */
35
+ add(value) {
36
+ return super.add(value.join(this._joint));
37
+ }
38
+ /**
39
+ * The function overrides the delete method and deletes an element from a Set by joining the elements of the input
40
+ * array with a specified joint and then calling the delete method of the parent class.
41
+ * @param {number[]} value - An array of numbers
42
+ * @returns The `delete` method is returning the result of calling the `delete` method of the superclass, with the
43
+ * `value` array joined together using the `_joint` property.
44
+ */
45
+ delete(value) {
46
+ return super.delete(value.join(this._joint));
47
+ }
48
+ _setJoint(v) {
49
+ this._joint = v;
50
+ }
51
+ }
@@ -0,0 +1,2 @@
1
+ export class HashTable {
2
+ }
@@ -0,0 +1,6 @@
1
+ export * from './hash-table';
2
+ export * from './coordinate-map';
3
+ export * from './coordinate-set';
4
+ export * from './pair';
5
+ export * from './tree-map';
6
+ export * from './tree-set';
@@ -0,0 +1,2 @@
1
+ export class Pair {
2
+ }
@@ -0,0 +1,2 @@
1
+ export class TreeMap {
2
+ }
@@ -0,0 +1,2 @@
1
+ export class TreeSet {
2
+ }
@@ -0,0 +1,152 @@
1
+ export class HeapItem {
2
+ /**
3
+ * The constructor function initializes an instance of a class with a priority and a value.
4
+ * @param {number} priority - The `priority` parameter is a number that represents the priority of the value. It is
5
+ * optional and has a default value of `NaN`.
6
+ * @param {T | null} [val=null] - The `val` parameter is of type `T | null`, which means it can accept a value of type
7
+ * `T` or `null`.
8
+ */
9
+ constructor(priority = Number.MAX_SAFE_INTEGER, val = null) {
10
+ this._val = val;
11
+ this._priority = priority;
12
+ }
13
+ get priority() {
14
+ return this._priority;
15
+ }
16
+ set priority(value) {
17
+ this._priority = value;
18
+ }
19
+ get val() {
20
+ return this._val;
21
+ }
22
+ set val(value) {
23
+ this._val = value;
24
+ }
25
+ }
26
+ export class Heap {
27
+ /**
28
+ * The function is a constructor for a class that initializes a priority callback function based on the
29
+ * options provided.
30
+ * @param [options] - An optional object that contains configuration options for the Heap.
31
+ */
32
+ constructor(options) {
33
+ if (options) {
34
+ const { priorityExtractor } = options;
35
+ if (priorityExtractor !== undefined && typeof priorityExtractor !== 'function') {
36
+ throw new Error('.constructor expects a valid priority function');
37
+ }
38
+ this._priorityExtractor = priorityExtractor || (el => +el);
39
+ }
40
+ else {
41
+ this._priorityExtractor = el => +el;
42
+ }
43
+ }
44
+ get pq() {
45
+ return this._pq;
46
+ }
47
+ get priorityExtractor() {
48
+ return this._priorityExtractor;
49
+ }
50
+ /**
51
+ * The function returns the size of a priority queue.
52
+ * @returns The size of the priority queue.
53
+ */
54
+ get size() {
55
+ return this._pq.size;
56
+ }
57
+ /**
58
+ * The function checks if a priority queue is empty.
59
+ * @returns {boolean} A boolean value indicating whether the size of the priority queue is less than 1.
60
+ */
61
+ isEmpty() {
62
+ return this._pq.size < 1;
63
+ }
64
+ /**
65
+ * The `peek` function returns the top item in the priority queue without removing it.
66
+ * @returns The `peek()` method is returning either a `HeapItem<T>` object or `null`.Returns an val with the highest priority in the queue
67
+ */
68
+ peek(isItem) {
69
+ isItem = isItem !== null && isItem !== void 0 ? isItem : false;
70
+ const peeked = this._pq.peek();
71
+ return isItem ? peeked : peeked === null || peeked === void 0 ? void 0 : peeked.val;
72
+ }
73
+ /**
74
+ * The `peekLast` function returns the last item in the heap.
75
+ * @returns The method `peekLast()` returns either a `HeapItem<T>` object or `null`.Returns an val with the lowest priority in the queue
76
+ */
77
+ peekLast(isItem) {
78
+ isItem = isItem !== null && isItem !== void 0 ? isItem : false;
79
+ const leafItem = this._pq.leaf();
80
+ return isItem ? leafItem : leafItem === null || leafItem === void 0 ? void 0 : leafItem.val;
81
+ }
82
+ /**
83
+ * The `add` function adds an val to a priority queue with an optional priority value.
84
+ * @param {T} val - The `val` parameter represents the value that you want to add to the heap. It can be of any
85
+ * type.
86
+ * @param {number} [priority] - The `priority` parameter is an optional number that represents the priority of the
87
+ * val being added to the heap. If the `val` parameter is a number, then the `priority` parameter is set to
88
+ * the value of `val`. If the `val` parameter is not a number, then the
89
+ * @returns The `add` method returns the instance of the `Heap` class.
90
+ * @throws {Error} if priority is not a valid number
91
+ */
92
+ add(priority, val) {
93
+ val = val === undefined ? priority : val;
94
+ this._pq.add(new HeapItem(priority, val));
95
+ return this;
96
+ }
97
+ /**
98
+ * The `poll` function returns the top item from a priority queue or null if the queue is empty.Removes and returns an val with the highest priority in the queue
99
+ * @returns either a HeapItem<T> object or null.
100
+ */
101
+ poll(isItem) {
102
+ isItem = isItem !== null && isItem !== void 0 ? isItem : false;
103
+ const top = this._pq.poll();
104
+ if (!top) {
105
+ return null;
106
+ }
107
+ return isItem ? top : top.val;
108
+ }
109
+ /**
110
+ * The function checks if a given node or value exists in the priority queue.
111
+ * @param {T | HeapItem<T>} node - The parameter `node` can be of type `T` or `HeapItem<T>`.
112
+ * @returns a boolean value.
113
+ */
114
+ has(node) {
115
+ if (node instanceof HeapItem) {
116
+ return this.pq.getNodes().includes(node);
117
+ }
118
+ else {
119
+ return (this.pq.getNodes().findIndex(item => {
120
+ return item.val === node;
121
+ }) !== -1);
122
+ }
123
+ }
124
+ /**
125
+ * The `toArray` function returns an array of `HeapItem<T>` objects.
126
+ * @returns An array of HeapItem<T> objects.Returns a sorted list of vals
127
+ */
128
+ toArray(isItem) {
129
+ isItem = isItem !== null && isItem !== void 0 ? isItem : false;
130
+ const itemArray = this._pq.toArray();
131
+ return isItem ? itemArray : itemArray.map(item => item.val);
132
+ }
133
+ /**
134
+ * The function sorts the elements in the priority queue and returns either the sorted items or their values depending
135
+ * on the value of the isItem parameter.
136
+ * @param {boolean} [isItem] - The `isItem` parameter is a boolean flag that indicates whether the sorted result should
137
+ * be an array of `HeapItem<T>` objects or an array of the values (`T`) of those objects. If `isItem` is `true`, the
138
+ * sorted result will be an array of `HeapItem
139
+ * @returns an array of either `HeapItem<T>`, `null`, `T`, or `undefined` values.
140
+ */
141
+ sort(isItem) {
142
+ isItem = isItem !== null && isItem !== void 0 ? isItem : false;
143
+ const sorted = this._pq.sort();
144
+ return isItem ? sorted : sorted.map(item => item.val);
145
+ }
146
+ /**
147
+ * The clear function clears the priority queue.
148
+ */
149
+ clear() {
150
+ this._pq.clear();
151
+ }
152
+ }
@@ -0,0 +1,3 @@
1
+ export * from './max-heap';
2
+ export * from './min-heap';
3
+ export * from './heap';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Tyler Zeng
5
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import { Heap } from './heap';
9
+ import { PriorityQueue } from '../priority-queue';
10
+ /**
11
+ * @class MaxHeap
12
+ * @extends Heap
13
+ */
14
+ export class MaxHeap extends Heap {
15
+ /**
16
+ * The constructor initializes a PriorityQueue with a custom comparator function.
17
+ * @param [options] - The `options` parameter is an optional object that can be passed to the constructor. It is of
18
+ * type `HeapOptions<T>`, which is a generic type that represents the options for the heap.
19
+ */
20
+ constructor(options) {
21
+ super(options);
22
+ this._pq = new PriorityQueue({
23
+ comparator: (a, b) => b.priority - a.priority
24
+ });
25
+ }
26
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * data-structure-typed
3
+ *
4
+ * @author Tyler Zeng
5
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
6
+ * @license MIT License
7
+ */
8
+ import { Heap } from './heap';
9
+ import { PriorityQueue } from '../priority-queue';
10
+ /**
11
+ * @class MinHeap
12
+ * @extends Heap
13
+ */
14
+ export class MinHeap extends Heap {
15
+ /**
16
+ * The constructor initializes a PriorityQueue with a comparator function that compares the priority of two HeapItem
17
+ * objects.
18
+ * @param [options] - The `options` parameter is an optional object that can be passed to the constructor. It is of
19
+ * type `HeapOptions<T>`, which is a generic type that represents the options for the heap.
20
+ */
21
+ constructor(options) {
22
+ super(options);
23
+ this._pq = new PriorityQueue({
24
+ comparator: (a, b) => a.priority - b.priority
25
+ });
26
+ }
27
+ }
@@ -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';
@@ -22,7 +22,7 @@ export declare class DoublyLinkedListNode<T = number> {
22
22
  get prev(): DoublyLinkedListNode<T> | null;
23
23
  set prev(value: DoublyLinkedListNode<T> | null);
24
24
  }
25
- export declare class DoublyLinkedList<T = number> {
25
+ export declare class DoublyLinkedList<T = any> {
26
26
  /**
27
27
  * The constructor initializes the linked list with an empty head, tail, and length.
28
28
  */
@@ -52,13 +52,13 @@ export declare class DoublyLinkedList<T = number> {
52
52
  * @returns The method is returning the value of the removed node (removedNode.val) if the list is not empty. If the
53
53
  * list is empty, it returns null.
54
54
  */
55
- pop(): T | null;
55
+ pop(): T | undefined;
56
56
  /**
57
57
  * The `shift()` function removes and returns the value of the first node in a doubly linked list.
58
58
  * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
59
59
  * list.
60
60
  */
61
- shift(): T | null;
61
+ shift(): T | undefined;
62
62
  /**
63
63
  * The unshift function adds a new node with the given value to the beginning of a doubly linked list.
64
64
  * @param {T} val - The `val` parameter represents the value of the new node that will be added to the beginning of the
@@ -72,7 +72,7 @@ export declare class DoublyLinkedList<T = number> {
72
72
  * @returns The method is returning the value at the specified index in the linked list. If the index is out of bounds
73
73
  * or the linked list is empty, it will return null.
74
74
  */
75
- getAt(index: number): T | null;
75
+ getAt(index: number): T | undefined;
76
76
  /**
77
77
  * The function `getNodeAt` returns the node at a given index in a doubly linked list, or null if the index is out of
78
78
  * range.
@@ -107,7 +107,7 @@ export declare class DoublyLinkedList<T = number> {
107
107
  * @returns The method `deleteAt` returns the value of the node that was deleted, or `null` if the index is out of
108
108
  * bounds.
109
109
  */
110
- deleteAt(index: number): T | null;
110
+ deleteAt(index: number): T | undefined;
111
111
  delete(valOrNode: T): boolean;
112
112
  delete(valOrNode: DoublyLinkedListNode<T>): boolean;
113
113
  /**