data-structure-typed 1.17.4 → 1.18.5

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 (293) hide show
  1. package/README.md +193 -66
  2. package/backup/recursive-type/src/assets/complexities-diff.jpg +0 -0
  3. package/backup/recursive-type/src/assets/data-structure-complexities.jpg +0 -0
  4. package/backup/recursive-type/src/assets/logo.png +0 -0
  5. package/backup/recursive-type/src/assets/overview-diagram-of-data-structures.png +0 -0
  6. package/backup/recursive-type/src/data-structures/binary-tree/aa-tree.ts +3 -0
  7. package/backup/recursive-type/src/data-structures/binary-tree/avl-tree.ts +288 -0
  8. package/backup/recursive-type/src/data-structures/binary-tree/b-tree.ts +3 -0
  9. package/backup/recursive-type/src/data-structures/binary-tree/binary-indexed-tree.ts +78 -0
  10. package/backup/recursive-type/src/data-structures/binary-tree/binary-tree.ts +1502 -0
  11. package/backup/recursive-type/src/data-structures/binary-tree/bst.ts +503 -0
  12. package/backup/recursive-type/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
  13. package/backup/recursive-type/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
  14. package/backup/recursive-type/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
  15. package/backup/recursive-type/src/data-structures/binary-tree/index.ts +11 -0
  16. package/backup/recursive-type/src/data-structures/binary-tree/rb-tree.ts +110 -0
  17. package/backup/recursive-type/src/data-structures/binary-tree/segment-tree.ts +243 -0
  18. package/backup/recursive-type/src/data-structures/binary-tree/splay-tree.ts +3 -0
  19. package/backup/recursive-type/src/data-structures/binary-tree/tree-multiset.ts +55 -0
  20. package/backup/recursive-type/src/data-structures/binary-tree/two-three-tree.ts +3 -0
  21. package/backup/recursive-type/src/data-structures/diagrams/README.md +5 -0
  22. package/backup/recursive-type/src/data-structures/graph/abstract-graph.ts +985 -0
  23. package/backup/recursive-type/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
  24. package/backup/recursive-type/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
  25. package/backup/recursive-type/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
  26. package/backup/recursive-type/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
  27. package/backup/recursive-type/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
  28. package/backup/recursive-type/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
  29. package/backup/recursive-type/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
  30. package/backup/recursive-type/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
  31. package/backup/recursive-type/src/data-structures/graph/diagrams/mst.jpg +0 -0
  32. package/backup/recursive-type/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
  33. package/backup/recursive-type/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
  34. package/backup/recursive-type/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
  35. package/backup/recursive-type/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
  36. package/backup/recursive-type/src/data-structures/graph/diagrams/tarjan.webp +0 -0
  37. package/backup/recursive-type/src/data-structures/graph/directed-graph.ts +478 -0
  38. package/backup/recursive-type/src/data-structures/graph/index.ts +3 -0
  39. package/backup/recursive-type/src/data-structures/graph/undirected-graph.ts +293 -0
  40. package/backup/recursive-type/src/data-structures/hash/coordinate-map.ts +67 -0
  41. package/backup/recursive-type/src/data-structures/hash/coordinate-set.ts +56 -0
  42. package/backup/recursive-type/src/data-structures/hash/hash-table.ts +3 -0
  43. package/backup/recursive-type/src/data-structures/hash/index.ts +6 -0
  44. package/backup/recursive-type/src/data-structures/hash/pair.ts +3 -0
  45. package/backup/recursive-type/src/data-structures/hash/tree-map.ts +3 -0
  46. package/backup/recursive-type/src/data-structures/hash/tree-set.ts +3 -0
  47. package/backup/recursive-type/src/data-structures/heap/heap.ts +176 -0
  48. package/backup/recursive-type/src/data-structures/heap/index.ts +3 -0
  49. package/backup/recursive-type/src/data-structures/heap/max-heap.ts +31 -0
  50. package/backup/recursive-type/src/data-structures/heap/min-heap.ts +34 -0
  51. package/backup/recursive-type/src/data-structures/index.ts +15 -0
  52. package/backup/recursive-type/src/data-structures/interfaces/abstract-graph.ts +42 -0
  53. package/backup/recursive-type/src/data-structures/interfaces/avl-tree.ts +1 -0
  54. package/backup/recursive-type/src/data-structures/interfaces/binary-tree.ts +56 -0
  55. package/backup/recursive-type/src/data-structures/interfaces/bst.ts +1 -0
  56. package/backup/recursive-type/src/data-structures/interfaces/directed-graph.ts +15 -0
  57. package/backup/recursive-type/src/data-structures/interfaces/doubly-linked-list.ts +1 -0
  58. package/backup/recursive-type/src/data-structures/interfaces/heap.ts +1 -0
  59. package/backup/recursive-type/src/data-structures/interfaces/index.ts +13 -0
  60. package/backup/recursive-type/src/data-structures/interfaces/navigator.ts +1 -0
  61. package/backup/recursive-type/src/data-structures/interfaces/priority-queue.ts +1 -0
  62. package/backup/recursive-type/src/data-structures/interfaces/segment-tree.ts +1 -0
  63. package/backup/recursive-type/src/data-structures/interfaces/singly-linked-list.ts +1 -0
  64. package/backup/recursive-type/src/data-structures/interfaces/tree-multiset.ts +1 -0
  65. package/backup/recursive-type/src/data-structures/interfaces/undirected-graph.ts +3 -0
  66. package/backup/recursive-type/src/data-structures/linked-list/doubly-linked-list.ts +573 -0
  67. package/backup/recursive-type/src/data-structures/linked-list/index.ts +3 -0
  68. package/backup/recursive-type/src/data-structures/linked-list/singly-linked-list.ts +490 -0
  69. package/backup/recursive-type/src/data-structures/linked-list/skip-linked-list.ts +3 -0
  70. package/backup/recursive-type/src/data-structures/matrix/index.ts +4 -0
  71. package/backup/recursive-type/src/data-structures/matrix/matrix.ts +27 -0
  72. package/backup/recursive-type/src/data-structures/matrix/matrix2d.ts +208 -0
  73. package/backup/recursive-type/src/data-structures/matrix/navigator.ts +122 -0
  74. package/backup/recursive-type/src/data-structures/matrix/vector2d.ts +316 -0
  75. package/backup/recursive-type/src/data-structures/priority-queue/index.ts +3 -0
  76. package/backup/recursive-type/src/data-structures/priority-queue/max-priority-queue.ts +49 -0
  77. package/backup/recursive-type/src/data-structures/priority-queue/min-priority-queue.ts +50 -0
  78. package/backup/recursive-type/src/data-structures/priority-queue/priority-queue.ts +354 -0
  79. package/backup/recursive-type/src/data-structures/queue/deque.ts +251 -0
  80. package/backup/recursive-type/src/data-structures/queue/index.ts +2 -0
  81. package/backup/recursive-type/src/data-structures/queue/queue.ts +120 -0
  82. package/backup/recursive-type/src/data-structures/stack/index.ts +1 -0
  83. package/backup/recursive-type/src/data-structures/stack/stack.ts +98 -0
  84. package/backup/recursive-type/src/data-structures/tree/index.ts +1 -0
  85. package/backup/recursive-type/src/data-structures/tree/tree.ts +80 -0
  86. package/backup/recursive-type/src/data-structures/trie/index.ts +1 -0
  87. package/backup/recursive-type/src/data-structures/trie/trie.ts +227 -0
  88. package/backup/recursive-type/src/data-structures/types/abstract-graph.ts +5 -0
  89. package/backup/recursive-type/src/data-structures/types/avl-tree.ts +8 -0
  90. package/backup/recursive-type/src/data-structures/types/binary-tree.ts +10 -0
  91. package/backup/recursive-type/src/data-structures/types/bst.ts +6 -0
  92. package/backup/recursive-type/src/data-structures/types/directed-graph.ts +8 -0
  93. package/backup/recursive-type/src/data-structures/types/doubly-linked-list.ts +1 -0
  94. package/backup/recursive-type/src/data-structures/types/heap.ts +5 -0
  95. package/backup/recursive-type/src/data-structures/types/index.ts +12 -0
  96. package/backup/recursive-type/src/data-structures/types/navigator.ts +13 -0
  97. package/backup/recursive-type/src/data-structures/types/priority-queue.ts +9 -0
  98. package/backup/recursive-type/src/data-structures/types/segment-tree.ts +1 -0
  99. package/backup/recursive-type/src/data-structures/types/singly-linked-list.ts +1 -0
  100. package/backup/recursive-type/src/data-structures/types/tree-multiset.ts +1 -0
  101. package/backup/recursive-type/src/index.ts +1 -0
  102. package/backup/recursive-type/src/utils/index.ts +2 -0
  103. package/backup/recursive-type/src/utils/types/index.ts +1 -0
  104. package/backup/recursive-type/src/utils/types/utils.ts +6 -0
  105. package/backup/recursive-type/src/utils/utils.ts +78 -0
  106. package/dist/data-structures/binary-tree/avl-tree.d.ts +19 -25
  107. package/dist/data-structures/binary-tree/avl-tree.js +12 -20
  108. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -1
  109. package/dist/data-structures/binary-tree/binary-indexed-tree.js +10 -0
  110. package/dist/data-structures/binary-tree/binary-tree.d.ts +135 -161
  111. package/dist/data-structures/binary-tree/binary-tree.js +192 -164
  112. package/dist/data-structures/binary-tree/bst.d.ts +21 -21
  113. package/dist/data-structures/binary-tree/bst.js +33 -36
  114. package/dist/data-structures/binary-tree/rb-tree.d.ts +1 -2
  115. package/dist/data-structures/binary-tree/rb-tree.js +68 -5
  116. package/dist/data-structures/binary-tree/segment-tree.d.ts +17 -39
  117. package/dist/data-structures/binary-tree/segment-tree.js +34 -47
  118. package/dist/data-structures/binary-tree/tree-multiset.d.ts +9 -8
  119. package/dist/data-structures/binary-tree/tree-multiset.js +7 -6
  120. package/dist/data-structures/graph/abstract-graph.d.ts +56 -71
  121. package/dist/data-structures/graph/abstract-graph.js +87 -92
  122. package/dist/data-structures/graph/directed-graph.d.ts +128 -105
  123. package/dist/data-structures/graph/directed-graph.js +161 -121
  124. package/dist/data-structures/graph/undirected-graph.d.ts +81 -62
  125. package/dist/data-structures/graph/undirected-graph.js +99 -78
  126. package/dist/data-structures/hash/coordinate-map.d.ts +1 -5
  127. package/dist/data-structures/hash/coordinate-map.js +3 -9
  128. package/dist/data-structures/hash/coordinate-set.d.ts +2 -6
  129. package/dist/data-structures/hash/coordinate-set.js +3 -9
  130. package/dist/data-structures/hash/hash-table.d.ts +2 -1
  131. package/dist/data-structures/hash/hash-table.js +7 -0
  132. package/dist/data-structures/hash/pair.d.ts +2 -1
  133. package/dist/data-structures/hash/pair.js +7 -0
  134. package/dist/data-structures/hash/tree-map.d.ts +2 -1
  135. package/dist/data-structures/hash/tree-map.js +7 -0
  136. package/dist/data-structures/hash/tree-set.d.ts +2 -1
  137. package/dist/data-structures/hash/tree-set.js +7 -0
  138. package/dist/data-structures/heap/heap.d.ts +0 -14
  139. package/dist/data-structures/heap/heap.js +3 -27
  140. package/dist/data-structures/index.d.ts +1 -0
  141. package/dist/data-structures/index.js +1 -0
  142. package/dist/data-structures/interfaces/abstract-graph.d.ts +22 -0
  143. package/dist/data-structures/interfaces/abstract-graph.js +2 -0
  144. package/dist/data-structures/interfaces/avl-tree.d.ts +1 -0
  145. package/dist/data-structures/interfaces/avl-tree.js +2 -0
  146. package/dist/data-structures/interfaces/binary-tree.d.ts +27 -0
  147. package/dist/data-structures/interfaces/binary-tree.js +2 -0
  148. package/dist/data-structures/interfaces/bst.d.ts +1 -0
  149. package/dist/data-structures/interfaces/bst.js +2 -0
  150. package/dist/data-structures/interfaces/directed-graph.d.ts +9 -0
  151. package/dist/data-structures/interfaces/directed-graph.js +2 -0
  152. package/dist/data-structures/interfaces/doubly-linked-list.d.ts +1 -0
  153. package/dist/data-structures/interfaces/doubly-linked-list.js +2 -0
  154. package/dist/data-structures/interfaces/heap.d.ts +1 -0
  155. package/dist/data-structures/interfaces/heap.js +2 -0
  156. package/dist/data-structures/interfaces/index.d.ts +13 -0
  157. package/dist/data-structures/interfaces/index.js +29 -0
  158. package/dist/data-structures/interfaces/navigator.d.ts +1 -0
  159. package/dist/data-structures/interfaces/navigator.js +2 -0
  160. package/dist/data-structures/interfaces/priority-queue.d.ts +1 -0
  161. package/dist/data-structures/interfaces/priority-queue.js +2 -0
  162. package/dist/data-structures/interfaces/segment-tree.d.ts +1 -0
  163. package/dist/data-structures/interfaces/segment-tree.js +2 -0
  164. package/dist/data-structures/interfaces/singly-linked-list.d.ts +1 -0
  165. package/dist/data-structures/interfaces/singly-linked-list.js +2 -0
  166. package/dist/data-structures/interfaces/tree-multiset.d.ts +1 -0
  167. package/dist/data-structures/interfaces/tree-multiset.js +2 -0
  168. package/dist/data-structures/interfaces/undirected-graph.d.ts +2 -0
  169. package/dist/data-structures/interfaces/undirected-graph.js +2 -0
  170. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +1 -3
  171. package/dist/data-structures/linked-list/doubly-linked-list.js +12 -18
  172. package/dist/data-structures/linked-list/singly-linked-list.d.ts +1 -2
  173. package/dist/data-structures/linked-list/singly-linked-list.js +12 -15
  174. package/dist/data-structures/priority-queue/priority-queue.d.ts +1 -1
  175. package/dist/data-structures/priority-queue/priority-queue.js +4 -4
  176. package/dist/data-structures/queue/deque.d.ts +5 -5
  177. package/dist/data-structures/queue/deque.js +6 -6
  178. package/dist/data-structures/queue/queue.d.ts +1 -1
  179. package/dist/data-structures/stack/stack.d.ts +1 -1
  180. package/dist/data-structures/tree/tree.d.ts +12 -4
  181. package/dist/data-structures/tree/tree.js +44 -12
  182. package/dist/data-structures/trie/trie.d.ts +3 -3
  183. package/dist/data-structures/trie/trie.js +10 -10
  184. package/dist/data-structures/types/abstract-graph.d.ts +1 -20
  185. package/dist/data-structures/types/avl-tree.d.ts +5 -4
  186. package/dist/data-structures/types/binary-tree.d.ts +6 -5
  187. package/dist/data-structures/types/bst.d.ts +4 -3
  188. package/dist/data-structures/types/directed-graph.d.ts +5 -9
  189. package/dist/data-structures/types/directed-graph.js +7 -0
  190. package/dist/data-structures/types/doubly-linked-list.d.ts +1 -1
  191. package/dist/data-structures/types/heap.d.ts +2 -2
  192. package/dist/data-structures/types/index.d.ts +0 -1
  193. package/dist/data-structures/types/index.js +0 -1
  194. package/dist/data-structures/types/navigator.d.ts +2 -2
  195. package/dist/data-structures/types/priority-queue.d.ts +2 -2
  196. package/dist/data-structures/types/tree-multiset.d.ts +3 -4
  197. package/docs/assets/search.js +1 -1
  198. package/docs/classes/AVLTree.html +552 -405
  199. package/docs/classes/AVLTreeNode.html +107 -242
  200. package/docs/classes/AaTree.html +18 -13
  201. package/docs/classes/AbstractEdge.html +77 -68
  202. package/docs/classes/AbstractGraph.html +223 -115
  203. package/docs/classes/AbstractVertex.html +71 -45
  204. package/docs/classes/ArrayDeque.html +31 -26
  205. package/docs/classes/BST.html +543 -391
  206. package/docs/classes/BSTNode.html +107 -236
  207. package/docs/classes/BTree.html +18 -13
  208. package/docs/classes/BinaryIndexedTree.html +56 -21
  209. package/docs/classes/BinaryTree.html +564 -355
  210. package/docs/classes/BinaryTreeNode.html +146 -199
  211. package/docs/classes/Character.html +21 -16
  212. package/docs/classes/CoordinateMap.html +49 -52
  213. package/docs/classes/CoordinateSet.html +50 -53
  214. package/docs/classes/Deque.html +51 -68
  215. package/docs/classes/DirectedEdge.html +98 -103
  216. package/docs/classes/DirectedGraph.html +449 -210
  217. package/docs/classes/DirectedVertex.html +63 -52
  218. package/docs/classes/DoublyLinkedList.html +56 -71
  219. package/docs/classes/DoublyLinkedListNode.html +28 -23
  220. package/docs/classes/HashTable.html +155 -0
  221. package/docs/classes/Heap.html +33 -109
  222. package/docs/classes/HeapItem.html +25 -20
  223. package/docs/classes/Matrix2D.html +33 -28
  224. package/docs/classes/MatrixNTI2D.html +21 -16
  225. package/docs/classes/MaxHeap.html +33 -114
  226. package/docs/classes/MaxPriorityQueue.html +71 -61
  227. package/docs/classes/MinHeap.html +33 -114
  228. package/docs/classes/MinPriorityQueue.html +71 -61
  229. package/docs/classes/Navigator.html +28 -23
  230. package/docs/classes/ObjectDeque.html +66 -51
  231. package/docs/classes/{RBTree.html → Pair.html} +25 -20
  232. package/docs/classes/PriorityQueue.html +66 -56
  233. package/docs/classes/Queue.html +33 -28
  234. package/docs/classes/SegmentTree.html +129 -57
  235. package/docs/classes/SegmentTreeNode.html +62 -140
  236. package/docs/classes/SinglyLinkedList.html +53 -58
  237. package/docs/classes/SinglyLinkedListNode.html +25 -20
  238. package/docs/classes/SkipLinkedList.html +18 -13
  239. package/docs/classes/SplayTree.html +18 -13
  240. package/docs/classes/Stack.html +31 -26
  241. package/docs/classes/TreeMap.html +155 -0
  242. package/docs/classes/TreeMultiSet.html +541 -388
  243. package/docs/classes/TreeNode.html +125 -35
  244. package/docs/classes/TreeSet.html +155 -0
  245. package/docs/classes/Trie.html +30 -25
  246. package/docs/classes/TrieNode.html +33 -28
  247. package/docs/classes/TwoThreeTree.html +18 -13
  248. package/docs/classes/UndirectedEdge.html +87 -80
  249. package/docs/classes/UndirectedGraph.html +356 -178
  250. package/docs/classes/UndirectedVertex.html +63 -52
  251. package/docs/classes/Vector2D.html +45 -40
  252. package/docs/enums/CP.html +21 -16
  253. package/docs/enums/FamilyPosition.html +21 -16
  254. package/docs/enums/LoopType.html +20 -15
  255. package/docs/{interfaces/AVLTreeDeleted.html → enums/TopologicalProperty.html} +47 -44
  256. package/docs/index.html +203 -69
  257. package/docs/interfaces/{PriorityQueueOptions.html → IBinaryTree.html} +49 -40
  258. package/docs/interfaces/IBinaryTreeNode.html +383 -0
  259. package/docs/interfaces/IDirectedGraph.html +24 -19
  260. package/docs/interfaces/IGraph.html +122 -89
  261. package/docs/interfaces/{HeapOptions.html → IUNDirectedGraph.html} +26 -53
  262. package/docs/modules.html +33 -23
  263. package/docs/types/{ToThunkFn.html → AVLTreeDeleted.html} +31 -22
  264. package/docs/types/BSTComparator.html +18 -13
  265. package/docs/types/BSTDeletedResult.html +23 -18
  266. package/docs/types/BinaryTreeDeleted.html +23 -18
  267. package/docs/types/BinaryTreeNodeId.html +18 -13
  268. package/docs/types/BinaryTreeNodePropertyName.html +18 -13
  269. package/docs/types/DFSOrderPattern.html +18 -13
  270. package/docs/types/DijkstraResult.html +18 -13
  271. package/docs/types/Direction.html +18 -13
  272. package/docs/types/{DoublyLinkedListGetBy.html → EdgeId.html} +22 -17
  273. package/docs/types/{TrlFn.html → HeapOptions.html} +33 -20
  274. package/docs/types/{TrlAsyncFn.html → NavigatorParams.html} +46 -20
  275. package/docs/types/NodeOrPropertyName.html +18 -13
  276. package/docs/types/PriorityQueueComparator.html +18 -13
  277. package/docs/types/PriorityQueueDFSOrderPattern.html +18 -13
  278. package/docs/types/{SpecifyOptional.html → PriorityQueueOptions.html} +32 -20
  279. package/docs/types/RecursiveAVLTreeNode.html +135 -0
  280. package/docs/types/RecursiveBSTNode.html +135 -0
  281. package/docs/types/RecursiveBinaryTreeNode.html +135 -0
  282. package/docs/types/ResultByProperty.html +21 -16
  283. package/docs/types/ResultsByProperty.html +21 -16
  284. package/docs/types/SegmentTreeNodeVal.html +18 -13
  285. package/docs/types/TopologicalStatus.html +18 -13
  286. package/docs/types/TreeMultiSetDeletedResult.html +23 -18
  287. package/docs/types/Turning.html +18 -13
  288. package/docs/types/VertexId.html +18 -13
  289. package/notes/note.md +12 -1
  290. package/package.json +11 -3
  291. package/tsconfig.json +2 -2
  292. package/docs/interfaces/NavigatorParams.html +0 -197
  293. package/docs/types/Thunk.html +0 -133
@@ -15,7 +15,6 @@ export declare class PriorityQueue<T = number> {
15
15
  constructor(options: PriorityQueueOptions<T>);
16
16
  protected _nodes: T[];
17
17
  get nodes(): T[];
18
- protected set nodes(value: T[]);
19
18
  get size(): number;
20
19
  /**
21
20
  * The `heapify` function creates a new PriorityQueue instance and fixes the heap property.
@@ -112,6 +111,7 @@ export declare class PriorityQueue<T = number> {
112
111
  * @returns an array of type `(T | null)[]`.
113
112
  */
114
113
  DFS(dfsMode: PriorityQueueDFSOrderPattern): (T | null)[];
114
+ protected _setNodes(value: T[]): void;
115
115
  protected readonly _comparator: PriorityQueueComparator<T>;
116
116
  /**
117
117
  * The function compares two numbers using a custom comparator function.
@@ -61,9 +61,6 @@ var PriorityQueue = /** @class */ (function () {
61
61
  get: function () {
62
62
  return this._nodes;
63
63
  },
64
- set: function (value) {
65
- this._nodes = value;
66
- },
67
64
  enumerable: false,
68
65
  configurable: true
69
66
  });
@@ -167,7 +164,7 @@ var PriorityQueue = /** @class */ (function () {
167
164
  * The clear function clears the nodes array.
168
165
  */
169
166
  PriorityQueue.prototype.clear = function () {
170
- this.nodes = [];
167
+ this._setNodes([]);
171
168
  };
172
169
  /**
173
170
  * The toArray function returns an array containing all the elements in the nodes property.
@@ -256,6 +253,9 @@ var PriorityQueue = /** @class */ (function () {
256
253
  this._isValidIndex(0) && traverse(0);
257
254
  return visitedNode;
258
255
  };
256
+ PriorityQueue.prototype._setNodes = function (value) {
257
+ this._nodes = value;
258
+ };
259
259
  /**
260
260
  * The function compares two numbers using a custom comparator function.
261
261
  * @param {number} a - The parameter "a" is a number that represents the index of a node in an array.
@@ -8,15 +8,12 @@
8
8
  import { DoublyLinkedList } from '../linked-list';
9
9
  export declare class Deque<T> extends DoublyLinkedList<T> {
10
10
  }
11
- export declare class ObjectDeque<T> {
11
+ export declare class ObjectDeque<T = number> {
12
12
  constructor(capacity?: number);
13
13
  private _nodes;
14
14
  get nodes(): {
15
15
  [p: number]: T;
16
16
  };
17
- protected set nodes(value: {
18
- [p: number]: T;
19
- });
20
17
  private _capacity;
21
18
  get capacity(): number;
22
19
  set capacity(value: number);
@@ -28,7 +25,6 @@ export declare class ObjectDeque<T> {
28
25
  set last(value: number);
29
26
  private _size;
30
27
  get size(): number;
31
- protected set size(value: number);
32
28
  addFirst(value: T): void;
33
29
  addLast(value: T): void;
34
30
  pollFirst(): T | undefined;
@@ -37,6 +33,10 @@ export declare class ObjectDeque<T> {
37
33
  peekLast(): T | undefined;
38
34
  get(index: number): NonNullable<T> | null;
39
35
  isEmpty(): boolean;
36
+ protected _seNodes(value: {
37
+ [p: number]: T;
38
+ }): void;
39
+ protected _setSize(value: number): void;
40
40
  }
41
41
  export declare class ArrayDeque<T> {
42
42
  protected _nodes: T[];
@@ -51,9 +51,6 @@ var ObjectDeque = /** @class */ (function () {
51
51
  get: function () {
52
52
  return this._nodes;
53
53
  },
54
- set: function (value) {
55
- this._nodes = value;
56
- },
57
54
  enumerable: false,
58
55
  configurable: true
59
56
  });
@@ -91,9 +88,6 @@ var ObjectDeque = /** @class */ (function () {
91
88
  get: function () {
92
89
  return this._size;
93
90
  },
94
- set: function (value) {
95
- this._size = value;
96
- },
97
91
  enumerable: false,
98
92
  configurable: true
99
93
  });
@@ -153,6 +147,12 @@ var ObjectDeque = /** @class */ (function () {
153
147
  ObjectDeque.prototype.isEmpty = function () {
154
148
  return this._size <= 0;
155
149
  };
150
+ ObjectDeque.prototype._seNodes = function (value) {
151
+ this._nodes = value;
152
+ };
153
+ ObjectDeque.prototype._setSize = function (value) {
154
+ this._size = value;
155
+ };
156
156
  return ObjectDeque;
157
157
  }());
158
158
  exports.ObjectDeque = ObjectDeque;
@@ -3,7 +3,7 @@
3
3
  * @copyright Tyler Zeng <zrwusa@gmail.com>
4
4
  * @class
5
5
  */
6
- export declare class Queue<T> {
6
+ export declare class Queue<T = number> {
7
7
  protected _nodes: T[];
8
8
  protected _offset: number;
9
9
  /**
@@ -3,7 +3,7 @@
3
3
  * @copyright Tyler Zeng <zrwusa@gmail.com>
4
4
  * @class
5
5
  */
6
- export declare class Stack<T> {
6
+ export declare class Stack<T = number> {
7
7
  protected _elements: T[];
8
8
  /**
9
9
  * The constructor initializes an array of elements, which can be provided as an optional parameter.
@@ -1,9 +1,17 @@
1
1
  export declare class TreeNode<T = number> {
2
- id: string;
3
- name?: string | undefined;
4
- value?: T | undefined;
5
- children?: TreeNode<T>[] | undefined;
6
2
  constructor(id: string, name?: string, value?: T, children?: TreeNode<T>[]);
3
+ private _id;
4
+ get id(): string;
5
+ set id(value: string);
6
+ private _name?;
7
+ get name(): string | undefined;
8
+ set name(value: string | undefined);
9
+ private _value?;
10
+ get value(): T | undefined;
11
+ set value(value: T | undefined);
12
+ private _children?;
13
+ get children(): TreeNode<T>[] | undefined;
14
+ set children(value: TreeNode<T>[] | undefined);
7
15
  addChildren(children: TreeNode<T> | TreeNode<T>[]): void;
8
16
  getHeight(): number;
9
17
  }
@@ -3,19 +3,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TreeNode = void 0;
4
4
  var TreeNode = /** @class */ (function () {
5
5
  function TreeNode(id, name, value, children) {
6
- this.id = id;
7
- this.name = name || '';
8
- this.value = value || undefined;
9
- this.children = children || [];
6
+ this._id = id;
7
+ this._name = name || '';
8
+ this._value = value || undefined;
9
+ this._children = children || [];
10
10
  }
11
- // TODO get set
12
- // get name (): string | undefined {
13
- // return this.name;
14
- // }
15
- //
16
- // set name (name: string | undefined) {
17
- // this.name = name;
18
- // }
11
+ Object.defineProperty(TreeNode.prototype, "id", {
12
+ get: function () {
13
+ return this._id;
14
+ },
15
+ set: function (value) {
16
+ this._id = value;
17
+ },
18
+ enumerable: false,
19
+ configurable: true
20
+ });
21
+ Object.defineProperty(TreeNode.prototype, "name", {
22
+ get: function () {
23
+ return this._name;
24
+ },
25
+ set: function (value) {
26
+ this._name = value;
27
+ },
28
+ enumerable: false,
29
+ configurable: true
30
+ });
31
+ Object.defineProperty(TreeNode.prototype, "value", {
32
+ get: function () {
33
+ return this._value;
34
+ },
35
+ set: function (value) {
36
+ this._value = value;
37
+ },
38
+ enumerable: false,
39
+ configurable: true
40
+ });
41
+ Object.defineProperty(TreeNode.prototype, "children", {
42
+ get: function () {
43
+ return this._children;
44
+ },
45
+ set: function (value) {
46
+ this._children = value;
47
+ },
48
+ enumerable: false,
49
+ configurable: true
50
+ });
19
51
  TreeNode.prototype.addChildren = function (children) {
20
52
  if (!this.children) {
21
53
  this.children = [];
@@ -6,16 +6,16 @@
6
6
  * @license MIT License
7
7
  */
8
8
  export declare class TrieNode {
9
- protected _value: string;
10
9
  constructor(v: string);
10
+ private _val;
11
+ get val(): string;
12
+ set val(v: string);
11
13
  protected _children: Map<string, TrieNode>;
12
14
  get children(): Map<string, TrieNode>;
13
15
  set children(v: Map<string, TrieNode>);
14
16
  protected _isEnd: boolean;
15
17
  get isEnd(): boolean;
16
18
  set isEnd(v: boolean);
17
- get val(): string;
18
- set val(v: string);
19
19
  }
20
20
  export declare class Trie {
21
21
  constructor(words?: string[]);
@@ -21,36 +21,36 @@ exports.Trie = exports.TrieNode = void 0;
21
21
  */
22
22
  var TrieNode = /** @class */ (function () {
23
23
  function TrieNode(v) {
24
- this._value = v;
24
+ this._val = v;
25
25
  this._isEnd = false;
26
26
  this._children = new Map();
27
27
  }
28
- Object.defineProperty(TrieNode.prototype, "children", {
28
+ Object.defineProperty(TrieNode.prototype, "val", {
29
29
  get: function () {
30
- return this._children;
30
+ return this._val;
31
31
  },
32
32
  set: function (v) {
33
- this._children = v;
33
+ this._val = v;
34
34
  },
35
35
  enumerable: false,
36
36
  configurable: true
37
37
  });
38
- Object.defineProperty(TrieNode.prototype, "isEnd", {
38
+ Object.defineProperty(TrieNode.prototype, "children", {
39
39
  get: function () {
40
- return this._isEnd;
40
+ return this._children;
41
41
  },
42
42
  set: function (v) {
43
- this._isEnd = v;
43
+ this._children = v;
44
44
  },
45
45
  enumerable: false,
46
46
  configurable: true
47
47
  });
48
- Object.defineProperty(TrieNode.prototype, "val", {
48
+ Object.defineProperty(TrieNode.prototype, "isEnd", {
49
49
  get: function () {
50
- return this._value;
50
+ return this._isEnd;
51
51
  },
52
52
  set: function (v) {
53
- this._value = v;
53
+ this._isEnd = v;
54
54
  },
55
55
  enumerable: false,
56
56
  configurable: true
@@ -1,4 +1,5 @@
1
1
  export type VertexId = string | number;
2
+ export type EdgeId = string;
2
3
  export type DijkstraResult<V> = {
3
4
  distMap: Map<V, number>;
4
5
  preMap: Map<V, V | null>;
@@ -7,23 +8,3 @@ export type DijkstraResult<V> = {
7
8
  minDist: number;
8
9
  minPath: V[];
9
10
  } | null;
10
- export interface IGraph<V, E> {
11
- hasVertex(vertexOrId: V | VertexId): boolean;
12
- getVertex(vertexOrId: VertexId | V): V | null;
13
- getVertexId(vertexOrId: V | VertexId): VertexId;
14
- vertexSet(): Map<VertexId, V>;
15
- addVertex(v: V): boolean;
16
- removeVertex(vertexOrId: V | VertexId): boolean;
17
- removeAllVertices(vertices: V[] | VertexId[]): boolean;
18
- degreeOf(vertexOrId: V | VertexId): number;
19
- edgesOf(vertexOrId: V | VertexId): E[];
20
- hasEdge(src: V | VertexId, dest: V | VertexId): boolean;
21
- getEdge(srcOrId: V | VertexId, destOrId: V | VertexId): E | null;
22
- edgeSet(): E[];
23
- addEdge(edge: E): boolean;
24
- removeEdgeBetween(srcOrId: V | VertexId, destOrId: V | VertexId): E | null;
25
- removeEdge(edge: E): E | null;
26
- setEdgeWeight(srcOrId: V | VertexId, destOrId: V | VertexId, weight: number): boolean;
27
- getMinPathBetween(v1: V | VertexId, v2: V | VertexId, isWeight?: boolean): V[] | null;
28
- getNeighbors(vertexOrId: V | VertexId): V[];
29
- }
@@ -1,5 +1,6 @@
1
1
  import { AVLTreeNode } from '../binary-tree';
2
- export interface AVLTreeDeleted<T> {
3
- deleted: AVLTreeNode<T> | null;
4
- needBalanced: AVLTreeNode<T> | null;
5
- }
2
+ export type AVLTreeDeleted<N> = {
3
+ deleted: N | null;
4
+ needBalanced: N | null;
5
+ };
6
+ export type RecursiveAVLTreeNode<T> = AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, AVLTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
@@ -3,9 +3,10 @@ export type BinaryTreeNodePropertyName = 'id' | 'val' | 'count';
3
3
  export type NodeOrPropertyName = 'node' | BinaryTreeNodePropertyName;
4
4
  export type DFSOrderPattern = 'in' | 'pre' | 'post';
5
5
  export type BinaryTreeNodeId = number;
6
- export type BinaryTreeDeleted<T> = {
7
- deleted: BinaryTreeNode<T> | null | undefined;
8
- needBalanced: BinaryTreeNode<T> | null;
6
+ export type BinaryTreeDeleted<N> = {
7
+ deleted: N | null | undefined;
8
+ needBalanced: N | null;
9
9
  };
10
- export type ResultByProperty<T> = T | BinaryTreeNode<T> | number | BinaryTreeNodeId;
11
- export type ResultsByProperty<T> = ResultByProperty<T>[];
10
+ export type ResultByProperty<N extends BinaryTreeNode<N['val'], N>> = N['val'] | N | number | BinaryTreeNodeId;
11
+ export type ResultsByProperty<N extends BinaryTreeNode<N['val'], N>> = ResultByProperty<N>[];
12
+ export type RecursiveBinaryTreeNode<T> = BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, BinaryTreeNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
@@ -1,7 +1,8 @@
1
1
  import { BSTNode } from '../binary-tree';
2
2
  import type { BinaryTreeNodeId } from './binary-tree';
3
3
  export type BSTComparator = (a: BinaryTreeNodeId, b: BinaryTreeNodeId) => number;
4
- export type BSTDeletedResult<T> = {
5
- deleted: BSTNode<T> | null;
6
- needBalanced: BSTNode<T> | null;
4
+ export type BSTDeletedResult<N extends BSTNode<N['val'], N>> = {
5
+ deleted: N | null;
6
+ needBalanced: N | null;
7
7
  };
8
+ export type RecursiveBSTNode<T> = BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, BSTNode<T, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
@@ -1,10 +1,6 @@
1
- import { VertexId } from './abstract-graph';
2
- export interface IDirectedGraph<V, E> {
3
- incomingEdgesOf(vertex: V): E[];
4
- outgoingEdgesOf(vertex: V): E[];
5
- inDegreeOf(vertexOrId: V | VertexId): number;
6
- outDegreeOf(vertexOrId: V | VertexId): number;
7
- getEdgeSrc(e: E): V | null;
8
- getEdgeDest(e: E): V | null;
9
- }
10
1
  export type TopologicalStatus = 0 | 1 | 2;
2
+ export declare enum TopologicalProperty {
3
+ VAL = "VAL",
4
+ NODE = "NODE",
5
+ ID = "ID"
6
+ }
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TopologicalProperty = void 0;
4
+ var TopologicalProperty;
5
+ (function (TopologicalProperty) {
6
+ TopologicalProperty["VAL"] = "VAL";
7
+ TopologicalProperty["NODE"] = "NODE";
8
+ TopologicalProperty["ID"] = "ID";
9
+ })(TopologicalProperty || (exports.TopologicalProperty = TopologicalProperty = {}));
@@ -1 +1 @@
1
- export type DoublyLinkedListGetBy = 'node' | 'val';
1
+ export {};
@@ -1,3 +1,3 @@
1
- export interface HeapOptions<T> {
1
+ export type HeapOptions<T> = {
2
2
  priority?: (element: T) => number;
3
- }
3
+ };
@@ -10,4 +10,3 @@ export * from './heap';
10
10
  export * from './singly-linked-list';
11
11
  export * from './doubly-linked-list';
12
12
  export * from './navigator';
13
- export * from '../../utils/types/utils';
@@ -26,4 +26,3 @@ __exportStar(require("./heap"), exports);
26
26
  __exportStar(require("./singly-linked-list"), exports);
27
27
  __exportStar(require("./doubly-linked-list"), exports);
28
28
  __exportStar(require("./navigator"), exports);
29
- __exportStar(require("../../utils/types/utils"), exports);
@@ -2,7 +2,7 @@ export type Direction = 'up' | 'right' | 'down' | 'left';
2
2
  export type Turning = {
3
3
  [key in Direction]: Direction;
4
4
  };
5
- export interface NavigatorParams<T> {
5
+ export type NavigatorParams<T> = {
6
6
  matrix: T[][];
7
7
  turning: Turning;
8
8
  onMove: (cur: [number, number]) => void;
@@ -11,4 +11,4 @@ export interface NavigatorParams<T> {
11
11
  charDir: Direction;
12
12
  VISITED: T;
13
13
  };
14
- }
14
+ };
@@ -1,7 +1,7 @@
1
1
  export type PriorityQueueComparator<T> = (a: T, b: T) => number;
2
- export interface PriorityQueueOptions<T> {
2
+ export type PriorityQueueOptions<T> = {
3
3
  nodes?: T[];
4
4
  isFix?: boolean;
5
5
  comparator: PriorityQueueComparator<T>;
6
- }
6
+ };
7
7
  export type PriorityQueueDFSOrderPattern = 'pre' | 'in' | 'post';
@@ -1,5 +1,4 @@
1
- import { BSTNode } from '../binary-tree';
2
- export type TreeMultiSetDeletedResult<T> = {
3
- deleted: BSTNode<T> | null;
4
- needBalanced: BSTNode<T> | null;
1
+ export type TreeMultiSetDeletedResult<N> = {
2
+ deleted: N | null;
3
+ needBalanced: N | null;
5
4
  };