data-structure-typed 2.0.5 → 2.1.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 +5 -1
- package/COMMANDS.md +27 -0
- package/README.md +5 -34
- package/benchmark/report.html +13 -77
- package/benchmark/report.json +152 -184
- package/dist/cjs/index.cjs +13062 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.mjs +12984 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.cjs +13091 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +13013 -0
- package/dist/index.js.map +1 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +219 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +144 -0
- package/dist/types/data-structures/base/linear-base.d.ts +335 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +182 -0
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +135 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +291 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +754 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +413 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +208 -0
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +190 -0
- package/dist/{esm → types}/data-structures/binary-tree/tree-multi-map.d.ts +72 -69
- package/dist/types/data-structures/graph/abstract-graph.d.ts +340 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +207 -0
- package/dist/types/data-structures/graph/map-graph.d.ts +78 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +188 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +345 -0
- package/dist/types/data-structures/heap/heap.d.ts +503 -0
- package/dist/types/data-structures/heap/max-heap.d.ts +32 -0
- package/dist/types/data-structures/heap/min-heap.d.ts +33 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +769 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +451 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +27 -0
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +27 -0
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +26 -0
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +15 -0
- package/dist/types/data-structures/queue/deque.d.ts +431 -0
- package/dist/types/data-structures/queue/queue.d.ts +308 -0
- package/dist/{cjs → types}/data-structures/stack/stack.d.ts +124 -102
- package/dist/types/data-structures/trie/trie.d.ts +350 -0
- package/dist/types/interfaces/binary-tree.d.ts +59 -0
- package/dist/types/interfaces/graph.d.ts +21 -0
- package/dist/{cjs → types}/types/data-structures/base/base.d.ts +1 -1
- package/dist/{esm → types}/types/data-structures/graph/abstract-graph.d.ts +4 -0
- package/dist/{cjs → types}/types/utils/utils.d.ts +1 -0
- package/dist/{esm → types}/utils/utils.d.ts +1 -1
- package/dist/umd/data-structure-typed.js +4693 -6484
- package/dist/umd/data-structure-typed.js.map +1 -0
- package/dist/umd/data-structure-typed.min.js +8 -6
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/jest.integration.config.js +3 -0
- package/package.json +13 -12
- package/src/data-structures/base/iterable-element-base.ts +238 -115
- package/src/data-structures/base/iterable-entry-base.ts +96 -120
- package/src/data-structures/base/linear-base.ts +271 -277
- package/src/data-structures/binary-tree/avl-tree-counter.ts +196 -217
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +188 -102
- package/src/data-structures/binary-tree/avl-tree.ts +237 -206
- package/src/data-structures/binary-tree/binary-tree.ts +665 -896
- package/src/data-structures/binary-tree/bst.ts +565 -572
- package/src/data-structures/binary-tree/red-black-tree.ts +157 -223
- package/src/data-structures/binary-tree/tree-counter.ts +195 -219
- package/src/data-structures/binary-tree/tree-multi-map.ts +127 -98
- package/src/data-structures/graph/abstract-graph.ts +339 -264
- package/src/data-structures/graph/directed-graph.ts +146 -236
- package/src/data-structures/graph/map-graph.ts +63 -60
- package/src/data-structures/graph/undirected-graph.ts +129 -152
- package/src/data-structures/hash/hash-map.ts +274 -496
- package/src/data-structures/heap/heap.ts +389 -402
- package/src/data-structures/heap/max-heap.ts +12 -76
- package/src/data-structures/heap/min-heap.ts +13 -76
- package/src/data-structures/linked-list/doubly-linked-list.ts +426 -530
- package/src/data-structures/linked-list/singly-linked-list.ts +495 -517
- package/src/data-structures/linked-list/skip-linked-list.ts +1 -108
- package/src/data-structures/priority-queue/max-priority-queue.ts +12 -87
- package/src/data-structures/priority-queue/min-priority-queue.ts +11 -88
- package/src/data-structures/priority-queue/priority-queue.ts +3 -92
- package/src/data-structures/queue/deque.ts +381 -357
- package/src/data-structures/queue/queue.ts +310 -264
- package/src/data-structures/stack/stack.ts +217 -131
- package/src/data-structures/trie/trie.ts +240 -175
- package/src/interfaces/binary-tree.ts +240 -6
- package/src/interfaces/graph.ts +37 -0
- package/src/types/data-structures/base/base.ts +5 -5
- package/src/types/data-structures/graph/abstract-graph.ts +5 -0
- package/src/types/utils/utils.ts +2 -0
- package/src/utils/utils.ts +9 -14
- package/test/integration/all-in-one.test.ts +1 -1
- package/test/integration/index.html +1 -1
- package/test/performance/benchmark-runner.ts +528 -0
- package/test/performance/data-structures/comparison/comparison.test.ts +27 -57
- package/test/performance/reportor.mjs +43 -43
- package/test/performance/runner-config.json +39 -0
- package/test/performance/single-suite-runner.ts +69 -0
- package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +5 -5
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +4 -4
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +350 -90
- package/test/unit/data-structures/binary-tree/bst.test.ts +12 -9
- package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +2 -2
- package/test/unit/data-structures/binary-tree/tree-counter.test.ts +25 -24
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +112 -4
- package/test/unit/data-structures/graph/abstract-graph.test.ts +0 -4
- package/test/unit/data-structures/graph/directed-graph.test.ts +1 -1
- package/test/unit/data-structures/heap/heap.test.ts +14 -21
- package/test/unit/data-structures/heap/max-heap.test.ts +5 -9
- package/test/unit/data-structures/heap/min-heap.test.ts +1 -4
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +14 -14
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +0 -7
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +8 -11
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +1 -4
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +1 -4
- package/test/unit/data-structures/queue/queue.test.ts +4 -5
- package/test/unit/utils/utils.test.ts +0 -1
- package/tsconfig-base.json +20 -20
- package/tsconfig-types.json +17 -0
- package/tsconfig.test.json +8 -0
- package/tsup.config.js +11 -22
- package/tsup.node.config.ts +37 -0
- package/dist/cjs/common/index.js +0 -29
- package/dist/cjs/common/index.js.map +0 -1
- package/dist/cjs/data-structures/base/index.js +0 -19
- package/dist/cjs/data-structures/base/index.js.map +0 -1
- package/dist/cjs/data-structures/base/iterable-element-base.d.ts +0 -116
- package/dist/cjs/data-structures/base/iterable-element-base.js +0 -202
- package/dist/cjs/data-structures/base/iterable-element-base.js.map +0 -1
- package/dist/cjs/data-structures/base/iterable-entry-base.d.ts +0 -168
- package/dist/cjs/data-structures/base/iterable-entry-base.js +0 -241
- package/dist/cjs/data-structures/base/iterable-entry-base.js.map +0 -1
- package/dist/cjs/data-structures/base/linear-base.d.ts +0 -277
- package/dist/cjs/data-structures/base/linear-base.js +0 -553
- package/dist/cjs/data-structures/base/linear-base.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.d.ts +0 -214
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js +0 -409
- package/dist/cjs/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -104
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js +0 -203
- package/dist/cjs/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +0 -302
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +0 -599
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +0 -295
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +0 -910
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +0 -2197
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +0 -461
- package/dist/cjs/data-structures/binary-tree/bst.js +0 -880
- package/dist/cjs/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/index.js +0 -27
- package/dist/cjs/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/red-black-tree.d.ts +0 -280
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js +0 -642
- package/dist/cjs/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/segment-tree.js +0 -298
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/tree-counter.d.ts +0 -212
- package/dist/cjs/data-structures/binary-tree/tree-counter.js +0 -445
- package/dist/cjs/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.d.ts +0 -267
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js +0 -365
- package/dist/cjs/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +0 -335
- package/dist/cjs/data-structures/graph/abstract-graph.js +0 -867
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +0 -323
- package/dist/cjs/data-structures/graph/directed-graph.js +0 -613
- package/dist/cjs/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/index.js +0 -21
- package/dist/cjs/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/data-structures/graph/map-graph.d.ts +0 -84
- package/dist/cjs/data-structures/graph/map-graph.js +0 -111
- package/dist/cjs/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +0 -231
- package/dist/cjs/data-structures/graph/undirected-graph.js +0 -445
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +0 -519
- package/dist/cjs/data-structures/hash/hash-map.js +0 -880
- package/dist/cjs/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/data-structures/hash/index.js +0 -18
- package/dist/cjs/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +0 -578
- package/dist/cjs/data-structures/heap/heap.js +0 -911
- package/dist/cjs/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/data-structures/heap/index.js +0 -20
- package/dist/cjs/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/data-structures/heap/max-heap.d.ts +0 -68
- package/dist/cjs/data-structures/heap/max-heap.js +0 -96
- package/dist/cjs/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/data-structures/heap/min-heap.d.ts +0 -68
- package/dist/cjs/data-structures/heap/min-heap.js +0 -87
- package/dist/cjs/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/data-structures/index.js +0 -29
- package/dist/cjs/data-structures/index.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +0 -885
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +0 -1238
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/index.js +0 -20
- package/dist/cjs/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +0 -500
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +0 -870
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +0 -134
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +0 -245
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/matrix/index.js +0 -19
- package/dist/cjs/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/data-structures/matrix/matrix.js +0 -449
- package/dist/cjs/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/data-structures/matrix/navigator.js +0 -112
- package/dist/cjs/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/index.js +0 -20
- package/dist/cjs/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +0 -71
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +0 -102
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +0 -72
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +0 -94
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +0 -74
- package/dist/cjs/data-structures/priority-queue/priority-queue.js +0 -96
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +0 -458
- package/dist/cjs/data-structures/queue/deque.js +0 -919
- package/dist/cjs/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/data-structures/queue/index.js +0 -19
- package/dist/cjs/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +0 -329
- package/dist/cjs/data-structures/queue/queue.js +0 -457
- package/dist/cjs/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/data-structures/stack/index.js +0 -18
- package/dist/cjs/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/data-structures/stack/stack.js +0 -346
- package/dist/cjs/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/data-structures/tree/index.js +0 -18
- package/dist/cjs/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/data-structures/tree/tree.js +0 -108
- package/dist/cjs/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/data-structures/trie/index.js +0 -18
- package/dist/cjs/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +0 -351
- package/dist/cjs/data-structures/trie/trie.js +0 -594
- package/dist/cjs/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/index.js +0 -22
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/interfaces/binary-tree.d.ts +0 -9
- package/dist/cjs/interfaces/binary-tree.js +0 -3
- package/dist/cjs/interfaces/binary-tree.js.map +0 -1
- package/dist/cjs/interfaces/doubly-linked-list.js +0 -3
- package/dist/cjs/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/cjs/interfaces/graph.d.ts +0 -5
- package/dist/cjs/interfaces/graph.js +0 -3
- package/dist/cjs/interfaces/graph.js.map +0 -1
- package/dist/cjs/interfaces/heap.js +0 -3
- package/dist/cjs/interfaces/heap.js.map +0 -1
- package/dist/cjs/interfaces/index.js +0 -25
- package/dist/cjs/interfaces/index.js.map +0 -1
- package/dist/cjs/interfaces/navigator.js +0 -3
- package/dist/cjs/interfaces/navigator.js.map +0 -1
- package/dist/cjs/interfaces/priority-queue.js +0 -3
- package/dist/cjs/interfaces/priority-queue.js.map +0 -1
- package/dist/cjs/interfaces/segment-tree.js +0 -3
- package/dist/cjs/interfaces/segment-tree.js.map +0 -1
- package/dist/cjs/interfaces/singly-linked-list.js +0 -3
- package/dist/cjs/interfaces/singly-linked-list.js.map +0 -1
- package/dist/cjs/types/common.js +0 -3
- package/dist/cjs/types/common.js.map +0 -1
- package/dist/cjs/types/data-structures/base/base.js +0 -3
- package/dist/cjs/types/data-structures/base/base.js.map +0 -1
- package/dist/cjs/types/data-structures/base/index.js +0 -18
- package/dist/cjs/types/data-structures/base/index.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/bst.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/index.js +0 -26
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js +0 -3
- package/dist/cjs/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/abstract-graph.d.ts +0 -10
- package/dist/cjs/types/data-structures/graph/abstract-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/directed-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/index.js +0 -20
- package/dist/cjs/types/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/map-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/undirected-graph.js +0 -3
- package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/hash-map.js +0 -3
- package/dist/cjs/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/index.js +0 -18
- package/dist/cjs/types/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/heap.js +0 -3
- package/dist/cjs/types/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/index.js +0 -18
- package/dist/cjs/types/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/max-heap.js +0 -3
- package/dist/cjs/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/min-heap.js +0 -3
- package/dist/cjs/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/types/data-structures/index.js +0 -29
- package/dist/cjs/types/data-structures/index.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js +0 -3
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/index.js +0 -20
- package/dist/cjs/types/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js +0 -3
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js +0 -3
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/index.js +0 -19
- package/dist/cjs/types/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/matrix.js +0 -3
- package/dist/cjs/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/navigator.js +0 -3
- package/dist/cjs/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/index.js +0 -20
- package/dist/cjs/types/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js +0 -3
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js +0 -3
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js +0 -3
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/deque.js +0 -3
- package/dist/cjs/types/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/index.js +0 -19
- package/dist/cjs/types/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/queue.js +0 -3
- package/dist/cjs/types/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/types/data-structures/stack/index.js +0 -18
- package/dist/cjs/types/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/types/data-structures/stack/stack.js +0 -3
- package/dist/cjs/types/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/types/data-structures/tree/index.js +0 -18
- package/dist/cjs/types/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/types/data-structures/tree/tree.js +0 -3
- package/dist/cjs/types/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/types/data-structures/trie/index.js +0 -18
- package/dist/cjs/types/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/types/data-structures/trie/trie.js +0 -3
- package/dist/cjs/types/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/types/index.js +0 -20
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/utils/index.js +0 -19
- package/dist/cjs/types/utils/index.js.map +0 -1
- package/dist/cjs/types/utils/utils.js +0 -3
- package/dist/cjs/types/utils/utils.js.map +0 -1
- package/dist/cjs/types/utils/validate-type.js +0 -3
- package/dist/cjs/types/utils/validate-type.js.map +0 -1
- package/dist/cjs/utils/index.js +0 -19
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/number.js +0 -24
- package/dist/cjs/utils/number.js.map +0 -1
- package/dist/cjs/utils/utils.d.ts +0 -209
- package/dist/cjs/utils/utils.js +0 -353
- package/dist/cjs/utils/utils.js.map +0 -1
- package/dist/esm/common/index.d.ts +0 -12
- package/dist/esm/common/index.js +0 -29
- package/dist/esm/common/index.js.map +0 -1
- package/dist/esm/data-structures/base/index.d.ts +0 -2
- package/dist/esm/data-structures/base/index.js +0 -3
- package/dist/esm/data-structures/base/index.js.map +0 -1
- package/dist/esm/data-structures/base/iterable-element-base.d.ts +0 -116
- package/dist/esm/data-structures/base/iterable-element-base.js +0 -199
- package/dist/esm/data-structures/base/iterable-element-base.js.map +0 -1
- package/dist/esm/data-structures/base/iterable-entry-base.d.ts +0 -168
- package/dist/esm/data-structures/base/iterable-entry-base.js +0 -237
- package/dist/esm/data-structures/base/iterable-entry-base.js.map +0 -1
- package/dist/esm/data-structures/base/linear-base.d.ts +0 -277
- package/dist/esm/data-structures/base/linear-base.js +0 -549
- package/dist/esm/data-structures/base/linear-base.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.d.ts +0 -214
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js +0 -410
- package/dist/esm/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -104
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js +0 -205
- package/dist/esm/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/avl-tree.d.ts +0 -302
- package/dist/esm/data-structures/binary-tree/avl-tree.js +0 -601
- package/dist/esm/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -174
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js +0 -296
- package/dist/esm/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/binary-tree.d.ts +0 -910
- package/dist/esm/data-structures/binary-tree/binary-tree.js +0 -2198
- package/dist/esm/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/bst.d.ts +0 -461
- package/dist/esm/data-structures/binary-tree/bst.js +0 -881
- package/dist/esm/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/index.d.ts +0 -10
- package/dist/esm/data-structures/binary-tree/index.js +0 -11
- package/dist/esm/data-structures/binary-tree/index.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/red-black-tree.d.ts +0 -280
- package/dist/esm/data-structures/binary-tree/red-black-tree.js +0 -641
- package/dist/esm/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/segment-tree.d.ts +0 -160
- package/dist/esm/data-structures/binary-tree/segment-tree.js +0 -295
- package/dist/esm/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/tree-counter.d.ts +0 -212
- package/dist/esm/data-structures/binary-tree/tree-counter.js +0 -446
- package/dist/esm/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js +0 -367
- package/dist/esm/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/esm/data-structures/graph/abstract-graph.d.ts +0 -335
- package/dist/esm/data-structures/graph/abstract-graph.js +0 -862
- package/dist/esm/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/esm/data-structures/graph/directed-graph.d.ts +0 -323
- package/dist/esm/data-structures/graph/directed-graph.js +0 -609
- package/dist/esm/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/esm/data-structures/graph/index.d.ts +0 -4
- package/dist/esm/data-structures/graph/index.js +0 -5
- package/dist/esm/data-structures/graph/index.js.map +0 -1
- package/dist/esm/data-structures/graph/map-graph.d.ts +0 -84
- package/dist/esm/data-structures/graph/map-graph.js +0 -108
- package/dist/esm/data-structures/graph/map-graph.js.map +0 -1
- package/dist/esm/data-structures/graph/undirected-graph.d.ts +0 -231
- package/dist/esm/data-structures/graph/undirected-graph.js +0 -439
- package/dist/esm/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/esm/data-structures/hash/hash-map.d.ts +0 -519
- package/dist/esm/data-structures/hash/hash-map.js +0 -878
- package/dist/esm/data-structures/hash/hash-map.js.map +0 -1
- package/dist/esm/data-structures/hash/index.d.ts +0 -1
- package/dist/esm/data-structures/hash/index.js +0 -2
- package/dist/esm/data-structures/hash/index.js.map +0 -1
- package/dist/esm/data-structures/heap/heap.d.ts +0 -578
- package/dist/esm/data-structures/heap/heap.js +0 -914
- package/dist/esm/data-structures/heap/heap.js.map +0 -1
- package/dist/esm/data-structures/heap/index.d.ts +0 -3
- package/dist/esm/data-structures/heap/index.js +0 -4
- package/dist/esm/data-structures/heap/index.js.map +0 -1
- package/dist/esm/data-structures/heap/max-heap.d.ts +0 -68
- package/dist/esm/data-structures/heap/max-heap.js +0 -95
- package/dist/esm/data-structures/heap/max-heap.js.map +0 -1
- package/dist/esm/data-structures/heap/min-heap.d.ts +0 -68
- package/dist/esm/data-structures/heap/min-heap.js +0 -83
- package/dist/esm/data-structures/heap/min-heap.js.map +0 -1
- package/dist/esm/data-structures/index.d.ts +0 -12
- package/dist/esm/data-structures/index.js +0 -13
- package/dist/esm/data-structures/index.js.map +0 -1
- package/dist/esm/data-structures/linked-list/doubly-linked-list.d.ts +0 -885
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js +0 -1236
- package/dist/esm/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/esm/data-structures/linked-list/index.d.ts +0 -3
- package/dist/esm/data-structures/linked-list/index.js +0 -4
- package/dist/esm/data-structures/linked-list/index.js.map +0 -1
- package/dist/esm/data-structures/linked-list/singly-linked-list.d.ts +0 -500
- package/dist/esm/data-structures/linked-list/singly-linked-list.js +0 -866
- package/dist/esm/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/esm/data-structures/linked-list/skip-linked-list.d.ts +0 -134
- package/dist/esm/data-structures/linked-list/skip-linked-list.js +0 -243
- package/dist/esm/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/esm/data-structures/matrix/index.d.ts +0 -2
- package/dist/esm/data-structures/matrix/index.js +0 -3
- package/dist/esm/data-structures/matrix/index.js.map +0 -1
- package/dist/esm/data-structures/matrix/matrix.d.ts +0 -168
- package/dist/esm/data-structures/matrix/matrix.js +0 -444
- package/dist/esm/data-structures/matrix/matrix.js.map +0 -1
- package/dist/esm/data-structures/matrix/navigator.d.ts +0 -55
- package/dist/esm/data-structures/matrix/navigator.js +0 -114
- package/dist/esm/data-structures/matrix/navigator.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/index.d.ts +0 -3
- package/dist/esm/data-structures/priority-queue/index.js +0 -4
- package/dist/esm/data-structures/priority-queue/index.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/max-priority-queue.d.ts +0 -71
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js +0 -101
- package/dist/esm/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/min-priority-queue.d.ts +0 -72
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js +0 -90
- package/dist/esm/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/esm/data-structures/priority-queue/priority-queue.d.ts +0 -74
- package/dist/esm/data-structures/priority-queue/priority-queue.js +0 -92
- package/dist/esm/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/esm/data-structures/queue/deque.d.ts +0 -458
- package/dist/esm/data-structures/queue/deque.js +0 -915
- package/dist/esm/data-structures/queue/deque.js.map +0 -1
- package/dist/esm/data-structures/queue/index.d.ts +0 -2
- package/dist/esm/data-structures/queue/index.js +0 -3
- package/dist/esm/data-structures/queue/index.js.map +0 -1
- package/dist/esm/data-structures/queue/queue.d.ts +0 -329
- package/dist/esm/data-structures/queue/queue.js +0 -452
- package/dist/esm/data-structures/queue/queue.js.map +0 -1
- package/dist/esm/data-structures/stack/index.d.ts +0 -1
- package/dist/esm/data-structures/stack/index.js +0 -2
- package/dist/esm/data-structures/stack/index.js.map +0 -1
- package/dist/esm/data-structures/stack/stack.d.ts +0 -284
- package/dist/esm/data-structures/stack/stack.js +0 -342
- package/dist/esm/data-structures/stack/stack.js.map +0 -1
- package/dist/esm/data-structures/tree/index.d.ts +0 -1
- package/dist/esm/data-structures/tree/index.js +0 -2
- package/dist/esm/data-structures/tree/index.js.map +0 -1
- package/dist/esm/data-structures/tree/tree.d.ts +0 -62
- package/dist/esm/data-structures/tree/tree.js +0 -107
- package/dist/esm/data-structures/tree/tree.js.map +0 -1
- package/dist/esm/data-structures/trie/index.d.ts +0 -1
- package/dist/esm/data-structures/trie/index.js +0 -2
- package/dist/esm/data-structures/trie/index.js.map +0 -1
- package/dist/esm/data-structures/trie/trie.d.ts +0 -351
- package/dist/esm/data-structures/trie/trie.js +0 -592
- package/dist/esm/data-structures/trie/trie.js.map +0 -1
- package/dist/esm/index.d.ts +0 -5
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/interfaces/binary-tree.d.ts +0 -9
- package/dist/esm/interfaces/binary-tree.js +0 -2
- package/dist/esm/interfaces/binary-tree.js.map +0 -1
- package/dist/esm/interfaces/doubly-linked-list.d.ts +0 -1
- package/dist/esm/interfaces/doubly-linked-list.js +0 -2
- package/dist/esm/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/esm/interfaces/graph.d.ts +0 -5
- package/dist/esm/interfaces/graph.js +0 -2
- package/dist/esm/interfaces/graph.js.map +0 -1
- package/dist/esm/interfaces/heap.d.ts +0 -1
- package/dist/esm/interfaces/heap.js +0 -2
- package/dist/esm/interfaces/heap.js.map +0 -1
- package/dist/esm/interfaces/index.d.ts +0 -8
- package/dist/esm/interfaces/index.js +0 -9
- package/dist/esm/interfaces/index.js.map +0 -1
- package/dist/esm/interfaces/navigator.d.ts +0 -1
- package/dist/esm/interfaces/navigator.js +0 -2
- package/dist/esm/interfaces/navigator.js.map +0 -1
- package/dist/esm/interfaces/priority-queue.d.ts +0 -1
- package/dist/esm/interfaces/priority-queue.js +0 -2
- package/dist/esm/interfaces/priority-queue.js.map +0 -1
- package/dist/esm/interfaces/segment-tree.d.ts +0 -1
- package/dist/esm/interfaces/segment-tree.js +0 -2
- package/dist/esm/interfaces/segment-tree.js.map +0 -1
- package/dist/esm/interfaces/singly-linked-list.d.ts +0 -1
- package/dist/esm/interfaces/singly-linked-list.js +0 -2
- package/dist/esm/interfaces/singly-linked-list.js.map +0 -1
- package/dist/esm/types/common.d.ts +0 -15
- package/dist/esm/types/common.js +0 -2
- package/dist/esm/types/common.js.map +0 -1
- package/dist/esm/types/data-structures/base/base.d.ts +0 -13
- package/dist/esm/types/data-structures/base/base.js +0 -2
- package/dist/esm/types/data-structures/base/base.js.map +0 -1
- package/dist/esm/types/data-structures/base/index.d.ts +0 -1
- package/dist/esm/types/data-structures/base/index.js +0 -2
- package/dist/esm/types/data-structures/base/index.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-counter.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree-multi-map.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/avl-tree.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -1
- package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/binary-tree.d.ts +0 -29
- package/dist/esm/types/data-structures/binary-tree/binary-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/bst.d.ts +0 -12
- package/dist/esm/types/data-structures/binary-tree/bst.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/index.d.ts +0 -9
- package/dist/esm/types/data-structures/binary-tree/index.js +0 -10
- package/dist/esm/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.d.ts +0 -3
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/red-black-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/segment-tree.d.ts +0 -1
- package/dist/esm/types/data-structures/binary-tree/segment-tree.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/tree-counter.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-counter.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-counter.js.map +0 -1
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js +0 -2
- package/dist/esm/types/data-structures/binary-tree/tree-multi-map.js.map +0 -1
- package/dist/esm/types/data-structures/graph/abstract-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/esm/types/data-structures/graph/directed-graph.d.ts +0 -1
- package/dist/esm/types/data-structures/graph/directed-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/esm/types/data-structures/graph/index.d.ts +0 -3
- package/dist/esm/types/data-structures/graph/index.js +0 -4
- package/dist/esm/types/data-structures/graph/index.js.map +0 -1
- package/dist/esm/types/data-structures/graph/map-graph.d.ts +0 -1
- package/dist/esm/types/data-structures/graph/map-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/esm/types/data-structures/graph/undirected-graph.d.ts +0 -1
- package/dist/esm/types/data-structures/graph/undirected-graph.js +0 -2
- package/dist/esm/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/esm/types/data-structures/hash/hash-map.d.ts +0 -19
- package/dist/esm/types/data-structures/hash/hash-map.js +0 -2
- package/dist/esm/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/esm/types/data-structures/hash/index.d.ts +0 -2
- package/dist/esm/types/data-structures/hash/index.js +0 -2
- package/dist/esm/types/data-structures/hash/index.js.map +0 -1
- package/dist/esm/types/data-structures/heap/heap.d.ts +0 -5
- package/dist/esm/types/data-structures/heap/heap.js +0 -2
- package/dist/esm/types/data-structures/heap/heap.js.map +0 -1
- package/dist/esm/types/data-structures/heap/index.d.ts +0 -1
- package/dist/esm/types/data-structures/heap/index.js +0 -2
- package/dist/esm/types/data-structures/heap/index.js.map +0 -1
- package/dist/esm/types/data-structures/heap/max-heap.d.ts +0 -1
- package/dist/esm/types/data-structures/heap/max-heap.js +0 -2
- package/dist/esm/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/esm/types/data-structures/heap/min-heap.d.ts +0 -1
- package/dist/esm/types/data-structures/heap/min-heap.js +0 -2
- package/dist/esm/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/esm/types/data-structures/index.d.ts +0 -12
- package/dist/esm/types/data-structures/index.js +0 -13
- package/dist/esm/types/data-structures/index.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -2
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js +0 -2
- package/dist/esm/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/index.d.ts +0 -3
- package/dist/esm/types/data-structures/linked-list/index.js +0 -4
- package/dist/esm/types/data-structures/linked-list/index.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.d.ts +0 -2
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.js +0 -2
- package/dist/esm/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/esm/types/data-structures/linked-list/skip-linked-list.d.ts +0 -4
- package/dist/esm/types/data-structures/linked-list/skip-linked-list.js +0 -2
- package/dist/esm/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/esm/types/data-structures/matrix/index.d.ts +0 -2
- package/dist/esm/types/data-structures/matrix/index.js +0 -3
- package/dist/esm/types/data-structures/matrix/index.js.map +0 -1
- package/dist/esm/types/data-structures/matrix/matrix.d.ts +0 -7
- package/dist/esm/types/data-structures/matrix/matrix.js +0 -2
- package/dist/esm/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/esm/types/data-structures/matrix/navigator.d.ts +0 -14
- package/dist/esm/types/data-structures/matrix/navigator.js +0 -2
- package/dist/esm/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/index.d.ts +0 -3
- package/dist/esm/types/data-structures/priority-queue/index.js +0 -4
- package/dist/esm/types/data-structures/priority-queue/index.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -1
- package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js +0 -2
- package/dist/esm/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -1
- package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js +0 -2
- package/dist/esm/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/esm/types/data-structures/priority-queue/priority-queue.d.ts +0 -2
- package/dist/esm/types/data-structures/priority-queue/priority-queue.js +0 -2
- package/dist/esm/types/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/esm/types/data-structures/queue/deque.d.ts +0 -4
- package/dist/esm/types/data-structures/queue/deque.js +0 -2
- package/dist/esm/types/data-structures/queue/deque.js.map +0 -1
- package/dist/esm/types/data-structures/queue/index.d.ts +0 -2
- package/dist/esm/types/data-structures/queue/index.js +0 -3
- package/dist/esm/types/data-structures/queue/index.js.map +0 -1
- package/dist/esm/types/data-structures/queue/queue.d.ts +0 -4
- package/dist/esm/types/data-structures/queue/queue.js +0 -2
- package/dist/esm/types/data-structures/queue/queue.js.map +0 -1
- package/dist/esm/types/data-structures/stack/index.d.ts +0 -1
- package/dist/esm/types/data-structures/stack/index.js +0 -2
- package/dist/esm/types/data-structures/stack/index.js.map +0 -1
- package/dist/esm/types/data-structures/stack/stack.d.ts +0 -2
- package/dist/esm/types/data-structures/stack/stack.js +0 -2
- package/dist/esm/types/data-structures/stack/stack.js.map +0 -1
- package/dist/esm/types/data-structures/tree/index.d.ts +0 -1
- package/dist/esm/types/data-structures/tree/index.js +0 -2
- package/dist/esm/types/data-structures/tree/index.js.map +0 -1
- package/dist/esm/types/data-structures/tree/tree.d.ts +0 -1
- package/dist/esm/types/data-structures/tree/tree.js +0 -2
- package/dist/esm/types/data-structures/tree/tree.js.map +0 -1
- package/dist/esm/types/data-structures/trie/index.d.ts +0 -1
- package/dist/esm/types/data-structures/trie/index.js +0 -2
- package/dist/esm/types/data-structures/trie/index.js.map +0 -1
- package/dist/esm/types/data-structures/trie/trie.d.ts +0 -4
- package/dist/esm/types/data-structures/trie/trie.js +0 -2
- package/dist/esm/types/data-structures/trie/trie.js.map +0 -1
- package/dist/esm/types/index.d.ts +0 -3
- package/dist/esm/types/index.js +0 -4
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/utils/index.d.ts +0 -2
- package/dist/esm/types/utils/index.js +0 -3
- package/dist/esm/types/utils/index.js.map +0 -1
- package/dist/esm/types/utils/utils.d.ts +0 -21
- package/dist/esm/types/utils/utils.js +0 -2
- package/dist/esm/types/utils/utils.js.map +0 -1
- package/dist/esm/types/utils/validate-type.d.ts +0 -19
- package/dist/esm/types/utils/validate-type.js +0 -2
- package/dist/esm/types/utils/validate-type.js.map +0 -1
- package/dist/esm/utils/index.d.ts +0 -2
- package/dist/esm/utils/index.js +0 -3
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/number.d.ts +0 -14
- package/dist/esm/utils/number.js +0 -21
- package/dist/esm/utils/number.js.map +0 -1
- package/dist/esm/utils/utils.js +0 -324
- package/dist/esm/utils/utils.js.map +0 -1
- package/test/performance/data-structures/binary-tree/avl-tree.test.mjs +0 -71
- package/test/performance/data-structures/binary-tree/red-black-tree.test.mjs +0 -81
- package/tsconfig-cjs.json +0 -14
- package/tsconfig-esm.json +0 -14
- /package/dist/{cjs → types}/common/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/base/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/graph/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/hash/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/heap/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/stack/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{cjs → types}/data-structures/trie/index.d.ts +0 -0
- /package/dist/{cjs → types}/index.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/doubly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/heap.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/index.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/navigator.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/segment-tree.d.ts +0 -0
- /package/dist/{cjs → types}/interfaces/singly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/common.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/base/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-counter.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/binary-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/bst.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/red-black-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-counter.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/binary-tree/tree-multi-map.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/hash/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/heap.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/queue/deque.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/queue/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/queue/queue.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/stack/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/stack/stack.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/tree/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/trie/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/data-structures/trie/trie.d.ts +0 -0
- /package/dist/{cjs → types}/types/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/utils/index.d.ts +0 -0
- /package/dist/{cjs → types}/types/utils/validate-type.d.ts +0 -0
- /package/dist/{cjs → types}/utils/index.d.ts +0 -0
- /package/dist/{cjs → types}/utils/number.d.ts +0 -0
|
@@ -1,160 +0,0 @@
|
|
|
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 type { SegmentTreeNodeVal } from '../../types';
|
|
9
|
-
export declare class SegmentTreeNode {
|
|
10
|
-
/**
|
|
11
|
-
* The constructor initializes the properties of a SegmentTreeNode object.
|
|
12
|
-
* @param {number} start - The `start` parameter represents the starting index of the segment covered
|
|
13
|
-
* by this node in a segment tree.
|
|
14
|
-
* @param {number} end - The `end` parameter represents the end index of the segment covered by this
|
|
15
|
-
* node in a segment tree.
|
|
16
|
-
* @param {number} sum - The `sum` parameter represents the sum of the values in the range covered by
|
|
17
|
-
* the segment tree node.
|
|
18
|
-
* @param {SegmentTreeNodeVal | undefined} [value] - The `value` parameter is an optional parameter
|
|
19
|
-
* of type `SegmentTreeNodeVal`. It represents the value associated with the segment tree node.
|
|
20
|
-
*/
|
|
21
|
-
constructor(start: number, end: number, sum: number, value?: SegmentTreeNodeVal | undefined);
|
|
22
|
-
protected _start: number;
|
|
23
|
-
/**
|
|
24
|
-
* The function returns the value of the protected variable _start.
|
|
25
|
-
* @returns The start value, which is of type number.
|
|
26
|
-
*/
|
|
27
|
-
get start(): number;
|
|
28
|
-
/**
|
|
29
|
-
* The above function sets the value of the "start" property.
|
|
30
|
-
* @param {number} value - The value parameter is of type number.
|
|
31
|
-
*/
|
|
32
|
-
set start(value: number);
|
|
33
|
-
protected _end: number;
|
|
34
|
-
/**
|
|
35
|
-
* The function returns the value of the protected variable `_end`.
|
|
36
|
-
* @returns The value of the protected property `_end`.
|
|
37
|
-
*/
|
|
38
|
-
get end(): number;
|
|
39
|
-
/**
|
|
40
|
-
* The above function sets the value of the "end" property.
|
|
41
|
-
* @param {number} value - The value parameter is a number that represents the new value for the end
|
|
42
|
-
* property.
|
|
43
|
-
*/
|
|
44
|
-
set end(value: number);
|
|
45
|
-
protected _value: SegmentTreeNodeVal | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* The function returns the value of a segment tree node.
|
|
48
|
-
* @returns The value being returned is either a `SegmentTreeNodeVal` object or `undefined`.
|
|
49
|
-
*/
|
|
50
|
-
get value(): SegmentTreeNodeVal | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* The function sets the value of a segment tree node.
|
|
53
|
-
* @param {SegmentTreeNodeVal | undefined} value - The `value` parameter is of type
|
|
54
|
-
* `SegmentTreeNodeVal` or `undefined`.
|
|
55
|
-
*/
|
|
56
|
-
set value(value: SegmentTreeNodeVal | undefined);
|
|
57
|
-
protected _sum: number;
|
|
58
|
-
/**
|
|
59
|
-
* The function returns the value of the sum property.
|
|
60
|
-
* @returns The method is returning the value of the variable `_sum`.
|
|
61
|
-
*/
|
|
62
|
-
get sum(): number;
|
|
63
|
-
/**
|
|
64
|
-
* The above function sets the value of the sum property.
|
|
65
|
-
* @param {number} value - The parameter "value" is of type "number".
|
|
66
|
-
*/
|
|
67
|
-
set sum(value: number);
|
|
68
|
-
protected _left: SegmentTreeNode | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* The function returns the left child of a segment tree node.
|
|
71
|
-
* @returns The `left` property of the `SegmentTreeNode` object is being returned. It is of type
|
|
72
|
-
* `SegmentTreeNode` or `undefined`.
|
|
73
|
-
*/
|
|
74
|
-
get left(): SegmentTreeNode | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* The function sets the value of the left property of a SegmentTreeNode object.
|
|
77
|
-
* @param {SegmentTreeNode | undefined} value - The value parameter is of type SegmentTreeNode or
|
|
78
|
-
* undefined.
|
|
79
|
-
*/
|
|
80
|
-
set left(value: SegmentTreeNode | undefined);
|
|
81
|
-
protected _right: SegmentTreeNode | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* The function returns the right child of a segment tree node.
|
|
84
|
-
* @returns The `getRight()` method is returning a value of type `SegmentTreeNode` or `undefined`.
|
|
85
|
-
*/
|
|
86
|
-
get right(): SegmentTreeNode | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* The function sets the right child of a segment tree node.
|
|
89
|
-
* @param {SegmentTreeNode | undefined} value - The `value` parameter is of type `SegmentTreeNode |
|
|
90
|
-
* undefined`. This means that it can accept either a `SegmentTreeNode` object or `undefined` as its
|
|
91
|
-
* value.
|
|
92
|
-
*/
|
|
93
|
-
set right(value: SegmentTreeNode | undefined);
|
|
94
|
-
}
|
|
95
|
-
export declare class SegmentTree {
|
|
96
|
-
/**
|
|
97
|
-
* The constructor initializes the values, start, end, and root properties of an object.
|
|
98
|
-
* @param {number[]} values - An array of numbers that will be used to build a binary search tree.
|
|
99
|
-
* @param {number} [start] - The `start` parameter is the index of the first element in the `values` array that should
|
|
100
|
-
* be included in the range. If no value is provided for `start`, it defaults to 0, which means the range starts from
|
|
101
|
-
* the beginning of the array.
|
|
102
|
-
* @param {number} [end] - The "end" parameter is the index of the last element in the "values" array that should be
|
|
103
|
-
* included in the range. If not provided, it defaults to the index of the last element in the "values" array.
|
|
104
|
-
*/
|
|
105
|
-
constructor(values: number[], start?: number, end?: number);
|
|
106
|
-
protected _values: number[];
|
|
107
|
-
/**
|
|
108
|
-
* The function returns an array of numbers.
|
|
109
|
-
* @returns An array of numbers is being returned.
|
|
110
|
-
*/
|
|
111
|
-
get values(): number[];
|
|
112
|
-
protected _start: number;
|
|
113
|
-
/**
|
|
114
|
-
* The function returns the value of the protected variable _start.
|
|
115
|
-
* @returns The start value, which is of type number.
|
|
116
|
-
*/
|
|
117
|
-
get start(): number;
|
|
118
|
-
protected _end: number;
|
|
119
|
-
/**
|
|
120
|
-
* The function returns the value of the protected variable `_end`.
|
|
121
|
-
* @returns The value of the protected property `_end`.
|
|
122
|
-
*/
|
|
123
|
-
get end(): number;
|
|
124
|
-
protected _root: SegmentTreeNode | undefined;
|
|
125
|
-
/**
|
|
126
|
-
* The function returns the root node of a segment tree.
|
|
127
|
-
* @returns The `root` property of the class `SegmentTreeNode` or `undefined` if it is not defined.
|
|
128
|
-
*/
|
|
129
|
-
get root(): SegmentTreeNode | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* The build function creates a segment tree by recursively dividing the given range into smaller segments and assigning
|
|
132
|
-
* the sum of values to each segment.
|
|
133
|
-
* @param {number} start - The `start` parameter represents the starting index of the segment or range for which we are
|
|
134
|
-
* building the segment tree.
|
|
135
|
-
* @param {number} end - The "end" parameter represents the ending index of the segment or range for which we want to
|
|
136
|
-
* build a segment tree.
|
|
137
|
-
* @returns a SegmentTreeNode object.
|
|
138
|
-
*/
|
|
139
|
-
build(start: number, end: number): SegmentTreeNode;
|
|
140
|
-
/**
|
|
141
|
-
* The function updates the value of a node in a segment tree and recalculates the sum of its children if they exist.
|
|
142
|
-
* @param {number} index - The index parameter represents the index of the node in the segment tree that needs to be
|
|
143
|
-
* updated.
|
|
144
|
-
* @param {number} sum - The `sum` parameter represents the new value that should be assigned to the `sum` property of
|
|
145
|
-
* the `SegmentTreeNode` at the specified `index`.
|
|
146
|
-
* @param {SegmentTreeNodeVal} [value] - The `value` parameter is an optional value that can be assigned to the `value`
|
|
147
|
-
* property of the `SegmentTreeNode` object. It is not currently used in the code, but you can uncomment the line `//
|
|
148
|
-
* cur.value = value;` and pass a value for `value` in the
|
|
149
|
-
* @returns The function does not return anything.
|
|
150
|
-
*/
|
|
151
|
-
updateNode(index: number, sum: number, value?: SegmentTreeNodeVal): void;
|
|
152
|
-
/**
|
|
153
|
-
* The function `querySumByRange` calculates the sum of values within a given range in a segment tree.
|
|
154
|
-
* @param {number} indexA - The starting index of the range for which you want to calculate the sum.
|
|
155
|
-
* @param {number} indexB - The parameter `indexB` represents the ending index of the range for which you want to
|
|
156
|
-
* calculate the sum.
|
|
157
|
-
* @returns The function `querySumByRange` returns a number.
|
|
158
|
-
*/
|
|
159
|
-
querySumByRange(indexA: number, indexB: number): number;
|
|
160
|
-
}
|
|
@@ -1,295 +0,0 @@
|
|
|
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
|
-
export class SegmentTreeNode {
|
|
9
|
-
/**
|
|
10
|
-
* The constructor initializes the properties of a SegmentTreeNode object.
|
|
11
|
-
* @param {number} start - The `start` parameter represents the starting index of the segment covered
|
|
12
|
-
* by this node in a segment tree.
|
|
13
|
-
* @param {number} end - The `end` parameter represents the end index of the segment covered by this
|
|
14
|
-
* node in a segment tree.
|
|
15
|
-
* @param {number} sum - The `sum` parameter represents the sum of the values in the range covered by
|
|
16
|
-
* the segment tree node.
|
|
17
|
-
* @param {SegmentTreeNodeVal | undefined} [value] - The `value` parameter is an optional parameter
|
|
18
|
-
* of type `SegmentTreeNodeVal`. It represents the value associated with the segment tree node.
|
|
19
|
-
*/
|
|
20
|
-
constructor(start, end, sum, value) {
|
|
21
|
-
this._start = start;
|
|
22
|
-
this._end = end;
|
|
23
|
-
this._sum = sum;
|
|
24
|
-
this._value = value || undefined;
|
|
25
|
-
}
|
|
26
|
-
_start = 0;
|
|
27
|
-
/**
|
|
28
|
-
* The function returns the value of the protected variable _start.
|
|
29
|
-
* @returns The start value, which is of type number.
|
|
30
|
-
*/
|
|
31
|
-
get start() {
|
|
32
|
-
return this._start;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The above function sets the value of the "start" property.
|
|
36
|
-
* @param {number} value - The value parameter is of type number.
|
|
37
|
-
*/
|
|
38
|
-
set start(value) {
|
|
39
|
-
this._start = value;
|
|
40
|
-
}
|
|
41
|
-
_end = 0;
|
|
42
|
-
/**
|
|
43
|
-
* The function returns the value of the protected variable `_end`.
|
|
44
|
-
* @returns The value of the protected property `_end`.
|
|
45
|
-
*/
|
|
46
|
-
get end() {
|
|
47
|
-
return this._end;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* The above function sets the value of the "end" property.
|
|
51
|
-
* @param {number} value - The value parameter is a number that represents the new value for the end
|
|
52
|
-
* property.
|
|
53
|
-
*/
|
|
54
|
-
set end(value) {
|
|
55
|
-
this._end = value;
|
|
56
|
-
}
|
|
57
|
-
_value = undefined;
|
|
58
|
-
/**
|
|
59
|
-
* The function returns the value of a segment tree node.
|
|
60
|
-
* @returns The value being returned is either a `SegmentTreeNodeVal` object or `undefined`.
|
|
61
|
-
*/
|
|
62
|
-
get value() {
|
|
63
|
-
return this._value;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The function sets the value of a segment tree node.
|
|
67
|
-
* @param {SegmentTreeNodeVal | undefined} value - The `value` parameter is of type
|
|
68
|
-
* `SegmentTreeNodeVal` or `undefined`.
|
|
69
|
-
*/
|
|
70
|
-
set value(value) {
|
|
71
|
-
this._value = value;
|
|
72
|
-
}
|
|
73
|
-
_sum = 0;
|
|
74
|
-
/**
|
|
75
|
-
* The function returns the value of the sum property.
|
|
76
|
-
* @returns The method is returning the value of the variable `_sum`.
|
|
77
|
-
*/
|
|
78
|
-
get sum() {
|
|
79
|
-
return this._sum;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* The above function sets the value of the sum property.
|
|
83
|
-
* @param {number} value - The parameter "value" is of type "number".
|
|
84
|
-
*/
|
|
85
|
-
set sum(value) {
|
|
86
|
-
this._sum = value;
|
|
87
|
-
}
|
|
88
|
-
_left = undefined;
|
|
89
|
-
/**
|
|
90
|
-
* The function returns the left child of a segment tree node.
|
|
91
|
-
* @returns The `left` property of the `SegmentTreeNode` object is being returned. It is of type
|
|
92
|
-
* `SegmentTreeNode` or `undefined`.
|
|
93
|
-
*/
|
|
94
|
-
get left() {
|
|
95
|
-
return this._left;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* The function sets the value of the left property of a SegmentTreeNode object.
|
|
99
|
-
* @param {SegmentTreeNode | undefined} value - The value parameter is of type SegmentTreeNode or
|
|
100
|
-
* undefined.
|
|
101
|
-
*/
|
|
102
|
-
set left(value) {
|
|
103
|
-
this._left = value;
|
|
104
|
-
}
|
|
105
|
-
_right = undefined;
|
|
106
|
-
/**
|
|
107
|
-
* The function returns the right child of a segment tree node.
|
|
108
|
-
* @returns The `getRight()` method is returning a value of type `SegmentTreeNode` or `undefined`.
|
|
109
|
-
*/
|
|
110
|
-
get right() {
|
|
111
|
-
return this._right;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* The function sets the right child of a segment tree node.
|
|
115
|
-
* @param {SegmentTreeNode | undefined} value - The `value` parameter is of type `SegmentTreeNode |
|
|
116
|
-
* undefined`. This means that it can accept either a `SegmentTreeNode` object or `undefined` as its
|
|
117
|
-
* value.
|
|
118
|
-
*/
|
|
119
|
-
set right(value) {
|
|
120
|
-
this._right = value;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
export class SegmentTree {
|
|
124
|
-
/**
|
|
125
|
-
* The constructor initializes the values, start, end, and root properties of an object.
|
|
126
|
-
* @param {number[]} values - An array of numbers that will be used to build a binary search tree.
|
|
127
|
-
* @param {number} [start] - The `start` parameter is the index of the first element in the `values` array that should
|
|
128
|
-
* be included in the range. If no value is provided for `start`, it defaults to 0, which means the range starts from
|
|
129
|
-
* the beginning of the array.
|
|
130
|
-
* @param {number} [end] - The "end" parameter is the index of the last element in the "values" array that should be
|
|
131
|
-
* included in the range. If not provided, it defaults to the index of the last element in the "values" array.
|
|
132
|
-
*/
|
|
133
|
-
constructor(values, start, end) {
|
|
134
|
-
start = start || 0;
|
|
135
|
-
end = end || values.length - 1;
|
|
136
|
-
this._values = values;
|
|
137
|
-
this._start = start;
|
|
138
|
-
this._end = end;
|
|
139
|
-
if (values.length > 0) {
|
|
140
|
-
this._root = this.build(start, end);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
this._root = undefined;
|
|
144
|
-
this._values = [];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
_values = [];
|
|
148
|
-
/**
|
|
149
|
-
* The function returns an array of numbers.
|
|
150
|
-
* @returns An array of numbers is being returned.
|
|
151
|
-
*/
|
|
152
|
-
get values() {
|
|
153
|
-
return this._values;
|
|
154
|
-
}
|
|
155
|
-
_start = 0;
|
|
156
|
-
/**
|
|
157
|
-
* The function returns the value of the protected variable _start.
|
|
158
|
-
* @returns The start value, which is of type number.
|
|
159
|
-
*/
|
|
160
|
-
get start() {
|
|
161
|
-
return this._start;
|
|
162
|
-
}
|
|
163
|
-
_end;
|
|
164
|
-
/**
|
|
165
|
-
* The function returns the value of the protected variable `_end`.
|
|
166
|
-
* @returns The value of the protected property `_end`.
|
|
167
|
-
*/
|
|
168
|
-
get end() {
|
|
169
|
-
return this._end;
|
|
170
|
-
}
|
|
171
|
-
_root;
|
|
172
|
-
/**
|
|
173
|
-
* The function returns the root node of a segment tree.
|
|
174
|
-
* @returns The `root` property of the class `SegmentTreeNode` or `undefined` if it is not defined.
|
|
175
|
-
*/
|
|
176
|
-
get root() {
|
|
177
|
-
return this._root;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* The build function creates a segment tree by recursively dividing the given range into smaller segments and assigning
|
|
181
|
-
* the sum of values to each segment.
|
|
182
|
-
* @param {number} start - The `start` parameter represents the starting index of the segment or range for which we are
|
|
183
|
-
* building the segment tree.
|
|
184
|
-
* @param {number} end - The "end" parameter represents the ending index of the segment or range for which we want to
|
|
185
|
-
* build a segment tree.
|
|
186
|
-
* @returns a SegmentTreeNode object.
|
|
187
|
-
*/
|
|
188
|
-
build(start, end) {
|
|
189
|
-
if (start > end) {
|
|
190
|
-
return new SegmentTreeNode(start, end, 0);
|
|
191
|
-
}
|
|
192
|
-
if (start === end)
|
|
193
|
-
return new SegmentTreeNode(start, end, this._values[start]);
|
|
194
|
-
const mid = start + Math.floor((end - start) / 2);
|
|
195
|
-
const left = this.build(start, mid);
|
|
196
|
-
const right = this.build(mid + 1, end);
|
|
197
|
-
const cur = new SegmentTreeNode(start, end, left.sum + right.sum);
|
|
198
|
-
cur.left = left;
|
|
199
|
-
cur.right = right;
|
|
200
|
-
return cur;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* The function updates the value of a node in a segment tree and recalculates the sum of its children if they exist.
|
|
204
|
-
* @param {number} index - The index parameter represents the index of the node in the segment tree that needs to be
|
|
205
|
-
* updated.
|
|
206
|
-
* @param {number} sum - The `sum` parameter represents the new value that should be assigned to the `sum` property of
|
|
207
|
-
* the `SegmentTreeNode` at the specified `index`.
|
|
208
|
-
* @param {SegmentTreeNodeVal} [value] - The `value` parameter is an optional value that can be assigned to the `value`
|
|
209
|
-
* property of the `SegmentTreeNode` object. It is not currently used in the code, but you can uncomment the line `//
|
|
210
|
-
* cur.value = value;` and pass a value for `value` in the
|
|
211
|
-
* @returns The function does not return anything.
|
|
212
|
-
*/
|
|
213
|
-
updateNode(index, sum, value) {
|
|
214
|
-
const root = this.root || undefined;
|
|
215
|
-
if (!root) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const dfs = (cur, index, sum, value) => {
|
|
219
|
-
if (cur.start === cur.end && cur.start === index) {
|
|
220
|
-
cur.sum = sum;
|
|
221
|
-
if (value !== undefined)
|
|
222
|
-
cur.value = value;
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const mid = cur.start + Math.floor((cur.end - cur.start) / 2);
|
|
226
|
-
if (index <= mid) {
|
|
227
|
-
if (cur.left) {
|
|
228
|
-
dfs(cur.left, index, sum, value);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
if (cur.right) {
|
|
233
|
-
dfs(cur.right, index, sum, value);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
if (cur.left && cur.right) {
|
|
237
|
-
cur.sum = cur.left.sum + cur.right.sum;
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
dfs(root, index, sum, value);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* The function `querySumByRange` calculates the sum of values within a given range in a segment tree.
|
|
244
|
-
* @param {number} indexA - The starting index of the range for which you want to calculate the sum.
|
|
245
|
-
* @param {number} indexB - The parameter `indexB` represents the ending index of the range for which you want to
|
|
246
|
-
* calculate the sum.
|
|
247
|
-
* @returns The function `querySumByRange` returns a number.
|
|
248
|
-
*/
|
|
249
|
-
querySumByRange(indexA, indexB) {
|
|
250
|
-
const root = this.root || undefined;
|
|
251
|
-
if (!root) {
|
|
252
|
-
return 0;
|
|
253
|
-
}
|
|
254
|
-
if (indexA < 0 || indexB >= this.values.length || indexA > indexB) {
|
|
255
|
-
return NaN;
|
|
256
|
-
}
|
|
257
|
-
const dfs = (cur, i, j) => {
|
|
258
|
-
if (i <= cur.start && j >= cur.end) {
|
|
259
|
-
// The range [i, j] completely covers the current node's range [cur.start, cur.end]
|
|
260
|
-
return cur.sum;
|
|
261
|
-
}
|
|
262
|
-
const mid = cur.start + Math.floor((cur.end - cur.start) / 2);
|
|
263
|
-
if (j <= mid) {
|
|
264
|
-
if (cur.left) {
|
|
265
|
-
return dfs(cur.left, i, j);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
return NaN;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
else if (i > mid) {
|
|
272
|
-
if (cur.right) {
|
|
273
|
-
return dfs(cur.right, i, j);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
return NaN;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
// Query both left and right subtrees
|
|
281
|
-
let leftSum = 0;
|
|
282
|
-
let rightSum = 0;
|
|
283
|
-
if (cur.left) {
|
|
284
|
-
leftSum = dfs(cur.left, i, mid);
|
|
285
|
-
}
|
|
286
|
-
if (cur.right) {
|
|
287
|
-
rightSum = dfs(cur.right, mid + 1, j);
|
|
288
|
-
}
|
|
289
|
-
return leftSum + rightSum;
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
return dfs(root, indexA, indexB);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
//# sourceMappingURL=segment-tree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"segment-tree.js","sourceRoot":"","sources":["../../../../src/data-structures/binary-tree/segment-tree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,OAAO,eAAe;IAC1B;;;;;;;;;;OAUG;IACH,YAAY,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,KAAsC;QACzF,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,SAAS,CAAC;IACnC,CAAC;IAES,MAAM,GAAG,CAAC,CAAC;IAErB;;;OAGG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IA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