data-structure-typed 1.54.0 → 1.54.1
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 +2 -0
- package/dist/cjs/types/data-structures/binary-tree/index.js +2 -0
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +1 -4
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.js +3 -0
- 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 +1 -4
- 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 → esm}/data-structures/binary-tree/index.js +2 -0
- 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 → esm}/types/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/{mjs → esm}/types/data-structures/binary-tree/index.js +2 -0
- package/dist/{mjs → esm}/types/data-structures/binary-tree/index.js.map +1 -1
- package/dist/esm/types/data-structures/binary-tree/rb-tree.d.ts +3 -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 -14
- 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 +2 -0
- package/src/types/data-structures/binary-tree/rb-tree.ts +1 -6
- package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -6
- 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.ts +171 -0
- package/test/integration/index.html +48 -48
- 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.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/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/tree-multi-map.d.ts +0 -5
- /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/rb-tree.js +0 -0
- /package/dist/{mjs → esm}/types/data-structures/binary-tree/rb-tree.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
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { AVLTreeCounterOptions, BinaryTreeDeleteResult, BSTNOptKeyOrNode, BTNRep, EntryCallback, IterationType, OptNodeOrNull } from '../../types';
|
|
9
9
|
import { IBinaryTree } from '../../interfaces';
|
|
10
10
|
import { AVLTree, AVLTreeNode } from './avl-tree';
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class AVLTreeCounterNode<K = any, V = any> extends AVLTreeNode<K, V> {
|
|
12
12
|
/**
|
|
13
13
|
* The constructor function initializes a BinaryTreeNode object with a key, value, and count.
|
|
14
14
|
* @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
|
|
@@ -20,20 +20,27 @@ export declare class AVLTreeMultiMapNode<K = any, V = any, NODE extends AVLTreeM
|
|
|
20
20
|
* parameter when creating a new instance of the `BinaryTreeNode` class.
|
|
21
21
|
*/
|
|
22
22
|
constructor(key: K, value?: V, count?: number);
|
|
23
|
+
parent?: AVLTreeCounterNode<K, V>;
|
|
24
|
+
_left?: OptNodeOrNull<AVLTreeCounterNode<K, V>>;
|
|
25
|
+
get left(): OptNodeOrNull<AVLTreeCounterNode<K, V>>;
|
|
26
|
+
set left(v: OptNodeOrNull<AVLTreeCounterNode<K, V>>);
|
|
27
|
+
_right?: OptNodeOrNull<AVLTreeCounterNode<K, V>>;
|
|
28
|
+
get right(): OptNodeOrNull<AVLTreeCounterNode<K, V>>;
|
|
29
|
+
set right(v: OptNodeOrNull<AVLTreeCounterNode<K, V>>);
|
|
23
30
|
}
|
|
24
31
|
/**
|
|
25
|
-
* The only distinction between a
|
|
32
|
+
* The only distinction between a AVLTreeCounter and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
|
|
26
33
|
*/
|
|
27
|
-
export declare class
|
|
34
|
+
export declare class AVLTreeCounter<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> {
|
|
28
35
|
/**
|
|
29
|
-
* The constructor initializes a new
|
|
36
|
+
* The constructor initializes a new AVLTreeCounter object with optional initial elements.
|
|
30
37
|
* @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter is an
|
|
31
38
|
* iterable object that can contain either keys, nodes, entries, or raw elements.
|
|
32
39
|
* @param [options] - The `options` parameter is an optional object that can be used to customize the
|
|
33
|
-
* behavior of the
|
|
40
|
+
* behavior of the AVLTreeCounter. It can include properties such as `compareKeys` and
|
|
34
41
|
* `compareValues` functions to define custom comparison logic for keys and values, respectively.
|
|
35
42
|
*/
|
|
36
|
-
constructor(keysNodesEntriesOrRaws?: Iterable<
|
|
43
|
+
constructor(keysNodesEntriesOrRaws?: Iterable<BTNRep<K, V, AVLTreeCounterNode<K, V>> | R>, options?: AVLTreeCounterOptions<K, V, R>);
|
|
37
44
|
protected _count: number;
|
|
38
45
|
/**
|
|
39
46
|
* The function calculates the sum of the count property of all nodes in a tree using depth-first
|
|
@@ -51,42 +58,42 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
51
58
|
*/
|
|
52
59
|
getComputedCount(): number;
|
|
53
60
|
/**
|
|
54
|
-
* The function creates a new
|
|
61
|
+
* The function creates a new AVLTreeCounterNode with the specified key, value, and count.
|
|
55
62
|
* @param {K} key - The key parameter represents the key of the node being created. It is of type K,
|
|
56
63
|
* which is a generic type that can be replaced with any specific type when using the function.
|
|
57
64
|
* @param {V} [value] - The `value` parameter is an optional parameter that represents the value
|
|
58
65
|
* associated with the key in the node. It is of type `V`, which can be any data type.
|
|
59
66
|
* @param {number} [count] - The `count` parameter represents the number of occurrences of a
|
|
60
|
-
* key-value pair in the
|
|
67
|
+
* key-value pair in the AVLTreeCounterNode. It is an optional parameter, so it can be omitted when
|
|
61
68
|
* calling the `createNode` method. If provided, it specifies the initial count for the node.
|
|
62
|
-
* @returns a new instance of the
|
|
69
|
+
* @returns a new instance of the AVLTreeCounterNode class, casted as AVLTreeCounterNode<K, V>.
|
|
63
70
|
*/
|
|
64
|
-
createNode(key: K, value?: V, count?: number):
|
|
71
|
+
createNode(key: K, value?: V, count?: number): AVLTreeCounterNode<K, V>;
|
|
65
72
|
/**
|
|
66
|
-
* The function creates a new
|
|
73
|
+
* The function creates a new AVLTreeCounter object with the specified options and returns it.
|
|
67
74
|
* @param [options] - The `options` parameter is an optional object that contains additional
|
|
68
|
-
* configuration options for creating the
|
|
69
|
-
* @returns a new instance of the
|
|
75
|
+
* configuration options for creating the AVLTreeCounter. It can have the following properties:
|
|
76
|
+
* @returns a new instance of the AVLTreeCounter class, with the specified options, as a TREE
|
|
70
77
|
* object.
|
|
71
78
|
*/
|
|
72
|
-
createTree(options?:
|
|
79
|
+
createTree(options?: AVLTreeCounterOptions<K, V, R>): AVLTreeCounter<K, V, R, MK, MV, MR>;
|
|
73
80
|
/**
|
|
74
|
-
* The function checks if the input is an instance of
|
|
75
|
-
* @param {BTNRep<K, V,
|
|
76
|
-
* `
|
|
77
|
-
* @returns a boolean value indicating whether the input parameter `
|
|
78
|
-
* an instance of the `
|
|
81
|
+
* The function checks if the input is an instance of AVLTreeCounterNode.
|
|
82
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The parameter
|
|
83
|
+
* `keyNodeOrEntry` can be of type `R` or `BTNRep<K, V, AVLTreeCounterNode<K, V>>`.
|
|
84
|
+
* @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
|
|
85
|
+
* an instance of the `AVLTreeCounterNode` class.
|
|
79
86
|
*/
|
|
80
|
-
isNode(
|
|
87
|
+
isNode(keyNodeOrEntry: BTNRep<K, V, AVLTreeCounterNode<K, V>>): keyNodeOrEntry is AVLTreeCounterNode<K, V>;
|
|
81
88
|
/**
|
|
82
89
|
* Time Complexity: O(log n)
|
|
83
90
|
* Space Complexity: O(1)
|
|
84
91
|
*
|
|
85
92
|
* The function overrides the add method of a TypeScript class to add a new node to a data structure
|
|
86
93
|
* and update the count.
|
|
87
|
-
* @param {BTNRep<K, V,
|
|
88
|
-
* `
|
|
89
|
-
* can also accept a value of type `BTNRep<K, V,
|
|
94
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The
|
|
95
|
+
* `keyNodeOrEntry` parameter can accept a value of type `R`, which can be any type. It
|
|
96
|
+
* can also accept a value of type `BTNRep<K, V, AVLTreeCounterNode<K, V>>`, which represents a key, node,
|
|
90
97
|
* entry, or raw element
|
|
91
98
|
* @param {V} [value] - The `value` parameter represents the value associated with the key in the
|
|
92
99
|
* data structure. It is an optional parameter, so it can be omitted if not needed.
|
|
@@ -95,14 +102,14 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
95
102
|
* be added once. However, you can specify a different value for `count` if you want to add
|
|
96
103
|
* @returns a boolean value.
|
|
97
104
|
*/
|
|
98
|
-
add(
|
|
105
|
+
add(keyNodeOrEntry: BTNRep<K, V, AVLTreeCounterNode<K, V>>, value?: V, count?: number): boolean;
|
|
99
106
|
/**
|
|
100
107
|
* Time Complexity: O(log n)
|
|
101
108
|
* Space Complexity: O(1)
|
|
102
109
|
*
|
|
103
110
|
* The function overrides the delete method in a binary tree data structure, handling deletion of
|
|
104
111
|
* nodes and maintaining balance in the tree.
|
|
105
|
-
* @param {BTNRep<K, V,
|
|
112
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The `predicate`
|
|
106
113
|
* parameter in the `delete` method is used to specify the condition for deleting a node from the
|
|
107
114
|
* binary tree. It can be a key, node, or entry that determines which
|
|
108
115
|
* node(s) should be deleted.
|
|
@@ -115,7 +122,7 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
115
122
|
* method returns an array of `BinaryTreeDeleteResult` objects, each containing information about the
|
|
116
123
|
* deleted node and whether balancing is needed in the tree.
|
|
117
124
|
*/
|
|
118
|
-
delete(
|
|
125
|
+
delete(keyNodeOrEntry: BTNRep<K, V, AVLTreeCounterNode<K, V>>, ignoreCount?: boolean): BinaryTreeDeleteResult<AVLTreeCounterNode<K, V>>[];
|
|
119
126
|
/**
|
|
120
127
|
* Time Complexity: O(1)
|
|
121
128
|
* Space Complexity: O(1)
|
|
@@ -144,63 +151,63 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = object, MK = any, MV
|
|
|
144
151
|
* The function overrides the clone method to create a deep copy of a tree object.
|
|
145
152
|
* @returns The `clone()` method is returning a cloned instance of the `TREE` object.
|
|
146
153
|
*/
|
|
147
|
-
clone():
|
|
154
|
+
clone(): AVLTreeCounter<K, V, R, MK, MV, MR>;
|
|
148
155
|
/**
|
|
149
|
-
* The `map` function in TypeScript overrides the default behavior to create a new
|
|
156
|
+
* The `map` function in TypeScript overrides the default behavior to create a new AVLTreeCounter
|
|
150
157
|
* with modified entries based on a provided callback.
|
|
151
158
|
* @param callback - The `callback` parameter is a function that will be called for each entry in the
|
|
152
|
-
*
|
|
159
|
+
* AVLTreeCounter. It takes four arguments:
|
|
153
160
|
* @param [options] - The `options` parameter in the `override map` function is of type
|
|
154
|
-
* `
|
|
155
|
-
* configuration options when creating a new `
|
|
161
|
+
* `AVLTreeCounterOptions<MK, MV, MR>`. This parameter allows you to provide additional
|
|
162
|
+
* configuration options when creating a new `AVLTreeCounter` instance within the `map` function.
|
|
156
163
|
* These options
|
|
157
164
|
* @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
|
|
158
165
|
* the value of `this` when executing the `callback` function. It allows you to set the context
|
|
159
166
|
* (value of `this`) for the callback function. This can be useful when you want to access properties
|
|
160
167
|
* or
|
|
161
|
-
* @returns The `map` method is returning a new `
|
|
168
|
+
* @returns The `map` method is returning a new `AVLTreeCounter` instance with the entries
|
|
162
169
|
* transformed by the provided `callback` function. Each entry in the original tree is passed to the
|
|
163
170
|
* `callback` function along with the index and the original tree itself. The transformed entries are
|
|
164
|
-
* then added to the new `
|
|
171
|
+
* then added to the new `AVLTreeCounter` instance, which is returned at the end.
|
|
165
172
|
*/
|
|
166
|
-
map<MK, MV, MR>(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?:
|
|
173
|
+
map<MK, MV, MR>(callback: EntryCallback<K, V | undefined, [MK, MV]>, options?: AVLTreeCounterOptions<MK, MV, MR>, thisArg?: any): AVLTreeCounter<MK, MV, MR>;
|
|
167
174
|
/**
|
|
168
175
|
* The function `keyValueNodeEntryRawToNodeAndValue` converts a key, value, entry, or raw element into
|
|
169
176
|
* a node object.
|
|
170
|
-
* @param {BTNRep<K, V,
|
|
171
|
-
* `
|
|
177
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The
|
|
178
|
+
* `keyNodeOrEntry` parameter can be of type `R` or `BTNRep<K, V, AVLTreeCounterNode<K, V>>`.
|
|
172
179
|
* @param {V} [value] - The `value` parameter is an optional value that can be passed to the
|
|
173
180
|
* `override` function. It represents the value associated with the key in the data structure. If no
|
|
174
181
|
* value is provided, it will default to `undefined`.
|
|
175
182
|
* @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
|
|
176
183
|
* times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
|
|
177
|
-
* @returns either a
|
|
184
|
+
* @returns either a AVLTreeCounterNode<K, V> object or undefined.
|
|
178
185
|
*/
|
|
179
|
-
protected
|
|
186
|
+
protected _keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry: BTNRep<K, V, AVLTreeCounterNode<K, V>>, value?: V, count?: number): [AVLTreeCounterNode<K, V> | undefined, V | undefined];
|
|
180
187
|
/**
|
|
181
188
|
* Time Complexity: O(1)
|
|
182
189
|
* Space Complexity: O(1)
|
|
183
190
|
*
|
|
184
191
|
* The `_swapProperties` function swaps the properties (key, value, count, height) between two nodes
|
|
185
192
|
* in a binary search tree.
|
|
186
|
-
* @param {
|
|
193
|
+
* @param {BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>} srcNode - The `srcNode` parameter represents the source node
|
|
187
194
|
* that will be swapped with the `destNode`.
|
|
188
|
-
* @param {
|
|
195
|
+
* @param {BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>} destNode - The `destNode` parameter represents the destination
|
|
189
196
|
* node where the properties will be swapped with the source node.
|
|
190
197
|
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
191
198
|
* If either `srcNode` or `destNode` is undefined, it returns `undefined`.
|
|
192
199
|
*/
|
|
193
|
-
protected _swapProperties(srcNode:
|
|
200
|
+
protected _swapProperties(srcNode: BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>, destNode: BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>): AVLTreeCounterNode<K, V> | undefined;
|
|
194
201
|
/**
|
|
195
202
|
* Time Complexity: O(1)
|
|
196
203
|
* Space Complexity: O(1)
|
|
197
204
|
*
|
|
198
205
|
* The function replaces an old node with a new node and updates the count property of the new node.
|
|
199
|
-
* @param {
|
|
200
|
-
* data structure. It is of type
|
|
201
|
-
* @param {
|
|
206
|
+
* @param {AVLTreeCounterNode<K, V>} oldNode - The oldNode parameter represents the node that needs to be replaced in the
|
|
207
|
+
* data structure. It is of type AVLTreeCounterNode<K, V>.
|
|
208
|
+
* @param {AVLTreeCounterNode<K, V>} newNode - The `newNode` parameter is an instance of the `AVLTreeCounterNode<K, V>` class.
|
|
202
209
|
* @returns The method is returning the result of calling the `_replaceNode` method from the
|
|
203
|
-
* superclass, which is of type `
|
|
210
|
+
* superclass, which is of type `AVLTreeCounterNode<K, V>`.
|
|
204
211
|
*/
|
|
205
|
-
protected _replaceNode(oldNode:
|
|
212
|
+
protected _replaceNode(oldNode: AVLTreeCounterNode<K, V>, newNode: AVLTreeCounterNode<K, V>): AVLTreeCounterNode<K, V>;
|
|
206
213
|
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AVLTreeCounter = exports.AVLTreeCounterNode = void 0;
|
|
4
|
+
const avl_tree_1 = require("./avl-tree");
|
|
5
|
+
class AVLTreeCounterNode extends avl_tree_1.AVLTreeNode {
|
|
6
|
+
/**
|
|
7
|
+
* The constructor function initializes a BinaryTreeNode object with a key, value, and count.
|
|
8
|
+
* @param {K} key - The `key` parameter is of type `K` and represents the unique identifier
|
|
9
|
+
* of the binary tree node.
|
|
10
|
+
* @param {V} [value] - The `value` parameter is an optional parameter of type `V`. It represents the value of the binary
|
|
11
|
+
* tree node. If no value is provided, it will be `undefined`.
|
|
12
|
+
* @param {number} [count=1] - The `count` parameter is a number that represents the number of times a particular value
|
|
13
|
+
* occurs in a binary tree node. It has a default value of 1, which means that if no value is provided for the `count`
|
|
14
|
+
* parameter when creating a new instance of the `BinaryTreeNode` class.
|
|
15
|
+
*/
|
|
16
|
+
constructor(key, value, count = 1) {
|
|
17
|
+
super(key, value);
|
|
18
|
+
this.parent = undefined;
|
|
19
|
+
this._left = undefined;
|
|
20
|
+
this._right = undefined;
|
|
21
|
+
this.count = count;
|
|
22
|
+
}
|
|
23
|
+
get left() {
|
|
24
|
+
return this._left;
|
|
25
|
+
}
|
|
26
|
+
set left(v) {
|
|
27
|
+
if (v) {
|
|
28
|
+
v.parent = this;
|
|
29
|
+
}
|
|
30
|
+
this._left = v;
|
|
31
|
+
}
|
|
32
|
+
get right() {
|
|
33
|
+
return this._right;
|
|
34
|
+
}
|
|
35
|
+
set right(v) {
|
|
36
|
+
if (v) {
|
|
37
|
+
v.parent = this;
|
|
38
|
+
}
|
|
39
|
+
this._right = v;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AVLTreeCounterNode = AVLTreeCounterNode;
|
|
43
|
+
/**
|
|
44
|
+
* The only distinction between a AVLTreeCounter and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
|
|
45
|
+
*/
|
|
46
|
+
class AVLTreeCounter extends avl_tree_1.AVLTree {
|
|
47
|
+
/**
|
|
48
|
+
* The constructor initializes a new AVLTreeCounter object with optional initial elements.
|
|
49
|
+
* @param keysNodesEntriesOrRaws - The `keysNodesEntriesOrRaws` parameter is an
|
|
50
|
+
* iterable object that can contain either keys, nodes, entries, or raw elements.
|
|
51
|
+
* @param [options] - The `options` parameter is an optional object that can be used to customize the
|
|
52
|
+
* behavior of the AVLTreeCounter. It can include properties such as `compareKeys` and
|
|
53
|
+
* `compareValues` functions to define custom comparison logic for keys and values, respectively.
|
|
54
|
+
*/
|
|
55
|
+
constructor(keysNodesEntriesOrRaws = [], options) {
|
|
56
|
+
super([], options);
|
|
57
|
+
this._count = 0;
|
|
58
|
+
if (keysNodesEntriesOrRaws)
|
|
59
|
+
this.addMany(keysNodesEntriesOrRaws);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The function calculates the sum of the count property of all nodes in a tree using depth-first
|
|
63
|
+
* search.
|
|
64
|
+
* @returns the sum of the count property of all nodes in the tree.
|
|
65
|
+
*/
|
|
66
|
+
get count() {
|
|
67
|
+
return this._count;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Time Complexity: O(n)
|
|
71
|
+
* Space Complexity: O(1)
|
|
72
|
+
*
|
|
73
|
+
* The function calculates the sum of the count property of all nodes in a tree using depth-first
|
|
74
|
+
* search.
|
|
75
|
+
* @returns the sum of the count property of all nodes in the tree.
|
|
76
|
+
*/
|
|
77
|
+
getComputedCount() {
|
|
78
|
+
let sum = 0;
|
|
79
|
+
this.dfs(node => (sum += node.count));
|
|
80
|
+
return sum;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The function creates a new AVLTreeCounterNode with the specified key, value, and count.
|
|
84
|
+
* @param {K} key - The key parameter represents the key of the node being created. It is of type K,
|
|
85
|
+
* which is a generic type that can be replaced with any specific type when using the function.
|
|
86
|
+
* @param {V} [value] - The `value` parameter is an optional parameter that represents the value
|
|
87
|
+
* associated with the key in the node. It is of type `V`, which can be any data type.
|
|
88
|
+
* @param {number} [count] - The `count` parameter represents the number of occurrences of a
|
|
89
|
+
* key-value pair in the AVLTreeCounterNode. It is an optional parameter, so it can be omitted when
|
|
90
|
+
* calling the `createNode` method. If provided, it specifies the initial count for the node.
|
|
91
|
+
* @returns a new instance of the AVLTreeCounterNode class, casted as AVLTreeCounterNode<K, V>.
|
|
92
|
+
*/
|
|
93
|
+
createNode(key, value, count) {
|
|
94
|
+
return new AVLTreeCounterNode(key, this._isMapMode ? undefined : value, count);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The function creates a new AVLTreeCounter object with the specified options and returns it.
|
|
98
|
+
* @param [options] - The `options` parameter is an optional object that contains additional
|
|
99
|
+
* configuration options for creating the AVLTreeCounter. It can have the following properties:
|
|
100
|
+
* @returns a new instance of the AVLTreeCounter class, with the specified options, as a TREE
|
|
101
|
+
* object.
|
|
102
|
+
*/
|
|
103
|
+
createTree(options) {
|
|
104
|
+
return new AVLTreeCounter([], Object.assign({ iterationType: this.iterationType, isMapMode: this._isMapMode, specifyComparable: this._specifyComparable, toEntryFn: this._toEntryFn, isReverse: this._isReverse }, options));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The function checks if the input is an instance of AVLTreeCounterNode.
|
|
108
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The parameter
|
|
109
|
+
* `keyNodeOrEntry` can be of type `R` or `BTNRep<K, V, AVLTreeCounterNode<K, V>>`.
|
|
110
|
+
* @returns a boolean value indicating whether the input parameter `keyNodeOrEntry` is
|
|
111
|
+
* an instance of the `AVLTreeCounterNode` class.
|
|
112
|
+
*/
|
|
113
|
+
isNode(keyNodeOrEntry) {
|
|
114
|
+
return keyNodeOrEntry instanceof AVLTreeCounterNode;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Time Complexity: O(log n)
|
|
118
|
+
* Space Complexity: O(1)
|
|
119
|
+
*
|
|
120
|
+
* The function overrides the add method of a TypeScript class to add a new node to a data structure
|
|
121
|
+
* and update the count.
|
|
122
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The
|
|
123
|
+
* `keyNodeOrEntry` parameter can accept a value of type `R`, which can be any type. It
|
|
124
|
+
* can also accept a value of type `BTNRep<K, V, AVLTreeCounterNode<K, V>>`, which represents a key, node,
|
|
125
|
+
* entry, or raw element
|
|
126
|
+
* @param {V} [value] - The `value` parameter represents the value associated with the key in the
|
|
127
|
+
* data structure. It is an optional parameter, so it can be omitted if not needed.
|
|
128
|
+
* @param [count=1] - The `count` parameter represents the number of times the key-value pair should
|
|
129
|
+
* be added to the data structure. By default, it is set to 1, meaning that the key-value pair will
|
|
130
|
+
* be added once. However, you can specify a different value for `count` if you want to add
|
|
131
|
+
* @returns a boolean value.
|
|
132
|
+
*/
|
|
133
|
+
add(keyNodeOrEntry, value, count = 1) {
|
|
134
|
+
const [newNode, newValue] = this._keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value, count);
|
|
135
|
+
if (newNode === undefined)
|
|
136
|
+
return false;
|
|
137
|
+
const orgNodeCount = (newNode === null || newNode === void 0 ? void 0 : newNode.count) || 0;
|
|
138
|
+
const inserted = super.add(newNode, newValue);
|
|
139
|
+
if (inserted) {
|
|
140
|
+
this._count += orgNodeCount;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Time Complexity: O(log n)
|
|
146
|
+
* Space Complexity: O(1)
|
|
147
|
+
*
|
|
148
|
+
* The function overrides the delete method in a binary tree data structure, handling deletion of
|
|
149
|
+
* nodes and maintaining balance in the tree.
|
|
150
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The `predicate`
|
|
151
|
+
* parameter in the `delete` method is used to specify the condition for deleting a node from the
|
|
152
|
+
* binary tree. It can be a key, node, or entry that determines which
|
|
153
|
+
* node(s) should be deleted.
|
|
154
|
+
* @param [ignoreCount=false] - The `ignoreCount` parameter in the `override delete` method is a
|
|
155
|
+
* boolean flag that determines whether to ignore the count of the node being deleted. If
|
|
156
|
+
* `ignoreCount` is set to `true`, the method will delete the node regardless of its count. If
|
|
157
|
+
* `ignoreCount` is set to
|
|
158
|
+
* @returns The `delete` method overrides the default delete behavior in a binary tree data
|
|
159
|
+
* structure. It takes a predicate or node to be deleted and an optional flag to ignore count. The
|
|
160
|
+
* method returns an array of `BinaryTreeDeleteResult` objects, each containing information about the
|
|
161
|
+
* deleted node and whether balancing is needed in the tree.
|
|
162
|
+
*/
|
|
163
|
+
delete(keyNodeOrEntry, ignoreCount = false) {
|
|
164
|
+
var _a;
|
|
165
|
+
const deletedResult = [];
|
|
166
|
+
if (!this.root)
|
|
167
|
+
return deletedResult;
|
|
168
|
+
const curr = (_a = this.getNode(keyNodeOrEntry)) !== null && _a !== void 0 ? _a : undefined;
|
|
169
|
+
if (!curr)
|
|
170
|
+
return deletedResult;
|
|
171
|
+
const parent = (curr === null || curr === void 0 ? void 0 : curr.parent) ? curr.parent : undefined;
|
|
172
|
+
let needBalanced = undefined, orgCurrent = curr;
|
|
173
|
+
if (curr.count > 1 && !ignoreCount) {
|
|
174
|
+
curr.count--;
|
|
175
|
+
this._count--;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
if (!curr.left) {
|
|
179
|
+
if (!parent) {
|
|
180
|
+
if (curr.right !== undefined && curr.right !== null)
|
|
181
|
+
this._setRoot(curr.right);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const { familyPosition: fp } = curr;
|
|
185
|
+
if (fp === 'LEFT' || fp === 'ROOT_LEFT') {
|
|
186
|
+
parent.left = curr.right;
|
|
187
|
+
}
|
|
188
|
+
else if (fp === 'RIGHT' || fp === 'ROOT_RIGHT') {
|
|
189
|
+
parent.right = curr.right;
|
|
190
|
+
}
|
|
191
|
+
needBalanced = parent;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
const leftSubTreeRightMost = curr.left ? this.getRightMost(node => node, curr.left) : undefined;
|
|
196
|
+
if (leftSubTreeRightMost) {
|
|
197
|
+
const parentOfLeftSubTreeMax = leftSubTreeRightMost.parent;
|
|
198
|
+
orgCurrent = this._swapProperties(curr, leftSubTreeRightMost);
|
|
199
|
+
if (parentOfLeftSubTreeMax) {
|
|
200
|
+
if (parentOfLeftSubTreeMax.right === leftSubTreeRightMost) {
|
|
201
|
+
parentOfLeftSubTreeMax.right = leftSubTreeRightMost.left;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
parentOfLeftSubTreeMax.left = leftSubTreeRightMost.left;
|
|
205
|
+
}
|
|
206
|
+
needBalanced = parentOfLeftSubTreeMax;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
this._size = this._size - 1;
|
|
211
|
+
// TODO How to handle when the count of target node is lesser than current node's count
|
|
212
|
+
if (orgCurrent)
|
|
213
|
+
this._count -= orgCurrent.count;
|
|
214
|
+
}
|
|
215
|
+
deletedResult.push({ deleted: orgCurrent, needBalanced });
|
|
216
|
+
if (needBalanced) {
|
|
217
|
+
this._balancePath(needBalanced);
|
|
218
|
+
}
|
|
219
|
+
return deletedResult;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Time Complexity: O(1)
|
|
223
|
+
* Space Complexity: O(1)
|
|
224
|
+
*
|
|
225
|
+
* The "clear" function overrides the parent class's "clear" function and also resets the count to
|
|
226
|
+
* zero.
|
|
227
|
+
*/
|
|
228
|
+
clear() {
|
|
229
|
+
super.clear();
|
|
230
|
+
this._count = 0;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Time Complexity: O(n log n)
|
|
234
|
+
* Space Complexity: O(log n)
|
|
235
|
+
* The `perfectlyBalance` function takes a sorted array of nodes and builds a balanced binary search
|
|
236
|
+
* tree using either a recursive or iterative approach.
|
|
237
|
+
* @param {IterationType} iterationType - The `iterationType` parameter is an optional parameter that
|
|
238
|
+
* specifies the type of iteration to use when building the balanced binary search tree. It has a
|
|
239
|
+
* default value of `this.iterationType`, which means it will use the iteration type currently set in
|
|
240
|
+
* the object.
|
|
241
|
+
* @returns The function `perfectlyBalance` returns a boolean value. It returns `true` if the
|
|
242
|
+
* balancing operation is successful, and `false` if there are no nodes to balance.
|
|
243
|
+
*/
|
|
244
|
+
perfectlyBalance(iterationType = this.iterationType) {
|
|
245
|
+
const sorted = this.dfs(node => node, 'IN'), n = sorted.length;
|
|
246
|
+
if (sorted.length < 1)
|
|
247
|
+
return false;
|
|
248
|
+
this.clear();
|
|
249
|
+
if (iterationType === 'RECURSIVE') {
|
|
250
|
+
const buildBalanceBST = (l, r) => {
|
|
251
|
+
if (l > r)
|
|
252
|
+
return;
|
|
253
|
+
const m = l + Math.floor((r - l) / 2);
|
|
254
|
+
const midNode = sorted[m];
|
|
255
|
+
if (this._isMapMode)
|
|
256
|
+
this.add(midNode.key, undefined, midNode.count);
|
|
257
|
+
else
|
|
258
|
+
this.add(midNode.key, midNode.value, midNode.count);
|
|
259
|
+
buildBalanceBST(l, m - 1);
|
|
260
|
+
buildBalanceBST(m + 1, r);
|
|
261
|
+
};
|
|
262
|
+
buildBalanceBST(0, n - 1);
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
const stack = [[0, n - 1]];
|
|
267
|
+
while (stack.length > 0) {
|
|
268
|
+
const popped = stack.pop();
|
|
269
|
+
if (popped) {
|
|
270
|
+
const [l, r] = popped;
|
|
271
|
+
if (l <= r) {
|
|
272
|
+
const m = l + Math.floor((r - l) / 2);
|
|
273
|
+
const midNode = sorted[m];
|
|
274
|
+
if (this._isMapMode)
|
|
275
|
+
this.add(midNode.key, undefined, midNode.count);
|
|
276
|
+
else
|
|
277
|
+
this.add(midNode.key, midNode.value, midNode.count);
|
|
278
|
+
stack.push([m + 1, r]);
|
|
279
|
+
stack.push([l, m - 1]);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Time complexity: O(n)
|
|
288
|
+
* Space complexity: O(n)
|
|
289
|
+
*
|
|
290
|
+
* The function overrides the clone method to create a deep copy of a tree object.
|
|
291
|
+
* @returns The `clone()` method is returning a cloned instance of the `TREE` object.
|
|
292
|
+
*/
|
|
293
|
+
clone() {
|
|
294
|
+
const cloned = this.createTree();
|
|
295
|
+
if (this._isMapMode)
|
|
296
|
+
this.bfs(node => cloned.add(node.key, undefined, node.count));
|
|
297
|
+
else
|
|
298
|
+
this.bfs(node => cloned.add(node.key, node.value, node.count));
|
|
299
|
+
if (this._isMapMode)
|
|
300
|
+
cloned._store = this._store;
|
|
301
|
+
return cloned;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The `map` function in TypeScript overrides the default behavior to create a new AVLTreeCounter
|
|
305
|
+
* with modified entries based on a provided callback.
|
|
306
|
+
* @param callback - The `callback` parameter is a function that will be called for each entry in the
|
|
307
|
+
* AVLTreeCounter. It takes four arguments:
|
|
308
|
+
* @param [options] - The `options` parameter in the `override map` function is of type
|
|
309
|
+
* `AVLTreeCounterOptions<MK, MV, MR>`. This parameter allows you to provide additional
|
|
310
|
+
* configuration options when creating a new `AVLTreeCounter` instance within the `map` function.
|
|
311
|
+
* These options
|
|
312
|
+
* @param {any} [thisArg] - The `thisArg` parameter in the `override map` function is used to specify
|
|
313
|
+
* the value of `this` when executing the `callback` function. It allows you to set the context
|
|
314
|
+
* (value of `this`) for the callback function. This can be useful when you want to access properties
|
|
315
|
+
* or
|
|
316
|
+
* @returns The `map` method is returning a new `AVLTreeCounter` instance with the entries
|
|
317
|
+
* transformed by the provided `callback` function. Each entry in the original tree is passed to the
|
|
318
|
+
* `callback` function along with the index and the original tree itself. The transformed entries are
|
|
319
|
+
* then added to the new `AVLTreeCounter` instance, which is returned at the end.
|
|
320
|
+
*/
|
|
321
|
+
map(callback, options, thisArg) {
|
|
322
|
+
const newTree = new AVLTreeCounter([], options);
|
|
323
|
+
let index = 0;
|
|
324
|
+
for (const [key, value] of this) {
|
|
325
|
+
newTree.add(callback.call(thisArg, key, value, index++, this));
|
|
326
|
+
}
|
|
327
|
+
return newTree;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The function `keyValueNodeEntryRawToNodeAndValue` converts a key, value, entry, or raw element into
|
|
331
|
+
* a node object.
|
|
332
|
+
* @param {BTNRep<K, V, AVLTreeCounterNode<K, V>>} keyNodeOrEntry - The
|
|
333
|
+
* `keyNodeOrEntry` parameter can be of type `R` or `BTNRep<K, V, AVLTreeCounterNode<K, V>>`.
|
|
334
|
+
* @param {V} [value] - The `value` parameter is an optional value that can be passed to the
|
|
335
|
+
* `override` function. It represents the value associated with the key in the data structure. If no
|
|
336
|
+
* value is provided, it will default to `undefined`.
|
|
337
|
+
* @param [count=1] - The `count` parameter is an optional parameter that specifies the number of
|
|
338
|
+
* times the key-value pair should be added to the data structure. If not provided, it defaults to 1.
|
|
339
|
+
* @returns either a AVLTreeCounterNode<K, V> object or undefined.
|
|
340
|
+
*/
|
|
341
|
+
_keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value, count = 1) {
|
|
342
|
+
if (keyNodeOrEntry === undefined || keyNodeOrEntry === null)
|
|
343
|
+
return [undefined, undefined];
|
|
344
|
+
if (this.isNode(keyNodeOrEntry))
|
|
345
|
+
return [keyNodeOrEntry, value];
|
|
346
|
+
if (this.isEntry(keyNodeOrEntry)) {
|
|
347
|
+
const [key, entryValue] = keyNodeOrEntry;
|
|
348
|
+
if (key === undefined || key === null)
|
|
349
|
+
return [undefined, undefined];
|
|
350
|
+
const finalValue = value !== null && value !== void 0 ? value : entryValue;
|
|
351
|
+
return [this.createNode(key, finalValue, count), finalValue];
|
|
352
|
+
}
|
|
353
|
+
return [this.createNode(keyNodeOrEntry, value, count), value];
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Time Complexity: O(1)
|
|
357
|
+
* Space Complexity: O(1)
|
|
358
|
+
*
|
|
359
|
+
* The `_swapProperties` function swaps the properties (key, value, count, height) between two nodes
|
|
360
|
+
* in a binary search tree.
|
|
361
|
+
* @param {BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>} srcNode - The `srcNode` parameter represents the source node
|
|
362
|
+
* that will be swapped with the `destNode`.
|
|
363
|
+
* @param {BSTNOptKeyOrNode<K, AVLTreeCounterNode<K, V>>} destNode - The `destNode` parameter represents the destination
|
|
364
|
+
* node where the properties will be swapped with the source node.
|
|
365
|
+
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
366
|
+
* If either `srcNode` or `destNode` is undefined, it returns `undefined`.
|
|
367
|
+
*/
|
|
368
|
+
_swapProperties(srcNode, destNode) {
|
|
369
|
+
srcNode = this.ensureNode(srcNode);
|
|
370
|
+
destNode = this.ensureNode(destNode);
|
|
371
|
+
if (srcNode && destNode) {
|
|
372
|
+
const { key, value, count, height } = destNode;
|
|
373
|
+
const tempNode = this.createNode(key, value, count);
|
|
374
|
+
if (tempNode) {
|
|
375
|
+
tempNode.height = height;
|
|
376
|
+
destNode.key = srcNode.key;
|
|
377
|
+
if (!this._isMapMode)
|
|
378
|
+
destNode.value = srcNode.value;
|
|
379
|
+
destNode.count = srcNode.count;
|
|
380
|
+
destNode.height = srcNode.height;
|
|
381
|
+
srcNode.key = tempNode.key;
|
|
382
|
+
if (!this._isMapMode)
|
|
383
|
+
srcNode.value = tempNode.value;
|
|
384
|
+
srcNode.count = tempNode.count;
|
|
385
|
+
srcNode.height = tempNode.height;
|
|
386
|
+
}
|
|
387
|
+
return destNode;
|
|
388
|
+
}
|
|
389
|
+
return undefined;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Time Complexity: O(1)
|
|
393
|
+
* Space Complexity: O(1)
|
|
394
|
+
*
|
|
395
|
+
* The function replaces an old node with a new node and updates the count property of the new node.
|
|
396
|
+
* @param {AVLTreeCounterNode<K, V>} oldNode - The oldNode parameter represents the node that needs to be replaced in the
|
|
397
|
+
* data structure. It is of type AVLTreeCounterNode<K, V>.
|
|
398
|
+
* @param {AVLTreeCounterNode<K, V>} newNode - The `newNode` parameter is an instance of the `AVLTreeCounterNode<K, V>` class.
|
|
399
|
+
* @returns The method is returning the result of calling the `_replaceNode` method from the
|
|
400
|
+
* superclass, which is of type `AVLTreeCounterNode<K, V>`.
|
|
401
|
+
*/
|
|
402
|
+
_replaceNode(oldNode, newNode) {
|
|
403
|
+
newNode.count = oldNode.count + newNode.count;
|
|
404
|
+
return super._replaceNode(oldNode, newNode);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
exports.AVLTreeCounter = AVLTreeCounter;
|
|
408
|
+
//# sourceMappingURL=avl-tree-counter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avl-tree-counter.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/avl-tree-counter.ts"],"names":[],"mappings":";;;AAiBA,yCAAkD;AAElD,MAAa,kBAAqC,SAAQ,sBAAiB;IACzE;;;;;;;;;OAS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