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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data-structure-typed
|
|
3
|
+
*
|
|
4
|
+
* @author Pablo Zeng
|
|
5
|
+
* @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
6
|
+
* @license MIT License
|
|
7
|
+
*/
|
|
8
|
+
import { AVLTreeMultiMapOptions, BTNRep, OptNodeOrNull } from '../../types';
|
|
9
|
+
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
10
|
+
import { IBinaryTree } from '../../interfaces';
|
|
11
|
+
export declare class AVLTreeMultiMapNode<K = any, V = any> extends AVLTreeNode<K, V[]> {
|
|
12
|
+
/**
|
|
13
|
+
* This TypeScript constructor initializes an object with a key of type K and an array of values of
|
|
14
|
+
* type V.
|
|
15
|
+
* @param {K} key - The `key` parameter is typically used to store a unique identifier or key for the
|
|
16
|
+
* data being stored in the data structure. It helps in quickly accessing or retrieving the
|
|
17
|
+
* associated value in the data structure.
|
|
18
|
+
* @param {V[]} value - The `value` parameter in the constructor represents an array of values of
|
|
19
|
+
* type `V`.
|
|
20
|
+
*/
|
|
21
|
+
constructor(key: K, value: V[]);
|
|
22
|
+
parent?: AVLTreeMultiMapNode<K, V>;
|
|
23
|
+
_left?: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
|
|
24
|
+
get left(): OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
|
|
25
|
+
set left(v: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>);
|
|
26
|
+
_right?: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
|
|
27
|
+
get right(): OptNodeOrNull<AVLTreeMultiMapNode<K, V>>;
|
|
28
|
+
set right(v: OptNodeOrNull<AVLTreeMultiMapNode<K, V>>);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends AVLTree<K, V[], R, MK, MV[], MR> implements IBinaryTree<K, V[], R, MK, MV, MR> {
|
|
34
|
+
/**
|
|
35
|
+
* The constructor initializes an AVLTreeMultiMap with the provided keys, nodes, entries, or raw data
|
|
36
|
+
* and options.
|
|
37
|
+
* @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
|
|
38
|
+
* iterable that can contain either key-value pairs represented as `BTNRep<K, V[],
|
|
39
|
+
* AVLTreeMultiMapNode<K, V>>` or raw data represented as `R`. This parameter is used to initialize
|
|
40
|
+
* the AVLTreeMulti
|
|
41
|
+
* @param [options] - The `options` parameter in the constructor is of type
|
|
42
|
+
* `AVLTreeMultiMapOptions<K, V[], R>`. It is an optional parameter that allows you to specify
|
|
43
|
+
* additional options for configuring the AVLTreeMultiMap instance.
|
|
44
|
+
*/
|
|
45
|
+
constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | R>, options?: AVLTreeMultiMapOptions<K, V[], R>);
|
|
46
|
+
/**
|
|
47
|
+
* Time Complexity: O(1)
|
|
48
|
+
* Space Complexity: O(1)
|
|
49
|
+
*
|
|
50
|
+
* The function `createTree` in TypeScript overrides the creation of an AVLTreeMultiMap with
|
|
51
|
+
* specified options.
|
|
52
|
+
* @param [options] - The `options` parameter in the `createTree` function is of type
|
|
53
|
+
* `AVLTreeMultiMapOptions<K, V[], R>`. This means it is an object that can have properties of type
|
|
54
|
+
* `K`, `V[]`, and `R`. The function creates a new `AVL
|
|
55
|
+
* @returns The `createTree` method is returning a new instance of `AVLTreeMultiMap` with the
|
|
56
|
+
* provided options.
|
|
57
|
+
*/
|
|
58
|
+
createTree(options?: AVLTreeMultiMapOptions<K, V[], R>): AVLTreeMultiMap<K, V, R, MK, MV, MR>;
|
|
59
|
+
/**
|
|
60
|
+
* Time Complexity: O(1)
|
|
61
|
+
* Space Complexity: O(1)
|
|
62
|
+
*
|
|
63
|
+
* The function `createNode` overrides the method to create a new AVLTreeMultiMapNode with a
|
|
64
|
+
* specified key and an empty array of values.
|
|
65
|
+
* @param {K} key - The `key` parameter in the `createNode` method represents the key of the node
|
|
66
|
+
* that will be created in the AVLTreeMultiMap.
|
|
67
|
+
* @returns An AVLTreeMultiMapNode object is being returned, initialized with the provided key and an
|
|
68
|
+
* empty array.
|
|
69
|
+
*/
|
|
70
|
+
createNode(key: K): AVLTreeMultiMapNode<K, V>;
|
|
71
|
+
add(node: BTNRep<K, V[], AVLTreeMultiMapNode<K, V>>): boolean;
|
|
72
|
+
add(key: K, value: V): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Time Complexity: O(log n)
|
|
75
|
+
* Space Complexity: O(log n)
|
|
76
|
+
*
|
|
77
|
+
* The function `deleteValue` removes a specific value from a key in an AVLTreeMultiMap data
|
|
78
|
+
* structure and deletes the entire node if no values are left for that key.
|
|
79
|
+
* @param {BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
80
|
+
* parameter in the `deleteValue` function can be either a `BTNRep` object representing a key-value
|
|
81
|
+
* pair in the AVLTreeMultiMapNode, or just the key itself.
|
|
82
|
+
* @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
|
|
83
|
+
* value that you want to delete from the multi-map data structure associated with a particular key.
|
|
84
|
+
* The function checks if the value exists in the array of values associated with the key, and if
|
|
85
|
+
* found, removes it from the array.
|
|
86
|
+
* @returns The `deleteValue` function returns a boolean value. It returns `true` if the specified
|
|
87
|
+
* `value` was successfully deleted from the array of values associated with the `keyNodeOrEntry`. If
|
|
88
|
+
* the value was not found in the array, it returns `false`.
|
|
89
|
+
*/
|
|
90
|
+
deleteValue(keyNodeOrEntry: BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K, value: V): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Time Complexity: O(n)
|
|
93
|
+
* Space Complexity: O(n)
|
|
94
|
+
*
|
|
95
|
+
* The function `clone` overrides the default cloning behavior to create a deep copy of a tree
|
|
96
|
+
* structure.
|
|
97
|
+
* @returns A cloned tree object is being returned.
|
|
98
|
+
*/
|
|
99
|
+
clone(): AVLTreeMultiMap<K, V, R, MK, MV, MR>;
|
|
100
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
2
|
+
export class AVLTreeMultiMapNode extends AVLTreeNode {
|
|
3
|
+
/**
|
|
4
|
+
* This TypeScript constructor initializes an object with a key of type K and an array of values of
|
|
5
|
+
* type V.
|
|
6
|
+
* @param {K} key - The `key` parameter is typically used to store a unique identifier or key for the
|
|
7
|
+
* data being stored in the data structure. It helps in quickly accessing or retrieving the
|
|
8
|
+
* associated value in the data structure.
|
|
9
|
+
* @param {V[]} value - The `value` parameter in the constructor represents an array of values of
|
|
10
|
+
* type `V`.
|
|
11
|
+
*/
|
|
12
|
+
constructor(key, value) {
|
|
13
|
+
super(key, value);
|
|
14
|
+
}
|
|
15
|
+
parent = undefined;
|
|
16
|
+
_left = undefined;
|
|
17
|
+
get left() {
|
|
18
|
+
return this._left;
|
|
19
|
+
}
|
|
20
|
+
set left(v) {
|
|
21
|
+
if (v) {
|
|
22
|
+
v.parent = this;
|
|
23
|
+
}
|
|
24
|
+
this._left = v;
|
|
25
|
+
}
|
|
26
|
+
_right = undefined;
|
|
27
|
+
get right() {
|
|
28
|
+
return this._right;
|
|
29
|
+
}
|
|
30
|
+
set right(v) {
|
|
31
|
+
if (v) {
|
|
32
|
+
v.parent = this;
|
|
33
|
+
}
|
|
34
|
+
this._right = v;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
export class AVLTreeMultiMap extends AVLTree {
|
|
41
|
+
/**
|
|
42
|
+
* The constructor initializes an AVLTreeMultiMap with the provided keys, nodes, entries, or raw data
|
|
43
|
+
* and options.
|
|
44
|
+
* @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
|
|
45
|
+
* iterable that can contain either key-value pairs represented as `BTNRep<K, V[],
|
|
46
|
+
* AVLTreeMultiMapNode<K, V>>` or raw data represented as `R`. This parameter is used to initialize
|
|
47
|
+
* the AVLTreeMulti
|
|
48
|
+
* @param [options] - The `options` parameter in the constructor is of type
|
|
49
|
+
* `AVLTreeMultiMapOptions<K, V[], R>`. It is an optional parameter that allows you to specify
|
|
50
|
+
* additional options for configuring the AVLTreeMultiMap instance.
|
|
51
|
+
*/
|
|
52
|
+
constructor(keysNodesEntriesOrRaws = [], options) {
|
|
53
|
+
super([], { ...options, isMapMode: true });
|
|
54
|
+
if (keysNodesEntriesOrRaws) {
|
|
55
|
+
this.addMany(keysNodesEntriesOrRaws);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Time Complexity: O(1)
|
|
60
|
+
* Space Complexity: O(1)
|
|
61
|
+
*
|
|
62
|
+
* The function `createTree` in TypeScript overrides the creation of an AVLTreeMultiMap with
|
|
63
|
+
* specified options.
|
|
64
|
+
* @param [options] - The `options` parameter in the `createTree` function is of type
|
|
65
|
+
* `AVLTreeMultiMapOptions<K, V[], R>`. This means it is an object that can have properties of type
|
|
66
|
+
* `K`, `V[]`, and `R`. The function creates a new `AVL
|
|
67
|
+
* @returns The `createTree` method is returning a new instance of `AVLTreeMultiMap` with the
|
|
68
|
+
* provided options.
|
|
69
|
+
*/
|
|
70
|
+
createTree(options) {
|
|
71
|
+
return new AVLTreeMultiMap([], {
|
|
72
|
+
iterationType: this.iterationType,
|
|
73
|
+
specifyComparable: this._specifyComparable,
|
|
74
|
+
toEntryFn: this._toEntryFn,
|
|
75
|
+
isReverse: this._isReverse,
|
|
76
|
+
...options
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Time Complexity: O(1)
|
|
81
|
+
* Space Complexity: O(1)
|
|
82
|
+
*
|
|
83
|
+
* The function `createNode` overrides the method to create a new AVLTreeMultiMapNode with a
|
|
84
|
+
* specified key and an empty array of values.
|
|
85
|
+
* @param {K} key - The `key` parameter in the `createNode` method represents the key of the node
|
|
86
|
+
* that will be created in the AVLTreeMultiMap.
|
|
87
|
+
* @returns An AVLTreeMultiMapNode object is being returned, initialized with the provided key and an
|
|
88
|
+
* empty array.
|
|
89
|
+
*/
|
|
90
|
+
createNode(key) {
|
|
91
|
+
return new AVLTreeMultiMapNode(key, []);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Time Complexity: O(log n)
|
|
95
|
+
* Space Complexity: O(log n)
|
|
96
|
+
*
|
|
97
|
+
* The function `add` in TypeScript overrides the superclass method to add key-value pairs to an AVL
|
|
98
|
+
* tree multi-map.
|
|
99
|
+
* @param {BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
100
|
+
* parameter in the `override add` method can be either a key-value pair entry or just a key. If it
|
|
101
|
+
* is a key-value pair entry, it will be in the format `[key, values]`, where `key` is the key and
|
|
102
|
+
* `values`
|
|
103
|
+
* @param {V} [value] - The `value` parameter in the `override add` method represents the value that
|
|
104
|
+
* you want to add to the AVLTreeMultiMap. It can be a single value or an array of values associated
|
|
105
|
+
* with a specific key.
|
|
106
|
+
* @returns The `override add` method is returning a boolean value, which indicates whether the
|
|
107
|
+
* addition operation was successful or not.
|
|
108
|
+
*/
|
|
109
|
+
add(keyNodeOrEntry, value) {
|
|
110
|
+
if (this.isRealNode(keyNodeOrEntry))
|
|
111
|
+
return super.add(keyNodeOrEntry);
|
|
112
|
+
const _commonAdd = (key, values) => {
|
|
113
|
+
if (key === undefined || key === null)
|
|
114
|
+
return false;
|
|
115
|
+
const existingValues = this.get(key);
|
|
116
|
+
if (existingValues !== undefined && values !== undefined) {
|
|
117
|
+
for (const value of values)
|
|
118
|
+
existingValues.push(value);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
const existingNode = this.getNode(key);
|
|
122
|
+
if (this.isRealNode(existingNode)) {
|
|
123
|
+
if (existingValues === undefined) {
|
|
124
|
+
super.add(key, values);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (values !== undefined) {
|
|
128
|
+
for (const value of values)
|
|
129
|
+
existingValues.push(value);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return super.add(key, values);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
if (this.isEntry(keyNodeOrEntry)) {
|
|
141
|
+
const [key, values] = keyNodeOrEntry;
|
|
142
|
+
return _commonAdd(key, value !== undefined ? [value] : values);
|
|
143
|
+
}
|
|
144
|
+
return _commonAdd(keyNodeOrEntry, value !== undefined ? [value] : undefined);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Time Complexity: O(log n)
|
|
148
|
+
* Space Complexity: O(log n)
|
|
149
|
+
*
|
|
150
|
+
* The function `deleteValue` removes a specific value from a key in an AVLTreeMultiMap data
|
|
151
|
+
* structure and deletes the entire node if no values are left for that key.
|
|
152
|
+
* @param {BTNRep<K, V[], AVLTreeMultiMapNode<K, V>> | K} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
153
|
+
* parameter in the `deleteValue` function can be either a `BTNRep` object representing a key-value
|
|
154
|
+
* pair in the AVLTreeMultiMapNode, or just the key itself.
|
|
155
|
+
* @param {V} value - The `value` parameter in the `deleteValue` function represents the specific
|
|
156
|
+
* value that you want to delete from the multi-map data structure associated with a particular key.
|
|
157
|
+
* The function checks if the value exists in the array of values associated with the key, and if
|
|
158
|
+
* found, removes it from the array.
|
|
159
|
+
* @returns The `deleteValue` function returns a boolean value. It returns `true` if the specified
|
|
160
|
+
* `value` was successfully deleted from the array of values associated with the `keyNodeOrEntry`. If
|
|
161
|
+
* the value was not found in the array, it returns `false`.
|
|
162
|
+
*/
|
|
163
|
+
deleteValue(keyNodeOrEntry, value) {
|
|
164
|
+
const values = this.get(keyNodeOrEntry);
|
|
165
|
+
if (Array.isArray(values)) {
|
|
166
|
+
const index = values.indexOf(value);
|
|
167
|
+
if (index === -1)
|
|
168
|
+
return false;
|
|
169
|
+
values.splice(index, 1);
|
|
170
|
+
// If no values left, remove the entire node
|
|
171
|
+
if (values.length === 0)
|
|
172
|
+
this.delete(keyNodeOrEntry);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Time Complexity: O(n)
|
|
179
|
+
* Space Complexity: O(n)
|
|
180
|
+
*
|
|
181
|
+
* The function `clone` overrides the default cloning behavior to create a deep copy of a tree
|
|
182
|
+
* structure.
|
|
183
|
+
* @returns A cloned tree object is being returned.
|
|
184
|
+
*/
|
|
185
|
+
clone() {
|
|
186
|
+
const cloned = this.createTree();
|
|
187
|
+
this._clone(cloned);
|
|
188
|
+
return cloned;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=avl-tree-multi-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avl-tree-multi-map.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-multi-map.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data-structure-typed
|
|
3
|
+
*
|
|
4
|
+
* @author Pablo Zeng
|
|
5
|
+
* @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
6
|
+
* @license MIT License
|
|
7
|
+
*/
|
|
8
|
+
import { BST, BSTNode } from './bst';
|
|
9
|
+
import type { AVLTreeOptions, BinaryTreeDeleteResult, BSTNOptKeyOrNode, BTNRep, EntryCallback, OptNodeOrNull } from '../../types';
|
|
10
|
+
import { IBinaryTree } from '../../interfaces';
|
|
11
|
+
export declare class AVLTreeNode<K = any, V = any> extends BSTNode<K, V> {
|
|
12
|
+
/**
|
|
13
|
+
* This TypeScript constructor function initializes an instance with a key and an optional value.
|
|
14
|
+
* @param {K} key - The `key` parameter is typically used to uniquely identify an object or element
|
|
15
|
+
* within a data structure. It serves as a reference or identifier for accessing or manipulating the
|
|
16
|
+
* associated value or data.
|
|
17
|
+
* @param {V} [value] - The `value` parameter in the constructor is optional, meaning it does not
|
|
18
|
+
* have to be provided when creating an instance of the class. If a value is not provided, it will
|
|
19
|
+
* default to `undefined`.
|
|
20
|
+
*/
|
|
21
|
+
constructor(key: K, value?: V);
|
|
22
|
+
parent?: AVLTreeNode<K, V>;
|
|
23
|
+
_left?: OptNodeOrNull<AVLTreeNode<K, V>>;
|
|
24
|
+
get left(): OptNodeOrNull<AVLTreeNode<K, V>>;
|
|
25
|
+
set left(v: OptNodeOrNull<AVLTreeNode<K, V>>);
|
|
26
|
+
_right?: OptNodeOrNull<AVLTreeNode<K, V>>;
|
|
27
|
+
get right(): OptNodeOrNull<AVLTreeNode<K, V>>;
|
|
28
|
+
set right(v: OptNodeOrNull<AVLTreeNode<K, V>>);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 1. Height-Balanced: Each node's left and right subtrees differ in height by no more than one.
|
|
32
|
+
* 2. Automatic Rebalancing: AVL trees rebalance themselves automatically during insertions and deletions.
|
|
33
|
+
* 3. Rotations for Balancing: Utilizes rotations (single or double) to maintain balance after updates.
|
|
34
|
+
* 4. Order Preservation: Maintains the binary search tree property where left child values are less than the parent, and right child values are greater.
|
|
35
|
+
* 5. Efficient Lookups: Offers O(log n) search time, where 'n' is the number of nodes, due to its balanced nature.
|
|
36
|
+
* 6. Complex Insertions and Deletions: Due to rebalancing, these operations are more complex than in a regular BST.
|
|
37
|
+
* 7. Path Length: The path length from the root to any leaf is longer compared to an unbalanced BST, but shorter than a linear chain of nodes.
|
|
38
|
+
*/
|
|
39
|
+
export declare class AVLTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> extends BST<K, V, R, MK, MV, MR> implements IBinaryTree<K, V, R, MK, MV, MR> {
|
|
40
|
+
/**
|
|
41
|
+
* This TypeScript constructor initializes an AVLTree with keys, nodes, entries, or raw data provided
|
|
42
|
+
* in an iterable format.
|
|
43
|
+
* @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter in the constructor is an
|
|
44
|
+
* iterable that can contain either `BTNRep<K, V, AVLTreeNode<K, V>>` objects or `R` objects. It is
|
|
45
|
+
* used to initialize the AVLTree with key-value pairs or raw data entries. If provided
|
|
46
|
+
* @param [options] - The `options` parameter in the constructor is of type `AVLTreeOptions<K, V,
|
|
47
|
+
* R>`. It is an optional parameter that allows you to specify additional options for configuring the
|
|
48
|
+
* AVL tree. These options could include things like custom comparators, initial capacity, or any
|
|
49
|
+
* other configuration settings specific
|
|
50
|
+
*/
|
|
51
|
+
constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V, AVLTreeNode<K, V>> | R>, options?: AVLTreeOptions<K, V, R>);
|
|
52
|
+
/**
|
|
53
|
+
* Time Complexity: O(1)
|
|
54
|
+
* Space Complexity: O(1)
|
|
55
|
+
*
|
|
56
|
+
* The function creates a new AVL tree node with the given key and value.
|
|
57
|
+
* @param {K} key - The key parameter is of type K, which represents the key of the node being
|
|
58
|
+
* created.
|
|
59
|
+
* @param {V} [value] - The "value" parameter is an optional parameter of type V. It represents the
|
|
60
|
+
* value associated with the key in the node being created.
|
|
61
|
+
* @returns The method is returning a new instance of the AVLTreeNode class, casted as the generic
|
|
62
|
+
* type AVLTreeNode<K, V>.
|
|
63
|
+
*/
|
|
64
|
+
createNode(key: K, value?: V): AVLTreeNode<K, V>;
|
|
65
|
+
/**
|
|
66
|
+
* Time Complexity: O(1)
|
|
67
|
+
* Space Complexity: O(1)
|
|
68
|
+
*
|
|
69
|
+
* The function creates a new AVL tree with the specified options and returns it.
|
|
70
|
+
* @param {AVLTreeOptions} [options] - The `options` parameter is an optional object that can be
|
|
71
|
+
* passed to the `createTree` function. It is used to customize the behavior of the AVL tree that is
|
|
72
|
+
* being created.
|
|
73
|
+
* @returns a new AVLTree object.
|
|
74
|
+
*/
|
|
75
|
+
createTree(options?: AVLTreeOptions<K, V, R>): AVLTree<K, V, R, MK, MV, MR>;
|
|
76
|
+
/**
|
|
77
|
+
* Time Complexity: O(1)
|
|
78
|
+
* Space Complexity: O(1)
|
|
79
|
+
*
|
|
80
|
+
* The function checks if the input is an instance of AVLTreeNode.
|
|
81
|
+
* @param {BTNRep<K, V, AVLTreeNode<K, V>>} keyNodeOrEntry - The parameter
|
|
82
|
+
* `keyNodeOrEntry` can be of type `R` or `BTNRep<K, V, AVLTreeNode<K, V>>`.
|
|
83
|
+
* @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
|
|
84
|
+
* an instance of the `AVLTreeNode` class.
|
|
85
|
+
*/
|
|
86
|
+
isNode(keyNodeOrEntry: BTNRep<K, V, AVLTreeNode<K, V>>): keyNodeOrEntry is AVLTreeNode<K, V>;
|
|
87
|
+
/**
|
|
88
|
+
* Time Complexity: O(log n)
|
|
89
|
+
* Space Complexity: O(log n)
|
|
90
|
+
*
|
|
91
|
+
* The function overrides the add method of a class and inserts a key-value pair into a data
|
|
92
|
+
* structure, then balances the path.
|
|
93
|
+
* @param {BTNRep<K, V, AVLTreeNode<K, V>>} keyNodeOrEntry - The parameter
|
|
94
|
+
* `keyNodeOrEntry` can accept values of type `R`, `BTNRep<K, V, AVLTreeNode<K, V>>`
|
|
95
|
+
* @param {V} [value] - The `value` parameter is an optional value that you want to associate with
|
|
96
|
+
* the key or node being added to the data structure.
|
|
97
|
+
* @returns The method is returning a boolean value.
|
|
98
|
+
*/
|
|
99
|
+
add(keyNodeOrEntry: BTNRep<K, V, AVLTreeNode<K, V>>, value?: V): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Time Complexity: O(log n)
|
|
102
|
+
* Space Complexity: O(log n)
|
|
103
|
+
*
|
|
104
|
+
* The function overrides the delete method in a TypeScript class, performs deletion, and then
|
|
105
|
+
* balances the tree if necessary.
|
|
106
|
+
* @param {BTNRep<K, V, AVLTreeNode<K, V>>} keyNodeOrEntry - The `keyNodeOrEntry`
|
|
107
|
+
* parameter in the `override delete` method can be one of the following types:
|
|
108
|
+
* @returns The `delete` method is being overridden in this code snippet. It first calls the `delete`
|
|
109
|
+
* method from the superclass (presumably a parent class) with the provided `predicate`, which could
|
|
110
|
+
* be a key, node, entry, or a custom predicate. The result of this deletion operation is stored in
|
|
111
|
+
* `deletedResults`, which is an array of `BinaryTreeDeleteResult` objects.
|
|
112
|
+
*/
|
|
113
|
+
delete(keyNodeOrEntry: BTNRep<K, V, AVLTreeNode<K, V>>): BinaryTreeDeleteResult<AVLTreeNode<K, V>>[];
|
|
114
|
+
/**
|
|
115
|
+
* Time Complexity: O(n)
|
|
116
|
+
* Space Complexity: O(n)
|
|
117
|
+
*
|
|
118
|
+
* The `map` function in TypeScript overrides the default map behavior of an AVLTree data structure
|
|
119
|
+
* by applying a callback function to each entry and creating a new AVLTree with the results.
|
|
120
|
+
* @param callback - A function that will be called for each entry in the AVLTree. It takes four
|
|
121
|
+
* arguments: the key, the value (which can be undefined), the index of the entry, and a reference to
|
|
122
|
+
* the AVLTree itself.
|
|
123
|
+
* @param [options] - The `options` parameter in the `override map` function is of type
|
|
124
|
+
* `AVLTreeOptions<MK, MV, MR>`. It is an optional parameter that allows you to specify additional
|
|
125
|
+
* options for the AVL tree being created during the mapping process. These options could include
|
|
126
|
+
* custom comparators, initial
|
|
127
|
+
* @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
|
|
128
|
+
* the value of `this` when executing the `callback` function. It allows you to set the context
|
|
129
|
+
* (value of `this`) within the callback function. This can be useful when you want to access
|
|
130
|
+
* properties or
|
|
131
|
+
* @returns The `map` method is returning a new AVLTree instance (`newTree`) with the entries
|
|
132
|
+
* modified by the provided callback function.
|
|
133
|
+
*/
|
|
134
|
+
map(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: AVLTreeOptions<MK, MV, MR>, thisArg?: any): AVLTree<MK, MV, MR>;
|
|
135
|
+
/**
|
|
136
|
+
* Time Complexity: O(n)
|
|
137
|
+
* Space Complexity: O(n)
|
|
138
|
+
*
|
|
139
|
+
* The function `clone` overrides the default cloning behavior to create a deep copy of a tree
|
|
140
|
+
* structure.
|
|
141
|
+
* @returns A cloned tree object is being returned.
|
|
142
|
+
*/
|
|
143
|
+
clone(): AVLTree<K, V, R, MK, MV, MR>;
|
|
144
|
+
/**
|
|
145
|
+
* Time Complexity: O(1)
|
|
146
|
+
* Space Complexity: O(1)
|
|
147
|
+
*
|
|
148
|
+
* The `_swapProperties` function swaps the key, value, and height properties between two nodes in a
|
|
149
|
+
* binary search tree.
|
|
150
|
+
* @param {BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>} srcNode - The `srcNode` parameter represents either a node
|
|
151
|
+
* object (`AVLTreeNode<K, V>`) or a key-value pair (`R`) that is being swapped with another node.
|
|
152
|
+
* @param {BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>} destNode - The `destNode` parameter is either an instance of
|
|
153
|
+
* `R` or an instance of `BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>`.
|
|
154
|
+
* @returns The method is returning the `destNodeEnsured` object if both `srcNodeEnsured` and
|
|
155
|
+
* `destNodeEnsured` are truthy. Otherwise, it returns `undefined`.
|
|
156
|
+
*/
|
|
157
|
+
protected _swapProperties(srcNode: BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>, destNode: BSTNOptKeyOrNode<K, AVLTreeNode<K, V>>): AVLTreeNode<K, V> | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Time Complexity: O(1)
|
|
160
|
+
* Space Complexity: O(1)
|
|
161
|
+
*
|
|
162
|
+
* The function calculates the balance factor of a node in a binary tree.
|
|
163
|
+
* @param {AVLTreeNode<K, V>} node - The parameter "node" is of type "AVLTreeNode<K, V>", which likely represents a node in a
|
|
164
|
+
* binary tree data structure.
|
|
165
|
+
* @returns the balance factor of a given node. The balance factor is calculated by subtracting the
|
|
166
|
+
* height of the left subtree from the height of the right subtree.
|
|
167
|
+
*/
|
|
168
|
+
protected _balanceFactor(node: AVLTreeNode<K, V>): number;
|
|
169
|
+
/**
|
|
170
|
+
* Time Complexity: O(1)
|
|
171
|
+
* Space Complexity: O(1)
|
|
172
|
+
*
|
|
173
|
+
* The function updates the height of a node in a binary tree based on the heights of its left and
|
|
174
|
+
* right children.
|
|
175
|
+
* @param {AVLTreeNode<K, V>} node - The parameter "node" represents a node in a binary tree data structure.
|
|
176
|
+
*/
|
|
177
|
+
protected _updateHeight(node: AVLTreeNode<K, V>): void;
|
|
178
|
+
/**
|
|
179
|
+
* Time Complexity: O(1)
|
|
180
|
+
* Space Complexity: O(1)
|
|
181
|
+
*
|
|
182
|
+
* The `_balanceLL` function performs a left-left rotation to balance a binary search tree.
|
|
183
|
+
* @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
|
|
184
|
+
*/
|
|
185
|
+
protected _balanceLL(A: AVLTreeNode<K, V>): void;
|
|
186
|
+
/**
|
|
187
|
+
* Time Complexity: O(1)
|
|
188
|
+
* Space Complexity: O(1)
|
|
189
|
+
*
|
|
190
|
+
* The `_balanceLR` function performs a left-right rotation to balance a binary tree.
|
|
191
|
+
* @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
|
|
192
|
+
*/
|
|
193
|
+
protected _balanceLR(A: AVLTreeNode<K, V>): void;
|
|
194
|
+
/**
|
|
195
|
+
* Time Complexity: O(1)
|
|
196
|
+
* Space Complexity: O(1)
|
|
197
|
+
*
|
|
198
|
+
* The function `_balanceRR` performs a right-right rotation to balance a binary tree.
|
|
199
|
+
* @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
|
|
200
|
+
*/
|
|
201
|
+
protected _balanceRR(A: AVLTreeNode<K, V>): void;
|
|
202
|
+
/**
|
|
203
|
+
* Time Complexity: O(1)
|
|
204
|
+
* Space Complexity: O(1)
|
|
205
|
+
*
|
|
206
|
+
* The function `_balanceRL` performs a right-left rotation to balance a binary tree.
|
|
207
|
+
* @param {AVLTreeNode<K, V>} A - A is a node in a binary tree.
|
|
208
|
+
*/
|
|
209
|
+
protected _balanceRL(A: AVLTreeNode<K, V>): void;
|
|
210
|
+
/**
|
|
211
|
+
* Time Complexity: O(log n)
|
|
212
|
+
* Space Complexity: O(1)
|
|
213
|
+
*
|
|
214
|
+
* The `_balancePath` function is used to update the heights of nodes and perform rotation operations
|
|
215
|
+
* to restore balance in an AVL tree after inserting a node.
|
|
216
|
+
* @param {BTNRep<K, V, AVLTreeNode<K, V>>} node - The `node` parameter can be of type `R` or
|
|
217
|
+
* `BTNRep<K, V, AVLTreeNode<K, V>>`.
|
|
218
|
+
*/
|
|
219
|
+
protected _balancePath(node: BTNRep<K, V, AVLTreeNode<K, V>>): void;
|
|
220
|
+
/**
|
|
221
|
+
* Time Complexity: O(1)
|
|
222
|
+
* Space Complexity: O(1)
|
|
223
|
+
*
|
|
224
|
+
* The function replaces an old node with a new node and sets the height of the new node to be the
|
|
225
|
+
* same as the old node.
|
|
226
|
+
* @param {AVLTreeNode<K, V>} oldNode - The `oldNode` parameter represents the node that needs to be replaced in
|
|
227
|
+
* the data structure.
|
|
228
|
+
* @param {AVLTreeNode<K, V>} newNode - The `newNode` parameter is the new node that will replace the `oldNode` in
|
|
229
|
+
* the data structure.
|
|
230
|
+
* @returns The method is returning the result of calling the `_replaceNode` method from the
|
|
231
|
+
* superclass, with the `oldNode` and `newNode` as arguments.
|
|
232
|
+
*/
|
|
233
|
+
protected _replaceNode(oldNode: AVLTreeNode<K, V>, newNode: AVLTreeNode<K, V>): AVLTreeNode<K, V>;
|
|
234
|
+
}
|