data-structure-typed 1.21.4 → 1.31.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.
- package/.auto-changelog +9 -0
- package/.auto-changelog-template.hbs +36 -0
- package/.eslintrc.js +61 -0
- package/.github/workflows/ci.yml +30 -0
- package/.prettierignore +6 -0
- package/.prettierrc.js +16 -0
- package/CHANGELOG.md +17 -0
- package/README.md +147 -95
- package/dist/data-structures/binary-tree/aa-tree.js +6 -2
- package/dist/data-structures/binary-tree/aa-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/abstract-binary-tree.js +398 -672
- package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/avl-tree.js +122 -151
- package/dist/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/b-tree.js +6 -2
- package/dist/data-structures/binary-tree/b-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +24 -54
- package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/binary-tree.js +31 -32
- package/dist/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/bst.js +266 -208
- package/dist/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/data-structures/binary-tree/index.js +1 -0
- package/dist/data-structures/binary-tree/index.js.map +1 -0
- package/dist/data-structures/binary-tree/rb-tree.js +46 -37
- package/dist/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/segment-tree.js +124 -127
- package/dist/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/splay-tree.js +6 -2
- package/dist/data-structures/binary-tree/splay-tree.js.map +1 -0
- package/dist/data-structures/binary-tree/tree-multiset.js +227 -354
- package/dist/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/data-structures/binary-tree/two-three-tree.js +6 -2
- package/dist/data-structures/binary-tree/two-three-tree.js.map +1 -0
- package/dist/data-structures/graph/abstract-graph.js +582 -609
- package/dist/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/data-structures/graph/directed-graph.js +276 -312
- package/dist/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/data-structures/graph/index.js +1 -0
- package/dist/data-structures/graph/index.js.map +1 -0
- package/dist/data-structures/graph/map-graph.js +88 -100
- package/dist/data-structures/graph/map-graph.js.map +1 -0
- package/dist/data-structures/graph/undirected-graph.js +180 -195
- package/dist/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/data-structures/hash/coordinate-map.js +46 -58
- package/dist/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/data-structures/hash/coordinate-set.js +43 -48
- package/dist/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/data-structures/hash/hash-table.js +6 -2
- package/dist/data-structures/hash/hash-table.js.map +1 -0
- package/dist/data-structures/hash/index.js +1 -0
- package/dist/data-structures/hash/index.js.map +1 -0
- package/dist/data-structures/hash/pair.js +6 -2
- package/dist/data-structures/hash/pair.js.map +1 -0
- package/dist/data-structures/hash/tree-map.js +6 -2
- package/dist/data-structures/hash/tree-map.js.map +1 -0
- package/dist/data-structures/hash/tree-set.js +6 -2
- package/dist/data-structures/hash/tree-set.js.map +1 -0
- package/dist/data-structures/heap/heap.js +83 -120
- package/dist/data-structures/heap/heap.js.map +1 -0
- package/dist/data-structures/heap/index.js +1 -0
- package/dist/data-structures/heap/index.js.map +1 -0
- package/dist/data-structures/heap/max-heap.js +27 -24
- package/dist/data-structures/heap/max-heap.js.map +1 -0
- package/dist/data-structures/heap/min-heap.js +27 -25
- package/dist/data-structures/heap/min-heap.js.map +1 -0
- package/dist/data-structures/index.js +1 -0
- package/dist/data-structures/index.js.map +1 -0
- package/dist/data-structures/linked-list/doubly-linked-list.js +202 -307
- package/dist/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/data-structures/linked-list/index.js +1 -0
- package/dist/data-structures/linked-list/index.js.map +1 -0
- package/dist/data-structures/linked-list/singly-linked-list.js +223 -251
- package/dist/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/data-structures/linked-list/skip-linked-list.js +6 -2
- package/dist/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/data-structures/matrix/index.js +1 -0
- package/dist/data-structures/matrix/index.js.map +1 -0
- package/dist/data-structures/matrix/matrix.js +9 -22
- package/dist/data-structures/matrix/matrix.js.map +1 -0
- package/dist/data-structures/matrix/matrix2d.js +75 -149
- package/dist/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/data-structures/matrix/navigator.js +38 -46
- package/dist/data-structures/matrix/navigator.js.map +1 -0
- package/dist/data-structures/matrix/vector2d.js +90 -254
- package/dist/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/data-structures/priority-queue/index.js +1 -0
- package/dist/data-structures/priority-queue/index.js.map +1 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +47 -32
- package/dist/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +47 -33
- package/dist/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/data-structures/priority-queue/priority-queue.js +150 -241
- package/dist/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/data-structures/queue/deque.js +130 -162
- package/dist/data-structures/queue/deque.js.map +1 -0
- package/dist/data-structures/queue/index.js +1 -0
- package/dist/data-structures/queue/index.js.map +1 -0
- package/dist/data-structures/queue/queue.js +181 -100
- package/dist/data-structures/queue/queue.js.map +1 -0
- package/dist/data-structures/stack/index.js +1 -0
- package/dist/data-structures/stack/index.js.map +1 -0
- package/dist/data-structures/stack/stack.js +23 -71
- package/dist/data-structures/stack/stack.js.map +1 -0
- package/dist/data-structures/tree/index.js +1 -0
- package/dist/data-structures/tree/index.js.map +1 -0
- package/dist/data-structures/tree/tree.js +46 -33
- package/dist/data-structures/tree/tree.js.map +1 -0
- package/dist/data-structures/trie/index.js +1 -0
- package/dist/data-structures/trie/index.js.map +1 -0
- package/dist/data-structures/trie/trie.js +201 -129
- package/dist/data-structures/trie/trie.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/abstract-binary-tree.js +1 -0
- package/dist/interfaces/abstract-binary-tree.js.map +1 -0
- package/dist/interfaces/abstract-graph.js +1 -0
- package/dist/interfaces/abstract-graph.js.map +1 -0
- package/dist/interfaces/avl-tree.js +1 -0
- package/dist/interfaces/avl-tree.js.map +1 -0
- package/dist/interfaces/binary-tree.js +1 -0
- package/dist/interfaces/binary-tree.js.map +1 -0
- package/dist/interfaces/bst.js +1 -0
- package/dist/interfaces/bst.js.map +1 -0
- package/dist/interfaces/directed-graph.js +1 -0
- package/dist/interfaces/directed-graph.js.map +1 -0
- package/dist/interfaces/doubly-linked-list.js +1 -0
- package/dist/interfaces/doubly-linked-list.js.map +1 -0
- package/dist/interfaces/heap.js +1 -0
- package/dist/interfaces/heap.js.map +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/navigator.js +1 -0
- package/dist/interfaces/navigator.js.map +1 -0
- package/dist/interfaces/priority-queue.js +1 -0
- package/dist/interfaces/priority-queue.js.map +1 -0
- package/dist/interfaces/rb-tree.js +1 -0
- package/dist/interfaces/rb-tree.js.map +1 -0
- package/dist/interfaces/segment-tree.js +1 -0
- package/dist/interfaces/segment-tree.js.map +1 -0
- package/dist/interfaces/singly-linked-list.js +1 -0
- package/dist/interfaces/singly-linked-list.js.map +1 -0
- package/dist/interfaces/tree-multiset.js +1 -0
- package/dist/interfaces/tree-multiset.js.map +1 -0
- package/dist/interfaces/undirected-graph.js +1 -0
- package/dist/interfaces/undirected-graph.js.map +1 -0
- package/dist/types/data-structures/abstract-binary-tree.js +1 -7
- package/dist/types/data-structures/abstract-binary-tree.js.map +1 -0
- package/dist/types/data-structures/abstract-graph.js +1 -0
- package/dist/types/data-structures/abstract-graph.js.map +1 -0
- package/dist/types/data-structures/avl-tree.js +1 -0
- package/dist/types/data-structures/avl-tree.js.map +1 -0
- package/dist/types/data-structures/binary-tree.js +1 -0
- package/dist/types/data-structures/binary-tree.js.map +1 -0
- package/dist/types/data-structures/bst.js +1 -0
- package/dist/types/data-structures/bst.js.map +1 -0
- package/dist/types/data-structures/directed-graph.js +1 -0
- package/dist/types/data-structures/directed-graph.js.map +1 -0
- package/dist/types/data-structures/doubly-linked-list.js +1 -0
- package/dist/types/data-structures/doubly-linked-list.js.map +1 -0
- package/dist/types/data-structures/heap.js +1 -0
- package/dist/types/data-structures/heap.js.map +1 -0
- package/dist/types/data-structures/index.js +1 -0
- package/dist/types/data-structures/index.js.map +1 -0
- package/dist/types/data-structures/map-graph.js +1 -0
- package/dist/types/data-structures/map-graph.js.map +1 -0
- package/dist/types/data-structures/navigator.js +1 -0
- package/dist/types/data-structures/navigator.js.map +1 -0
- package/dist/types/data-structures/priority-queue.js +1 -0
- package/dist/types/data-structures/priority-queue.js.map +1 -0
- package/dist/types/data-structures/rb-tree.js +1 -0
- package/dist/types/data-structures/rb-tree.js.map +1 -0
- package/dist/types/data-structures/segment-tree.js +1 -0
- package/dist/types/data-structures/segment-tree.js.map +1 -0
- package/dist/types/data-structures/singly-linked-list.js +1 -0
- package/dist/types/data-structures/singly-linked-list.js.map +1 -0
- package/dist/types/data-structures/tree-multiset.js +1 -0
- package/dist/types/data-structures/tree-multiset.js.map +1 -0
- package/dist/types/helpers.js +1 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utils/index.js +1 -0
- package/dist/types/utils/index.js.map +1 -0
- package/dist/types/utils/utils.js +1 -0
- package/dist/types/utils/utils.js.map +1 -0
- package/dist/types/utils/validate-type.js +1 -0
- package/dist/types/utils/validate-type.js.map +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/utils.js +108 -22
- package/dist/utils/utils.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +127 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1367 -0
- package/docs/classes/AVLTree.html +2259 -0
- package/docs/classes/AVLTreeNode.html +399 -0
- package/docs/classes/AaTree.html +202 -0
- package/docs/classes/AbstractBinaryTree.html +1913 -0
- package/docs/classes/AbstractBinaryTreeNode.html +441 -0
- package/docs/classes/AbstractEdge.html +345 -0
- package/docs/classes/AbstractGraph.html +1105 -0
- package/docs/classes/AbstractVertex.html +299 -0
- package/docs/classes/ArrayDeque.html +469 -0
- package/docs/classes/BST.html +2103 -0
- package/docs/classes/BSTNode.html +400 -0
- package/docs/classes/BTree.html +202 -0
- package/docs/classes/BinaryIndexedTree.html +371 -0
- package/docs/classes/BinaryTree.html +1944 -0
- package/docs/classes/BinaryTreeNode.html +399 -0
- package/docs/classes/Character.html +250 -0
- package/docs/classes/CoordinateMap.html +513 -0
- package/docs/classes/CoordinateSet.html +474 -0
- package/docs/classes/Deque.html +1005 -0
- package/docs/classes/DirectedEdge.html +404 -0
- package/docs/classes/DirectedGraph.html +1530 -0
- package/docs/classes/DirectedVertex.html +286 -0
- package/docs/classes/DoublyLinkedList.html +998 -0
- package/docs/classes/DoublyLinkedListNode.html +327 -0
- package/docs/classes/HashTable.html +202 -0
- package/docs/classes/Heap.html +647 -0
- package/docs/classes/HeapItem.html +296 -0
- package/docs/classes/LinkedListQueue.html +884 -0
- package/docs/classes/MapEdge.html +391 -0
- package/docs/classes/MapGraph.html +1583 -0
- package/docs/classes/MapVertex.html +356 -0
- package/docs/classes/Matrix2D.html +532 -0
- package/docs/classes/MatrixNTI2D.html +270 -0
- package/docs/classes/MaxHeap.html +671 -0
- package/docs/classes/MaxPriorityQueue.html +866 -0
- package/docs/classes/MinHeap.html +672 -0
- package/docs/classes/MinPriorityQueue.html +868 -0
- package/docs/classes/Navigator.html +343 -0
- package/docs/classes/ObjectDeque.html +527 -0
- package/docs/classes/Pair.html +202 -0
- package/docs/classes/PriorityQueue.html +790 -0
- package/docs/classes/Queue.html +521 -0
- package/docs/classes/RBTree.html +2101 -0
- package/docs/classes/RBTreeNode.html +431 -0
- package/docs/classes/SegmentTree.html +464 -0
- package/docs/classes/SegmentTreeNode.html +387 -0
- package/docs/classes/SinglyLinkedList.html +830 -0
- package/docs/classes/SinglyLinkedListNode.html +300 -0
- package/docs/classes/SkipLinkedList.html +202 -0
- package/docs/classes/SplayTree.html +202 -0
- package/docs/classes/Stack.html +398 -0
- package/docs/classes/TreeMap.html +202 -0
- package/docs/classes/TreeMultiset.html +2587 -0
- package/docs/classes/TreeMultisetNode.html +447 -0
- package/docs/classes/TreeNode.html +344 -0
- package/docs/classes/TreeSet.html +202 -0
- package/docs/classes/Trie.html +402 -0
- package/docs/classes/TrieNode.html +310 -0
- package/docs/classes/TwoThreeTree.html +202 -0
- package/docs/classes/UndirectedEdge.html +374 -0
- package/docs/classes/UndirectedGraph.html +1285 -0
- package/docs/classes/UndirectedVertex.html +284 -0
- package/docs/classes/Vector2D.html +835 -0
- package/docs/enums/CP.html +211 -0
- package/docs/enums/FamilyPosition.html +239 -0
- package/docs/enums/LoopType.html +212 -0
- package/docs/enums/RBColor.html +204 -0
- package/docs/enums/TopologicalProperty.html +211 -0
- package/docs/functions/arrayRemove.html +208 -0
- package/docs/functions/isThunk.html +186 -0
- package/docs/functions/toThunk.html +186 -0
- package/docs/functions/trampoline.html +186 -0
- package/docs/functions/trampolineAsync.html +186 -0
- package/docs/functions/uuidV4.html +181 -0
- package/docs/index.html +693 -0
- package/docs/interfaces/IAVLTree.html +1245 -0
- package/docs/interfaces/IAbstractBinaryTree.html +1101 -0
- package/docs/interfaces/IAbstractBinaryTreeNode.html +335 -0
- package/docs/interfaces/IAbstractGraph.html +433 -0
- package/docs/interfaces/IBST.html +1245 -0
- package/docs/interfaces/IDirectedGraph.html +570 -0
- package/docs/interfaces/IRBTree.html +1247 -0
- package/docs/interfaces/IUNDirectedGraph.html +463 -0
- package/docs/modules.html +328 -0
- package/docs/types/AVLTreeNodeNested.html +182 -0
- package/docs/types/AVLTreeOptions.html +180 -0
- package/docs/types/AbstractBinaryTreeNodeNested.html +182 -0
- package/docs/types/AbstractBinaryTreeNodeProperties.html +182 -0
- package/docs/types/AbstractBinaryTreeNodeProperty.html +182 -0
- package/docs/types/AbstractBinaryTreeOptions.html +182 -0
- package/docs/types/BSTComparator.html +192 -0
- package/docs/types/BSTNodeNested.html +182 -0
- package/docs/types/BSTOptions.html +182 -0
- package/docs/types/BinaryTreeDeletedResult.html +189 -0
- package/docs/types/BinaryTreeNodeId.html +177 -0
- package/docs/types/BinaryTreeNodeNested.html +182 -0
- package/docs/types/BinaryTreeNodePropertyName.html +177 -0
- package/docs/types/BinaryTreeOptions.html +180 -0
- package/docs/types/DFSOrderPattern.html +177 -0
- package/docs/types/DijkstraResult.html +199 -0
- package/docs/types/Direction.html +177 -0
- package/docs/types/DummyAny.html +190 -0
- package/docs/types/EdgeId.html +177 -0
- package/docs/types/HeapOptions.html +198 -0
- package/docs/types/IAVLTreeNode.html +184 -0
- package/docs/types/IBSTNode.html +184 -0
- package/docs/types/IBinaryTree.html +182 -0
- package/docs/types/IBinaryTreeNode.html +184 -0
- package/docs/types/IRBTreeNode.html +184 -0
- package/docs/types/ITreeMultiset.html +182 -0
- package/docs/types/ITreeMultisetNode.html +184 -0
- package/docs/types/KeyValueObject.html +182 -0
- package/docs/types/KeyValueObjectWithId.html +184 -0
- package/docs/types/MapGraphCoordinate.html +177 -0
- package/docs/types/NavigatorParams.html +211 -0
- package/docs/types/NodeOrPropertyName.html +177 -0
- package/docs/types/NonNumberNonObjectButDefined.html +177 -0
- package/docs/types/ObjectWithNonNumberId.html +184 -0
- package/docs/types/ObjectWithNumberId.html +184 -0
- package/docs/types/ObjectWithoutId.html +177 -0
- package/docs/types/PriorityQueueComparator.html +197 -0
- package/docs/types/PriorityQueueDFSOrderPattern.html +177 -0
- package/docs/types/PriorityQueueOptions.html +191 -0
- package/docs/types/RBTreeNodeNested.html +182 -0
- package/docs/types/RBTreeOptions.html +180 -0
- package/docs/types/RestrictValById.html +177 -0
- package/docs/types/SegmentTreeNodeVal.html +177 -0
- package/docs/types/SpecifyOptional.html +184 -0
- package/docs/types/Thunk.html +185 -0
- package/docs/types/ToThunkFn.html +185 -0
- package/docs/types/TopologicalStatus.html +177 -0
- package/docs/types/TreeMultisetNodeNested.html +182 -0
- package/docs/types/TreeMultisetOptions.html +180 -0
- package/docs/types/TrlAsyncFn.html +190 -0
- package/docs/types/TrlFn.html +190 -0
- package/docs/types/Turning.html +177 -0
- package/docs/types/VertexId.html +177 -0
- package/docs/variables/THUNK_SYMBOL.html +177 -0
- package/jest.config.js +5 -0
- package/lib/data-structures/binary-tree/aa-tree.js +2 -0
- package/{dist → lib}/data-structures/binary-tree/abstract-binary-tree.d.ts +25 -20
- package/lib/data-structures/binary-tree/abstract-binary-tree.js +1307 -0
- package/{dist → lib}/data-structures/binary-tree/avl-tree.d.ts +12 -12
- package/lib/data-structures/binary-tree/avl-tree.js +311 -0
- package/lib/data-structures/binary-tree/b-tree.js +2 -0
- package/lib/data-structures/binary-tree/binary-indexed-tree.js +69 -0
- package/lib/data-structures/binary-tree/binary-tree.js +35 -0
- package/{dist → lib}/data-structures/binary-tree/bst.d.ts +19 -8
- package/lib/data-structures/binary-tree/bst.js +551 -0
- package/lib/data-structures/binary-tree/index.js +12 -0
- package/{dist → lib}/data-structures/binary-tree/rb-tree.d.ts +0 -6
- package/lib/data-structures/binary-tree/rb-tree.js +22 -0
- package/lib/data-structures/binary-tree/segment-tree.js +210 -0
- package/lib/data-structures/binary-tree/splay-tree.js +2 -0
- package/{dist → lib}/data-structures/binary-tree/tree-multiset.d.ts +20 -23
- package/lib/data-structures/binary-tree/tree-multiset.js +673 -0
- package/lib/data-structures/binary-tree/two-three-tree.js +2 -0
- package/lib/data-structures/graph/abstract-graph.js +918 -0
- package/lib/data-structures/graph/directed-graph.js +416 -0
- package/lib/data-structures/graph/index.js +4 -0
- package/lib/data-structures/graph/map-graph.js +105 -0
- package/lib/data-structures/graph/undirected-graph.js +246 -0
- package/lib/data-structures/hash/coordinate-map.js +61 -0
- package/lib/data-structures/hash/coordinate-set.js +51 -0
- package/lib/data-structures/hash/hash-table.js +2 -0
- package/lib/data-structures/hash/index.js +6 -0
- package/lib/data-structures/hash/pair.js +2 -0
- package/lib/data-structures/hash/tree-map.js +2 -0
- package/lib/data-structures/hash/tree-set.js +2 -0
- package/lib/data-structures/heap/heap.js +152 -0
- package/lib/data-structures/heap/index.js +3 -0
- package/lib/data-structures/heap/max-heap.js +26 -0
- package/lib/data-structures/heap/min-heap.js +27 -0
- package/lib/data-structures/index.js +11 -0
- package/{dist → lib}/data-structures/linked-list/doubly-linked-list.d.ts +5 -5
- package/lib/data-structures/linked-list/doubly-linked-list.js +521 -0
- package/lib/data-structures/linked-list/index.js +3 -0
- package/{dist → lib}/data-structures/linked-list/singly-linked-list.d.ts +6 -5
- package/lib/data-structures/linked-list/singly-linked-list.js +443 -0
- package/lib/data-structures/linked-list/skip-linked-list.js +2 -0
- package/lib/data-structures/matrix/index.js +4 -0
- package/lib/data-structures/matrix/matrix.js +24 -0
- package/lib/data-structures/matrix/matrix2d.js +195 -0
- package/lib/data-structures/matrix/navigator.js +101 -0
- package/lib/data-structures/matrix/vector2d.js +287 -0
- package/lib/data-structures/priority-queue/index.js +3 -0
- package/lib/data-structures/priority-queue/max-priority-queue.js +39 -0
- package/lib/data-structures/priority-queue/min-priority-queue.js +40 -0
- package/lib/data-structures/priority-queue/priority-queue.js +317 -0
- package/{dist → lib}/data-structures/queue/deque.d.ts +45 -0
- package/lib/data-structures/queue/deque.js +270 -0
- package/lib/data-structures/queue/index.js +2 -0
- package/{dist → lib}/data-structures/queue/queue.d.ts +47 -13
- package/lib/data-structures/queue/queue.js +165 -0
- package/lib/data-structures/stack/index.js +1 -0
- package/lib/data-structures/stack/stack.js +87 -0
- package/lib/data-structures/tree/index.js +1 -0
- package/lib/data-structures/tree/tree.js +56 -0
- package/lib/data-structures/trie/index.js +1 -0
- package/lib/data-structures/trie/trie.js +205 -0
- package/lib/index.js +4 -0
- package/{dist → lib}/interfaces/avl-tree.d.ts +1 -9
- package/lib/interfaces/binary-tree.d.ts +4 -0
- package/{dist → lib}/interfaces/bst.d.ts +1 -2
- package/lib/interfaces/heap.js +1 -0
- package/lib/interfaces/index.js +15 -0
- package/lib/interfaces/navigator.d.ts +1 -0
- package/lib/interfaces/navigator.js +1 -0
- package/lib/interfaces/priority-queue.d.ts +1 -0
- package/lib/interfaces/priority-queue.js +1 -0
- package/{dist → lib}/interfaces/rb-tree.d.ts +1 -2
- package/lib/interfaces/rb-tree.js +1 -0
- package/lib/interfaces/segment-tree.d.ts +1 -0
- package/lib/interfaces/segment-tree.js +1 -0
- package/lib/interfaces/singly-linked-list.d.ts +1 -0
- package/lib/interfaces/singly-linked-list.js +1 -0
- package/lib/interfaces/tree-multiset.d.ts +5 -0
- package/lib/interfaces/tree-multiset.js +1 -0
- package/lib/interfaces/undirected-graph.js +1 -0
- package/{dist → lib}/types/data-structures/abstract-binary-tree.d.ts +1 -1
- package/lib/types/data-structures/abstract-binary-tree.js +22 -0
- package/lib/types/data-structures/abstract-graph.js +1 -0
- package/{dist → lib}/types/data-structures/avl-tree.d.ts +1 -1
- package/lib/types/data-structures/avl-tree.js +1 -0
- package/lib/types/data-structures/binary-tree.js +1 -0
- package/lib/types/data-structures/bst.js +6 -0
- package/lib/types/data-structures/directed-graph.js +6 -0
- package/lib/types/data-structures/doubly-linked-list.d.ts +1 -0
- package/lib/types/data-structures/doubly-linked-list.js +1 -0
- package/lib/types/data-structures/heap.js +1 -0
- package/lib/types/data-structures/index.js +15 -0
- package/lib/types/data-structures/map-graph.js +1 -0
- package/lib/types/data-structures/navigator.js +1 -0
- package/lib/types/data-structures/priority-queue.js +1 -0
- package/lib/types/data-structures/rb-tree.js +5 -0
- package/lib/types/data-structures/segment-tree.js +1 -0
- package/lib/types/data-structures/singly-linked-list.d.ts +1 -0
- package/lib/types/data-structures/singly-linked-list.js +1 -0
- package/lib/types/data-structures/tree-multiset.js +1 -0
- package/lib/types/helpers.d.ts +1 -0
- package/lib/types/helpers.js +1 -0
- package/lib/types/index.js +3 -0
- package/lib/types/utils/index.js +2 -0
- package/{dist → lib}/types/utils/utils.d.ts +1 -1
- package/lib/types/utils/utils.js +1 -0
- package/{dist → lib}/types/utils/validate-type.d.ts +1 -1
- package/lib/types/utils/validate-type.js +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/utils.js +57 -0
- package/package.json +147 -56
- package/rename_clear_files.sh +29 -0
- package/test/integration/avl-tree.test.ts +111 -0
- package/test/integration/bst.test.ts +371 -0
- package/test/integration/heap.test.js +19 -0
- package/test/integration/index.html +44 -0
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +111 -0
- package/test/unit/data-structures/binary-tree/bst.test.ts +371 -0
- package/test/unit/data-structures/binary-tree/overall.test.ts +57 -0
- package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +405 -0
- package/test/unit/data-structures/graph/abstract-graph.test.ts +5 -0
- package/test/unit/data-structures/graph/directed-graph.test.ts +517 -0
- package/test/unit/data-structures/graph/index.ts +2 -0
- package/test/unit/data-structures/graph/map-graph.test.ts +46 -0
- package/test/unit/data-structures/graph/overall.test.ts +50 -0
- package/test/unit/data-structures/graph/undirected-graph.test.ts +60 -0
- package/test/unit/data-structures/heap/heap.test.ts +56 -0
- package/test/unit/data-structures/heap/max-heap.test.ts +42 -0
- package/test/unit/data-structures/heap/min-heap.test.ts +81 -0
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +365 -0
- package/test/unit/data-structures/linked-list/index.ts +4 -0
- package/test/unit/data-structures/linked-list/linked-list.test.ts +37 -0
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +401 -0
- package/test/unit/data-structures/linked-list/skip-linked-list.test.ts +13 -0
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +106 -0
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +105 -0
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +27 -0
- package/test/unit/data-structures/queue/queue.test.ts +36 -0
- package/test/utils/index.ts +2 -0
- package/test/utils/magnitude.ts +21 -0
- package/test/utils/number.ts +3 -0
- package/tsconfig.build.json +33 -0
- package/tsconfig.json +38 -0
- package/umd/bundle.min.js +3 -0
- package/umd/bundle.min.js.map +1 -0
- package/webpack.config.js +28 -0
- package/dist/bundle.js +0 -2
- package/dist/interfaces/binary-tree.d.ts +0 -6
- package/dist/interfaces/tree-multiset.d.ts +0 -7
- /package/{dist → lib}/data-structures/binary-tree/aa-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/b-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/binary-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/splay-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/binary-tree/two-three-tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/{dist → lib}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/{dist → lib}/data-structures/graph/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/graph/map-graph.d.ts +0 -0
- /package/{dist → lib}/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/coordinate-map.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/coordinate-set.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/hash-table.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/pair.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/tree-map.d.ts +0 -0
- /package/{dist → lib}/data-structures/hash/tree-set.d.ts +0 -0
- /package/{dist → lib}/data-structures/heap/heap.d.ts +0 -0
- /package/{dist → lib}/data-structures/heap/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/heap/max-heap.d.ts +0 -0
- /package/{dist → lib}/data-structures/heap/min-heap.d.ts +0 -0
- /package/{dist → lib}/data-structures/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/linked-list/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/{dist → lib}/data-structures/matrix/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/matrix/matrix.d.ts +0 -0
- /package/{dist → lib}/data-structures/matrix/matrix2d.d.ts +0 -0
- /package/{dist → lib}/data-structures/matrix/navigator.d.ts +0 -0
- /package/{dist → lib}/data-structures/matrix/vector2d.d.ts +0 -0
- /package/{dist → lib}/data-structures/priority-queue/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/{dist → lib}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/{dist → lib}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/{dist → lib}/data-structures/queue/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/stack/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/stack/stack.d.ts +0 -0
- /package/{dist → lib}/data-structures/tree/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/tree/tree.d.ts +0 -0
- /package/{dist → lib}/data-structures/trie/index.d.ts +0 -0
- /package/{dist → lib}/data-structures/trie/trie.d.ts +0 -0
- /package/{dist → lib}/index.d.ts +0 -0
- /package/{dist → lib}/interfaces/abstract-binary-tree.d.ts +0 -0
- /package/{dist/interfaces/doubly-linked-list.d.ts → lib/interfaces/abstract-binary-tree.js} +0 -0
- /package/{dist → lib}/interfaces/abstract-graph.d.ts +0 -0
- /package/{dist/interfaces/heap.d.ts → lib/interfaces/abstract-graph.js} +0 -0
- /package/{dist/interfaces/navigator.d.ts → lib/interfaces/avl-tree.js} +0 -0
- /package/{dist/interfaces/priority-queue.d.ts → lib/interfaces/binary-tree.js} +0 -0
- /package/{dist/interfaces/segment-tree.d.ts → lib/interfaces/bst.js} +0 -0
- /package/{dist → lib}/interfaces/directed-graph.d.ts +0 -0
- /package/{dist/interfaces/singly-linked-list.d.ts → lib/interfaces/directed-graph.js} +0 -0
- /package/{dist/types/data-structures → lib/interfaces}/doubly-linked-list.d.ts +0 -0
- /package/{dist/types/data-structures/singly-linked-list.d.ts → lib/interfaces/doubly-linked-list.js} +0 -0
- /package/{dist/types/helpers.d.ts → lib/interfaces/heap.d.ts} +0 -0
- /package/{dist → lib}/interfaces/index.d.ts +0 -0
- /package/{dist → lib}/interfaces/undirected-graph.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/abstract-graph.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/binary-tree.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/bst.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/directed-graph.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/heap.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/index.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/map-graph.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/navigator.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/priority-queue.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/rb-tree.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/segment-tree.d.ts +0 -0
- /package/{dist → lib}/types/data-structures/tree-multiset.d.ts +0 -0
- /package/{dist → lib}/types/index.d.ts +0 -0
- /package/{dist → lib}/types/utils/index.d.ts +0 -0
- /package/{dist → lib}/utils/index.d.ts +0 -0
- /package/{dist → lib}/utils/utils.d.ts +0 -0
- /package/{dist/bundle.js.LICENSE.txt → umd/bundle.min.js.LICENSE.txt} +0 -0
|
@@ -1,93 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.PriorityQueue = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* The constructor initializes a priority queue with the given options, including an array of nodes and a comparator
|
|
7
|
-
* function.
|
|
8
|
-
* @param options - The `options` parameter is an object that contains the following properties:
|
|
9
|
-
*/
|
|
10
|
-
constructor(options) {
|
|
40
|
+
var PriorityQueue = (function () {
|
|
41
|
+
function PriorityQueue(options) {
|
|
11
42
|
this._nodes = [];
|
|
12
|
-
this._comparator = (a, b)
|
|
13
|
-
|
|
43
|
+
this._comparator = function (a, b) {
|
|
44
|
+
var aKey = a, bKey = b;
|
|
14
45
|
return aKey - bKey;
|
|
15
46
|
};
|
|
16
|
-
|
|
47
|
+
var nodes = options.nodes, comparator = options.comparator, _a = options.isFix, isFix = _a === void 0 ? true : _a;
|
|
17
48
|
this._comparator = comparator;
|
|
18
49
|
if (nodes && Array.isArray(nodes) && nodes.length > 0) {
|
|
19
|
-
|
|
20
|
-
this._nodes = [...nodes];
|
|
50
|
+
this._nodes = __spreadArray([], __read(nodes), false);
|
|
21
51
|
isFix && this._fix();
|
|
22
52
|
}
|
|
23
53
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
Object.defineProperty(PriorityQueue.prototype, "nodes", {
|
|
55
|
+
get: function () {
|
|
56
|
+
return this._nodes;
|
|
57
|
+
},
|
|
58
|
+
enumerable: false,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(PriorityQueue.prototype, "size", {
|
|
62
|
+
get: function () {
|
|
63
|
+
return this.nodes.length;
|
|
64
|
+
},
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
68
|
+
PriorityQueue.heapify = function (options) {
|
|
69
|
+
var heap = new PriorityQueue(options);
|
|
39
70
|
heap._fix();
|
|
40
71
|
return heap;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* following properties:
|
|
47
|
-
* @returns the result of calling the `isValid()` method on a new instance of the `PriorityQueue` class.
|
|
48
|
-
*/
|
|
49
|
-
static isPriorityQueueified(options) {
|
|
50
|
-
return new PriorityQueue(Object.assign(Object.assign({}, options), { isFix: false })).isValid();
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
|
|
54
|
-
*/
|
|
55
|
-
getNodes() {
|
|
72
|
+
};
|
|
73
|
+
PriorityQueue.isPriorityQueueified = function (options) {
|
|
74
|
+
return new PriorityQueue(__assign(__assign({}, options), { isFix: false })).isValid();
|
|
75
|
+
};
|
|
76
|
+
PriorityQueue.prototype.getNodes = function () {
|
|
56
77
|
return this._nodes;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
* The "add" function adds a node to the heap and ensures that the heap property is maintained.
|
|
60
|
-
* @param {T} node - The parameter "node" is of type T, which means it can be any data type. It represents the node
|
|
61
|
-
* that needs to be added to the heap.
|
|
62
|
-
*/
|
|
63
|
-
add(node) {
|
|
78
|
+
};
|
|
79
|
+
PriorityQueue.prototype.add = function (node) {
|
|
64
80
|
this.nodes.push(node);
|
|
65
81
|
this._heapifyUp(this.size - 1);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
* The "has" function checks if a given node is present in the list of nodes.
|
|
69
|
-
* @param {T} node - The parameter `node` is of type `T`, which means it can be any type. It represents the node that
|
|
70
|
-
* we want to check if it exists in the `nodes` array.
|
|
71
|
-
* @returns a boolean value indicating whether the given node is included in the array of nodes.
|
|
72
|
-
*/
|
|
73
|
-
has(node) {
|
|
82
|
+
};
|
|
83
|
+
PriorityQueue.prototype.has = function (node) {
|
|
74
84
|
return this.nodes.includes(node);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
* The `peek` function returns the first element of the `nodes` array if it exists, otherwise it returns `null`.
|
|
78
|
-
* @returns The `peek()` function is returning the first element (`T`) of the `nodes` array if the `size` is not zero.
|
|
79
|
-
* Otherwise, it returns `null`.
|
|
80
|
-
*/
|
|
81
|
-
peek() {
|
|
85
|
+
};
|
|
86
|
+
PriorityQueue.prototype.peek = function () {
|
|
82
87
|
return this.size ? this.nodes[0] : null;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
* The `poll` function removes and returns the top element from a heap data structure.
|
|
86
|
-
* @returns The `poll()` method returns a value of type `T` or `null`.
|
|
87
|
-
*/
|
|
88
|
-
poll() {
|
|
88
|
+
};
|
|
89
|
+
PriorityQueue.prototype.poll = function () {
|
|
89
90
|
var _a, _b;
|
|
90
|
-
|
|
91
|
+
var res = null;
|
|
91
92
|
if (this.size > 1) {
|
|
92
93
|
this._swap(0, this.nodes.length - 1);
|
|
93
94
|
res = (_a = this.nodes.pop()) !== null && _a !== void 0 ? _a : null;
|
|
@@ -97,56 +98,30 @@ class PriorityQueue {
|
|
|
97
98
|
res = (_b = this.nodes.pop()) !== null && _b !== void 0 ? _b : null;
|
|
98
99
|
}
|
|
99
100
|
return res;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
* The `leaf` function returns the last element in the `nodes` array or `null` if the array is empty.
|
|
103
|
-
* @returns The method `leaf()` is returning the last element (`T`) in the `nodes` array if it exists. If the array is
|
|
104
|
-
* empty or the last element is `null`, then it returns `null`.
|
|
105
|
-
*/
|
|
106
|
-
leaf() {
|
|
101
|
+
};
|
|
102
|
+
PriorityQueue.prototype.leaf = function () {
|
|
107
103
|
var _a;
|
|
108
104
|
return (_a = this.nodes[this.size - 1]) !== null && _a !== void 0 ? _a : null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
* The function checks if the size of an object is equal to zero and returns a boolean value indicating whether the
|
|
112
|
-
* object is empty or not.
|
|
113
|
-
* @returns The method `isEmpty()` is returning a boolean value indicating whether the size of the object is equal to
|
|
114
|
-
* 0.
|
|
115
|
-
*/
|
|
116
|
-
isEmpty() {
|
|
105
|
+
};
|
|
106
|
+
PriorityQueue.prototype.isEmpty = function () {
|
|
117
107
|
return this.size === 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
* The clear function clears the nodes array.
|
|
121
|
-
*/
|
|
122
|
-
clear() {
|
|
108
|
+
};
|
|
109
|
+
PriorityQueue.prototype.clear = function () {
|
|
123
110
|
this._setNodes([]);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
clone() {
|
|
139
|
-
return new PriorityQueue({ nodes: this.nodes, comparator: this._comparator });
|
|
140
|
-
}
|
|
141
|
-
// --- start additional methods ---
|
|
142
|
-
/**
|
|
143
|
-
* The `isValid` function recursively checks if a binary tree satisfies a certain condition.
|
|
144
|
-
* @returns The function `isValid()` returns a boolean value.
|
|
145
|
-
*/
|
|
146
|
-
isValid() {
|
|
147
|
-
for (let i = 0; i < this.nodes.length; i++) {
|
|
148
|
-
const leftChildIndex = this._getLeft(i);
|
|
149
|
-
const rightChildIndex = this._getRight(i);
|
|
111
|
+
};
|
|
112
|
+
PriorityQueue.prototype.toArray = function () {
|
|
113
|
+
return __spreadArray([], __read(this.nodes), false);
|
|
114
|
+
};
|
|
115
|
+
PriorityQueue.prototype.clone = function () {
|
|
116
|
+
return new PriorityQueue({
|
|
117
|
+
nodes: this.nodes,
|
|
118
|
+
comparator: this._comparator
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
PriorityQueue.prototype.isValid = function () {
|
|
122
|
+
for (var i = 0; i < this.nodes.length; i++) {
|
|
123
|
+
var leftChildIndex = this._getLeft(i);
|
|
124
|
+
var rightChildIndex = this._getRight(i);
|
|
150
125
|
if (this._isValidIndex(leftChildIndex) && !this._compare(leftChildIndex, i)) {
|
|
151
126
|
return false;
|
|
152
127
|
}
|
|
@@ -155,124 +130,70 @@ class PriorityQueue {
|
|
|
155
130
|
}
|
|
156
131
|
}
|
|
157
132
|
return true;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
162
|
-
/**
|
|
163
|
-
* The function sorts the elements in a data structure and returns them in an array.
|
|
164
|
-
* Plan to support sorting of duplicate elements.
|
|
165
|
-
* @returns The `sort()` method is returning an array of type `T[]`.
|
|
166
|
-
*/
|
|
167
|
-
sort() {
|
|
168
|
-
const visitedNode = [];
|
|
133
|
+
};
|
|
134
|
+
PriorityQueue.prototype.sort = function () {
|
|
135
|
+
var visitedNode = [];
|
|
169
136
|
while (this.size !== 0) {
|
|
170
|
-
|
|
171
|
-
if (
|
|
172
|
-
visitedNode.push(
|
|
137
|
+
var top_1 = this.poll();
|
|
138
|
+
if (top_1)
|
|
139
|
+
visitedNode.push(top_1);
|
|
173
140
|
}
|
|
174
141
|
return visitedNode;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* the nodes should be visited during the Depth-First Search (DFS) traversal. It can have one of the following values:
|
|
181
|
-
* @returns an array of type `(T | null)[]`.
|
|
182
|
-
*/
|
|
183
|
-
DFS(dfsMode) {
|
|
184
|
-
const visitedNode = [];
|
|
185
|
-
const traverse = (cur) => {
|
|
142
|
+
};
|
|
143
|
+
PriorityQueue.prototype.DFS = function (dfsMode) {
|
|
144
|
+
var _this = this;
|
|
145
|
+
var visitedNode = [];
|
|
146
|
+
var traverse = function (cur) {
|
|
186
147
|
var _a, _b, _c;
|
|
187
|
-
|
|
188
|
-
|
|
148
|
+
var leftChildIndex = _this._getLeft(cur);
|
|
149
|
+
var rightChildIndex = _this._getRight(cur);
|
|
189
150
|
switch (dfsMode) {
|
|
190
151
|
case 'in':
|
|
191
|
-
|
|
192
|
-
visitedNode.push((_a =
|
|
193
|
-
|
|
152
|
+
_this._isValidIndex(leftChildIndex) && traverse(leftChildIndex);
|
|
153
|
+
visitedNode.push((_a = _this.nodes[cur]) !== null && _a !== void 0 ? _a : null);
|
|
154
|
+
_this._isValidIndex(rightChildIndex) && traverse(rightChildIndex);
|
|
194
155
|
break;
|
|
195
156
|
case 'pre':
|
|
196
|
-
visitedNode.push((_b =
|
|
197
|
-
|
|
198
|
-
|
|
157
|
+
visitedNode.push((_b = _this.nodes[cur]) !== null && _b !== void 0 ? _b : null);
|
|
158
|
+
_this._isValidIndex(leftChildIndex) && traverse(leftChildIndex);
|
|
159
|
+
_this._isValidIndex(rightChildIndex) && traverse(rightChildIndex);
|
|
199
160
|
break;
|
|
200
161
|
case 'post':
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
visitedNode.push((_c =
|
|
162
|
+
_this._isValidIndex(leftChildIndex) && traverse(leftChildIndex);
|
|
163
|
+
_this._isValidIndex(rightChildIndex) && traverse(rightChildIndex);
|
|
164
|
+
visitedNode.push((_c = _this.nodes[cur]) !== null && _c !== void 0 ? _c : null);
|
|
204
165
|
break;
|
|
205
166
|
}
|
|
206
167
|
};
|
|
207
168
|
this._isValidIndex(0) && traverse(0);
|
|
208
169
|
return visitedNode;
|
|
209
|
-
}
|
|
210
|
-
_setNodes(value) {
|
|
170
|
+
};
|
|
171
|
+
PriorityQueue.prototype._setNodes = function (value) {
|
|
211
172
|
this._nodes = value;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
* The function compares two numbers using a custom comparator function.
|
|
215
|
-
* @param {number} a - The parameter "a" is a number that represents the index of a node in an array.
|
|
216
|
-
* @param {number} b - The parameter "b" is a number.
|
|
217
|
-
* @returns the result of the comparison between the elements at indices `a` and `b` in the `nodes` array. The
|
|
218
|
-
* comparison is done using the `_comparator` function, and if the result is greater than 0, `true` is returned,
|
|
219
|
-
* indicating that the element at index `a` is greater than the element at index `b`.
|
|
220
|
-
*/
|
|
221
|
-
_compare(a, b) {
|
|
173
|
+
};
|
|
174
|
+
PriorityQueue.prototype._compare = function (a, b) {
|
|
222
175
|
return this._comparator(this.nodes[a], this.nodes[b]) > 0;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
* @param {number} a - The parameter "a" is a number that represents the index of an element in an array.
|
|
227
|
-
* @param {number} b - The parameter "b" is a number.
|
|
228
|
-
*/
|
|
229
|
-
_swap(a, b) {
|
|
230
|
-
const temp = this.nodes[a];
|
|
176
|
+
};
|
|
177
|
+
PriorityQueue.prototype._swap = function (a, b) {
|
|
178
|
+
var temp = this.nodes[a];
|
|
231
179
|
this.nodes[a] = this.nodes[b];
|
|
232
180
|
this.nodes[b] = temp;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
* The function checks if a given index is valid within an array.
|
|
236
|
-
* @param {number} index - The parameter "index" is of type number and represents the index value that needs to be
|
|
237
|
-
* checked for validity.
|
|
238
|
-
* @returns A boolean value indicating whether the given index is valid or not.
|
|
239
|
-
*/
|
|
240
|
-
_isValidIndex(index) {
|
|
181
|
+
};
|
|
182
|
+
PriorityQueue.prototype._isValidIndex = function (index) {
|
|
241
183
|
return index > -1 && index < this.nodes.length;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
* The function returns the index of the parent node given the index of a child node in a binary tree.
|
|
245
|
-
* @param {number} child - The "child" parameter is a number representing the index of a child node in a binary tree.
|
|
246
|
-
* @returns the parent of the given child node.
|
|
247
|
-
*/
|
|
248
|
-
_getParent(child) {
|
|
184
|
+
};
|
|
185
|
+
PriorityQueue.prototype._getParent = function (child) {
|
|
249
186
|
return Math.floor((child - 1) / 2);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
* The function returns the index of the right child node in a binary tree given the index of its parent node.
|
|
261
|
-
* @param {number} parent - The parameter "parent" is a number that represents the index of a node in a binary tree.
|
|
262
|
-
* @returns the right child of a given parent node in a binary tree.
|
|
263
|
-
*/
|
|
264
|
-
_getRight(parent) {
|
|
265
|
-
return (2 * parent) + 2;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* The function returns the index of the smallest child node of a given parent node.
|
|
269
|
-
* @param {number} parent - The parent parameter is a number that represents the index of the parent node in a binary
|
|
270
|
-
* tree.
|
|
271
|
-
* @returns the minimum value between the parent node and its left and right child nodes.
|
|
272
|
-
*/
|
|
273
|
-
_getComparedChild(parent) {
|
|
274
|
-
let min = parent;
|
|
275
|
-
const left = this._getLeft(parent), right = this._getRight(parent);
|
|
187
|
+
};
|
|
188
|
+
PriorityQueue.prototype._getLeft = function (parent) {
|
|
189
|
+
return 2 * parent + 1;
|
|
190
|
+
};
|
|
191
|
+
PriorityQueue.prototype._getRight = function (parent) {
|
|
192
|
+
return 2 * parent + 2;
|
|
193
|
+
};
|
|
194
|
+
PriorityQueue.prototype._getComparedChild = function (parent) {
|
|
195
|
+
var min = parent;
|
|
196
|
+
var left = this._getLeft(parent), right = this._getRight(parent);
|
|
276
197
|
if (left < this.size && this._compare(min, left)) {
|
|
277
198
|
min = left;
|
|
278
199
|
}
|
|
@@ -280,39 +201,27 @@ class PriorityQueue {
|
|
|
280
201
|
min = right;
|
|
281
202
|
}
|
|
282
203
|
return min;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
* The function `_heapifyUp` is used to maintain the heap property by moving an element up the heap until it is in the
|
|
286
|
-
* correct position.
|
|
287
|
-
* @param {number} start - The start parameter is the index of the element that needs to be moved up in the heap.
|
|
288
|
-
*/
|
|
289
|
-
_heapifyUp(start) {
|
|
204
|
+
};
|
|
205
|
+
PriorityQueue.prototype._heapifyUp = function (start) {
|
|
290
206
|
while (start > 0 && this._compare(this._getParent(start), start)) {
|
|
291
|
-
|
|
292
|
-
this._swap(start,
|
|
293
|
-
start =
|
|
207
|
+
var parent_1 = this._getParent(start);
|
|
208
|
+
this._swap(start, parent_1);
|
|
209
|
+
start = parent_1;
|
|
294
210
|
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* @param {number} start - The start parameter is the index of the element in the heap from where the heapifyDown
|
|
299
|
-
* operation should start.
|
|
300
|
-
*/
|
|
301
|
-
_heapifyDown(start) {
|
|
302
|
-
let min = this._getComparedChild(start);
|
|
211
|
+
};
|
|
212
|
+
PriorityQueue.prototype._heapifyDown = function (start) {
|
|
213
|
+
var min = this._getComparedChild(start);
|
|
303
214
|
while (this._compare(start, min)) {
|
|
304
215
|
this._swap(min, start);
|
|
305
216
|
start = min;
|
|
306
217
|
min = this._getComparedChild(start);
|
|
307
218
|
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
* towards the root.
|
|
312
|
-
*/
|
|
313
|
-
_fix() {
|
|
314
|
-
for (let i = Math.floor(this.size / 2); i > -1; i--)
|
|
219
|
+
};
|
|
220
|
+
PriorityQueue.prototype._fix = function () {
|
|
221
|
+
for (var i = Math.floor(this.size / 2); i > -1; i--)
|
|
315
222
|
this._heapifyDown(i);
|
|
316
|
-
}
|
|
317
|
-
|
|
223
|
+
};
|
|
224
|
+
return PriorityQueue;
|
|
225
|
+
}());
|
|
318
226
|
exports.PriorityQueue = PriorityQueue;
|
|
227
|
+
//# sourceMappingURL=priority-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priority-queue.js","sourceRoot":"","sources":["../../../src/data-structures/priority-queue/priority-queue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;IAME,uBAAY,OAAgC;QAWlC,WAAM,GAAQ,EAAE,CAAC;QAkNR,gBAAW,GAA+B,UAAC,CAAI,EAAE,CAAI;YACtE,IAAM,IAAI,GAAG,CAAsB,EACjC,IAAI,GAAG,CAAsB,CAAC;YAChC,OAAO,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC;QAhOQ,IAAA,KAAK,GAA+B,OAAO,MAAtC,EAAE,UAAU,GAAmB,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