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
|
@@ -10,10 +10,7 @@ import {BiTreeDeleteResult, BTNCallback, CP, FamilyPosition, IterationType} from
|
|
|
10
10
|
import {IBinaryTree} from '../../interfaces';
|
|
11
11
|
import {AVLTree, AVLTreeNode} from './avl-tree';
|
|
12
12
|
|
|
13
|
-
export class TreeMultimapNode<
|
|
14
|
-
V = any,
|
|
15
|
-
N extends TreeMultimapNode<V, N> = TreeMultimapNodeNested<V>
|
|
16
|
-
> extends AVLTreeNode<V, N> {
|
|
13
|
+
export class TreeMultimapNode<V = any, N extends TreeMultimapNode<V, N> = TreeMultimapNodeNested<V>> extends AVLTreeNode<V, N> {
|
|
17
14
|
count: number;
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -160,52 +157,6 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
160
157
|
* Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.
|
|
161
158
|
*/
|
|
162
159
|
|
|
163
|
-
/**
|
|
164
|
-
* Time Complexity: O(1) - constant time, as it performs basic pointer assignments.
|
|
165
|
-
* Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.
|
|
166
|
-
*
|
|
167
|
-
* The function adds a new node to a binary tree, either as the left child or the right child of a
|
|
168
|
-
* given parent node.
|
|
169
|
-
* @param {N | undefined} newNode - The `newNode` parameter represents the node that needs to be
|
|
170
|
-
* added to the binary tree. It can be of type `N` (which represents a node in the binary tree) or
|
|
171
|
-
* `undefined` if there is no node to add.
|
|
172
|
-
* @param {BTNKey | N | undefined} parent - The `parent` parameter represents the parent node to
|
|
173
|
-
* which the new node will be added as a child. It can be either a node object (`N`) or a key value
|
|
174
|
-
* (`BTNKey`).
|
|
175
|
-
* @returns The method `_addTo` returns either the `parent.left` or `parent.right` node that was
|
|
176
|
-
* added, or `undefined` if no node was added.
|
|
177
|
-
*/
|
|
178
|
-
protected override _addTo(newNode: N | undefined, parent: BTNKey | N | undefined): N | undefined {
|
|
179
|
-
parent = this.ensureNotKey(parent);
|
|
180
|
-
if (parent) {
|
|
181
|
-
if (parent.left === undefined) {
|
|
182
|
-
parent.left = newNode;
|
|
183
|
-
if (newNode !== undefined) {
|
|
184
|
-
this._size = this.size + 1;
|
|
185
|
-
this._count += newNode.count;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return parent.left;
|
|
189
|
-
} else if (parent.right === undefined) {
|
|
190
|
-
parent.right = newNode;
|
|
191
|
-
if (newNode !== undefined) {
|
|
192
|
-
this._size = this.size + 1;
|
|
193
|
-
this._count += newNode.count;
|
|
194
|
-
}
|
|
195
|
-
return parent.right;
|
|
196
|
-
} else {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
} else {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* 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.
|
|
206
|
-
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
160
|
/**
|
|
210
161
|
* 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.
|
|
211
162
|
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
@@ -241,8 +192,8 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
241
192
|
}
|
|
242
193
|
|
|
243
194
|
/**
|
|
244
|
-
* Time Complexity: O(
|
|
245
|
-
* Space Complexity: O(
|
|
195
|
+
* 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.
|
|
196
|
+
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
246
197
|
*/
|
|
247
198
|
|
|
248
199
|
/**
|
|
@@ -295,8 +246,8 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
295
246
|
}
|
|
296
247
|
|
|
297
248
|
/**
|
|
298
|
-
* Time Complexity: O(log n) - logarithmic time, where "n" is the number of nodes in the tree.
|
|
299
|
-
* Space Complexity: O(
|
|
249
|
+
* 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.
|
|
250
|
+
* Space Complexity: O(n) - linear space, as it creates an array to store the sorted nodes.
|
|
300
251
|
*/
|
|
301
252
|
|
|
302
253
|
/**
|
|
@@ -330,7 +281,8 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
330
281
|
if (!curr) return deletedResult;
|
|
331
282
|
|
|
332
283
|
const parent: N | undefined = curr?.parent ? curr.parent : undefined;
|
|
333
|
-
let needBalanced: N | undefined = undefined,
|
|
284
|
+
let needBalanced: N | undefined = undefined,
|
|
285
|
+
orgCurrent: N | undefined = curr;
|
|
334
286
|
|
|
335
287
|
if (curr.count > 1 && !ignoreCount) {
|
|
336
288
|
curr.count--;
|
|
@@ -377,6 +329,11 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
377
329
|
return deletedResult;
|
|
378
330
|
}
|
|
379
331
|
|
|
332
|
+
/**
|
|
333
|
+
* 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.
|
|
334
|
+
* Space Complexity: O(1) - constant space, as it doesn't use additional data structures that scale with input size.
|
|
335
|
+
*/
|
|
336
|
+
|
|
380
337
|
/**
|
|
381
338
|
* The clear() function clears the contents of a data structure and sets the count to zero.
|
|
382
339
|
*/
|
|
@@ -385,6 +342,47 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
385
342
|
this._count = 0;
|
|
386
343
|
}
|
|
387
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Time Complexity: O(1) - constant time, as it performs basic pointer assignments.
|
|
347
|
+
* Space Complexity: O(1) - constant space, as it only uses a constant amount of memory.
|
|
348
|
+
*
|
|
349
|
+
* The function adds a new node to a binary tree, either as the left child or the right child of a
|
|
350
|
+
* given parent node.
|
|
351
|
+
* @param {N | undefined} newNode - The `newNode` parameter represents the node that needs to be
|
|
352
|
+
* added to the binary tree. It can be of type `N` (which represents a node in the binary tree) or
|
|
353
|
+
* `undefined` if there is no node to add.
|
|
354
|
+
* @param {BTNKey | N | undefined} parent - The `parent` parameter represents the parent node to
|
|
355
|
+
* which the new node will be added as a child. It can be either a node object (`N`) or a key value
|
|
356
|
+
* (`BTNKey`).
|
|
357
|
+
* @returns The method `_addTo` returns either the `parent.left` or `parent.right` node that was
|
|
358
|
+
* added, or `undefined` if no node was added.
|
|
359
|
+
*/
|
|
360
|
+
protected override _addTo(newNode: N | undefined, parent: BTNKey | N | undefined): N | undefined {
|
|
361
|
+
parent = this.ensureNotKey(parent);
|
|
362
|
+
if (parent) {
|
|
363
|
+
if (parent.left === undefined) {
|
|
364
|
+
parent.left = newNode;
|
|
365
|
+
if (newNode !== undefined) {
|
|
366
|
+
this._size = this.size + 1;
|
|
367
|
+
this._count += newNode.count;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return parent.left;
|
|
371
|
+
} else if (parent.right === undefined) {
|
|
372
|
+
parent.right = newNode;
|
|
373
|
+
if (newNode !== undefined) {
|
|
374
|
+
this._size = this.size + 1;
|
|
375
|
+
this._count += newNode.count;
|
|
376
|
+
}
|
|
377
|
+
return parent.right;
|
|
378
|
+
} else {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
388
386
|
/**
|
|
389
387
|
* The `_swap` function swaps the key, value, count, and height properties between two nodes.
|
|
390
388
|
* @param {BTNKey | N | undefined} srcNode - The `srcNode` parameter represents the source node from
|
|
@@ -394,7 +392,7 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
394
392
|
* @returns either the `destNode` object if both `srcNode` and `destNode` are defined, or `undefined`
|
|
395
393
|
* if either `srcNode` or `destNode` is undefined.
|
|
396
394
|
*/
|
|
397
|
-
protected _swap(srcNode: BTNKey | N | undefined, destNode:BTNKey | N | undefined): N | undefined{
|
|
395
|
+
protected _swap(srcNode: BTNKey | N | undefined, destNode: BTNKey | N | undefined): N | undefined {
|
|
398
396
|
srcNode = this.ensureNotKey(srcNode);
|
|
399
397
|
destNode = this.ensureNotKey(destNode);
|
|
400
398
|
if (srcNode && destNode) {
|
|
@@ -416,6 +414,6 @@ export class TreeMultimap<V = any, N extends TreeMultimapNode<V, N> = TreeMultim
|
|
|
416
414
|
|
|
417
415
|
return destNode;
|
|
418
416
|
}
|
|
419
|
-
return
|
|
417
|
+
return undefined;
|
|
420
418
|
}
|
|
421
|
-
}
|
|
419
|
+
}
|
|
@@ -64,8 +64,7 @@ export abstract class AbstractGraph<
|
|
|
64
64
|
E = any,
|
|
65
65
|
VO extends AbstractVertex<V> = AbstractVertex<V>,
|
|
66
66
|
EO extends AbstractEdge<E> = AbstractEdge<E>
|
|
67
|
-
> implements IGraph<V, E, VO, EO>
|
|
68
|
-
{
|
|
67
|
+
> implements IGraph<V, E, VO, EO> {
|
|
69
68
|
protected _vertices: Map<VertexKey, VO> = new Map<VertexKey, VO>();
|
|
70
69
|
|
|
71
70
|
get vertices(): Map<VertexKey, VO> {
|
|
@@ -496,7 +495,7 @@ export abstract class AbstractGraph<
|
|
|
496
495
|
* Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
|
|
497
496
|
*/
|
|
498
497
|
|
|
499
|
-
|
|
498
|
+
/**
|
|
500
499
|
* Time Complexity: O(V^2 + E) - Quadratic time in the worst case (no heap optimization).
|
|
501
500
|
* Space Complexity: O(V + E) - Depends on the implementation (Dijkstra's algorithm).
|
|
502
501
|
*
|
|
@@ -515,12 +514,7 @@ export abstract class AbstractGraph<
|
|
|
515
514
|
* shortest paths from the source vertex to all other vertices in the graph. If `genPaths
|
|
516
515
|
* @returns The function `dijkstraWithoutHeap` returns an object of type `DijkstraResult<VO>`.
|
|
517
516
|
*/
|
|
518
|
-
dijkstraWithoutHeap(
|
|
519
|
-
src: VO | VertexKey,
|
|
520
|
-
dest?: VO | VertexKey | null,
|
|
521
|
-
getMinDist?: boolean,
|
|
522
|
-
genPaths?: boolean
|
|
523
|
-
): DijkstraResult<VO> {
|
|
517
|
+
dijkstraWithoutHeap(src: VO | VertexKey, dest?: VO | VertexKey | null, getMinDist?: boolean, genPaths?: boolean): DijkstraResult<VO> {
|
|
524
518
|
if (getMinDist === undefined) getMinDist = false;
|
|
525
519
|
if (genPaths === undefined) genPaths = false;
|
|
526
520
|
|
|
@@ -643,7 +637,7 @@ export abstract class AbstractGraph<
|
|
|
643
637
|
* Space Complexity: O(V + E) - Depends on the implementation (using a binary heap).
|
|
644
638
|
*/
|
|
645
639
|
|
|
646
|
-
|
|
640
|
+
/**
|
|
647
641
|
* Time Complexity: O((V + E) * log(V)) - Depends on the implementation (using a binary heap).
|
|
648
642
|
* Space Complexity: O(V + E) - Depends on the implementation (using a binary heap).
|
|
649
643
|
*
|
|
@@ -663,12 +657,7 @@ export abstract class AbstractGraph<
|
|
|
663
657
|
* shortest paths from the source vertex to all other vertices in the graph. If `genPaths
|
|
664
658
|
* @returns The function `dijkstra` returns an object of type `DijkstraResult<VO>`.
|
|
665
659
|
*/
|
|
666
|
-
dijkstra(
|
|
667
|
-
src: VO | VertexKey,
|
|
668
|
-
dest?: VO | VertexKey | null,
|
|
669
|
-
getMinDist?: boolean,
|
|
670
|
-
genPaths?: boolean
|
|
671
|
-
): DijkstraResult<VO> {
|
|
660
|
+
dijkstra(src: VO | VertexKey, dest?: VO | VertexKey | null, getMinDist?: boolean, genPaths?: boolean): DijkstraResult<VO> {
|
|
672
661
|
if (getMinDist === undefined) getMinDist = false;
|
|
673
662
|
if (genPaths === undefined) genPaths = false;
|
|
674
663
|
|
|
@@ -993,12 +982,7 @@ export abstract class AbstractGraph<
|
|
|
993
982
|
* are arrays of vertices that form cycles within the SCCs.
|
|
994
983
|
* @returns The function `tarjan` returns an object with the following properties:
|
|
995
984
|
*/
|
|
996
|
-
tarjan(
|
|
997
|
-
needCutVertexes: boolean = false,
|
|
998
|
-
needBridges: boolean = false,
|
|
999
|
-
needSCCs: boolean = true,
|
|
1000
|
-
needCycles: boolean = false
|
|
1001
|
-
) {
|
|
985
|
+
tarjan(needCutVertexes: boolean = false, needBridges: boolean = false, needSCCs: boolean = true, needCycles: boolean = false) {
|
|
1002
986
|
// !! in undirected graph we will not let child visit parent when dfs
|
|
1003
987
|
// !! articulation point(in dfs search tree not in graph): (cur !== root && cur.has(child)) && (low(child) >= dfn(cur)) || (cur === root && cur.children() >= 2)
|
|
1004
988
|
// !! bridge: low(child) > dfn(cur)
|
|
@@ -45,15 +45,9 @@ export class DirectedEdge<E = any> extends AbstractEdge<E> {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export class DirectedGraph<
|
|
49
|
-
V = any,
|
|
50
|
-
E = any,
|
|
51
|
-
VO extends DirectedVertex<V> = DirectedVertex<V>,
|
|
52
|
-
EO extends DirectedEdge<E> = DirectedEdge<E>
|
|
53
|
-
>
|
|
48
|
+
export class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V> = DirectedVertex<V>, EO extends DirectedEdge<E> = DirectedEdge<E>>
|
|
54
49
|
extends AbstractGraph<V, E, VO, EO>
|
|
55
|
-
implements IGraph<V, E, VO, EO>
|
|
56
|
-
{
|
|
50
|
+
implements IGraph<V, E, VO, EO> {
|
|
57
51
|
/**
|
|
58
52
|
* The constructor function initializes an instance of a class.
|
|
59
53
|
*/
|
|
@@ -591,4 +585,4 @@ export class DirectedGraph<
|
|
|
591
585
|
return false;
|
|
592
586
|
}
|
|
593
587
|
}
|
|
594
|
-
}
|
|
588
|
+
}
|
|
@@ -40,12 +40,12 @@ export class MapEdge<E = any> extends DirectedEdge<E> {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export class MapGraph<
|
|
44
|
-
V
|
|
45
|
-
E
|
|
46
|
-
VO
|
|
47
|
-
EO
|
|
48
|
-
>
|
|
43
|
+
export class MapGraph<V = any, E = any, VO extends MapVertex<V> = MapVertex<V>, EO extends MapEdge<E> = MapEdge<E>> extends DirectedGraph<
|
|
44
|
+
V,
|
|
45
|
+
E,
|
|
46
|
+
VO,
|
|
47
|
+
EO
|
|
48
|
+
> {
|
|
49
49
|
/**
|
|
50
50
|
* The constructor function initializes the origin and bottomRight properties of a MapGraphCoordinate object.
|
|
51
51
|
* @param {MapGraphCoordinate} origin - The `origin` parameter is a `MapGraphCoordinate` object that represents the
|
|
@@ -49,8 +49,7 @@ export class UndirectedGraph<
|
|
|
49
49
|
EO extends UndirectedEdge<E> = UndirectedEdge<E>
|
|
50
50
|
>
|
|
51
51
|
extends AbstractGraph<V, E, VO, EO>
|
|
52
|
-
implements IGraph<V, E, VO, EO>
|
|
53
|
-
{
|
|
52
|
+
implements IGraph<V, E, VO, EO> {
|
|
54
53
|
/**
|
|
55
54
|
* The constructor initializes a new Map object to store edges.
|
|
56
55
|
*/
|
|
@@ -445,7 +445,6 @@ export class FibonacciHeap<E> {
|
|
|
445
445
|
return this.push(element);
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
|
|
449
448
|
/**
|
|
450
449
|
* Time Complexity: O(1)
|
|
451
450
|
* Space Complexity: O(1)
|
|
@@ -473,7 +472,6 @@ export class FibonacciHeap<E> {
|
|
|
473
472
|
return this;
|
|
474
473
|
}
|
|
475
474
|
|
|
476
|
-
|
|
477
475
|
/**
|
|
478
476
|
* Time Complexity: O(1)
|
|
479
477
|
* Space Complexity: O(1)
|
|
@@ -743,10 +741,7 @@ export class FibonacciHeap<E> {
|
|
|
743
741
|
protected consolidate(): void {
|
|
744
742
|
const A: (FibonacciHeapNode<E> | undefined)[] = new Array(this.size);
|
|
745
743
|
const nodes = this.consumeLinkedList(this.root);
|
|
746
|
-
let x: FibonacciHeapNode<E> | undefined,
|
|
747
|
-
y: FibonacciHeapNode<E> | undefined,
|
|
748
|
-
d: number,
|
|
749
|
-
t: FibonacciHeapNode<E> | undefined;
|
|
744
|
+
let x: FibonacciHeapNode<E> | undefined, y: FibonacciHeapNode<E> | undefined, d: number, t: FibonacciHeapNode<E> | undefined;
|
|
750
745
|
|
|
751
746
|
for (const node of nodes) {
|
|
752
747
|
x = node;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {BinaryTreeNode} from '../data-structures';
|
|
2
|
-
import {
|
|
2
|
+
import {BinaryTreeNodeNested, BiTreeDeleteResult, BTNCallback, BTNKey} from '../types';
|
|
3
3
|
|
|
4
4
|
export interface IBinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNodeNested<V>> {
|
|
5
5
|
createNode(key: BTNKey, value?: N['value']): N;
|
|
@@ -16,20 +16,6 @@ export type ObjectWithNumberKey = {
|
|
|
16
16
|
key: number;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export type RestrictValByKey =
|
|
20
|
-
| NonNumberNonObjectButDefined
|
|
21
|
-
| ObjectWithoutKey
|
|
22
|
-
| ObjectWithNonNumberKey
|
|
23
|
-
| ObjectWithNumberKey;
|
|
19
|
+
export type RestrictValByKey = NonNumberNonObjectButDefined | ObjectWithoutKey | ObjectWithNonNumberKey | ObjectWithNumberKey;
|
|
24
20
|
|
|
25
|
-
export type DummyAny =
|
|
26
|
-
| string
|
|
27
|
-
| number
|
|
28
|
-
| boolean
|
|
29
|
-
| null
|
|
30
|
-
| undefined
|
|
31
|
-
| object
|
|
32
|
-
| symbol
|
|
33
|
-
| void
|
|
34
|
-
| ((...args: []) => any)
|
|
35
|
-
| never;
|
|
21
|
+
export type DummyAny = string | number | boolean | null | undefined | object | symbol | void | ((...args: []) => any) | never;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset='UTF-8'>
|
|
5
5
|
<title>CDN Test</title>
|
|
6
|
+
<!-- <script src="../../dist/umd/data-structure-typed.min.js"></script>-->
|
|
6
7
|
<script src='https://cdn.jsdelivr.net/npm/data-structure-typed/dist/umd/data-structure-typed.min.js'></script>
|
|
8
|
+
<script src='https://unpkg.com/js-sdsl@4.4.2/dist/umd/js-sdsl.js'></script>
|
|
7
9
|
</head>
|
|
8
10
|
<body>
|
|
9
11
|
<div id='app'>
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
const tree = new BinaryTree();
|
|
55
57
|
tree.add(3);
|
|
56
58
|
tree.add(12);
|
|
57
|
-
tree.addMany([1, 6, 9, 8,5,2,3,4,7])
|
|
59
|
+
tree.addMany([1, 6, 9, 8, 5, 2, 3, 4, 7])
|
|
58
60
|
tree.add(10);
|
|
59
61
|
console.log(tree.isPerfectlyBalanced());
|
|
60
62
|
tree.print();
|
|
@@ -74,17 +76,61 @@
|
|
|
74
76
|
|
|
75
77
|
|
|
76
78
|
try {
|
|
79
|
+
const {OrderedMap} = sdsl;
|
|
77
80
|
const {RedBlackTree} = dataStructureTyped;
|
|
81
|
+
const cTree = new OrderedMap();
|
|
78
82
|
const tree = new RedBlackTree();
|
|
79
|
-
|
|
83
|
+
const tS = performance.now();
|
|
84
|
+
for (let i = 1; i < 1000000; i++) {
|
|
80
85
|
tree.add(i, i);
|
|
81
86
|
}
|
|
82
|
-
console.log(
|
|
83
|
-
tree.
|
|
87
|
+
console.log(performance.now() - tS);
|
|
88
|
+
console.log(tree.size);
|
|
89
|
+
const cS = performance.now();
|
|
90
|
+
for (let i = 1; i < 1000000; i++) {
|
|
91
|
+
cTree.setElement(i, i);
|
|
92
|
+
}
|
|
93
|
+
console.log(performance.now() - cS);
|
|
94
|
+
console.log(cTree.size());
|
|
95
|
+
|
|
96
|
+
// console.log(tree.isPerfectlyBalanced());
|
|
97
|
+
// tree.print();
|
|
84
98
|
|
|
85
99
|
} catch (e) {
|
|
86
100
|
console.error(e);
|
|
87
101
|
}
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
const {PriorityQueue: CPriorityQueue} = sdsl;
|
|
105
|
+
const {PriorityQueue} = dataStructureTyped;
|
|
106
|
+
const pq = new PriorityQueue({comparator: (a, b) => b - a});
|
|
107
|
+
|
|
108
|
+
const tS = performance.now();
|
|
109
|
+
|
|
110
|
+
for (let i = 0; i < 1000000; i++) {
|
|
111
|
+
pq.add(i);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
for (let i = 0; i < 10000; i++) {
|
|
115
|
+
pq.pop();
|
|
116
|
+
}
|
|
117
|
+
console.log(performance.now() - tS);
|
|
118
|
+
console.log(pq.size);
|
|
119
|
+
const cS = performance.now();
|
|
120
|
+
const cpq = new CPriorityQueue();
|
|
121
|
+
|
|
122
|
+
for (let i = 0; i < 1000000; i++) {
|
|
123
|
+
cpq.push(i);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
for (let i = 0; i < 10000; i++) {
|
|
127
|
+
cpq.pop();
|
|
128
|
+
}
|
|
129
|
+
console.log(performance.now() - cS);
|
|
130
|
+
console.log(cpq.size());
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.error(e);
|
|
133
|
+
}
|
|
88
134
|
</script>
|
|
89
135
|
|
|
90
136
|
</body>
|
|
@@ -2,7 +2,7 @@ import {RedBlackTree} from '../../../../src';
|
|
|
2
2
|
import * as Benchmark from 'benchmark';
|
|
3
3
|
import {getRandomIntArray, magnitude} from '../../../utils';
|
|
4
4
|
import {OrderedMap} from 'js-sdsl';
|
|
5
|
-
import {isCompetitor} from
|
|
5
|
+
import {isCompetitor} from '../../../config';
|
|
6
6
|
|
|
7
7
|
const suite = new Benchmark.Suite();
|
|
8
8
|
const rbTree = new RedBlackTree();
|
|
@@ -10,32 +10,31 @@ const {HUNDRED_THOUSAND} = magnitude;
|
|
|
10
10
|
const arr = getRandomIntArray(HUNDRED_THOUSAND, 0, HUNDRED_THOUSAND, true);
|
|
11
11
|
const competitor = new OrderedMap<number, number>();
|
|
12
12
|
|
|
13
|
-
suite
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
13
|
+
suite.add(`${HUNDRED_THOUSAND.toLocaleString()} add`, () => {
|
|
14
|
+
rbTree.clear();
|
|
15
|
+
for (let i = 0; i < arr.length; i++) {
|
|
16
|
+
rbTree.add(arr[i]);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
21
19
|
|
|
22
20
|
if (isCompetitor) {
|
|
23
21
|
suite.add(`${HUNDRED_THOUSAND.toLocaleString()} competitor add`, () => {
|
|
24
22
|
for (let i = 0; i < arr.length; i++) {
|
|
25
23
|
competitor.setElement(arr[i], arr[i]);
|
|
26
24
|
}
|
|
27
|
-
})
|
|
25
|
+
});
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
suite
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
28
|
+
suite
|
|
29
|
+
.add(`${HUNDRED_THOUSAND.toLocaleString()} add & delete randomly`, () => {
|
|
30
|
+
rbTree.clear();
|
|
31
|
+
for (let i = 0; i < arr.length; i++) {
|
|
32
|
+
rbTree.add(arr[i]);
|
|
33
|
+
}
|
|
34
|
+
for (let i = 0; i < arr.length; i++) {
|
|
35
|
+
rbTree.delete(arr[i]);
|
|
36
|
+
}
|
|
37
|
+
})
|
|
39
38
|
.add(`${HUNDRED_THOUSAND.toLocaleString()} getNode`, () => {
|
|
40
39
|
for (let i = 0; i < arr.length; i++) {
|
|
41
40
|
rbTree.getNode(arr[i]);
|
|
@@ -2,28 +2,26 @@ import {HashMap} from '../../../../src';
|
|
|
2
2
|
import {HashMap as CHashMap} from 'js-sdsl';
|
|
3
3
|
import * as Benchmark from 'benchmark';
|
|
4
4
|
import {magnitude} from '../../../utils';
|
|
5
|
-
import {isCompetitor} from
|
|
5
|
+
import {isCompetitor} from '../../../config';
|
|
6
6
|
|
|
7
7
|
const suite = new Benchmark.Suite();
|
|
8
8
|
const {TEN_THOUSAND} = magnitude;
|
|
9
9
|
|
|
10
|
-
suite
|
|
11
|
-
|
|
12
|
-
const hm = new HashMap<number, number>();
|
|
10
|
+
suite.add(`${TEN_THOUSAND.toLocaleString()} set`, () => {
|
|
11
|
+
const hm = new HashMap<number, number>();
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
for (let i = 0; i < TEN_THOUSAND; i++) {
|
|
14
|
+
hm.set(i, i);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
18
17
|
if (isCompetitor) {
|
|
19
|
-
|
|
20
18
|
suite.add(`${TEN_THOUSAND.toLocaleString()} competitor set`, () => {
|
|
21
19
|
const hm = new CHashMap<number, number>();
|
|
22
20
|
|
|
23
21
|
for (let i = 0; i < TEN_THOUSAND; i++) {
|
|
24
22
|
hm.setElement(i, i);
|
|
25
23
|
}
|
|
26
|
-
})
|
|
24
|
+
});
|
|
27
25
|
}
|
|
28
26
|
suite.add(`${TEN_THOUSAND.toLocaleString()} set & get`, () => {
|
|
29
27
|
const hm = new HashMap<number, number>();
|
|
@@ -34,8 +32,7 @@ suite.add(`${TEN_THOUSAND.toLocaleString()} set & get`, () => {
|
|
|
34
32
|
for (let i = 0; i < TEN_THOUSAND; i++) {
|
|
35
33
|
hm.get(i);
|
|
36
34
|
}
|
|
37
|
-
})
|
|
38
|
-
;
|
|
35
|
+
});
|
|
39
36
|
if (isCompetitor) {
|
|
40
37
|
suite.add(`${TEN_THOUSAND.toLocaleString()} competitor set & get`, () => {
|
|
41
38
|
const hm = new CHashMap<number, number>();
|
|
@@ -46,6 +43,6 @@ if (isCompetitor) {
|
|
|
46
43
|
for (let i = 0; i < TEN_THOUSAND; i++) {
|
|
47
44
|
hm.getElementByKey(i);
|
|
48
45
|
}
|
|
49
|
-
})
|
|
46
|
+
});
|
|
50
47
|
}
|
|
51
48
|
export {suite};
|
|
@@ -2,29 +2,29 @@ import {DoublyLinkedList, DoublyLinkedListNode} from '../../../../src';
|
|
|
2
2
|
import {LinkList as CLinkedList} from 'js-sdsl';
|
|
3
3
|
import * as Benchmark from 'benchmark';
|
|
4
4
|
import {magnitude} from '../../../utils';
|
|
5
|
-
import {isCompetitor} from
|
|
5
|
+
import {isCompetitor} from '../../../config';
|
|
6
6
|
|
|
7
7
|
const suite = new Benchmark.Suite();
|
|
8
8
|
const {LINEAR} = magnitude;
|
|
9
9
|
|
|
10
|
-
suite
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
suite.add(`${LINEAR.toLocaleString()} unshift`, () => {
|
|
11
|
+
const list = new DoublyLinkedList<number>();
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < LINEAR; i++) {
|
|
14
|
+
list.unshift(i);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
if (isCompetitor) {
|
|
18
|
+
suite.add(`${LINEAR.toLocaleString()} competitor unshift`, () => {
|
|
19
|
+
const list = new CLinkedList<number>();
|
|
13
20
|
|
|
14
21
|
for (let i = 0; i < LINEAR; i++) {
|
|
15
|
-
list.
|
|
22
|
+
list.pushFront(i);
|
|
16
23
|
}
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < LINEAR; i++) {
|
|
23
|
-
list.pushFront(i);
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
suite.add(`${LINEAR.toLocaleString()} unshift & shift`, () => {
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
suite
|
|
27
|
+
.add(`${LINEAR.toLocaleString()} unshift & shift`, () => {
|
|
28
28
|
const list = new DoublyLinkedList<number>();
|
|
29
29
|
|
|
30
30
|
for (let i = 0; i < LINEAR; i++) {
|
|
@@ -6,9 +6,7 @@ const suite = new Benchmark.Suite();
|
|
|
6
6
|
const {TEN_THOUSAND} = magnitude;
|
|
7
7
|
|
|
8
8
|
suite.add(`${TEN_THOUSAND.toLocaleString()} refill & poll`, () => {
|
|
9
|
-
const nodes = Array.from(
|
|
10
|
-
new Set<number>(Array.from(new Array(TEN_THOUSAND), () => Math.floor(Math.random() * TEN_THOUSAND * 100)))
|
|
11
|
-
);
|
|
9
|
+
const nodes = Array.from(new Set<number>(Array.from(new Array(TEN_THOUSAND), () => Math.floor(Math.random() * TEN_THOUSAND * 100))));
|
|
12
10
|
const maxPQ = new MaxPriorityQueue<number>();
|
|
13
11
|
maxPQ.refill(nodes);
|
|
14
12
|
while (maxPQ.size > 0) {
|
|
@@ -2,23 +2,22 @@ import {PriorityQueue as CPriorityQueue} from 'js-sdsl';
|
|
|
2
2
|
import {PriorityQueue} from '../../../../src';
|
|
3
3
|
import * as Benchmark from 'benchmark';
|
|
4
4
|
import {magnitude} from '../../../utils';
|
|
5
|
-
import {isCompetitor} from
|
|
5
|
+
import {isCompetitor} from '../../../config';
|
|
6
6
|
|
|
7
7
|
const suite = new Benchmark.Suite();
|
|
8
8
|
const {TEN_THOUSAND} = magnitude;
|
|
9
9
|
|
|
10
|
-
suite
|
|
11
|
-
|
|
12
|
-
const pq = new PriorityQueue<number>({comparator: (a, b) => b - a});
|
|
10
|
+
suite.add(`${TEN_THOUSAND.toLocaleString()} add & pop`, () => {
|
|
11
|
+
const pq = new PriorityQueue<number>({comparator: (a, b) => b - a});
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
for (let i = 0; i < TEN_THOUSAND; i++) {
|
|
14
|
+
pq.add(i);
|
|
15
|
+
}
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
for (let i = 0; i < TEN_THOUSAND; i++) {
|
|
18
|
+
pq.pop();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
22
21
|
if (isCompetitor) {
|
|
23
22
|
suite.add(`${TEN_THOUSAND.toLocaleString()} competitor add & pop`, () => {
|
|
24
23
|
const pq = new CPriorityQueue<number>();
|
|
@@ -31,7 +30,6 @@ if (isCompetitor) {
|
|
|
31
30
|
pq.pop();
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
|
-
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
export {suite};
|