data-structure-typed 1.54.0 → 1.54.2
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/CHANGELOG.md +1 -1
- package/README.md +1 -0
- package/benchmark/report.html +1 -28
- package/benchmark/report.json +17 -326
- package/dist/{mjs/data-structures/binary-tree/avl-tree-multi-map.d.ts → cjs/data-structures/binary-tree/avl-tree-counter.d.ts} +54 -47
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +408 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +71 -177
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +135 -340
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +102 -57
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +110 -47
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +3 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +240 -190
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +269 -240
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +145 -112
- package/dist/cjs/data-structures/binary-tree/bst.js +180 -129
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/cjs/data-structures/binary-tree/index.js +2 -0
- package/dist/cjs/data-structures/binary-tree/index.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +100 -82
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js +115 -79
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +1 -1
- package/dist/{mjs/data-structures/binary-tree/tree-multi-map.d.ts → cjs/data-structures/binary-tree/tree-counter.d.ts} +74 -64
- package/dist/cjs/data-structures/binary-tree/tree-counter.js +445 -0
- package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +78 -174
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +142 -377
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +1 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +3 -0
- package/dist/cjs/data-structures/graph/directed-graph.js +3 -0
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/map-graph.d.ts +3 -0
- package/dist/cjs/data-structures/graph/map-graph.js +3 -0
- package/dist/cjs/data-structures/graph/map-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +3 -0
- package/dist/cjs/data-structures/graph/undirected-graph.js +3 -0
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +3 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +3 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +3 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +3 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/matrix/matrix.d.ts +3 -0
- package/dist/cjs/data-structures/matrix/matrix.js +3 -0
- package/dist/cjs/data-structures/matrix/matrix.js.map +1 -1
- package/dist/cjs/data-structures/matrix/navigator.d.ts +3 -0
- package/dist/cjs/data-structures/matrix/navigator.js +3 -0
- package/dist/cjs/data-structures/matrix/navigator.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +3 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +3 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +0 -4
- package/dist/cjs/data-structures/trie/trie.js +0 -4
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/interfaces/binary-tree.d.ts +8 -8
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js +3 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -4
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +0 -3
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +0 -3
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +3 -3
- package/dist/cjs/types/data-structures/binary-tree/index.d.ts +3 -1
- package/dist/cjs/types/data-structures/binary-tree/index.js +3 -1
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.d.ts +3 -0
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js +3 -0
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/cjs/types/data-structures/binary-tree/{rb-tree.js → tree-counter.js} +1 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -5
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +213 -0
- package/dist/{mjs/data-structures/binary-tree/avl-tree-multi-map.js → esm/data-structures/binary-tree/avl-tree-counter.js} +73 -60
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +100 -0
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +191 -0
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +1 -0
- package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +234 -0
- package/dist/{mjs → esm}/data-structures/binary-tree/avl-tree.js +110 -47
- package/dist/esm/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/binary-tree/binary-indexed-tree.js +3 -0
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/binary-tree/binary-tree.d.ts +240 -190
- package/dist/{mjs → esm}/data-structures/binary-tree/binary-tree.js +272 -245
- package/dist/esm/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/binary-tree/bst.d.ts +145 -112
- package/dist/{mjs → esm}/data-structures/binary-tree/bst.js +201 -155
- package/dist/esm/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/{mjs/types/data-structures/binary-tree/index.d.ts → esm/data-structures/binary-tree/index.js} +6 -2
- package/dist/{mjs → esm}/data-structures/binary-tree/index.js.map +1 -1
- package/dist/{mjs → esm}/data-structures/binary-tree/red-black-tree.d.ts +100 -82
- package/dist/{mjs → esm}/data-structures/binary-tree/red-black-tree.js +115 -79
- package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +1 -0
- package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +212 -0
- package/dist/{mjs/data-structures/binary-tree/tree-multi-map.js → esm/data-structures/binary-tree/tree-counter.js} +111 -96
- package/dist/esm/data-structures/binary-tree/tree-counter.js.map +1 -0
- package/dist/esm/data-structures/binary-tree/tree-multi-map.d.ts +106 -0
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js +196 -0
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/graph/directed-graph.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/graph/directed-graph.js +3 -0
- package/dist/esm/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/graph/map-graph.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/graph/map-graph.js +3 -0
- package/dist/esm/data-structures/graph/map-graph.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/graph/undirected-graph.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/graph/undirected-graph.js +3 -0
- package/dist/esm/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/linked-list/singly-linked-list.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/linked-list/singly-linked-list.js +3 -0
- package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/linked-list/skip-linked-list.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/linked-list/skip-linked-list.js +3 -0
- package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/matrix/matrix.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/matrix/matrix.js +3 -0
- package/dist/esm/data-structures/matrix/matrix.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/matrix/navigator.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/matrix/navigator.js +3 -0
- package/dist/esm/data-structures/matrix/navigator.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/priority-queue/max-priority-queue.js +3 -0
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
- package/dist/{mjs → esm}/data-structures/priority-queue/min-priority-queue.js +3 -0
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/{mjs → esm}/data-structures/trie/trie.d.ts +0 -4
- package/dist/{mjs → esm}/data-structures/trie/trie.js +0 -4
- package/dist/esm/data-structures/trie/trie.js.map +1 -0
- package/dist/esm/interfaces/binary-tree.d.ts +9 -0
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js +2 -0
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js.map +1 -0
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -0
- package/dist/esm/types/data-structures/binary-tree/avl-tree.d.ts +2 -0
- package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-tree.d.ts +0 -3
- package/dist/{mjs → esm}/types/data-structures/binary-tree/bst.d.ts +3 -3
- package/dist/{mjs/data-structures/binary-tree/index.js → esm/types/data-structures/binary-tree/index.d.ts} +4 -4
- package/dist/{mjs → esm}/types/data-structures/binary-tree/index.js +3 -1
- package/dist/{mjs → esm}/types/data-structures/binary-tree/index.js.map +1 -1
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.d.ts +3 -0
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.js +2 -0
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.js.map +1 -0
- package/dist/esm/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/esm/types/data-structures/binary-tree/tree-counter.js +2 -0
- package/dist/esm/types/data-structures/binary-tree/tree-counter.js.map +1 -0
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -0
- package/dist/umd/data-structure-typed.js +1464 -895
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +14 -19
- package/src/data-structures/binary-tree/avl-tree-counter.ts +463 -0
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +155 -393
- package/src/data-structures/binary-tree/avl-tree.ts +144 -93
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -0
- package/src/data-structures/binary-tree/binary-tree.ts +433 -405
- package/src/data-structures/binary-tree/bst.ts +261 -239
- package/src/data-structures/binary-tree/index.ts +2 -0
- package/src/data-structures/binary-tree/red-black-tree.ts +163 -134
- package/src/data-structures/binary-tree/tree-counter.ts +504 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +161 -429
- package/src/data-structures/graph/directed-graph.ts +3 -0
- package/src/data-structures/graph/map-graph.ts +3 -0
- package/src/data-structures/graph/undirected-graph.ts +3 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +3 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +3 -0
- package/src/data-structures/matrix/matrix.ts +3 -0
- package/src/data-structures/matrix/navigator.ts +3 -0
- package/src/data-structures/priority-queue/max-priority-queue.ts +3 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +3 -0
- package/src/data-structures/trie/trie.ts +0 -4
- package/src/interfaces/binary-tree.ts +10 -24
- package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -6
- package/src/types/data-structures/binary-tree/avl-tree.ts +0 -5
- package/src/types/data-structures/binary-tree/binary-tree.ts +0 -5
- package/src/types/data-structures/binary-tree/bst.ts +5 -5
- package/src/types/data-structures/binary-tree/index.ts +3 -1
- package/src/types/data-structures/binary-tree/red-black-tree.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -7
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/integration/avl-tree.test.ts +1 -1
- package/test/integration/bst.test.ts +2 -2
- package/test/integration/compile.js +144 -0
- package/test/integration/compile.mjs +135 -0
- package/test/integration/compile.ts +171 -0
- package/test/integration/index.html +48 -48
- package/test/performance/data-structures/binary-tree/avl-tree.test.js +45 -0
- package/test/performance/data-structures/binary-tree/avl-tree.test.ts +4 -4
- package/test/performance/data-structures/binary-tree/rb-tree.test.ts +5 -4
- package/test/performance/data-structures/comparison/comparison.test.ts +2 -2
- package/test/performance/reportor.js +249 -0
- package/test/performance/reportor.ts +5 -3
- package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +877 -0
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +459 -761
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +223 -223
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +474 -492
- package/test/unit/data-structures/binary-tree/bst.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/overall.test.ts +0 -3
- package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +87 -90
- package/test/unit/data-structures/binary-tree/tree-counter.test.ts +975 -0
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +729 -857
- package/test/unit/data-structures/hash/hash-map.test.ts +1 -1
- package/{tsconfig-mjs.json → tsconfig-esm.json} +1 -1
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +0 -6
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +0 -189
- package/dist/mjs/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/mjs/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/mjs/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/mjs/data-structures/graph/map-graph.js.map +0 -1
- package/dist/mjs/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/mjs/data-structures/matrix/matrix.js.map +0 -1
- package/dist/mjs/data-structures/matrix/navigator.js.map +0 -1
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/mjs/data-structures/trie/trie.js.map +0 -1
- package/dist/mjs/interfaces/binary-tree.d.ts +0 -9
- package/dist/mjs/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -5
- package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +0 -5
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +0 -6
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.js +0 -2
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/mjs/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -5
- package/src/types/data-structures/binary-tree/rb-tree.ts +0 -10
- /package/dist/{mjs → esm}/common/index.d.ts +0 -0
- /package/dist/{mjs → esm}/common/index.js +0 -0
- /package/dist/{mjs → esm}/common/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/base/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/base/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/base/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/base/iterable-element-base.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/base/iterable-element-base.js +0 -0
- /package/dist/{mjs → esm}/data-structures/base/iterable-element-base.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/base/iterable-entry-base.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/base/iterable-entry-base.js +0 -0
- /package/dist/{mjs → esm}/data-structures/base/iterable-entry-base.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/binary-tree/segment-tree.js +0 -0
- /package/dist/{mjs → esm}/data-structures/binary-tree/segment-tree.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/graph/abstract-graph.js +0 -0
- /package/dist/{mjs → esm}/data-structures/graph/abstract-graph.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/graph/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/graph/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/graph/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/hash/hash-map.js +0 -0
- /package/dist/{mjs → esm}/data-structures/hash/hash-map.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/hash/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/hash/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/hash/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/heap.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/heap.js +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/heap.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/max-heap.js +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/max-heap.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/min-heap.js +0 -0
- /package/dist/{mjs → esm}/data-structures/heap/min-heap.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/linked-list/doubly-linked-list.js +0 -0
- /package/dist/{mjs → esm}/data-structures/linked-list/doubly-linked-list.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/linked-list/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/linked-list/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/matrix/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/matrix/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/priority-queue/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/priority-queue/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/priority-queue/priority-queue.js +0 -0
- /package/dist/{mjs → esm}/data-structures/priority-queue/priority-queue.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/deque.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/deque.js +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/deque.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/queue.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/queue.js +0 -0
- /package/dist/{mjs → esm}/data-structures/queue/queue.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/stack/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/stack/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/stack/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/stack/stack.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/stack/stack.js +0 -0
- /package/dist/{mjs → esm}/data-structures/stack/stack.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/tree/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/tree/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/tree/index.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/tree/tree.js +0 -0
- /package/dist/{mjs → esm}/data-structures/tree/tree.js.map +0 -0
- /package/dist/{mjs → esm}/data-structures/trie/index.d.ts +0 -0
- /package/dist/{mjs → esm}/data-structures/trie/index.js +0 -0
- /package/dist/{mjs → esm}/data-structures/trie/index.js.map +0 -0
- /package/dist/{mjs → esm}/index.d.ts +0 -0
- /package/dist/{mjs → esm}/index.js +0 -0
- /package/dist/{mjs → esm}/index.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/binary-tree.js +0 -0
- /package/dist/{mjs → esm}/interfaces/binary-tree.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/doubly-linked-list.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/doubly-linked-list.js +0 -0
- /package/dist/{mjs → esm}/interfaces/doubly-linked-list.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/graph.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/graph.js +0 -0
- /package/dist/{mjs → esm}/interfaces/graph.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/heap.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/heap.js +0 -0
- /package/dist/{mjs → esm}/interfaces/heap.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/index.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/index.js +0 -0
- /package/dist/{mjs → esm}/interfaces/index.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/navigator.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/navigator.js +0 -0
- /package/dist/{mjs → esm}/interfaces/navigator.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/priority-queue.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/priority-queue.js +0 -0
- /package/dist/{mjs → esm}/interfaces/priority-queue.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/segment-tree.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/segment-tree.js +0 -0
- /package/dist/{mjs → esm}/interfaces/segment-tree.js.map +0 -0
- /package/dist/{mjs → esm}/interfaces/singly-linked-list.d.ts +0 -0
- /package/dist/{mjs → esm}/interfaces/singly-linked-list.js +0 -0
- /package/dist/{mjs → esm}/interfaces/singly-linked-list.js.map +0 -0
- /package/dist/{mjs → esm}/types/common.d.ts +0 -0
- /package/dist/{mjs → esm}/types/common.js +0 -0
- /package/dist/{mjs → esm}/types/common.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/base/base.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/base/base.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/base/base.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/base/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/base/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/base/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/avl-tree.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-tree.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/binary-tree.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/bst.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/bst.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/segment-tree.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/segment-tree.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/tree-multi-map.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/tree-multi-map.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/abstract-graph.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/abstract-graph.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/directed-graph.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/directed-graph.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/map-graph.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/map-graph.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/undirected-graph.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/graph/undirected-graph.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/hash/hash-map.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/hash/hash-map.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/hash/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/hash/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/hash/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/heap.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/heap.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/heap.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/max-heap.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/max-heap.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/min-heap.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/heap/min-heap.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/doubly-linked-list.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/doubly-linked-list.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/singly-linked-list.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/singly-linked-list.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/skip-linked-list.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/linked-list/skip-linked-list.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/matrix.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/matrix.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/navigator.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/matrix/navigator.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/max-priority-queue.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/max-priority-queue.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/min-priority-queue.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/min-priority-queue.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/priority-queue.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/priority-queue/priority-queue.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/deque.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/deque.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/deque.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/queue.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/queue.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/queue/queue.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/stack/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/stack/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/stack/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/stack/stack.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/stack/stack.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/stack/stack.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/tree/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/tree/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/tree/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/tree/tree.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/tree/tree.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/trie/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/trie/index.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/trie/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/data-structures/trie/trie.d.ts +0 -0
- /package/dist/{mjs → esm}/types/data-structures/trie/trie.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/trie/trie.js.map +0 -0
- /package/dist/{mjs → esm}/types/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/index.js +0 -0
- /package/dist/{mjs → esm}/types/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/utils/index.d.ts +0 -0
- /package/dist/{mjs → esm}/types/utils/index.js +0 -0
- /package/dist/{mjs → esm}/types/utils/index.js.map +0 -0
- /package/dist/{mjs → esm}/types/utils/utils.d.ts +0 -0
- /package/dist/{mjs → esm}/types/utils/utils.js +0 -0
- /package/dist/{mjs → esm}/types/utils/utils.js.map +0 -0
- /package/dist/{mjs → esm}/types/utils/validate-type.d.ts +0 -0
- /package/dist/{mjs → esm}/types/utils/validate-type.js +0 -0
- /package/dist/{mjs → esm}/types/utils/validate-type.js.map +0 -0
- /package/dist/{mjs → esm}/utils/index.d.ts +0 -0
- /package/dist/{mjs → esm}/utils/index.js +0 -0
- /package/dist/{mjs → esm}/utils/index.js.map +0 -0
- /package/dist/{mjs → esm}/utils/number.d.ts +0 -0
- /package/dist/{mjs → esm}/utils/number.js +0 -0
- /package/dist/{mjs → esm}/utils/number.js.map +0 -0
- /package/dist/{mjs → esm}/utils/utils.d.ts +0 -0
- /package/dist/{mjs → esm}/utils/utils.js +0 -0
- /package/dist/{mjs → esm}/utils/utils.js.map +0 -0
|
@@ -59,6 +59,9 @@ export class SinglyLinkedListNode<E = any> {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
62
65
|
export class SinglyLinkedList<E = any, R = any> extends IterableElementBase<E, R, SinglyLinkedList<E, R>> {
|
|
63
66
|
constructor(
|
|
64
67
|
elements: Iterable<E> | Iterable<R> | Iterable<SinglyLinkedListNode<E>> = [],
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
import type { Comparator, ElementCallback, PriorityQueueOptions } from '../../types';
|
|
9
9
|
import { PriorityQueue } from './priority-queue';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
11
14
|
export class MaxPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
|
|
12
15
|
/**
|
|
13
16
|
* The constructor initializes a PriorityQueue with optional elements and options, including a
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
import type { Comparator, ElementCallback, PriorityQueueOptions } from '../../types';
|
|
9
9
|
import { PriorityQueue } from './priority-queue';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
11
14
|
export class MinPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
|
|
12
15
|
/**
|
|
13
16
|
* The constructor initializes a PriorityQueue with optional elements and options, including a
|
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
import type { ElementCallback, TrieOptions } from '../../types';
|
|
9
9
|
import { IterableElementBase } from '../base';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
13
|
-
* and a flag indicating whether it's the end of a word.
|
|
14
|
-
*/
|
|
15
11
|
export class TrieNode {
|
|
16
12
|
constructor(key: string) {
|
|
17
13
|
this._key = key;
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
BinaryTreeDeleteResult,
|
|
4
|
-
BinaryTreeNested,
|
|
5
|
-
BinaryTreeNodeNested,
|
|
6
|
-
BinaryTreeOptions,
|
|
7
|
-
BTNRep,
|
|
8
|
-
NodePredicate
|
|
9
|
-
} from '../types';
|
|
1
|
+
import { BinaryTreeNode } from '../data-structures';
|
|
2
|
+
import type { BinaryTreeDeleteResult, BinaryTreeOptions, BTNRep, NodePredicate } from '../types';
|
|
10
3
|
|
|
11
|
-
export interface IBinaryTree<
|
|
12
|
-
K
|
|
13
|
-
V = any,
|
|
14
|
-
R = object,
|
|
15
|
-
MK = any,
|
|
16
|
-
MV = any,
|
|
17
|
-
MR = object,
|
|
18
|
-
NODE extends BinaryTreeNode<K, V, NODE> = BinaryTreeNodeNested<K, V>,
|
|
19
|
-
TREE extends BinaryTree<K, V, R, MK, MV, MR, NODE, TREE> = BinaryTreeNested<K, V, R, MK, MV, MR, NODE>
|
|
20
|
-
> {
|
|
21
|
-
createNode(key: K, value?: NODE['value']): NODE;
|
|
4
|
+
export interface IBinaryTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> {
|
|
5
|
+
createNode(key: K, value?: BinaryTreeNode['value']): BinaryTreeNode;
|
|
22
6
|
|
|
23
|
-
createTree(options?: Partial<BinaryTreeOptions<K, V, R>>):
|
|
7
|
+
createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): IBinaryTree<K, V, R, MK, MV, MR>;
|
|
24
8
|
|
|
25
|
-
add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V,
|
|
9
|
+
add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V, BinaryTreeNode<K, V>>, value?: V, count?: number): boolean;
|
|
26
10
|
|
|
27
|
-
addMany(nodes: Iterable<BTNRep<K, V,
|
|
11
|
+
addMany(nodes: Iterable<BTNRep<K, V, BinaryTreeNode<K, V>>>, values?: Iterable<V | undefined>): boolean[];
|
|
28
12
|
|
|
29
|
-
delete(
|
|
13
|
+
delete(
|
|
14
|
+
predicate: R | BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V>>
|
|
15
|
+
): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
|
|
30
16
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
|
|
2
1
|
import type { AVLTreeOptions } from './avl-tree';
|
|
3
2
|
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
export type AVLTreeMultiMapNested<K, V, R, MK, MV, MR, NODE extends AVLTreeMultiMapNode<K, V, NODE>> = AVLTreeMultiMap<K, V, R, MK, MV, MR, NODE, AVLTreeMultiMap<K, V, R, MK, MV, MR, NODE, AVLTreeMultiMap<K, V, R, MK, MV, MR, NODE, any>>>
|
|
7
|
-
|
|
8
|
-
export type AVLTreeMultiMapOptions<K, V, R> = AVLTreeOptions<K, V, R> & {}
|
|
3
|
+
export type AVLTreeMultiMapOptions<K, V, R> = Omit<AVLTreeOptions<K, V, R>, 'isMapMode'> & {}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { AVLTree, AVLTreeNode } from '../../../data-structures';
|
|
2
1
|
import { BSTOptions } from './bst';
|
|
3
2
|
|
|
4
|
-
export type AVLTreeNodeNested<K, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, any>>>
|
|
5
|
-
|
|
6
|
-
export type AVLTreeNested<K, V, R,MK, MV, MR, NODE extends AVLTreeNode<K, V, NODE>> = AVLTree<K, V, R,MK, MV, MR, NODE, AVLTree<K, V, R,MK, MV, MR, NODE, AVLTree<K, V, R,MK, MV, MR, NODE, any>>>
|
|
7
|
-
|
|
8
3
|
export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
|
|
2
1
|
import { IterationType, OptValue } from '../../common';
|
|
3
2
|
import { DFSOperation } from '../../../common';
|
|
4
3
|
|
|
5
|
-
export type BinaryTreeNodeNested<K, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>
|
|
6
|
-
|
|
7
|
-
export type BinaryTreeNested<K, V, R, MK, MV, MR, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, R, MK, MV, MR, NODE,BinaryTree<K, V, R, MK, MV, MR, NODE,BinaryTree<K, V, R, MK, MV, MR, NODE,any>>>
|
|
8
|
-
|
|
9
4
|
export type ToEntryFn<K, V, R> = (rawElement: R) => BTNEntry<K, V>;
|
|
10
5
|
|
|
11
6
|
export type BinaryTreeOptions<K, V, R> = {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { BST, BSTNode } from '../../../data-structures';
|
|
2
1
|
import type { BinaryTreeOptions } from './binary-tree';
|
|
3
2
|
import { Comparable } from '../../utils';
|
|
4
|
-
|
|
5
|
-
export type BSTNodeNested<K, V> = BSTNode<K, V, BSTNode<K, V, BSTNode<K, V, any>>>
|
|
6
|
-
|
|
7
|
-
export type BSTNested<K, V, R,MK, MV, MR, NODE extends BSTNode<K, V, NODE>> = BST<K, V, R,MK, MV, MR, NODE,BST<K, V, R,MK, MV, MR, NODE,BST<K, V, R,MK, MV, MR, NODE, any>>>
|
|
3
|
+
import { OptValue } from '../../common';
|
|
8
4
|
|
|
9
5
|
export type BSTOptions<K, V, R> = BinaryTreeOptions<K, V, R> & {
|
|
10
6
|
specifyComparable?: (key: K) => Comparable
|
|
@@ -15,5 +11,9 @@ export type BSTNOptKey<K> = K | undefined;
|
|
|
15
11
|
|
|
16
12
|
export type OptNode<NODE> = NODE | undefined;
|
|
17
13
|
|
|
14
|
+
export type BSTNEntry<K, V> = [BSTNOptKey<K>, OptValue<V>];
|
|
15
|
+
|
|
18
16
|
export type BSTNOptKeyOrNode<K, NODE> = BSTNOptKey<K> | NODE;
|
|
19
17
|
|
|
18
|
+
export type BSTNRep<K, V, NODE> = BSTNEntry<K, V> | BSTNOptKeyOrNode<K, NODE>;
|
|
19
|
+
|
|
@@ -3,5 +3,7 @@ export * from './bst';
|
|
|
3
3
|
export * from './avl-tree';
|
|
4
4
|
export * from './segment-tree';
|
|
5
5
|
export * from './avl-tree-multi-map';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './red-black-tree';
|
|
7
7
|
export * from './tree-multi-map';
|
|
8
|
+
export * from './tree-counter';
|
|
9
|
+
export * from './avl-tree-counter';
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { RedBlackTreeOptions } from './rb-tree';
|
|
1
|
+
import type { RedBlackTreeOptions } from './red-black-tree';
|
|
3
2
|
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
export type TreeMultiMapNested<K, V, R, MK, MV, MR, NODE extends TreeMultiMapNode<K, V, NODE>> = TreeMultiMap<K, V, R, MK, MV, MR, NODE, TreeMultiMap<K, V, R, MK, MV, MR, NODE,TreeMultiMap<K, V, R, MK, MV, MR, NODE, any>>>
|
|
7
|
-
|
|
8
|
-
export type TreeMultiMapOptions<K, V, R> = RedBlackTreeOptions<K, V, R> & {}
|
|
3
|
+
export type TreeMultiMapOptions<K, V, R> = Omit<RedBlackTreeOptions<K, V, R>, 'isMapMode'> & {}
|
|
@@ -3,7 +3,7 @@ import { AVLTree } from 'data-structure-typed';
|
|
|
3
3
|
describe('AVL Tree Test from data-structure-typed', () => {
|
|
4
4
|
it('should perform various operations on a AVL Tree from data-structure-typed', () => {
|
|
5
5
|
const keys = [11, 3, 15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5];
|
|
6
|
-
const tree = new AVLTree<number>();
|
|
6
|
+
const tree = new AVLTree<number>([], { isMapMode: false });
|
|
7
7
|
|
|
8
8
|
for (const i of keys) tree.add([i, i]);
|
|
9
9
|
|
|
@@ -48,7 +48,7 @@ describe('AVL Tree Test', () => {
|
|
|
48
48
|
expect(lesserSum).toBe(45);
|
|
49
49
|
|
|
50
50
|
// node15 has type problem. After the uniform design, the generics of containers (DirectedGraph, BST) are based on the type of value. However, this design has a drawback: when I attempt to inherit from the Vertex or BSTNode classes, the types of the results obtained by all methods are those of the parent class.
|
|
51
|
-
expect(node15?.value).toBe(
|
|
51
|
+
expect(node15?.value).toBe(undefined);
|
|
52
52
|
|
|
53
53
|
const dfs = tree.dfs(node => node, 'IN');
|
|
54
54
|
expect(dfs[0].key).toBe(1);
|
|
@@ -27,7 +27,7 @@ describe('Individual package BST operations test', () => {
|
|
|
27
27
|
expect(nodeVal9?.key).toBe(undefined);
|
|
28
28
|
|
|
29
29
|
const nodeVal11 = bst.getNode(node => node.value === 11);
|
|
30
|
-
expect(nodeVal11?.key).toBe(
|
|
30
|
+
expect(nodeVal11?.key).toBe(undefined);
|
|
31
31
|
|
|
32
32
|
const leftMost = bst.getLeftMost(node => node);
|
|
33
33
|
expect(leftMost?.key).toBe(1);
|
|
@@ -186,7 +186,7 @@ describe('Individual package BST operations test', () => {
|
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
it('should perform various operations on a Binary Search Tree with object values', () => {
|
|
189
|
-
const objBST = new BST<number, { key: number; keyA: number }>();
|
|
189
|
+
const objBST = new BST<number, { key: number; keyA: number }>([], { isMapMode: false });
|
|
190
190
|
expect(objBST).toBeInstanceOf(BST);
|
|
191
191
|
objBST.add([11, { key: 11, keyA: 11 }]);
|
|
192
192
|
objBST.add([3, { key: 3, keyA: 3 }]);
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
var data_structure_typed_1 = require('data-structure-typed');
|
|
4
|
+
|
|
5
|
+
var orgArr = [6, 1, 2, 7, 5, 3, 4, 9, 8];
|
|
6
|
+
var orgStrArr = ['trie', 'trial', 'trick', 'trip', 'tree', 'trend', 'triangle', 'track', 'trace', 'transmit'];
|
|
7
|
+
var entries = [
|
|
8
|
+
[6, '6'],
|
|
9
|
+
[1, '1'],
|
|
10
|
+
[2, '2'],
|
|
11
|
+
[7, '7'],
|
|
12
|
+
[5, '5'],
|
|
13
|
+
[3, '3'],
|
|
14
|
+
[4, '4'],
|
|
15
|
+
[9, '9'],
|
|
16
|
+
[8, '8']
|
|
17
|
+
];
|
|
18
|
+
var queue = new data_structure_typed_1.Queue(orgArr);
|
|
19
|
+
queue.print();
|
|
20
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
21
|
+
var deque = new data_structure_typed_1.Deque(orgArr);
|
|
22
|
+
deque.print();
|
|
23
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
24
|
+
var sList = new data_structure_typed_1.SinglyLinkedList(orgArr);
|
|
25
|
+
sList.print();
|
|
26
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
27
|
+
var dList = new data_structure_typed_1.DoublyLinkedList(orgArr);
|
|
28
|
+
dList.print();
|
|
29
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
30
|
+
var stack = new data_structure_typed_1.Stack(orgArr);
|
|
31
|
+
stack.print();
|
|
32
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
33
|
+
var minHeap = new data_structure_typed_1.MinHeap(orgArr);
|
|
34
|
+
minHeap.print();
|
|
35
|
+
// [1, 5, 2, 7, 6, 3, 4, 9, 8]
|
|
36
|
+
var maxPQ = new data_structure_typed_1.MaxPriorityQueue(orgArr);
|
|
37
|
+
maxPQ.print();
|
|
38
|
+
// [9, 8, 4, 7, 5, 2, 3, 1, 6]
|
|
39
|
+
var biTree = new data_structure_typed_1.BinaryTree(entries);
|
|
40
|
+
biTree.print();
|
|
41
|
+
// ___6___
|
|
42
|
+
// / \
|
|
43
|
+
// ___1_ _2_
|
|
44
|
+
// / \ / \
|
|
45
|
+
// _7_ 5 3 4
|
|
46
|
+
// / \
|
|
47
|
+
// 9 8
|
|
48
|
+
var bst = new data_structure_typed_1.BST(entries);
|
|
49
|
+
bst.print();
|
|
50
|
+
// _____5___
|
|
51
|
+
// / \
|
|
52
|
+
// _2_ _7_
|
|
53
|
+
// / \ / \
|
|
54
|
+
// 1 3_ 6 8_
|
|
55
|
+
// \ \
|
|
56
|
+
// 4 9
|
|
57
|
+
var rbTree = new data_structure_typed_1.RedBlackTree(entries);
|
|
58
|
+
rbTree.print();
|
|
59
|
+
// ___4___
|
|
60
|
+
// / \
|
|
61
|
+
// _2_ _6___
|
|
62
|
+
// / \ / \
|
|
63
|
+
// 1 3 5 _8_
|
|
64
|
+
// / \
|
|
65
|
+
// 7 9
|
|
66
|
+
var avl = new data_structure_typed_1.AVLTree(entries);
|
|
67
|
+
avl.print();
|
|
68
|
+
// ___4___
|
|
69
|
+
// / \
|
|
70
|
+
// _2_ _6___
|
|
71
|
+
// / \ / \
|
|
72
|
+
// 1 3 5 _8_
|
|
73
|
+
// / \
|
|
74
|
+
// 7 9
|
|
75
|
+
var treeMulti = new data_structure_typed_1.TreeMultiMap(entries);
|
|
76
|
+
treeMulti.print();
|
|
77
|
+
// ___4___
|
|
78
|
+
// / \
|
|
79
|
+
// _2_ _6___
|
|
80
|
+
// / \ / \
|
|
81
|
+
// 1 3 5 _8_
|
|
82
|
+
// / \
|
|
83
|
+
// 7 9
|
|
84
|
+
var hm = new data_structure_typed_1.HashMap(entries);
|
|
85
|
+
hm.print();
|
|
86
|
+
// [[6, "6"], [1, "1"], [2, "2"], [7, "7"], [5, "5"], [3, "3"], [4, "4"], [9, "9"], [8, "8"]]
|
|
87
|
+
var rbTreeH = new data_structure_typed_1.RedBlackTree(hm);
|
|
88
|
+
rbTreeH.print();
|
|
89
|
+
// ___4___
|
|
90
|
+
// / \
|
|
91
|
+
// _2_ _6___
|
|
92
|
+
// / \ / \
|
|
93
|
+
// 1 3 5 _8_
|
|
94
|
+
// / \
|
|
95
|
+
// 7 9
|
|
96
|
+
var pq = new data_structure_typed_1.MinPriorityQueue(orgArr);
|
|
97
|
+
pq.print();
|
|
98
|
+
// [1, 5, 2, 7, 6, 3, 4, 9, 8]
|
|
99
|
+
var bst1 = new data_structure_typed_1.BST(pq);
|
|
100
|
+
bst1.print();
|
|
101
|
+
// _____5___
|
|
102
|
+
// / \
|
|
103
|
+
// _2_ _7_
|
|
104
|
+
// / \ / \
|
|
105
|
+
// 1 3_ 6 8_
|
|
106
|
+
// \ \
|
|
107
|
+
// 4 9
|
|
108
|
+
var dq1 = new data_structure_typed_1.Deque(orgArr);
|
|
109
|
+
dq1.print();
|
|
110
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
111
|
+
var rbTree1 = new data_structure_typed_1.RedBlackTree(dq1);
|
|
112
|
+
rbTree1.print();
|
|
113
|
+
// _____5___
|
|
114
|
+
// / \
|
|
115
|
+
// _2___ _7___
|
|
116
|
+
// / \ / \
|
|
117
|
+
// 1 _4 6 _9
|
|
118
|
+
// / /
|
|
119
|
+
// 3 8
|
|
120
|
+
var trie2 = new data_structure_typed_1.Trie(orgStrArr);
|
|
121
|
+
trie2.print();
|
|
122
|
+
// ['trie', 'trial', 'triangle', 'trick', 'trip', 'tree', 'trend', 'track', 'trace', 'transmit']
|
|
123
|
+
var heap2 = new data_structure_typed_1.Heap(trie2, {
|
|
124
|
+
comparator: function (a, b) {
|
|
125
|
+
return Number(a) - Number(b);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
heap2.print();
|
|
129
|
+
// ['transmit', 'trace', 'tree', 'trend', 'track', 'trial', 'trip', 'trie', 'trick', 'triangle']
|
|
130
|
+
var dq2 = new data_structure_typed_1.Deque(heap2);
|
|
131
|
+
dq2.print();
|
|
132
|
+
// ['transmit', 'trace', 'tree', 'trend', 'track', 'trial', 'trip', 'trie', 'trick', 'triangle']
|
|
133
|
+
var entries2 = dq2.map(function (el, i) {
|
|
134
|
+
return [i, el];
|
|
135
|
+
});
|
|
136
|
+
var avl2 = new data_structure_typed_1.AVLTree(entries2);
|
|
137
|
+
avl2.print();
|
|
138
|
+
// ___3_______
|
|
139
|
+
// / \
|
|
140
|
+
// _1_ ___7_
|
|
141
|
+
// / \ / \
|
|
142
|
+
// 0 2 _5_ 8_
|
|
143
|
+
// / \ \
|
|
144
|
+
// 4 6 9
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { AVLTree, BinaryTree, BST, Deque, DoublyLinkedList, HashMap, Heap, MaxPriorityQueue, MinHeap, MinPriorityQueue, Queue, RedBlackTree, SinglyLinkedList, Stack, TreeMultiMap, Trie } from 'data-structure-typed';
|
|
2
|
+
const orgArr = [6, 1, 2, 7, 5, 3, 4, 9, 8];
|
|
3
|
+
const orgStrArr = ['trie', 'trial', 'trick', 'trip', 'tree', 'trend', 'triangle', 'track', 'trace', 'transmit'];
|
|
4
|
+
const entries = [
|
|
5
|
+
[6, '6'],
|
|
6
|
+
[1, '1'],
|
|
7
|
+
[2, '2'],
|
|
8
|
+
[7, '7'],
|
|
9
|
+
[5, '5'],
|
|
10
|
+
[3, '3'],
|
|
11
|
+
[4, '4'],
|
|
12
|
+
[9, '9'],
|
|
13
|
+
[8, '8']
|
|
14
|
+
];
|
|
15
|
+
const queue = new Queue(orgArr);
|
|
16
|
+
queue.print();
|
|
17
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
18
|
+
const deque = new Deque(orgArr);
|
|
19
|
+
deque.print();
|
|
20
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
21
|
+
const sList = new SinglyLinkedList(orgArr);
|
|
22
|
+
sList.print();
|
|
23
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
24
|
+
const dList = new DoublyLinkedList(orgArr);
|
|
25
|
+
dList.print();
|
|
26
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
27
|
+
const stack = new Stack(orgArr);
|
|
28
|
+
stack.print();
|
|
29
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
30
|
+
const minHeap = new MinHeap(orgArr);
|
|
31
|
+
minHeap.print();
|
|
32
|
+
// [1, 5, 2, 7, 6, 3, 4, 9, 8]
|
|
33
|
+
const maxPQ = new MaxPriorityQueue(orgArr);
|
|
34
|
+
maxPQ.print();
|
|
35
|
+
// [9, 8, 4, 7, 5, 2, 3, 1, 6]
|
|
36
|
+
const biTree = new BinaryTree(entries);
|
|
37
|
+
biTree.print();
|
|
38
|
+
// ___6___
|
|
39
|
+
// / \
|
|
40
|
+
// ___1_ _2_
|
|
41
|
+
// / \ / \
|
|
42
|
+
// _7_ 5 3 4
|
|
43
|
+
// / \
|
|
44
|
+
// 9 8
|
|
45
|
+
const bst = new BST(entries);
|
|
46
|
+
bst.print();
|
|
47
|
+
// _____5___
|
|
48
|
+
// / \
|
|
49
|
+
// _2_ _7_
|
|
50
|
+
// / \ / \
|
|
51
|
+
// 1 3_ 6 8_
|
|
52
|
+
// \ \
|
|
53
|
+
// 4 9
|
|
54
|
+
const rbTree = new RedBlackTree(entries);
|
|
55
|
+
rbTree.print();
|
|
56
|
+
// ___4___
|
|
57
|
+
// / \
|
|
58
|
+
// _2_ _6___
|
|
59
|
+
// / \ / \
|
|
60
|
+
// 1 3 5 _8_
|
|
61
|
+
// / \
|
|
62
|
+
// 7 9
|
|
63
|
+
const avl = new AVLTree(entries);
|
|
64
|
+
avl.print();
|
|
65
|
+
// ___4___
|
|
66
|
+
// / \
|
|
67
|
+
// _2_ _6___
|
|
68
|
+
// / \ / \
|
|
69
|
+
// 1 3 5 _8_
|
|
70
|
+
// / \
|
|
71
|
+
// 7 9
|
|
72
|
+
const treeMulti = new TreeMultiMap(entries);
|
|
73
|
+
treeMulti.print();
|
|
74
|
+
// ___4___
|
|
75
|
+
// / \
|
|
76
|
+
// _2_ _6___
|
|
77
|
+
// / \ / \
|
|
78
|
+
// 1 3 5 _8_
|
|
79
|
+
// / \
|
|
80
|
+
// 7 9
|
|
81
|
+
const hm = new HashMap(entries);
|
|
82
|
+
hm.print();
|
|
83
|
+
// [[6, "6"], [1, "1"], [2, "2"], [7, "7"], [5, "5"], [3, "3"], [4, "4"], [9, "9"], [8, "8"]]
|
|
84
|
+
const rbTreeH = new RedBlackTree(hm);
|
|
85
|
+
rbTreeH.print();
|
|
86
|
+
// ___4___
|
|
87
|
+
// / \
|
|
88
|
+
// _2_ _6___
|
|
89
|
+
// / \ / \
|
|
90
|
+
// 1 3 5 _8_
|
|
91
|
+
// / \
|
|
92
|
+
// 7 9
|
|
93
|
+
const pq = new MinPriorityQueue(orgArr);
|
|
94
|
+
pq.print();
|
|
95
|
+
// [1, 5, 2, 7, 6, 3, 4, 9, 8]
|
|
96
|
+
const bst1 = new BST(pq);
|
|
97
|
+
bst1.print();
|
|
98
|
+
// _____5___
|
|
99
|
+
// / \
|
|
100
|
+
// _2_ _7_
|
|
101
|
+
// / \ / \
|
|
102
|
+
// 1 3_ 6 8_
|
|
103
|
+
// \ \
|
|
104
|
+
// 4 9
|
|
105
|
+
const dq1 = new Deque(orgArr);
|
|
106
|
+
dq1.print();
|
|
107
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
108
|
+
const rbTree1 = new RedBlackTree(dq1);
|
|
109
|
+
rbTree1.print();
|
|
110
|
+
// _____5___
|
|
111
|
+
// / \
|
|
112
|
+
// _2___ _7___
|
|
113
|
+
// / \ / \
|
|
114
|
+
// 1 _4 6 _9
|
|
115
|
+
// / /
|
|
116
|
+
// 3 8
|
|
117
|
+
const trie2 = new Trie(orgStrArr);
|
|
118
|
+
trie2.print();
|
|
119
|
+
// ['trie', 'trial', 'triangle', 'trick', 'trip', 'tree', 'trend', 'track', 'trace', 'transmit']
|
|
120
|
+
const heap2 = new Heap(trie2, { comparator: (a, b) => Number(a) - Number(b) });
|
|
121
|
+
heap2.print();
|
|
122
|
+
// ['transmit', 'trace', 'tree', 'trend', 'track', 'trial', 'trip', 'trie', 'trick', 'triangle']
|
|
123
|
+
const dq2 = new Deque(heap2);
|
|
124
|
+
dq2.print();
|
|
125
|
+
// ['transmit', 'trace', 'tree', 'trend', 'track', 'trial', 'trip', 'trie', 'trick', 'triangle']
|
|
126
|
+
const entries2 = dq2.map((el, i) => [i, el]);
|
|
127
|
+
const avl2 = new AVLTree(entries2);
|
|
128
|
+
avl2.print();
|
|
129
|
+
// ___3_______
|
|
130
|
+
// / \
|
|
131
|
+
// _1_ ___7_
|
|
132
|
+
// / \ / \
|
|
133
|
+
// 0 2 _5_ 8_
|
|
134
|
+
// / \ \
|
|
135
|
+
// 4 6 9
|