data-structure-typed 1.43.1 → 1.44.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/.eslintrc.js +3 -1
- package/CHANGELOG.md +1 -1
- package/README.md +7 -0
- package/benchmark/report.html +30 -30
- package/benchmark/report.json +201 -147
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/binary-tree.d.ts +8 -8
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/binary-tree.js +62 -62
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/index.js.map +1 -0
- package/dist/{mjs/src → cjs}/data-structures/binary-tree/rb-tree.d.ts +4 -4
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/rb-tree.js +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/tree-multimap.js +50 -50
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -0
- package/dist/{mjs/src → cjs}/data-structures/graph/abstract-graph.d.ts +37 -37
- package/dist/cjs/{src/data-structures → data-structures}/graph/abstract-graph.js +37 -37
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/data-structures/index.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/{src/interfaces → interfaces}/binary-tree.d.ts +1 -1
- package/dist/cjs/interfaces/binary-tree.js.map +1 -0
- package/dist/cjs/interfaces/doubly-linked-list.js.map +1 -0
- package/dist/cjs/{src/interfaces → interfaces}/graph.js.map +1 -1
- package/dist/cjs/{src/interfaces → interfaces}/heap.js.map +1 -1
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/cjs/interfaces/navigator.js.map +1 -0
- package/dist/cjs/interfaces/priority-queue.js.map +1 -0
- package/dist/cjs/interfaces/segment-tree.js.map +1 -0
- package/dist/cjs/interfaces/singly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-multimap.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/types/data-structures/index.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/types/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/types/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/types/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/types/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/types/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/types/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/types/helpers.js.map +1 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/utils/index.js.map +1 -0
- package/dist/cjs/{src/types → types}/utils/utils.js.map +1 -1
- package/dist/cjs/types/utils/validate-type.js.map +1 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/utils.js.map +1 -0
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/avl-tree.js +3 -8
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/binary-indexed-tree.js +3 -7
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/binary-tree.d.ts +8 -8
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/binary-tree.js +97 -102
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/bst.js +34 -39
- package/dist/mjs/data-structures/binary-tree/index.js +7 -0
- package/dist/{cjs/src → mjs}/data-structures/binary-tree/rb-tree.d.ts +4 -4
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/rb-tree.js +43 -48
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/segment-tree.js +2 -7
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/tree-multimap.js +60 -65
- package/dist/{cjs/src → mjs}/data-structures/graph/abstract-graph.d.ts +37 -37
- package/dist/mjs/{src/data-structures → data-structures}/graph/abstract-graph.js +46 -52
- package/dist/mjs/{src/data-structures → data-structures}/graph/directed-graph.js +9 -15
- package/dist/mjs/data-structures/graph/index.js +4 -0
- package/dist/mjs/{src/data-structures → data-structures}/graph/map-graph.js +4 -10
- package/dist/mjs/{src/data-structures → data-structures}/graph/undirected-graph.js +7 -13
- package/dist/mjs/{src/data-structures → data-structures}/hash/coordinate-map.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/hash/coordinate-set.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/hash/hash-map.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/hash/hash-table.js +2 -7
- package/dist/mjs/data-structures/hash/index.js +6 -0
- package/dist/mjs/data-structures/hash/tree-map.js +2 -0
- package/dist/mjs/data-structures/hash/tree-set.js +2 -0
- package/dist/mjs/{src/data-structures → data-structures}/heap/heap.js +3 -9
- package/dist/mjs/data-structures/heap/index.js +3 -0
- package/dist/mjs/{src/data-structures → data-structures}/heap/max-heap.js +2 -6
- package/dist/mjs/{src/data-structures → data-structures}/heap/min-heap.js +2 -6
- package/dist/mjs/data-structures/index.js +11 -0
- package/dist/mjs/{src/data-structures → data-structures}/linked-list/doubly-linked-list.js +2 -7
- package/dist/mjs/data-structures/linked-list/index.js +3 -0
- package/dist/mjs/{src/data-structures → data-structures}/linked-list/singly-linked-list.js +2 -7
- package/dist/mjs/{src/data-structures → data-structures}/linked-list/skip-linked-list.js +2 -7
- package/dist/mjs/data-structures/matrix/index.js +4 -0
- package/dist/mjs/{src/data-structures → data-structures}/matrix/matrix.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/matrix/matrix2d.js +4 -8
- package/dist/mjs/{src/data-structures → data-structures}/matrix/navigator.js +2 -7
- package/dist/mjs/{src/data-structures → data-structures}/matrix/vector2d.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/priority-queue/max-priority-queue.js +2 -6
- package/dist/mjs/{src/data-structures → data-structures}/priority-queue/min-priority-queue.js +2 -6
- package/dist/mjs/data-structures/priority-queue/priority-queue.js +13 -0
- package/dist/mjs/{src/data-structures → data-structures}/queue/deque.js +4 -10
- package/dist/mjs/{src/data-structures → data-structures}/queue/queue.js +3 -8
- package/dist/mjs/{src/data-structures → data-structures}/stack/stack.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/tree/tree.js +1 -5
- package/dist/mjs/{src/data-structures → data-structures}/trie/trie.js +2 -7
- package/dist/mjs/index.js +4 -0
- package/dist/mjs/{src/interfaces → interfaces}/binary-tree.d.ts +1 -1
- package/dist/mjs/interfaces/index.js +8 -0
- package/dist/mjs/{src/types → types}/data-structures/binary-tree/binary-tree.js +4 -7
- package/dist/mjs/types/data-structures/binary-tree/index.js +6 -0
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.js +5 -0
- package/dist/mjs/types/data-structures/graph/directed-graph.js +6 -0
- package/dist/mjs/types/data-structures/graph/index.js +3 -0
- package/dist/mjs/types/data-structures/hash/hash-table.js +1 -0
- package/dist/mjs/types/data-structures/hash/index.js +1 -0
- package/dist/mjs/types/data-structures/hash/tree-map.d.ts +1 -0
- package/dist/mjs/types/data-structures/hash/tree-map.js +1 -0
- package/dist/mjs/types/data-structures/hash/tree-set.d.ts +1 -0
- package/dist/mjs/types/data-structures/hash/tree-set.js +1 -0
- package/dist/mjs/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/mjs/types/data-structures/heap/heap.js +1 -0
- package/dist/mjs/types/data-structures/heap/index.js +1 -0
- package/dist/mjs/types/data-structures/heap/max-heap.d.ts +1 -0
- package/dist/mjs/types/data-structures/heap/max-heap.js +1 -0
- package/dist/mjs/types/data-structures/heap/min-heap.d.ts +1 -0
- package/dist/mjs/types/data-structures/heap/min-heap.js +1 -0
- package/dist/mjs/types/data-structures/index.js +11 -0
- package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -0
- package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.js +1 -0
- package/dist/mjs/types/data-structures/linked-list/index.js +2 -0
- package/dist/mjs/types/data-structures/linked-list/singly-linked-list.d.ts +1 -0
- package/dist/mjs/types/data-structures/linked-list/singly-linked-list.js +1 -0
- package/dist/mjs/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
- package/dist/mjs/types/data-structures/linked-list/skip-linked-list.js +1 -0
- package/dist/mjs/types/data-structures/matrix/index.js +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix.js +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix2d.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix2d.js +1 -0
- package/dist/mjs/types/data-structures/matrix/navigator.js +1 -0
- package/dist/mjs/types/data-structures/matrix/vector2d.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/vector2d.js +1 -0
- package/dist/mjs/types/data-structures/priority-queue/index.d.ts +3 -0
- package/dist/mjs/types/data-structures/priority-queue/index.js +3 -0
- package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.js +1 -0
- package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.js +1 -0
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.js +1 -0
- package/dist/mjs/types/data-structures/queue/deque.d.ts +1 -0
- package/dist/mjs/types/data-structures/queue/deque.js +1 -0
- package/dist/mjs/types/data-structures/queue/index.d.ts +2 -0
- package/dist/mjs/types/data-structures/queue/index.js +2 -0
- package/dist/mjs/types/data-structures/queue/queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/queue/queue.js +1 -0
- package/dist/mjs/types/data-structures/stack/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/stack/index.js +1 -0
- package/dist/mjs/types/data-structures/stack/stack.d.ts +1 -0
- package/dist/mjs/types/data-structures/stack/stack.js +1 -0
- package/dist/mjs/types/data-structures/tree/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/tree/index.js +1 -0
- package/dist/mjs/types/data-structures/tree/tree.d.ts +1 -0
- package/dist/mjs/types/data-structures/tree/tree.js +1 -0
- package/dist/mjs/types/data-structures/trie/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/trie/index.js +1 -0
- package/dist/mjs/types/data-structures/trie/trie.d.ts +1 -0
- package/dist/mjs/types/data-structures/trie/trie.js +1 -0
- package/dist/mjs/types/helpers.js +6 -0
- package/dist/mjs/types/index.js +3 -0
- package/dist/mjs/types/utils/index.js +2 -0
- package/dist/mjs/types/utils/utils.js +1 -0
- package/dist/mjs/types/utils/validate-type.js +1 -0
- package/dist/mjs/utils/index.js +1 -0
- package/dist/mjs/utils/utils.js +54 -0
- package/dist/umd/data-structure-typed.js +10593 -0
- package/dist/umd/data-structure-typed.min.js +5 -10
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +14 -15
- package/src/data-structures/binary-tree/avl-tree.ts +2 -3
- package/src/data-structures/binary-tree/binary-tree.ts +85 -92
- package/src/data-structures/binary-tree/bst.ts +14 -22
- package/src/data-structures/binary-tree/rb-tree.ts +11 -20
- package/src/data-structures/binary-tree/tree-multimap.ts +56 -58
- package/src/data-structures/graph/abstract-graph.ts +6 -22
- package/src/data-structures/graph/directed-graph.ts +3 -9
- package/src/data-structures/graph/map-graph.ts +6 -6
- package/src/data-structures/graph/undirected-graph.ts +1 -2
- package/src/data-structures/heap/heap.ts +1 -6
- package/src/data-structures/trie/trie.ts +1 -1
- package/src/interfaces/binary-tree.ts +1 -1
- package/src/types/utils/validate-type.ts +2 -16
- package/test/integration/index.html +50 -4
- package/test/performance/data-structures/binary-tree/rb-tree.test.ts +18 -19
- package/test/performance/data-structures/hash/hash-map.test.ts +10 -13
- package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +16 -16
- package/test/performance/data-structures/priority-queue/max-priority-queue.test.ts +1 -3
- package/test/performance/data-structures/priority-queue/priority-queue.test.ts +10 -12
- package/test/performance/data-structures/queue/deque.test.ts +18 -19
- package/test/performance/data-structures/queue/queue.test.ts +18 -19
- package/test/performance/data-structures/stack/stack.test.ts +10 -11
- package/test/performance/reportor.ts +4 -5
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +0 -1
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +83 -61
- package/test/unit/data-structures/binary-tree/bst.test.ts +2 -6
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +34 -25
- package/test/unit/data-structures/graph/abstract-graph.test.ts +6 -6
- package/test/unit/data-structures/graph/directed-graph.test.ts +8 -28
- package/test/unit/data-structures/heap/heap.test.ts +1 -8
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +34 -12
- package/test/utils/json2html.ts +2 -6
- package/tsconfig-base.json +0 -1
- package/tsconfig-cjs.json +4 -3
- package/tsconfig-mjs.json +5 -3
- package/tsup.config.js +39 -17
- package/dist/cjs/src/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/src/data-structures/binary-tree/tree-multimap.js.map +0 -1
- package/dist/cjs/src/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/src/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/src/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/src/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/src/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/hash-table.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/tree-map.js.map +0 -1
- package/dist/cjs/src/data-structures/hash/tree-set.js.map +0 -1
- package/dist/cjs/src/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/src/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/src/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/src/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/src/data-structures/index.js.map +0 -1
- package/dist/cjs/src/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/src/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/src/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/src/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/src/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/src/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/src/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/cjs/src/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/src/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/cjs/src/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/src/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/src/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/src/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/src/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/src/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/src/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/src/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/src/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/src/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/src/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/src/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/src/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/cjs/src/interfaces/binary-tree.js.map +0 -1
- package/dist/cjs/src/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/cjs/src/interfaces/index.js.map +0 -1
- package/dist/cjs/src/interfaces/navigator.js.map +0 -1
- package/dist/cjs/src/interfaces/priority-queue.js.map +0 -1
- package/dist/cjs/src/interfaces/segment-tree.js.map +0 -1
- package/dist/cjs/src/interfaces/singly-linked-list.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/src/types/data-structures/binary-tree/tree-multimap.js.map +0 -1
- package/dist/cjs/src/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/src/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/src/types/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/src/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/hash-table.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/tree-map.js.map +0 -1
- package/dist/cjs/src/types/data-structures/hash/tree-set.js.map +0 -1
- package/dist/cjs/src/types/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/src/types/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/src/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/src/types/data-structures/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/src/types/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/src/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/src/types/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/src/types/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/cjs/src/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/src/types/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/cjs/src/types/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/src/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/src/types/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/src/types/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/src/types/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/src/types/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/src/types/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/src/types/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/src/types/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/src/types/helpers.js.map +0 -1
- package/dist/cjs/src/types/index.js.map +0 -1
- package/dist/cjs/src/types/utils/index.js.map +0 -1
- package/dist/cjs/src/types/utils/validate-type.js.map +0 -1
- package/dist/cjs/src/utils/index.js.map +0 -1
- package/dist/cjs/src/utils/utils.js.map +0 -1
- package/dist/mjs/src/data-structures/binary-tree/index.js +0 -23
- package/dist/mjs/src/data-structures/graph/index.js +0 -20
- package/dist/mjs/src/data-structures/hash/index.js +0 -22
- package/dist/mjs/src/data-structures/hash/tree-map.js +0 -6
- package/dist/mjs/src/data-structures/hash/tree-set.js +0 -6
- package/dist/mjs/src/data-structures/heap/index.js +0 -19
- package/dist/mjs/src/data-structures/index.js +0 -27
- package/dist/mjs/src/data-structures/linked-list/index.js +0 -19
- package/dist/mjs/src/data-structures/matrix/index.js +0 -20
- package/dist/mjs/src/data-structures/priority-queue/index.js +0 -19
- package/dist/mjs/src/data-structures/priority-queue/priority-queue.js +0 -17
- package/dist/mjs/src/data-structures/queue/index.js +0 -18
- package/dist/mjs/src/data-structures/stack/index.js +0 -17
- package/dist/mjs/src/data-structures/tree/index.js +0 -17
- package/dist/mjs/src/data-structures/trie/index.js +0 -17
- package/dist/mjs/src/index.js +0 -20
- package/dist/mjs/src/interfaces/binary-tree.js +0 -2
- package/dist/mjs/src/interfaces/doubly-linked-list.js +0 -2
- package/dist/mjs/src/interfaces/graph.js +0 -2
- package/dist/mjs/src/interfaces/heap.js +0 -2
- package/dist/mjs/src/interfaces/index.js +0 -24
- package/dist/mjs/src/interfaces/navigator.js +0 -2
- package/dist/mjs/src/interfaces/priority-queue.js +0 -2
- package/dist/mjs/src/interfaces/segment-tree.js +0 -2
- package/dist/mjs/src/interfaces/singly-linked-list.js +0 -2
- package/dist/mjs/src/types/data-structures/binary-tree/avl-tree.js +0 -2
- package/dist/mjs/src/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
- package/dist/mjs/src/types/data-structures/binary-tree/bst.js +0 -2
- package/dist/mjs/src/types/data-structures/binary-tree/index.js +0 -22
- package/dist/mjs/src/types/data-structures/binary-tree/rb-tree.js +0 -8
- package/dist/mjs/src/types/data-structures/binary-tree/segment-tree.js +0 -2
- package/dist/mjs/src/types/data-structures/binary-tree/tree-multimap.js +0 -2
- package/dist/mjs/src/types/data-structures/graph/abstract-graph.js +0 -2
- package/dist/mjs/src/types/data-structures/graph/directed-graph.js +0 -9
- package/dist/mjs/src/types/data-structures/graph/index.js +0 -19
- package/dist/mjs/src/types/data-structures/graph/map-graph.js +0 -2
- package/dist/mjs/src/types/data-structures/graph/undirected-graph.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/coordinate-map.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/coordinate-set.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/hash-map.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/hash-table.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/index.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/tree-map.js +0 -2
- package/dist/mjs/src/types/data-structures/hash/tree-set.js +0 -2
- package/dist/mjs/src/types/data-structures/heap/heap.js +0 -2
- package/dist/mjs/src/types/data-structures/heap/index.js +0 -17
- package/dist/mjs/src/types/data-structures/heap/max-heap.js +0 -2
- package/dist/mjs/src/types/data-structures/heap/min-heap.js +0 -2
- package/dist/mjs/src/types/data-structures/index.js +0 -27
- package/dist/mjs/src/types/data-structures/linked-list/doubly-linked-list.js +0 -2
- package/dist/mjs/src/types/data-structures/linked-list/index.js +0 -18
- package/dist/mjs/src/types/data-structures/linked-list/singly-linked-list.js +0 -2
- package/dist/mjs/src/types/data-structures/linked-list/skip-linked-list.js +0 -2
- package/dist/mjs/src/types/data-structures/matrix/index.js +0 -17
- package/dist/mjs/src/types/data-structures/matrix/matrix.js +0 -2
- package/dist/mjs/src/types/data-structures/matrix/matrix2d.js +0 -2
- package/dist/mjs/src/types/data-structures/matrix/navigator.js +0 -2
- package/dist/mjs/src/types/data-structures/matrix/vector2d.js +0 -2
- package/dist/mjs/src/types/data-structures/priority-queue/index.js +0 -19
- package/dist/mjs/src/types/data-structures/priority-queue/max-priority-queue.js +0 -2
- package/dist/mjs/src/types/data-structures/priority-queue/min-priority-queue.js +0 -2
- package/dist/mjs/src/types/data-structures/priority-queue/priority-queue.js +0 -2
- package/dist/mjs/src/types/data-structures/queue/deque.js +0 -2
- package/dist/mjs/src/types/data-structures/queue/index.js +0 -18
- package/dist/mjs/src/types/data-structures/queue/queue.js +0 -2
- package/dist/mjs/src/types/data-structures/stack/index.js +0 -17
- package/dist/mjs/src/types/data-structures/stack/stack.js +0 -2
- package/dist/mjs/src/types/data-structures/tree/index.js +0 -17
- package/dist/mjs/src/types/data-structures/tree/tree.js +0 -2
- package/dist/mjs/src/types/data-structures/trie/index.js +0 -17
- package/dist/mjs/src/types/data-structures/trie/trie.js +0 -2
- package/dist/mjs/src/types/helpers.js +0 -9
- package/dist/mjs/src/types/index.js +0 -19
- package/dist/mjs/src/types/utils/index.js +0 -18
- package/dist/mjs/src/types/utils/utils.js +0 -2
- package/dist/mjs/src/types/utils/validate-type.js +0 -2
- package/dist/mjs/src/utils/index.js +0 -17
- package/dist/mjs/src/utils/utils.js +0 -64
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/avl-tree.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/avl-tree.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/binary-indexed-tree.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/binary-indexed-tree.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/bst.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/bst.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/segment-tree.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/binary-tree/segment-tree.js +0 -0
- package/dist/{mjs/src → cjs}/data-structures/binary-tree/tree-multimap.d.ts +24 -24
- package/dist/cjs/{src/data-structures → data-structures}/graph/directed-graph.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/directed-graph.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/map-graph.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/map-graph.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/undirected-graph.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/graph/undirected-graph.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/coordinate-map.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/coordinate-map.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/coordinate-set.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/coordinate-set.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/hash-map.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/hash-map.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/hash-table.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/hash-table.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/tree-map.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/tree-map.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/tree-set.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/hash/tree-set.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/heap.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/heap.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/max-heap.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/max-heap.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/min-heap.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/heap/min-heap.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/doubly-linked-list.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/doubly-linked-list.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/singly-linked-list.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/singly-linked-list.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/skip-linked-list.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/linked-list/skip-linked-list.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/matrix.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/matrix.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/matrix2d.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/matrix2d.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/navigator.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/navigator.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/vector2d.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/matrix/vector2d.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/max-priority-queue.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/max-priority-queue.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/min-priority-queue.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/min-priority-queue.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/priority-queue.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/priority-queue/priority-queue.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/queue/deque.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/queue/deque.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/queue/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/queue/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/queue/queue.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/queue/queue.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/stack/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/stack/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/stack/stack.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/stack/stack.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/tree/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/tree/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/tree/tree.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/tree/tree.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/trie/index.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/trie/index.js +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/trie/trie.d.ts +0 -0
- package/dist/cjs/{src/data-structures → data-structures}/trie/trie.js +0 -0
- package/dist/cjs/{src/index.d.ts → index.d.ts} +0 -0
- package/dist/cjs/{src/index.js → index.js} +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/binary-tree.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/doubly-linked-list.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/doubly-linked-list.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/graph.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/graph.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/heap.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/heap.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/index.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/index.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/navigator.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/navigator.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/priority-queue.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/priority-queue.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/segment-tree.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/segment-tree.js +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/singly-linked-list.d.ts +0 -0
- package/dist/cjs/{src/interfaces → interfaces}/singly-linked-list.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/avl-tree.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/avl-tree.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/binary-indexed-tree.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/binary-tree.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/binary-tree.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/bst.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/bst.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/rb-tree.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/rb-tree.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/segment-tree.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/tree-multimap.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/binary-tree/tree-multimap.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/abstract-graph.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/abstract-graph.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/directed-graph.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/directed-graph.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/map-graph.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/map-graph.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/undirected-graph.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/graph/undirected-graph.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/coordinate-map.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/coordinate-map.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/coordinate-set.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/coordinate-set.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/hash-map.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/hash-map.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/hash-table.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/hash-table.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/tree-map.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/tree-map.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/tree-set.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/hash/tree-set.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/heap.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/heap.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/max-heap.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/max-heap.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/min-heap.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/heap/min-heap.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/doubly-linked-list.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/singly-linked-list.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/linked-list/skip-linked-list.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/matrix.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/matrix.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/matrix2d.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/matrix2d.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/navigator.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/navigator.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/vector2d.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/matrix/vector2d.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/max-priority-queue.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/min-priority-queue.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/priority-queue/priority-queue.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/queue/deque.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/queue/deque.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/queue/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/queue/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/queue/queue.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/queue/queue.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/stack/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/stack/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/stack/stack.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/stack/stack.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/tree/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/tree/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/tree/tree.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/tree/tree.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/trie/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/trie/index.js +0 -0
- package/dist/cjs/{src/types → types}/data-structures/trie/trie.d.ts +0 -0
- package/dist/cjs/{src/types → types}/data-structures/trie/trie.js +0 -0
- package/dist/cjs/{src/types → types}/helpers.d.ts +0 -0
- package/dist/cjs/{src/types → types}/helpers.js +0 -0
- package/dist/cjs/{src/types → types}/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/index.js +0 -0
- package/dist/cjs/{src/types → types}/utils/index.d.ts +0 -0
- package/dist/cjs/{src/types → types}/utils/index.js +0 -0
- package/dist/cjs/{src/types → types}/utils/utils.d.ts +0 -0
- package/dist/cjs/{src/types → types}/utils/utils.js +0 -0
- package/dist/cjs/{src/types → types}/utils/validate-type.d.ts +0 -0
- package/dist/cjs/{src/types → types}/utils/validate-type.js +0 -0
- package/dist/cjs/{src/utils → utils}/index.d.ts +0 -0
- package/dist/cjs/{src/utils → utils}/index.js +0 -0
- package/dist/cjs/{src/utils → utils}/utils.d.ts +0 -0
- package/dist/cjs/{src/utils → utils}/utils.js +0 -0
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/avl-tree.d.ts +0 -0
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/binary-indexed-tree.d.ts +0 -0
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/bst.d.ts +0 -0
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/index.d.ts +0 -0
- package/dist/mjs/{src/data-structures → data-structures}/binary-tree/segment-tree.d.ts +0 -0
- package/dist/{cjs/src → mjs}/data-structures/binary-tree/tree-multimap.d.ts +24 -24
- /package/dist/mjs/{src/data-structures → data-structures}/graph/directed-graph.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/graph/index.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/graph/map-graph.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/graph/undirected-graph.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/coordinate-map.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/coordinate-set.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/hash-map.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/hash-table.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/index.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/tree-map.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/hash/tree-set.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/heap/heap.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/heap/index.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/heap/max-heap.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/heap/min-heap.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/index.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/linked-list/index.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/matrix/index.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/matrix/matrix.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/matrix/matrix2d.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/matrix/navigator.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/matrix/vector2d.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/priority-queue/index.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/priority-queue/index.d.ts → data-structures/priority-queue/index.js} +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/queue/deque.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/queue/index.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/queue/index.d.ts → data-structures/queue/index.js} +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/queue/queue.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/stack/index.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/stack/index.d.ts → data-structures/stack/index.js} +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/stack/stack.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/tree/index.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/tree/index.d.ts → data-structures/tree/index.js} +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/tree/tree.d.ts +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/trie/index.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/trie/index.d.ts → data-structures/trie/index.js} +0 -0
- /package/dist/mjs/{src/data-structures → data-structures}/trie/trie.d.ts +0 -0
- /package/dist/mjs/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/mjs/{src/interfaces/doubly-linked-list.d.ts → interfaces/binary-tree.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/linked-list → interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/mjs/{src/interfaces/heap.d.ts → interfaces/doubly-linked-list.js} +0 -0
- /package/dist/mjs/{src/interfaces → interfaces}/graph.d.ts +0 -0
- /package/dist/mjs/{src/interfaces/navigator.d.ts → interfaces/graph.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/heap → interfaces}/heap.d.ts +0 -0
- /package/dist/mjs/{src/interfaces/priority-queue.d.ts → interfaces/heap.js} +0 -0
- /package/dist/mjs/{src/interfaces → interfaces}/index.d.ts +0 -0
- /package/dist/mjs/{src/interfaces/segment-tree.d.ts → interfaces/navigator.d.ts} +0 -0
- /package/dist/mjs/{src/interfaces/singly-linked-list.d.ts → interfaces/navigator.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/priority-queue → interfaces}/priority-queue.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/binary-tree/binary-indexed-tree.d.ts → interfaces/priority-queue.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/graph/undirected-graph.d.ts → interfaces/segment-tree.d.ts} +0 -0
- /package/dist/mjs/{src/types/data-structures/hash/coordinate-map.d.ts → interfaces/segment-tree.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/linked-list → interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/hash/coordinate-set.d.ts → interfaces/singly-linked-list.js} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/hash/hash-map.d.ts → types/data-structures/binary-tree/avl-tree.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/hash/hash-table.d.ts → types/data-structures/binary-tree/binary-indexed-tree.d.ts} +0 -0
- /package/dist/mjs/{src/types/data-structures/hash/tree-map.d.ts → types/data-structures/binary-tree/binary-indexed-tree.js} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/binary-tree.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/bst.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/hash/tree-set.d.ts → types/data-structures/binary-tree/bst.js} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/heap/max-heap.d.ts → types/data-structures/binary-tree/segment-tree.js} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/binary-tree/tree-multimap.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/heap/min-heap.d.ts → types/data-structures/binary-tree/tree-multimap.js} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/linked-list/skip-linked-list.d.ts → types/data-structures/graph/abstract-graph.js} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/graph/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/mjs/{src/types/data-structures/matrix/matrix.d.ts → types/data-structures/graph/map-graph.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/matrix/matrix2d.d.ts → types/data-structures/graph/undirected-graph.d.ts} +0 -0
- /package/dist/mjs/{src/types/data-structures/matrix/vector2d.d.ts → types/data-structures/graph/undirected-graph.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/priority-queue/max-priority-queue.d.ts → types/data-structures/hash/coordinate-map.d.ts} +0 -0
- /package/dist/mjs/{src/types/data-structures/priority-queue/min-priority-queue.d.ts → types/data-structures/hash/coordinate-map.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/queue/deque.d.ts → types/data-structures/hash/coordinate-set.d.ts} +0 -0
- /package/dist/mjs/{src/types/data-structures/queue/queue.d.ts → types/data-structures/hash/coordinate-set.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/stack/stack.d.ts → types/data-structures/hash/hash-map.d.ts} +0 -0
- /package/dist/mjs/{src/types/data-structures/tree/tree.d.ts → types/data-structures/hash/hash-map.js} +0 -0
- /package/dist/mjs/{src/types/data-structures/trie/trie.d.ts → types/data-structures/hash/hash-table.d.ts} +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/hash/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/heap/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/helpers.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/utils/index.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/utils/utils.d.ts +0 -0
- /package/dist/mjs/{src/types → types}/utils/validate-type.d.ts +0 -0
- /package/dist/mjs/{src/utils → utils}/index.d.ts +0 -0
- /package/dist/mjs/{src/utils → utils}/utils.d.ts +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* data-structure-typed
|
|
4
3
|
*
|
|
@@ -6,19 +5,16 @@
|
|
|
6
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
7
6
|
* @license MIT License
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const binary_tree_1 = require("./binary-tree");
|
|
14
|
-
class RedBlackTreeNode extends bst_1.BSTNode {
|
|
8
|
+
import { RBTNColor } from '../../types';
|
|
9
|
+
import { BST, BSTNode } from './bst';
|
|
10
|
+
import { BinaryTreeNode } from './binary-tree';
|
|
11
|
+
export class RedBlackTreeNode extends BSTNode {
|
|
15
12
|
color;
|
|
16
|
-
constructor(key, value, color =
|
|
13
|
+
constructor(key, value, color = RBTNColor.BLACK) {
|
|
17
14
|
super(key, value);
|
|
18
15
|
this.color = color;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
exports.RedBlackTreeNode = RedBlackTreeNode;
|
|
22
18
|
/**
|
|
23
19
|
* 1. Each node is either red or black.
|
|
24
20
|
* 2. The root node is always black.
|
|
@@ -26,7 +22,8 @@ exports.RedBlackTreeNode = RedBlackTreeNode;
|
|
|
26
22
|
* 4. Red nodes must have black children.
|
|
27
23
|
* 5. Black balance: Every path from any node to each of its leaf nodes contains the same number of black nodes.
|
|
28
24
|
*/
|
|
29
|
-
class RedBlackTree extends
|
|
25
|
+
export class RedBlackTree extends BST {
|
|
26
|
+
NIL = new RedBlackTreeNode(NaN);
|
|
30
27
|
/**
|
|
31
28
|
* The constructor function initializes a Red-Black Tree with an optional set of options.
|
|
32
29
|
* @param {RBTreeOptions} [options] - The `options` parameter is an optional object that can be
|
|
@@ -44,7 +41,6 @@ class RedBlackTree extends bst_1.BST {
|
|
|
44
41
|
get size() {
|
|
45
42
|
return this._size;
|
|
46
43
|
}
|
|
47
|
-
NIL = new RedBlackTreeNode(NaN);
|
|
48
44
|
/**
|
|
49
45
|
* Time Complexity: O(log n) on average (where n is the number of nodes in the tree)
|
|
50
46
|
* Space Complexity: O(1)
|
|
@@ -63,7 +59,7 @@ class RedBlackTree extends bst_1.BST {
|
|
|
63
59
|
add(keyOrNode, value) {
|
|
64
60
|
let node;
|
|
65
61
|
if (this.isNodeKey(keyOrNode)) {
|
|
66
|
-
node = this.createNode(keyOrNode, value,
|
|
62
|
+
node = this.createNode(keyOrNode, value, RBTNColor.RED);
|
|
67
63
|
}
|
|
68
64
|
else if (keyOrNode instanceof RedBlackTreeNode) {
|
|
69
65
|
node = keyOrNode;
|
|
@@ -101,7 +97,7 @@ class RedBlackTree extends bst_1.BST {
|
|
|
101
97
|
y.right = node;
|
|
102
98
|
}
|
|
103
99
|
if (node.parent === undefined) {
|
|
104
|
-
node.color =
|
|
100
|
+
node.color = RBTNColor.BLACK;
|
|
105
101
|
this._size++;
|
|
106
102
|
return;
|
|
107
103
|
}
|
|
@@ -112,7 +108,7 @@ class RedBlackTree extends bst_1.BST {
|
|
|
112
108
|
this._fixInsert(node);
|
|
113
109
|
this._size++;
|
|
114
110
|
}
|
|
115
|
-
createNode(key, value, color =
|
|
111
|
+
createNode(key, value, color = RBTNColor.BLACK) {
|
|
116
112
|
return new RedBlackTreeNode(key, value, color);
|
|
117
113
|
}
|
|
118
114
|
/**
|
|
@@ -183,7 +179,7 @@ class RedBlackTree extends bst_1.BST {
|
|
|
183
179
|
y.left.parent = y;
|
|
184
180
|
y.color = z.color;
|
|
185
181
|
}
|
|
186
|
-
if (yOriginalColor ===
|
|
182
|
+
if (yOriginalColor === RBTNColor.BLACK) {
|
|
187
183
|
this._fixDelete(x);
|
|
188
184
|
}
|
|
189
185
|
this._size--;
|
|
@@ -221,7 +217,7 @@ class RedBlackTree extends bst_1.BST {
|
|
|
221
217
|
* @returns a value of type `N`, `null`, or `undefined`.
|
|
222
218
|
*/
|
|
223
219
|
getNode(identifier, callback = this._defaultOneParamCallback, beginRoot = this.root, iterationType = this.iterationType) {
|
|
224
|
-
if (identifier instanceof
|
|
220
|
+
if (identifier instanceof BinaryTreeNode)
|
|
225
221
|
callback = (node => node);
|
|
226
222
|
beginRoot = this.ensureNotKey(beginRoot);
|
|
227
223
|
return this.getNodes(identifier, callback, true, beginRoot, iterationType)[0] ?? undefined;
|
|
@@ -363,32 +359,32 @@ class RedBlackTree extends bst_1.BST {
|
|
|
363
359
|
*/
|
|
364
360
|
_fixDelete(x) {
|
|
365
361
|
let s;
|
|
366
|
-
while (x !== this.root && x.color ===
|
|
362
|
+
while (x !== this.root && x.color === RBTNColor.BLACK) {
|
|
367
363
|
if (x.parent && x === x.parent.left) {
|
|
368
364
|
s = x.parent.right;
|
|
369
365
|
if (s.color === 1) {
|
|
370
|
-
s.color =
|
|
371
|
-
x.parent.color =
|
|
366
|
+
s.color = RBTNColor.BLACK;
|
|
367
|
+
x.parent.color = RBTNColor.RED;
|
|
372
368
|
this._leftRotate(x.parent);
|
|
373
369
|
s = x.parent.right;
|
|
374
370
|
}
|
|
375
|
-
if (s.left !== undefined && s.left.color ===
|
|
376
|
-
s.color =
|
|
371
|
+
if (s.left !== undefined && s.left.color === RBTNColor.BLACK && s.right && s.right.color === RBTNColor.BLACK) {
|
|
372
|
+
s.color = RBTNColor.RED;
|
|
377
373
|
x = x.parent;
|
|
378
374
|
}
|
|
379
375
|
else {
|
|
380
|
-
if (s.right && s.right.color ===
|
|
376
|
+
if (s.right && s.right.color === RBTNColor.BLACK) {
|
|
381
377
|
if (s.left)
|
|
382
|
-
s.left.color =
|
|
383
|
-
s.color =
|
|
378
|
+
s.left.color = RBTNColor.BLACK;
|
|
379
|
+
s.color = RBTNColor.RED;
|
|
384
380
|
this._rightRotate(s);
|
|
385
381
|
s = x.parent.right;
|
|
386
382
|
}
|
|
387
383
|
if (s)
|
|
388
384
|
s.color = x.parent.color;
|
|
389
|
-
x.parent.color =
|
|
385
|
+
x.parent.color = RBTNColor.BLACK;
|
|
390
386
|
if (s && s.right)
|
|
391
|
-
s.right.color =
|
|
387
|
+
s.right.color = RBTNColor.BLACK;
|
|
392
388
|
this._leftRotate(x.parent);
|
|
393
389
|
x = this.root;
|
|
394
390
|
}
|
|
@@ -396,34 +392,34 @@ class RedBlackTree extends bst_1.BST {
|
|
|
396
392
|
else {
|
|
397
393
|
s = x.parent.left;
|
|
398
394
|
if (s.color === 1) {
|
|
399
|
-
s.color =
|
|
400
|
-
x.parent.color =
|
|
395
|
+
s.color = RBTNColor.BLACK;
|
|
396
|
+
x.parent.color = RBTNColor.RED;
|
|
401
397
|
this._rightRotate(x.parent);
|
|
402
398
|
s = x.parent.left;
|
|
403
399
|
}
|
|
404
|
-
if (s && s.right && s.right.color ===
|
|
405
|
-
s.color =
|
|
400
|
+
if (s && s.right && s.right.color === RBTNColor.BLACK && s.right.color === RBTNColor.BLACK) {
|
|
401
|
+
s.color = RBTNColor.RED;
|
|
406
402
|
x = x.parent;
|
|
407
403
|
}
|
|
408
404
|
else {
|
|
409
|
-
if (s && s.left && s.left.color ===
|
|
405
|
+
if (s && s.left && s.left.color === RBTNColor.BLACK) {
|
|
410
406
|
if (s.right)
|
|
411
|
-
s.right.color =
|
|
412
|
-
s.color =
|
|
407
|
+
s.right.color = RBTNColor.BLACK;
|
|
408
|
+
s.color = RBTNColor.RED;
|
|
413
409
|
this._leftRotate(s);
|
|
414
410
|
s = x.parent.left;
|
|
415
411
|
}
|
|
416
412
|
if (s)
|
|
417
413
|
s.color = x.parent.color;
|
|
418
|
-
x.parent.color =
|
|
414
|
+
x.parent.color = RBTNColor.BLACK;
|
|
419
415
|
if (s && s.left)
|
|
420
|
-
s.left.color =
|
|
416
|
+
s.left.color = RBTNColor.BLACK;
|
|
421
417
|
this._rightRotate(x.parent);
|
|
422
418
|
x = this.root;
|
|
423
419
|
}
|
|
424
420
|
}
|
|
425
421
|
}
|
|
426
|
-
x.color =
|
|
422
|
+
x.color = RBTNColor.BLACK;
|
|
427
423
|
}
|
|
428
424
|
/**
|
|
429
425
|
* Time Complexity: O(1)
|
|
@@ -467,9 +463,9 @@ class RedBlackTree extends bst_1.BST {
|
|
|
467
463
|
if (k.parent.parent && k.parent === k.parent.parent.right) {
|
|
468
464
|
u = k.parent.parent.left;
|
|
469
465
|
if (u && u.color === 1) {
|
|
470
|
-
u.color =
|
|
471
|
-
k.parent.color =
|
|
472
|
-
k.parent.parent.color =
|
|
466
|
+
u.color = RBTNColor.BLACK;
|
|
467
|
+
k.parent.color = RBTNColor.BLACK;
|
|
468
|
+
k.parent.parent.color = RBTNColor.RED;
|
|
473
469
|
k = k.parent.parent;
|
|
474
470
|
}
|
|
475
471
|
else {
|
|
@@ -477,17 +473,17 @@ class RedBlackTree extends bst_1.BST {
|
|
|
477
473
|
k = k.parent;
|
|
478
474
|
this._rightRotate(k);
|
|
479
475
|
}
|
|
480
|
-
k.parent.color =
|
|
481
|
-
k.parent.parent.color =
|
|
476
|
+
k.parent.color = RBTNColor.BLACK;
|
|
477
|
+
k.parent.parent.color = RBTNColor.RED;
|
|
482
478
|
this._leftRotate(k.parent.parent);
|
|
483
479
|
}
|
|
484
480
|
}
|
|
485
481
|
else {
|
|
486
482
|
u = k.parent.parent.right;
|
|
487
483
|
if (u && u.color === 1) {
|
|
488
|
-
u.color =
|
|
489
|
-
k.parent.color =
|
|
490
|
-
k.parent.parent.color =
|
|
484
|
+
u.color = RBTNColor.BLACK;
|
|
485
|
+
k.parent.color = RBTNColor.BLACK;
|
|
486
|
+
k.parent.parent.color = RBTNColor.RED;
|
|
491
487
|
k = k.parent.parent;
|
|
492
488
|
}
|
|
493
489
|
else {
|
|
@@ -495,8 +491,8 @@ class RedBlackTree extends bst_1.BST {
|
|
|
495
491
|
k = k.parent;
|
|
496
492
|
this._leftRotate(k);
|
|
497
493
|
}
|
|
498
|
-
k.parent.color =
|
|
499
|
-
k.parent.parent.color =
|
|
494
|
+
k.parent.color = RBTNColor.BLACK;
|
|
495
|
+
k.parent.parent.color = RBTNColor.RED;
|
|
500
496
|
this._rightRotate(k.parent.parent);
|
|
501
497
|
}
|
|
502
498
|
}
|
|
@@ -504,7 +500,6 @@ class RedBlackTree extends bst_1.BST {
|
|
|
504
500
|
break;
|
|
505
501
|
}
|
|
506
502
|
}
|
|
507
|
-
this.root.color =
|
|
503
|
+
this.root.color = RBTNColor.BLACK;
|
|
508
504
|
}
|
|
509
505
|
}
|
|
510
|
-
exports.RedBlackTree = RedBlackTree;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* data-structure-typed
|
|
4
3
|
*
|
|
@@ -6,9 +5,7 @@
|
|
|
6
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
7
6
|
* @license MIT License
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
exports.SegmentTree = exports.SegmentTreeNode = void 0;
|
|
11
|
-
class SegmentTreeNode {
|
|
8
|
+
export class SegmentTreeNode {
|
|
12
9
|
start = 0;
|
|
13
10
|
end = 0;
|
|
14
11
|
value = null;
|
|
@@ -22,8 +19,7 @@ class SegmentTreeNode {
|
|
|
22
19
|
this.value = value || null;
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
class SegmentTree {
|
|
22
|
+
export class SegmentTree {
|
|
27
23
|
/**
|
|
28
24
|
* The constructor initializes the values, start, end, and root properties of an object.
|
|
29
25
|
* @param {number[]} values - An array of numbers that will be used to build a binary search tree.
|
|
@@ -179,4 +175,3 @@ class SegmentTree {
|
|
|
179
175
|
return dfs(root, indexA, indexB);
|
|
180
176
|
}
|
|
181
177
|
}
|
|
182
|
-
exports.SegmentTree = SegmentTree;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const types_1 = require("../../types");
|
|
5
|
-
const avl_tree_1 = require("./avl-tree");
|
|
6
|
-
class TreeMultimapNode extends avl_tree_1.AVLTreeNode {
|
|
1
|
+
import { CP, FamilyPosition, IterationType } from '../../types';
|
|
2
|
+
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
3
|
+
export class TreeMultimapNode extends AVLTreeNode {
|
|
7
4
|
count;
|
|
8
5
|
/**
|
|
9
6
|
* The constructor function initializes a BinaryTreeNode object with a key, value, and count.
|
|
@@ -20,11 +17,10 @@ class TreeMultimapNode extends avl_tree_1.AVLTreeNode {
|
|
|
20
17
|
this.count = count;
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
exports.TreeMultimapNode = TreeMultimapNode;
|
|
24
20
|
/**
|
|
25
21
|
* The only distinction between a TreeMultimap and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
|
|
26
22
|
*/
|
|
27
|
-
class TreeMultimap extends
|
|
23
|
+
export class TreeMultimap extends AVLTree {
|
|
28
24
|
/**
|
|
29
25
|
* The constructor function for a TreeMultimap class in TypeScript, which extends another class and sets an option to
|
|
30
26
|
* merge duplicated values.
|
|
@@ -94,14 +90,14 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
94
90
|
while (traversing) {
|
|
95
91
|
if (cur) {
|
|
96
92
|
if (newNode) {
|
|
97
|
-
if (this._compare(cur.key, newNode.key) ===
|
|
93
|
+
if (this._compare(cur.key, newNode.key) === CP.eq) {
|
|
98
94
|
cur.value = newNode.value;
|
|
99
95
|
cur.count += newNode.count;
|
|
100
96
|
this._count += newNode.count;
|
|
101
97
|
traversing = false;
|
|
102
98
|
inserted = cur;
|
|
103
99
|
}
|
|
104
|
-
else if (this._compare(cur.key, newNode.key) ===
|
|
100
|
+
else if (this._compare(cur.key, newNode.key) === CP.gt) {
|
|
105
101
|
// Traverse left of the node
|
|
106
102
|
if (cur.left === undefined) {
|
|
107
103
|
//Add to the left of the current node
|
|
@@ -117,7 +113,7 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
117
113
|
cur = cur.left;
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
|
-
else if (this._compare(cur.key, newNode.key) ===
|
|
116
|
+
else if (this._compare(cur.key, newNode.key) === CP.lt) {
|
|
121
117
|
// Traverse right of the node
|
|
122
118
|
if (cur.right === undefined) {
|
|
123
119
|
//Add to the right of the current node
|
|
@@ -151,52 +147,6 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
151
147
|
* Time Complexity: O(1) - constant time, as it performs basic pointer assignments.
|
|
152
148
|
* Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.
|
|
153
149
|
*/
|
|
154
|
-
/**
|
|
155
|
-
* Time Complexity: O(1) - constant time, as it performs basic pointer assignments.
|
|
156
|
-
* Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.
|
|
157
|
-
*
|
|
158
|
-
* The function adds a new node to a binary tree, either as the left child or the right child of a
|
|
159
|
-
* given parent node.
|
|
160
|
-
* @param {N | undefined} newNode - The `newNode` parameter represents the node that needs to be
|
|
161
|
-
* added to the binary tree. It can be of type `N` (which represents a node in the binary tree) or
|
|
162
|
-
* `undefined` if there is no node to add.
|
|
163
|
-
* @param {BTNKey | N | undefined} parent - The `parent` parameter represents the parent node to
|
|
164
|
-
* which the new node will be added as a child. It can be either a node object (`N`) or a key value
|
|
165
|
-
* (`BTNKey`).
|
|
166
|
-
* @returns The method `_addTo` returns either the `parent.left` or `parent.right` node that was
|
|
167
|
-
* added, or `undefined` if no node was added.
|
|
168
|
-
*/
|
|
169
|
-
_addTo(newNode, parent) {
|
|
170
|
-
parent = this.ensureNotKey(parent);
|
|
171
|
-
if (parent) {
|
|
172
|
-
if (parent.left === undefined) {
|
|
173
|
-
parent.left = newNode;
|
|
174
|
-
if (newNode !== undefined) {
|
|
175
|
-
this._size = this.size + 1;
|
|
176
|
-
this._count += newNode.count;
|
|
177
|
-
}
|
|
178
|
-
return parent.left;
|
|
179
|
-
}
|
|
180
|
-
else if (parent.right === undefined) {
|
|
181
|
-
parent.right = newNode;
|
|
182
|
-
if (newNode !== undefined) {
|
|
183
|
-
this._size = this.size + 1;
|
|
184
|
-
this._count += newNode.count;
|
|
185
|
-
}
|
|
186
|
-
return parent.right;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Time Complexity: O(k log n) - logarithmic time for each insertion, where "n" is the number of nodes in the tree, and "k" is the number of keys to be inserted. This is because the method iterates through the keys and calls the add method for each.
|
|
198
|
-
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
199
|
-
*/
|
|
200
150
|
/**
|
|
201
151
|
* Time Complexity: O(k log n) - logarithmic time for each insertion, where "n" is the number of nodes in the tree, and "k" is the number of keys to be inserted. This is because the method iterates through the keys and calls the add method for each.
|
|
202
152
|
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
@@ -227,8 +177,8 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
227
177
|
return inserted;
|
|
228
178
|
}
|
|
229
179
|
/**
|
|
230
|
-
* Time Complexity: O(
|
|
231
|
-
* Space Complexity: O(
|
|
180
|
+
* Time Complexity: O(k log n) - logarithmic time for each insertion, where "n" is the number of nodes in the tree, and "k" is the number of keys to be inserted. This is because the method iterates through the keys and calls the add method for each.
|
|
181
|
+
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
232
182
|
*/
|
|
233
183
|
/**
|
|
234
184
|
* Time Complexity: O(n log n) - logarithmic time for each insertion, where "n" is the number of nodes in the tree. This is because the method calls the add method for each node.
|
|
@@ -246,7 +196,7 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
246
196
|
if (sorted.length < 1)
|
|
247
197
|
return false;
|
|
248
198
|
this.clear();
|
|
249
|
-
if (iterationType ===
|
|
199
|
+
if (iterationType === IterationType.RECURSIVE) {
|
|
250
200
|
const buildBalanceBST = (l, r) => {
|
|
251
201
|
if (l > r)
|
|
252
202
|
return;
|
|
@@ -278,8 +228,8 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
278
228
|
}
|
|
279
229
|
}
|
|
280
230
|
/**
|
|
281
|
-
* Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree.
|
|
282
|
-
* Space Complexity: O(
|
|
231
|
+
* Time Complexity: O(n log n) - logarithmic time for each insertion, where "n" is the number of nodes in the tree. This is because the method calls the add method for each node.
|
|
232
|
+
* Space Complexity: O(n) - linear space, as it creates an array to store the sorted nodes.
|
|
283
233
|
*/
|
|
284
234
|
/**
|
|
285
235
|
* Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The delete method of the superclass (AVLTree) has logarithmic time complexity.
|
|
@@ -321,10 +271,10 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
321
271
|
}
|
|
322
272
|
else {
|
|
323
273
|
const { familyPosition: fp } = curr;
|
|
324
|
-
if (fp ===
|
|
274
|
+
if (fp === FamilyPosition.LEFT || fp === FamilyPosition.ROOT_LEFT) {
|
|
325
275
|
parent.left = curr.right;
|
|
326
276
|
}
|
|
327
|
-
else if (fp ===
|
|
277
|
+
else if (fp === FamilyPosition.RIGHT || fp === FamilyPosition.ROOT_RIGHT) {
|
|
328
278
|
parent.right = curr.right;
|
|
329
279
|
}
|
|
330
280
|
needBalanced = parent;
|
|
@@ -357,6 +307,10 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
357
307
|
}
|
|
358
308
|
return deletedResult;
|
|
359
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree. The delete method of the superclass (AVLTree) has logarithmic time complexity.
|
|
312
|
+
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
313
|
+
*/
|
|
360
314
|
/**
|
|
361
315
|
* The clear() function clears the contents of a data structure and sets the count to zero.
|
|
362
316
|
*/
|
|
@@ -364,6 +318,48 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
364
318
|
super.clear();
|
|
365
319
|
this._count = 0;
|
|
366
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Time Complexity: O(1) - constant time, as it performs basic pointer assignments.
|
|
323
|
+
* Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.
|
|
324
|
+
*
|
|
325
|
+
* The function adds a new node to a binary tree, either as the left child or the right child of a
|
|
326
|
+
* given parent node.
|
|
327
|
+
* @param {N | undefined} newNode - The `newNode` parameter represents the node that needs to be
|
|
328
|
+
* added to the binary tree. It can be of type `N` (which represents a node in the binary tree) or
|
|
329
|
+
* `undefined` if there is no node to add.
|
|
330
|
+
* @param {BTNKey | N | undefined} parent - The `parent` parameter represents the parent node to
|
|
331
|
+
* which the new node will be added as a child. It can be either a node object (`N`) or a key value
|
|
332
|
+
* (`BTNKey`).
|
|
333
|
+
* @returns The method `_addTo` returns either the `parent.left` or `parent.right` node that was
|
|
334
|
+
* added, or `undefined` if no node was added.
|
|
335
|
+
*/
|
|
336
|
+
_addTo(newNode, parent) {
|
|
337
|
+
parent = this.ensureNotKey(parent);
|
|
338
|
+
if (parent) {
|
|
339
|
+
if (parent.left === undefined) {
|
|
340
|
+
parent.left = newNode;
|
|
341
|
+
if (newNode !== undefined) {
|
|
342
|
+
this._size = this.size + 1;
|
|
343
|
+
this._count += newNode.count;
|
|
344
|
+
}
|
|
345
|
+
return parent.left;
|
|
346
|
+
}
|
|
347
|
+
else if (parent.right === undefined) {
|
|
348
|
+
parent.right = newNode;
|
|
349
|
+
if (newNode !== undefined) {
|
|
350
|
+
this._size = this.size + 1;
|
|
351
|
+
this._count += newNode.count;
|
|
352
|
+
}
|
|
353
|
+
return parent.right;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
367
363
|
/**
|
|
368
364
|
* The `_swap` function swaps the key, value, count, and height properties between two nodes.
|
|
369
365
|
* @param {BTNKey | N | undefined} srcNode - The `srcNode` parameter represents the source node from
|
|
@@ -395,4 +391,3 @@ class TreeMultimap extends avl_tree_1.AVLTree {
|
|
|
395
391
|
return undefined;
|
|
396
392
|
}
|
|
397
393
|
}
|
|
398
|
-
exports.TreeMultimap = TreeMultimap;
|
|
@@ -235,24 +235,24 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
|
|
|
235
235
|
* Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
|
|
236
236
|
*/
|
|
237
237
|
/**
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
238
|
+
* Time Complexity: O(V^2 + E) - Quadratic time in the worst case (no heap optimization).
|
|
239
|
+
* Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
|
|
240
|
+
*
|
|
241
|
+
* The function `dijkstraWithoutHeap` implements Dijkstra's algorithm to find the shortest path between two vertices in
|
|
242
|
+
* a graph without using a heap data structure.
|
|
243
|
+
* @param {VO | VertexKey} src - The source vertex from which to start the Dijkstra's algorithm. It can be either a
|
|
244
|
+
* vertex object or a vertex ID.
|
|
245
|
+
* @param {VO | VertexKey | null} [dest] - The `dest` parameter in the `dijkstraWithoutHeap` function is an optional
|
|
246
|
+
* parameter that specifies the destination vertex for the Dijkstra algorithm. It can be either a vertex object or its
|
|
247
|
+
* identifier. If no destination is provided, the value is set to `null`.
|
|
248
|
+
* @param {boolean} [getMinDist] - The `getMinDist` parameter is a boolean flag that determines whether the minimum
|
|
249
|
+
* distance from the source vertex to the destination vertex should be calculated and returned in the result. If
|
|
250
|
+
* `getMinDist` is set to `true`, the `minDist` property in the result will contain the minimum distance
|
|
251
|
+
* @param {boolean} [genPaths] - The `genPaths` parameter is a boolean flag that determines whether or not to generate
|
|
252
|
+
* paths in the Dijkstra algorithm. If `genPaths` is set to `true`, the algorithm will calculate and return the
|
|
253
|
+
* shortest paths from the source vertex to all other vertices in the graph. If `genPaths
|
|
254
|
+
* @returns The function `dijkstraWithoutHeap` returns an object of type `DijkstraResult<VO>`.
|
|
255
|
+
*/
|
|
256
256
|
dijkstraWithoutHeap(src: VO | VertexKey, dest?: VO | VertexKey | null, getMinDist?: boolean, genPaths?: boolean): DijkstraResult<VO>;
|
|
257
257
|
/**
|
|
258
258
|
* Dijkstra algorithm time: O(logVE) space: O(VO + EO)
|
|
@@ -268,25 +268,25 @@ export declare abstract class AbstractGraph<V = any, E = any, VO extends Abstrac
|
|
|
268
268
|
* Space Complexity: O(V + E) - Depends on the implementation (using a binary heap).
|
|
269
269
|
*/
|
|
270
270
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
271
|
+
* Time Complexity: O((V + E) * log(V)) - Depends on the implementation (using a binary heap).
|
|
272
|
+
* Space Complexity: O(V + E) - Depends on the implementation (using a binary heap).
|
|
273
|
+
*
|
|
274
|
+
* Dijkstra's algorithm is used to find the shortest paths from a source node to all other nodes in a graph. Its basic idea is to repeatedly choose the node closest to the source node and update the distances of other nodes using this node as an intermediary. Dijkstra's algorithm requires that the edge weights in the graph are non-negative.
|
|
275
|
+
* The `dijkstra` function implements Dijkstra's algorithm to find the shortest path between a source vertex and an
|
|
276
|
+
* optional destination vertex, and optionally returns the minimum distance, the paths, and other information.
|
|
277
|
+
* @param {VO | VertexKey} src - The `src` parameter represents the source vertex from which the Dijkstra algorithm will
|
|
278
|
+
* start. It can be either a vertex object or a vertex ID.
|
|
279
|
+
* @param {VO | VertexKey | null} [dest] - The `dest` parameter is the destination vertex or vertex ID. It specifies the
|
|
280
|
+
* vertex to which the shortest path is calculated from the source vertex. If no destination is provided, the algorithm
|
|
281
|
+
* will calculate the shortest paths to all other vertices from the source vertex.
|
|
282
|
+
* @param {boolean} [getMinDist] - The `getMinDist` parameter is a boolean flag that determines whether the minimum
|
|
283
|
+
* distance from the source vertex to the destination vertex should be calculated and returned in the result. If
|
|
284
|
+
* `getMinDist` is set to `true`, the `minDist` property in the result will contain the minimum distance
|
|
285
|
+
* @param {boolean} [genPaths] - The `genPaths` parameter is a boolean flag that determines whether or not to generate
|
|
286
|
+
* paths in the Dijkstra algorithm. If `genPaths` is set to `true`, the algorithm will calculate and return the
|
|
287
|
+
* shortest paths from the source vertex to all other vertices in the graph. If `genPaths
|
|
288
|
+
* @returns The function `dijkstra` returns an object of type `DijkstraResult<VO>`.
|
|
289
|
+
*/
|
|
290
290
|
dijkstra(src: VO | VertexKey, dest?: VO | VertexKey | null, getMinDist?: boolean, genPaths?: boolean): DijkstraResult<VO>;
|
|
291
291
|
/**
|
|
292
292
|
* Time Complexity: O(V * E) - Quadratic time in the worst case (Bellman-Ford algorithm).
|