data-structure-typed 1.21.3 → 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 +150 -98
- 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './abstract-binary-tree';
|
|
2
|
+
export * from './abstract-graph';
|
|
3
|
+
export * from './avl-tree';
|
|
4
|
+
export * from './binary-tree';
|
|
5
|
+
export * from './bst';
|
|
6
|
+
export * from './directed-graph';
|
|
7
|
+
export * from './doubly-linked-list';
|
|
8
|
+
export * from './heap';
|
|
9
|
+
export * from './navigator';
|
|
10
|
+
export * from './priority-queue';
|
|
11
|
+
export * from './rb-tree';
|
|
12
|
+
export * from './segment-tree';
|
|
13
|
+
export * from './singly-linked-list';
|
|
14
|
+
export * from './tree-multiset';
|
|
15
|
+
export * from './undirected-graph';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { RBTreeNode } from '../data-structures';
|
|
2
2
|
import { IBST, IBSTNode } from './bst';
|
|
3
3
|
import { BinaryTreeNodeId } from '../types';
|
|
4
|
-
export
|
|
5
|
-
}
|
|
4
|
+
export type IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
|
|
6
5
|
export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
|
|
7
6
|
createNode(id: BinaryTreeNodeId, val?: N['val'], count?: number): N;
|
|
8
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TreeMultisetNode } from '../data-structures';
|
|
2
|
+
import { IBSTNode } from './bst';
|
|
3
|
+
import { IAVLTree } from './avl-tree';
|
|
4
|
+
export type ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
|
|
5
|
+
export type ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> = IAVLTree<N>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different loop types.
|
|
3
|
+
*
|
|
4
|
+
* - `iterative`: Indicates the iterative loop type (with loops that use iterations).
|
|
5
|
+
* - `recursive`: Indicates the recursive loop type (with loops that call themselves).
|
|
6
|
+
*/
|
|
7
|
+
export var LoopType;
|
|
8
|
+
(function (LoopType) {
|
|
9
|
+
LoopType["ITERATIVE"] = "ITERATIVE";
|
|
10
|
+
LoopType["RECURSIVE"] = "RECURSIVE";
|
|
11
|
+
})(LoopType || (LoopType = {}));
|
|
12
|
+
/* This enumeration defines the position of a node within a family tree composed of three associated nodes, where 'root' represents the root node of the family tree, 'left' represents the left child node, and 'right' represents the right child node. */
|
|
13
|
+
export var FamilyPosition;
|
|
14
|
+
(function (FamilyPosition) {
|
|
15
|
+
FamilyPosition["ROOT"] = "ROOT";
|
|
16
|
+
FamilyPosition["LEFT"] = "LEFT";
|
|
17
|
+
FamilyPosition["RIGHT"] = "RIGHT";
|
|
18
|
+
FamilyPosition["ROOT_LEFT"] = "ROOT_LEFT";
|
|
19
|
+
FamilyPosition["ROOT_RIGHT"] = "ROOT_RIGHT";
|
|
20
|
+
FamilyPosition["ISOLATED"] = "ISOLATED";
|
|
21
|
+
FamilyPosition["MAL_NODE"] = "MAL_NODE";
|
|
22
|
+
})(FamilyPosition || (FamilyPosition = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AVLTreeNode } from '../../data-structures
|
|
1
|
+
import { AVLTreeNode } from '../../data-structures';
|
|
2
2
|
import { BSTOptions } from './bst';
|
|
3
3
|
export type AVLTreeNodeNested<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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
4
|
export type AVLTreeOptions = BSTOptions & {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './binary-tree';
|
|
2
|
+
export * from './bst';
|
|
3
|
+
export * from './avl-tree';
|
|
4
|
+
export * from './segment-tree';
|
|
5
|
+
export * from './tree-multiset';
|
|
6
|
+
export * from './abstract-graph';
|
|
7
|
+
export * from './map-graph';
|
|
8
|
+
export * from './abstract-binary-tree';
|
|
9
|
+
export * from './rb-tree';
|
|
10
|
+
export * from './directed-graph';
|
|
11
|
+
export * from './priority-queue';
|
|
12
|
+
export * from './heap';
|
|
13
|
+
export * from './singly-linked-list';
|
|
14
|
+
export * from './doubly-linked-list';
|
|
15
|
+
export * from './navigator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -16,4 +16,4 @@ export type ObjectWithNumberId = {
|
|
|
16
16
|
id: number;
|
|
17
17
|
};
|
|
18
18
|
export type RestrictValById = NonNumberNonObjectButDefined | ObjectWithoutId | ObjectWithNonNumberId | ObjectWithNumberId;
|
|
19
|
-
export type DummyAny = string | number | boolean | null | undefined | object | symbol | void |
|
|
19
|
+
export type DummyAny = string | number | boolean | null | undefined | object | symbol | void | ((...args: []) => any) | never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const uuidV4 = function () {
|
|
11
|
+
return 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function (c) {
|
|
12
|
+
const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
13
|
+
return v.toString(16);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export const arrayRemove = function (array, predicate) {
|
|
17
|
+
let i = -1, len = array ? array.length : 0;
|
|
18
|
+
const result = [];
|
|
19
|
+
while (++i < len) {
|
|
20
|
+
const value = array[i];
|
|
21
|
+
if (predicate(value, i, array)) {
|
|
22
|
+
result.push(value);
|
|
23
|
+
Array.prototype.splice.call(array, i--, 1);
|
|
24
|
+
len--;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
export const THUNK_SYMBOL = Symbol('thunk');
|
|
30
|
+
export const isThunk = (fnOrValue) => {
|
|
31
|
+
return typeof fnOrValue === 'function' && fnOrValue.__THUNK__ === THUNK_SYMBOL;
|
|
32
|
+
};
|
|
33
|
+
export const toThunk = (fn) => {
|
|
34
|
+
const thunk = () => fn();
|
|
35
|
+
thunk.__THUNK__ = THUNK_SYMBOL;
|
|
36
|
+
return thunk;
|
|
37
|
+
};
|
|
38
|
+
export const trampoline = (fn) => {
|
|
39
|
+
const cont = (...args) => toThunk(() => fn(...args));
|
|
40
|
+
return Object.assign((...args) => {
|
|
41
|
+
let result = fn(...args);
|
|
42
|
+
while (isThunk(result) && typeof result === 'function') {
|
|
43
|
+
result = result();
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}, { cont });
|
|
47
|
+
};
|
|
48
|
+
export const trampolineAsync = (fn) => {
|
|
49
|
+
const cont = (...args) => toThunk(() => fn(...args));
|
|
50
|
+
return Object.assign((...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
let result = yield fn(...args);
|
|
52
|
+
while (isThunk(result) && typeof result === 'function') {
|
|
53
|
+
result = yield result();
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}), { cont });
|
|
57
|
+
};
|
package/package.json
CHANGED
|
@@ -1,56 +1,137 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-structure-typed",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.31.0",
|
|
4
|
+
"description": "Data Structures of Javascript & TypeScript. AVLTree, Binary Search Tree, Binary Tree, Tree Multiset, Graph, Heap, Priority Queue, Linked List.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"module": "
|
|
7
|
-
"types": "
|
|
6
|
+
"module": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"umd:main": "umd/bundle.min.js",
|
|
9
|
+
"source": "src/index.ts",
|
|
8
10
|
"scripts": {
|
|
9
|
-
"build": "
|
|
10
|
-
"build:
|
|
11
|
+
"build": "npm run build:es6 && npm run build:commonjs && npm run build:umd",
|
|
12
|
+
"build:es6": "rm -rf lib && tsc",
|
|
13
|
+
"build:commonjs": "rm -rf dist && tsc --project tsconfig.build.json",
|
|
14
|
+
"build:umd": "webpack",
|
|
11
15
|
"build:docs": "typedoc --out docs ./src",
|
|
16
|
+
"lint": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
17
|
+
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
18
|
+
"update:test-deps": "npm i avl-tree-typed binary-tree-typed bst-typed deque-typed directed-graph-typed doubly-linked-list-typed graph-typed heap-typed linked-list-typed max-heap-typed max-priority-queue-typed min-heap-typed min-priority-queue-typed priority-queue-typed singly-linked-list-typed stack-typed tree-multiset-typed trie-typed undirected-graph-typed queue-typed --save-dev",
|
|
12
19
|
"test": "jest",
|
|
13
|
-
"update:test-deps": "npm i avl-tree-typed binary-tree-typed bst-typed deque-typed directed-graph-typed doubly-linked-list-typed graph-typed heap-typed linked-list-typed max-heap-typed max-priority-queue-typed min-heap-typed min-priority-queue-typed priority-queue-typed singly-linked-list-typed stack-typed tree-multiset-typed trie-typed undirected-graph-typed --save-dev",
|
|
14
20
|
"deps:check": "dependency-cruiser src",
|
|
15
|
-
"
|
|
21
|
+
"changelog": "auto-changelog",
|
|
22
|
+
"build:publish": "npm run test && npm run build && npm run build:docs && npm run changelog && npm publish"
|
|
16
23
|
},
|
|
17
24
|
"repository": {
|
|
18
25
|
"type": "git",
|
|
19
26
|
"url": "git+https://github.com/zrwusa/data-structure-typed.git"
|
|
20
27
|
},
|
|
21
28
|
"keywords": [
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
29
|
+
"data",
|
|
30
|
+
"structure",
|
|
31
|
+
"structures",
|
|
32
|
+
"data structure",
|
|
33
|
+
"data-structure",
|
|
34
|
+
"data structures",
|
|
35
|
+
"data-structures",
|
|
36
|
+
"binary",
|
|
37
|
+
"depth",
|
|
38
|
+
"breadth",
|
|
39
|
+
"first",
|
|
40
|
+
"search",
|
|
41
|
+
"index",
|
|
42
|
+
"avl",
|
|
43
|
+
"segment",
|
|
44
|
+
"prefix",
|
|
45
|
+
"tree",
|
|
46
|
+
"multiset",
|
|
47
|
+
"directed",
|
|
48
|
+
"undirected",
|
|
49
|
+
"graph",
|
|
50
|
+
"min",
|
|
51
|
+
"max",
|
|
52
|
+
"heap",
|
|
53
|
+
"priority",
|
|
54
|
+
"queue",
|
|
55
|
+
"singly",
|
|
56
|
+
"doubly",
|
|
57
|
+
"linked",
|
|
58
|
+
"list",
|
|
59
|
+
"js",
|
|
60
|
+
"ts",
|
|
61
|
+
"javascript",
|
|
62
|
+
"typscript",
|
|
63
|
+
"sort",
|
|
64
|
+
"algorithm",
|
|
65
|
+
"binary search tree",
|
|
66
|
+
"binary-search-tree",
|
|
67
|
+
"binary tree",
|
|
68
|
+
"binary-tree",
|
|
69
|
+
"bst",
|
|
70
|
+
"BST",
|
|
71
|
+
"avl tree",
|
|
72
|
+
"avl-tree",
|
|
73
|
+
"tree multiset",
|
|
74
|
+
"tree-multiset",
|
|
75
|
+
"binary indexed tree",
|
|
76
|
+
"binary-indexed-tree",
|
|
77
|
+
"segment tree",
|
|
78
|
+
"segment-tree",
|
|
79
|
+
"trie",
|
|
80
|
+
"prefix tree",
|
|
81
|
+
"prefix-tree",
|
|
82
|
+
"dfs",
|
|
46
83
|
"DFS",
|
|
47
|
-
"
|
|
84
|
+
"depth first Search",
|
|
85
|
+
"depth-first-Search",
|
|
86
|
+
"bfs",
|
|
48
87
|
"BFS",
|
|
88
|
+
"breadth first search",
|
|
89
|
+
"dfs iterative",
|
|
90
|
+
"DFS Iterative",
|
|
91
|
+
"recursive",
|
|
92
|
+
"iterative",
|
|
93
|
+
"directed graph",
|
|
94
|
+
"directed-graph",
|
|
95
|
+
"undirected graph",
|
|
96
|
+
"undirected-graph",
|
|
97
|
+
"min heap",
|
|
98
|
+
"min-heap",
|
|
99
|
+
"max heap",
|
|
100
|
+
"max-heap",
|
|
101
|
+
"priority queue",
|
|
102
|
+
"priority-queue",
|
|
103
|
+
"max priority queue",
|
|
104
|
+
"max-priority-queue",
|
|
105
|
+
"min priority queue",
|
|
106
|
+
"min-priority-queue",
|
|
107
|
+
"array queue",
|
|
108
|
+
"array-queue",
|
|
109
|
+
"stack",
|
|
110
|
+
"hash",
|
|
111
|
+
"deque",
|
|
112
|
+
"object deque",
|
|
113
|
+
"array deque",
|
|
114
|
+
"linked list",
|
|
115
|
+
"linked-list",
|
|
116
|
+
"singly linked list",
|
|
117
|
+
"singly-linked-list",
|
|
118
|
+
"doubly linked list",
|
|
119
|
+
"doubly-linked-list",
|
|
49
120
|
"morris",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
121
|
+
"Morris",
|
|
122
|
+
"bellman ford",
|
|
123
|
+
"Bellman Ford",
|
|
124
|
+
"bellman-ford",
|
|
125
|
+
"dijkstra",
|
|
126
|
+
"Dijkstra",
|
|
127
|
+
"floyd warshall",
|
|
128
|
+
"Floyd Warshall",
|
|
129
|
+
"floyd-warshall",
|
|
130
|
+
"tarjan",
|
|
131
|
+
"Tarjan",
|
|
132
|
+
"Tarjan's",
|
|
133
|
+
"DataStructure",
|
|
134
|
+
"DataStructures"
|
|
54
135
|
],
|
|
55
136
|
"author": "Tyler Zeng zrwusa@gmail.com",
|
|
56
137
|
"license": "MIT",
|
|
@@ -61,31 +142,41 @@
|
|
|
61
142
|
"devDependencies": {
|
|
62
143
|
"@types/jest": "^29.5.3",
|
|
63
144
|
"@types/node": "^20.4.9",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
145
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
146
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
147
|
+
"auto-changelog": "^2.4.0",
|
|
148
|
+
"avl-tree-typed": "^1.3.3",
|
|
149
|
+
"binary-tree-typed": "^1.3.3",
|
|
150
|
+
"bst-typed": "^1.3.3",
|
|
67
151
|
"dependency-cruiser": "^13.1.2",
|
|
68
|
-
"deque-typed": "^1.
|
|
69
|
-
"directed-graph-typed": "^1.
|
|
70
|
-
"doubly-linked-list-typed": "^1.
|
|
71
|
-
"
|
|
72
|
-
"
|
|
152
|
+
"deque-typed": "^1.3.3",
|
|
153
|
+
"directed-graph-typed": "^1.3.3",
|
|
154
|
+
"doubly-linked-list-typed": "^1.3.3",
|
|
155
|
+
"eslint": "^7.32.0",
|
|
156
|
+
"eslint-config-prettier": "^8.3.0",
|
|
157
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
158
|
+
"eslint-import-resolver-typescript": "^2.5.0",
|
|
159
|
+
"eslint-plugin-import": "^2.25.4",
|
|
160
|
+
"graph-typed": "^1.3.3",
|
|
161
|
+
"heap-typed": "^1.3.3",
|
|
73
162
|
"jest": "^29.6.2",
|
|
74
|
-
"linked-list-typed": "^1.
|
|
75
|
-
"max-heap-typed": "^1.
|
|
76
|
-
"max-priority-queue-typed": "^1.
|
|
77
|
-
"min-heap-typed": "^1.
|
|
78
|
-
"min-priority-queue-typed": "^1.
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
163
|
+
"linked-list-typed": "^1.3.3",
|
|
164
|
+
"max-heap-typed": "^1.3.3",
|
|
165
|
+
"max-priority-queue-typed": "^1.3.3",
|
|
166
|
+
"min-heap-typed": "^1.3.3",
|
|
167
|
+
"min-priority-queue-typed": "^1.3.3",
|
|
168
|
+
"prettier": "^3.0.3",
|
|
169
|
+
"priority-queue-typed": "^1.3.3",
|
|
170
|
+
"queue-typed": "^1.3.3",
|
|
171
|
+
"singly-linked-list-typed": "^1.3.3",
|
|
172
|
+
"stack-typed": "^1.3.3",
|
|
173
|
+
"tree-multiset-typed": "^1.3.3",
|
|
174
|
+
"trie-typed": "^1.3.3",
|
|
84
175
|
"ts-jest": "^29.1.1",
|
|
85
176
|
"ts-loader": "^9.4.4",
|
|
86
177
|
"typedoc": "^0.24.8",
|
|
87
178
|
"typescript": "^4.9.5",
|
|
88
|
-
"undirected-graph-typed": "^1.
|
|
179
|
+
"undirected-graph-typed": "^1.3.3",
|
|
89
180
|
"webpack": "^5.88.2",
|
|
90
181
|
"webpack-cli": "^5.1.4"
|
|
91
182
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# iterate the directory to rename and clear content of files
|
|
4
|
+
rename_and_clear_files() {
|
|
5
|
+
local directory="$1"
|
|
6
|
+
local extension="$2"
|
|
7
|
+
local new_prefix="$3"
|
|
8
|
+
|
|
9
|
+
for file in "$directory"/*; do
|
|
10
|
+
if [ -d "$file" ]; then
|
|
11
|
+
rename_and_clear_files "$file" "$extension" "$new_prefix"
|
|
12
|
+
elif [ -f "$file" ] && [[ "$file" == *"$extension" ]]; then
|
|
13
|
+
filename=$(basename "$file" "$extension")
|
|
14
|
+
new_name="$directory/${filename}${new_prefix}${extension}"
|
|
15
|
+
mv "$file" "$new_name"
|
|
16
|
+
echo "Renamed $file to $new_name"
|
|
17
|
+
> "$new_name" # clear content of file
|
|
18
|
+
fi
|
|
19
|
+
done
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# check if directory, extension and prefix were provided
|
|
23
|
+
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
|
|
24
|
+
echo "Usage: $0 <directory> <extension> <new_prefix>"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# evoke the recursive function to rename and clear files
|
|
29
|
+
rename_and_clear_files "$1" "$2" "$3"
|