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,284 +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 { ElementCallback, StackOptions } from '../../types';
|
|
9
|
-
import { IterableElementBase } from '../base';
|
|
10
|
-
/**
|
|
11
|
-
* 1. Last In, First Out (LIFO): The core characteristic of a stack is its last in, first out nature, meaning the last element added to the stack will be the first to be removed.
|
|
12
|
-
* 2. Uses: Stacks are commonly used for managing a series of tasks or elements that need to be processed in a last in, first out manner. They are widely used in various scenarios, such as in function calls in programming languages, evaluation of arithmetic expressions, and backtracking algorithms.
|
|
13
|
-
* 3. Performance: Stack operations are typically O(1) in time complexity, meaning that regardless of the stack's size, adding, removing, and viewing the top element are very fast operations.
|
|
14
|
-
* 4. Function Calls: In most modern programming languages, the records of function calls are managed through a stack. When a function is called, its record (including parameters, local variables, and return address) is 'pushed' into the stack. When the function returns, its record is 'popped' from the stack.
|
|
15
|
-
* 5. Expression Evaluation: Used for the evaluation of arithmetic or logical expressions, especially when dealing with parenthesis matching and operator precedence.
|
|
16
|
-
* 6. Backtracking Algorithms: In problems where multiple branches need to be explored but only one branch can be explored at a time, stacks can be used to save the state at each branching point.
|
|
17
|
-
* @example
|
|
18
|
-
* // Balanced Parentheses or Brackets
|
|
19
|
-
* type ValidCharacters = ')' | '(' | ']' | '[' | '}' | '{';
|
|
20
|
-
*
|
|
21
|
-
* const stack = new Stack<string>();
|
|
22
|
-
* const input: ValidCharacters[] = '[({})]'.split('') as ValidCharacters[];
|
|
23
|
-
* const matches: { [key in ValidCharacters]?: ValidCharacters } = { ')': '(', ']': '[', '}': '{' };
|
|
24
|
-
* for (const char of input) {
|
|
25
|
-
* if ('([{'.includes(char)) {
|
|
26
|
-
* stack.push(char);
|
|
27
|
-
* } else if (')]}'.includes(char)) {
|
|
28
|
-
* if (stack.pop() !== matches[char]) {
|
|
29
|
-
* fail('Parentheses are not balanced');
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* console.log(stack.isEmpty()); // true
|
|
34
|
-
* @example
|
|
35
|
-
* // Expression Evaluation and Conversion
|
|
36
|
-
* const stack = new Stack<number>();
|
|
37
|
-
* const expression = [5, 3, '+']; // Equivalent to 5 + 3
|
|
38
|
-
* expression.forEach(token => {
|
|
39
|
-
* if (typeof token === 'number') {
|
|
40
|
-
* stack.push(token);
|
|
41
|
-
* } else {
|
|
42
|
-
* const b = stack.pop()!;
|
|
43
|
-
* const a = stack.pop()!;
|
|
44
|
-
* stack.push(token === '+' ? a + b : 0); // Only handling '+' here
|
|
45
|
-
* }
|
|
46
|
-
* });
|
|
47
|
-
* console.log(stack.pop()); // 8
|
|
48
|
-
* @example
|
|
49
|
-
* // Depth-First Search (DFS)
|
|
50
|
-
* const stack = new Stack<number>();
|
|
51
|
-
* const graph: { [key in number]: number[] } = { 1: [2, 3], 2: [4], 3: [5], 4: [], 5: [] };
|
|
52
|
-
* const visited: number[] = [];
|
|
53
|
-
* stack.push(1);
|
|
54
|
-
* while (!stack.isEmpty()) {
|
|
55
|
-
* const node = stack.pop()!;
|
|
56
|
-
* if (!visited.includes(node)) {
|
|
57
|
-
* visited.push(node);
|
|
58
|
-
* graph[node].forEach(neighbor => stack.push(neighbor));
|
|
59
|
-
* }
|
|
60
|
-
* }
|
|
61
|
-
* console.log(visited); // [1, 3, 5, 2, 4]
|
|
62
|
-
* @example
|
|
63
|
-
* // Backtracking Algorithms
|
|
64
|
-
* const stack = new Stack<[number, number]>();
|
|
65
|
-
* const maze = [
|
|
66
|
-
* ['S', ' ', 'X'],
|
|
67
|
-
* ['X', ' ', 'X'],
|
|
68
|
-
* [' ', ' ', 'E']
|
|
69
|
-
* ];
|
|
70
|
-
* const start: [number, number] = [0, 0];
|
|
71
|
-
* const end = [2, 2];
|
|
72
|
-
* const directions = [
|
|
73
|
-
* [0, 1], // To the right
|
|
74
|
-
* [1, 0], // down
|
|
75
|
-
* [0, -1], // left
|
|
76
|
-
* [-1, 0] // up
|
|
77
|
-
* ];
|
|
78
|
-
*
|
|
79
|
-
* const visited = new Set<string>(); // Used to record visited nodes
|
|
80
|
-
* stack.push(start);
|
|
81
|
-
* const path: number[][] = [];
|
|
82
|
-
*
|
|
83
|
-
* while (!stack.isEmpty()) {
|
|
84
|
-
* const [x, y] = stack.pop()!;
|
|
85
|
-
* if (visited.has(`${x},${y}`)) continue; // Skip already visited nodes
|
|
86
|
-
* visited.add(`${x},${y}`);
|
|
87
|
-
*
|
|
88
|
-
* path.push([x, y]);
|
|
89
|
-
*
|
|
90
|
-
* if (x === end[0] && y === end[1]) {
|
|
91
|
-
* break; // Find the end point and exit
|
|
92
|
-
* }
|
|
93
|
-
*
|
|
94
|
-
* for (const [dx, dy] of directions) {
|
|
95
|
-
* const nx = x + dx;
|
|
96
|
-
* const ny = y + dy;
|
|
97
|
-
* if (
|
|
98
|
-
* maze[nx]?.[ny] === ' ' || // feasible path
|
|
99
|
-
* maze[nx]?.[ny] === 'E' // destination
|
|
100
|
-
* ) {
|
|
101
|
-
* stack.push([nx, ny]);
|
|
102
|
-
* }
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
*
|
|
106
|
-
* expect(path).toContainEqual(end);
|
|
107
|
-
* @example
|
|
108
|
-
* // Function Call Stack
|
|
109
|
-
* const functionStack = new Stack<string>();
|
|
110
|
-
* functionStack.push('main');
|
|
111
|
-
* functionStack.push('foo');
|
|
112
|
-
* functionStack.push('bar');
|
|
113
|
-
* console.log(functionStack.pop()); // 'bar'
|
|
114
|
-
* console.log(functionStack.pop()); // 'foo'
|
|
115
|
-
* console.log(functionStack.pop()); // 'main'
|
|
116
|
-
* @example
|
|
117
|
-
* // Simplify File Paths
|
|
118
|
-
* const stack = new Stack<string>();
|
|
119
|
-
* const path = '/a/./b/../../c';
|
|
120
|
-
* path.split('/').forEach(segment => {
|
|
121
|
-
* if (segment === '..') stack.pop();
|
|
122
|
-
* else if (segment && segment !== '.') stack.push(segment);
|
|
123
|
-
* });
|
|
124
|
-
* console.log(stack.elements.join('/')); // 'c'
|
|
125
|
-
* @example
|
|
126
|
-
* // Stock Span Problem
|
|
127
|
-
* const stack = new Stack<number>();
|
|
128
|
-
* const prices = [100, 80, 60, 70, 60, 75, 85];
|
|
129
|
-
* const spans: number[] = [];
|
|
130
|
-
* prices.forEach((price, i) => {
|
|
131
|
-
* while (!stack.isEmpty() && prices[stack.peek()!] <= price) {
|
|
132
|
-
* stack.pop();
|
|
133
|
-
* }
|
|
134
|
-
* spans.push(stack.isEmpty() ? i + 1 : i - stack.peek()!);
|
|
135
|
-
* stack.push(i);
|
|
136
|
-
* });
|
|
137
|
-
* console.log(spans); // [1, 1, 1, 2, 1, 4, 6]
|
|
138
|
-
*/
|
|
139
|
-
export declare class Stack<E = any, R = any> extends IterableElementBase<E, R> {
|
|
140
|
-
constructor(elements?: Iterable<E> | Iterable<R>, options?: StackOptions<E, R>);
|
|
141
|
-
protected _elements: E[];
|
|
142
|
-
/**
|
|
143
|
-
* The elements function returns the elements of this set.
|
|
144
|
-
* @return An array of elements
|
|
145
|
-
*/
|
|
146
|
-
get elements(): E[];
|
|
147
|
-
/**
|
|
148
|
-
* The size() function returns the number of elements in an array.
|
|
149
|
-
* @returns The size of the elements array.
|
|
150
|
-
*/
|
|
151
|
-
get size(): number;
|
|
152
|
-
/**
|
|
153
|
-
* Time Complexity: O(n)
|
|
154
|
-
* Space Complexity: O(n)
|
|
155
|
-
*
|
|
156
|
-
* The function "fromArray" creates a new Stack object from an array of elements.
|
|
157
|
-
* @param {E[]} elements - The `elements` parameter is an array of elements of type `E`.
|
|
158
|
-
* @returns {Stack} The method is returning a new instance of the Stack class, initialized with the elements from the input
|
|
159
|
-
* array.
|
|
160
|
-
*/
|
|
161
|
-
static fromArray<E>(elements: E[]): Stack<E>;
|
|
162
|
-
/**
|
|
163
|
-
* Time Complexity: O(1)
|
|
164
|
-
* Space Complexity: O(1)
|
|
165
|
-
*
|
|
166
|
-
* The function checks if an array is empty and returns a boolean value.
|
|
167
|
-
* @returns A boolean value indicating whether the `_elements` array is empty or not.
|
|
168
|
-
*/
|
|
169
|
-
isEmpty(): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Time Complexity: O(1)
|
|
172
|
-
* Space Complexity: O(1)
|
|
173
|
-
*
|
|
174
|
-
* The `peek` function returns the last element of an array, or undefined if the array is empty.
|
|
175
|
-
* @returns The `peek()` function returns the last element of the `_elements` array, or `undefined` if the array is empty.
|
|
176
|
-
*/
|
|
177
|
-
peek(): E | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* Time Complexity: O(1)
|
|
180
|
-
* Space Complexity: O(1)
|
|
181
|
-
*
|
|
182
|
-
* The push function adds an element to the stack and returns the updated stack.
|
|
183
|
-
* @param {E} element - The parameter "element" is of type E, which means it can be any data type.
|
|
184
|
-
* @returns The `push` method is returning the updated `Stack<E>` object.
|
|
185
|
-
*/
|
|
186
|
-
push(element: E): boolean;
|
|
187
|
-
/**
|
|
188
|
-
* Time Complexity: O(1)
|
|
189
|
-
* Space Complexity: O(1)
|
|
190
|
-
*
|
|
191
|
-
* The `pop` function removes and returns the last element from an array, or returns undefined if the array is empty.
|
|
192
|
-
* @returns The `pop()` method is returning the last element of the array `_elements` if the array is not empty. If the
|
|
193
|
-
* array is empty, it returns `undefined`.
|
|
194
|
-
*/
|
|
195
|
-
pop(): E | undefined;
|
|
196
|
-
/**
|
|
197
|
-
* Time Complexity: O(k)
|
|
198
|
-
* Space Complexity: O(1)
|
|
199
|
-
*
|
|
200
|
-
* The function `pushMany` iterates over elements and pushes them into an array after applying a
|
|
201
|
-
* transformation function if provided.
|
|
202
|
-
* @param {Iterable<E> | Iterable<R>} elements - The `elements` parameter in the `pushMany` function
|
|
203
|
-
* is an iterable containing elements of type `E` or `R`. The function iterates over each element in
|
|
204
|
-
* the iterable and pushes it into the data structure. If a transformation function `toElementFn` is
|
|
205
|
-
* provided, it is used to
|
|
206
|
-
* @returns The `pushMany` function is returning an array of boolean values indicating whether each
|
|
207
|
-
* element was successfully pushed into the data structure.
|
|
208
|
-
*/
|
|
209
|
-
pushMany(elements: Iterable<E> | Iterable<R>): boolean[];
|
|
210
|
-
/**
|
|
211
|
-
* Time Complexity: O(n)
|
|
212
|
-
* Space Complexity: O(1)
|
|
213
|
-
*
|
|
214
|
-
* The toArray function returns a copy of the elements in an array.
|
|
215
|
-
* @returns An array of type E.
|
|
216
|
-
*/
|
|
217
|
-
delete(element: E): boolean;
|
|
218
|
-
/**
|
|
219
|
-
* Time Complexity: O(n)
|
|
220
|
-
* Space Complexity: O(1)
|
|
221
|
-
*
|
|
222
|
-
* The toArray function returns a copy of the elements in an array.
|
|
223
|
-
* @returns An array of type E.
|
|
224
|
-
*/
|
|
225
|
-
deleteAt(index: number): boolean;
|
|
226
|
-
/**
|
|
227
|
-
* Time Complexity: O(1)
|
|
228
|
-
* Space Complexity: O(1)
|
|
229
|
-
*
|
|
230
|
-
* The clear function clears the elements array.
|
|
231
|
-
*/
|
|
232
|
-
clear(): void;
|
|
233
|
-
/**
|
|
234
|
-
* Time Complexity: O(n)
|
|
235
|
-
* Space Complexity: O(n)
|
|
236
|
-
*
|
|
237
|
-
* The `clone()` function returns a new `Stack` object with the same elements as the original stack.
|
|
238
|
-
* @returns The `clone()` method is returning a new `Stack` object with a copy of the `_elements` array.
|
|
239
|
-
*/
|
|
240
|
-
clone(): Stack<E, R>;
|
|
241
|
-
/**
|
|
242
|
-
* Time Complexity: O(n)
|
|
243
|
-
* Space Complexity: O(n)
|
|
244
|
-
*
|
|
245
|
-
* The `filter` function creates a new stack containing elements from the original stack that satisfy
|
|
246
|
-
* a given predicate function.
|
|
247
|
-
* @param predicate - The `predicate` parameter is a callback function that takes three arguments:
|
|
248
|
-
* the current element being iterated over, the index of the current element, and the stack itself.
|
|
249
|
-
* It should return a boolean value indicating whether the element should be included in the filtered
|
|
250
|
-
* stack or not.
|
|
251
|
-
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
252
|
-
* to be used as `this` when executing the `predicate` function. If `thisArg` is provided, it will be
|
|
253
|
-
* passed as the `this` value to the `predicate` function. If `thisArg` is
|
|
254
|
-
* @returns The `filter` method is returning a new `Stack` object that contains the elements that
|
|
255
|
-
* satisfy the given predicate function.
|
|
256
|
-
*/
|
|
257
|
-
filter(predicate: ElementCallback<E, R, boolean>, thisArg?: any): Stack<E, R>;
|
|
258
|
-
/**
|
|
259
|
-
* Time Complexity: O(n)
|
|
260
|
-
* Space Complexity: O(n)
|
|
261
|
-
*
|
|
262
|
-
* The `map` function takes a callback function and applies it to each element in the stack,
|
|
263
|
-
* returning a new stack with the results.
|
|
264
|
-
* @param callback - The callback parameter is a function that will be called for each element in the
|
|
265
|
-
* stack. It takes three arguments: the current element, the index of the element, and the stack
|
|
266
|
-
* itself. It should return a new value that will be added to the new stack.
|
|
267
|
-
* @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
|
|
268
|
-
* transform the raw element (`RM`) into a new element (`EM`) before pushing it into the new stack.
|
|
269
|
-
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
|
|
270
|
-
* specify the value of `this` within the callback function. It is used to set the context or scope
|
|
271
|
-
* in which the callback function will be executed. If `thisArg` is provided, it will be used as the
|
|
272
|
-
* value of
|
|
273
|
-
* @returns a new Stack object with elements of type EM and raw elements of type RM.
|
|
274
|
-
*/
|
|
275
|
-
map<EM, RM>(callback: ElementCallback<E, R, EM>, toElementFn?: (rawElement: RM) => EM, thisArg?: any): Stack<EM, RM>;
|
|
276
|
-
/**
|
|
277
|
-
* Time Complexity: O(n)
|
|
278
|
-
* Space Complexity: O(n)
|
|
279
|
-
*
|
|
280
|
-
* Custom iterator for the Stack class.
|
|
281
|
-
* @returns An iterator object.
|
|
282
|
-
*/
|
|
283
|
-
protected _getIterator(): IterableIterator<E>;
|
|
284
|
-
}
|
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import { IterableElementBase } from '../base';
|
|
2
|
-
/**
|
|
3
|
-
* 1. Last In, First Out (LIFO): The core characteristic of a stack is its last in, first out nature, meaning the last element added to the stack will be the first to be removed.
|
|
4
|
-
* 2. Uses: Stacks are commonly used for managing a series of tasks or elements that need to be processed in a last in, first out manner. They are widely used in various scenarios, such as in function calls in programming languages, evaluation of arithmetic expressions, and backtracking algorithms.
|
|
5
|
-
* 3. Performance: Stack operations are typically O(1) in time complexity, meaning that regardless of the stack's size, adding, removing, and viewing the top element are very fast operations.
|
|
6
|
-
* 4. Function Calls: In most modern programming languages, the records of function calls are managed through a stack. When a function is called, its record (including parameters, local variables, and return address) is 'pushed' into the stack. When the function returns, its record is 'popped' from the stack.
|
|
7
|
-
* 5. Expression Evaluation: Used for the evaluation of arithmetic or logical expressions, especially when dealing with parenthesis matching and operator precedence.
|
|
8
|
-
* 6. Backtracking Algorithms: In problems where multiple branches need to be explored but only one branch can be explored at a time, stacks can be used to save the state at each branching point.
|
|
9
|
-
* @example
|
|
10
|
-
* // Balanced Parentheses or Brackets
|
|
11
|
-
* type ValidCharacters = ')' | '(' | ']' | '[' | '}' | '{';
|
|
12
|
-
*
|
|
13
|
-
* const stack = new Stack<string>();
|
|
14
|
-
* const input: ValidCharacters[] = '[({})]'.split('') as ValidCharacters[];
|
|
15
|
-
* const matches: { [key in ValidCharacters]?: ValidCharacters } = { ')': '(', ']': '[', '}': '{' };
|
|
16
|
-
* for (const char of input) {
|
|
17
|
-
* if ('([{'.includes(char)) {
|
|
18
|
-
* stack.push(char);
|
|
19
|
-
* } else if (')]}'.includes(char)) {
|
|
20
|
-
* if (stack.pop() !== matches[char]) {
|
|
21
|
-
* fail('Parentheses are not balanced');
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* console.log(stack.isEmpty()); // true
|
|
26
|
-
* @example
|
|
27
|
-
* // Expression Evaluation and Conversion
|
|
28
|
-
* const stack = new Stack<number>();
|
|
29
|
-
* const expression = [5, 3, '+']; // Equivalent to 5 + 3
|
|
30
|
-
* expression.forEach(token => {
|
|
31
|
-
* if (typeof token === 'number') {
|
|
32
|
-
* stack.push(token);
|
|
33
|
-
* } else {
|
|
34
|
-
* const b = stack.pop()!;
|
|
35
|
-
* const a = stack.pop()!;
|
|
36
|
-
* stack.push(token === '+' ? a + b : 0); // Only handling '+' here
|
|
37
|
-
* }
|
|
38
|
-
* });
|
|
39
|
-
* console.log(stack.pop()); // 8
|
|
40
|
-
* @example
|
|
41
|
-
* // Depth-First Search (DFS)
|
|
42
|
-
* const stack = new Stack<number>();
|
|
43
|
-
* const graph: { [key in number]: number[] } = { 1: [2, 3], 2: [4], 3: [5], 4: [], 5: [] };
|
|
44
|
-
* const visited: number[] = [];
|
|
45
|
-
* stack.push(1);
|
|
46
|
-
* while (!stack.isEmpty()) {
|
|
47
|
-
* const node = stack.pop()!;
|
|
48
|
-
* if (!visited.includes(node)) {
|
|
49
|
-
* visited.push(node);
|
|
50
|
-
* graph[node].forEach(neighbor => stack.push(neighbor));
|
|
51
|
-
* }
|
|
52
|
-
* }
|
|
53
|
-
* console.log(visited); // [1, 3, 5, 2, 4]
|
|
54
|
-
* @example
|
|
55
|
-
* // Backtracking Algorithms
|
|
56
|
-
* const stack = new Stack<[number, number]>();
|
|
57
|
-
* const maze = [
|
|
58
|
-
* ['S', ' ', 'X'],
|
|
59
|
-
* ['X', ' ', 'X'],
|
|
60
|
-
* [' ', ' ', 'E']
|
|
61
|
-
* ];
|
|
62
|
-
* const start: [number, number] = [0, 0];
|
|
63
|
-
* const end = [2, 2];
|
|
64
|
-
* const directions = [
|
|
65
|
-
* [0, 1], // To the right
|
|
66
|
-
* [1, 0], // down
|
|
67
|
-
* [0, -1], // left
|
|
68
|
-
* [-1, 0] // up
|
|
69
|
-
* ];
|
|
70
|
-
*
|
|
71
|
-
* const visited = new Set<string>(); // Used to record visited nodes
|
|
72
|
-
* stack.push(start);
|
|
73
|
-
* const path: number[][] = [];
|
|
74
|
-
*
|
|
75
|
-
* while (!stack.isEmpty()) {
|
|
76
|
-
* const [x, y] = stack.pop()!;
|
|
77
|
-
* if (visited.has(`${x},${y}`)) continue; // Skip already visited nodes
|
|
78
|
-
* visited.add(`${x},${y}`);
|
|
79
|
-
*
|
|
80
|
-
* path.push([x, y]);
|
|
81
|
-
*
|
|
82
|
-
* if (x === end[0] && y === end[1]) {
|
|
83
|
-
* break; // Find the end point and exit
|
|
84
|
-
* }
|
|
85
|
-
*
|
|
86
|
-
* for (const [dx, dy] of directions) {
|
|
87
|
-
* const nx = x + dx;
|
|
88
|
-
* const ny = y + dy;
|
|
89
|
-
* if (
|
|
90
|
-
* maze[nx]?.[ny] === ' ' || // feasible path
|
|
91
|
-
* maze[nx]?.[ny] === 'E' // destination
|
|
92
|
-
* ) {
|
|
93
|
-
* stack.push([nx, ny]);
|
|
94
|
-
* }
|
|
95
|
-
* }
|
|
96
|
-
* }
|
|
97
|
-
*
|
|
98
|
-
* expect(path).toContainEqual(end);
|
|
99
|
-
* @example
|
|
100
|
-
* // Function Call Stack
|
|
101
|
-
* const functionStack = new Stack<string>();
|
|
102
|
-
* functionStack.push('main');
|
|
103
|
-
* functionStack.push('foo');
|
|
104
|
-
* functionStack.push('bar');
|
|
105
|
-
* console.log(functionStack.pop()); // 'bar'
|
|
106
|
-
* console.log(functionStack.pop()); // 'foo'
|
|
107
|
-
* console.log(functionStack.pop()); // 'main'
|
|
108
|
-
* @example
|
|
109
|
-
* // Simplify File Paths
|
|
110
|
-
* const stack = new Stack<string>();
|
|
111
|
-
* const path = '/a/./b/../../c';
|
|
112
|
-
* path.split('/').forEach(segment => {
|
|
113
|
-
* if (segment === '..') stack.pop();
|
|
114
|
-
* else if (segment && segment !== '.') stack.push(segment);
|
|
115
|
-
* });
|
|
116
|
-
* console.log(stack.elements.join('/')); // 'c'
|
|
117
|
-
* @example
|
|
118
|
-
* // Stock Span Problem
|
|
119
|
-
* const stack = new Stack<number>();
|
|
120
|
-
* const prices = [100, 80, 60, 70, 60, 75, 85];
|
|
121
|
-
* const spans: number[] = [];
|
|
122
|
-
* prices.forEach((price, i) => {
|
|
123
|
-
* while (!stack.isEmpty() && prices[stack.peek()!] <= price) {
|
|
124
|
-
* stack.pop();
|
|
125
|
-
* }
|
|
126
|
-
* spans.push(stack.isEmpty() ? i + 1 : i - stack.peek()!);
|
|
127
|
-
* stack.push(i);
|
|
128
|
-
* });
|
|
129
|
-
* console.log(spans); // [1, 1, 1, 2, 1, 4, 6]
|
|
130
|
-
*/
|
|
131
|
-
export class Stack extends IterableElementBase {
|
|
132
|
-
constructor(elements = [], options) {
|
|
133
|
-
super(options);
|
|
134
|
-
this.pushMany(elements);
|
|
135
|
-
}
|
|
136
|
-
_elements = [];
|
|
137
|
-
/**
|
|
138
|
-
* The elements function returns the elements of this set.
|
|
139
|
-
* @return An array of elements
|
|
140
|
-
*/
|
|
141
|
-
get elements() {
|
|
142
|
-
return this._elements;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* The size() function returns the number of elements in an array.
|
|
146
|
-
* @returns The size of the elements array.
|
|
147
|
-
*/
|
|
148
|
-
get size() {
|
|
149
|
-
return this.elements.length;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Time Complexity: O(n)
|
|
153
|
-
* Space Complexity: O(n)
|
|
154
|
-
*
|
|
155
|
-
* The function "fromArray" creates a new Stack object from an array of elements.
|
|
156
|
-
* @param {E[]} elements - The `elements` parameter is an array of elements of type `E`.
|
|
157
|
-
* @returns {Stack} The method is returning a new instance of the Stack class, initialized with the elements from the input
|
|
158
|
-
* array.
|
|
159
|
-
*/
|
|
160
|
-
static fromArray(elements) {
|
|
161
|
-
return new Stack(elements);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Time Complexity: O(1)
|
|
165
|
-
* Space Complexity: O(1)
|
|
166
|
-
*
|
|
167
|
-
* The function checks if an array is empty and returns a boolean value.
|
|
168
|
-
* @returns A boolean value indicating whether the `_elements` array is empty or not.
|
|
169
|
-
*/
|
|
170
|
-
isEmpty() {
|
|
171
|
-
return this.elements.length === 0;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Time Complexity: O(1)
|
|
175
|
-
* Space Complexity: O(1)
|
|
176
|
-
*
|
|
177
|
-
* The `peek` function returns the last element of an array, or undefined if the array is empty.
|
|
178
|
-
* @returns The `peek()` function returns the last element of the `_elements` array, or `undefined` if the array is empty.
|
|
179
|
-
*/
|
|
180
|
-
peek() {
|
|
181
|
-
if (this.isEmpty())
|
|
182
|
-
return undefined;
|
|
183
|
-
return this.elements[this.elements.length - 1];
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Time Complexity: O(1)
|
|
187
|
-
* Space Complexity: O(1)
|
|
188
|
-
*
|
|
189
|
-
* The push function adds an element to the stack and returns the updated stack.
|
|
190
|
-
* @param {E} element - The parameter "element" is of type E, which means it can be any data type.
|
|
191
|
-
* @returns The `push` method is returning the updated `Stack<E>` object.
|
|
192
|
-
*/
|
|
193
|
-
push(element) {
|
|
194
|
-
this.elements.push(element);
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Time Complexity: O(1)
|
|
199
|
-
* Space Complexity: O(1)
|
|
200
|
-
*
|
|
201
|
-
* The `pop` function removes and returns the last element from an array, or returns undefined if the array is empty.
|
|
202
|
-
* @returns The `pop()` method is returning the last element of the array `_elements` if the array is not empty. If the
|
|
203
|
-
* array is empty, it returns `undefined`.
|
|
204
|
-
*/
|
|
205
|
-
pop() {
|
|
206
|
-
if (this.isEmpty())
|
|
207
|
-
return;
|
|
208
|
-
return this.elements.pop();
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Time Complexity: O(k)
|
|
212
|
-
* Space Complexity: O(1)
|
|
213
|
-
*
|
|
214
|
-
* The function `pushMany` iterates over elements and pushes them into an array after applying a
|
|
215
|
-
* transformation function if provided.
|
|
216
|
-
* @param {Iterable<E> | Iterable<R>} elements - The `elements` parameter in the `pushMany` function
|
|
217
|
-
* is an iterable containing elements of type `E` or `R`. The function iterates over each element in
|
|
218
|
-
* the iterable and pushes it into the data structure. If a transformation function `toElementFn` is
|
|
219
|
-
* provided, it is used to
|
|
220
|
-
* @returns The `pushMany` function is returning an array of boolean values indicating whether each
|
|
221
|
-
* element was successfully pushed into the data structure.
|
|
222
|
-
*/
|
|
223
|
-
pushMany(elements) {
|
|
224
|
-
const ans = [];
|
|
225
|
-
for (const el of elements) {
|
|
226
|
-
if (this.toElementFn) {
|
|
227
|
-
ans.push(this.push(this.toElementFn(el)));
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
ans.push(this.push(el));
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return ans;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Time Complexity: O(n)
|
|
237
|
-
* Space Complexity: O(1)
|
|
238
|
-
*
|
|
239
|
-
* The toArray function returns a copy of the elements in an array.
|
|
240
|
-
* @returns An array of type E.
|
|
241
|
-
*/
|
|
242
|
-
delete(element) {
|
|
243
|
-
const index = this.elements.indexOf(element);
|
|
244
|
-
return this.deleteAt(index);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Time Complexity: O(n)
|
|
248
|
-
* Space Complexity: O(1)
|
|
249
|
-
*
|
|
250
|
-
* The toArray function returns a copy of the elements in an array.
|
|
251
|
-
* @returns An array of type E.
|
|
252
|
-
*/
|
|
253
|
-
deleteAt(index) {
|
|
254
|
-
const spliced = this.elements.splice(index, 1);
|
|
255
|
-
return spliced.length === 1;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Time Complexity: O(1)
|
|
259
|
-
* Space Complexity: O(1)
|
|
260
|
-
*
|
|
261
|
-
* The clear function clears the elements array.
|
|
262
|
-
*/
|
|
263
|
-
clear() {
|
|
264
|
-
this._elements = [];
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Time Complexity: O(n)
|
|
268
|
-
* Space Complexity: O(n)
|
|
269
|
-
*
|
|
270
|
-
* The `clone()` function returns a new `Stack` object with the same elements as the original stack.
|
|
271
|
-
* @returns The `clone()` method is returning a new `Stack` object with a copy of the `_elements` array.
|
|
272
|
-
*/
|
|
273
|
-
clone() {
|
|
274
|
-
return new Stack(this, { toElementFn: this.toElementFn });
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Time Complexity: O(n)
|
|
278
|
-
* Space Complexity: O(n)
|
|
279
|
-
*
|
|
280
|
-
* The `filter` function creates a new stack containing elements from the original stack that satisfy
|
|
281
|
-
* a given predicate function.
|
|
282
|
-
* @param predicate - The `predicate` parameter is a callback function that takes three arguments:
|
|
283
|
-
* the current element being iterated over, the index of the current element, and the stack itself.
|
|
284
|
-
* It should return a boolean value indicating whether the element should be included in the filtered
|
|
285
|
-
* stack or not.
|
|
286
|
-
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
287
|
-
* to be used as `this` when executing the `predicate` function. If `thisArg` is provided, it will be
|
|
288
|
-
* passed as the `this` value to the `predicate` function. If `thisArg` is
|
|
289
|
-
* @returns The `filter` method is returning a new `Stack` object that contains the elements that
|
|
290
|
-
* satisfy the given predicate function.
|
|
291
|
-
*/
|
|
292
|
-
filter(predicate, thisArg) {
|
|
293
|
-
const newStack = new Stack([], { toElementFn: this.toElementFn });
|
|
294
|
-
let index = 0;
|
|
295
|
-
for (const el of this) {
|
|
296
|
-
if (predicate.call(thisArg, el, index, this)) {
|
|
297
|
-
newStack.push(el);
|
|
298
|
-
}
|
|
299
|
-
index++;
|
|
300
|
-
}
|
|
301
|
-
return newStack;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Time Complexity: O(n)
|
|
305
|
-
* Space Complexity: O(n)
|
|
306
|
-
*
|
|
307
|
-
* The `map` function takes a callback function and applies it to each element in the stack,
|
|
308
|
-
* returning a new stack with the results.
|
|
309
|
-
* @param callback - The callback parameter is a function that will be called for each element in the
|
|
310
|
-
* stack. It takes three arguments: the current element, the index of the element, and the stack
|
|
311
|
-
* itself. It should return a new value that will be added to the new stack.
|
|
312
|
-
* @param [toElementFn] - The `toElementFn` parameter is an optional function that can be used to
|
|
313
|
-
* transform the raw element (`RM`) into a new element (`EM`) before pushing it into the new stack.
|
|
314
|
-
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
|
|
315
|
-
* specify the value of `this` within the callback function. It is used to set the context or scope
|
|
316
|
-
* in which the callback function will be executed. If `thisArg` is provided, it will be used as the
|
|
317
|
-
* value of
|
|
318
|
-
* @returns a new Stack object with elements of type EM and raw elements of type RM.
|
|
319
|
-
*/
|
|
320
|
-
map(callback, toElementFn, thisArg) {
|
|
321
|
-
const newStack = new Stack([], { toElementFn });
|
|
322
|
-
let index = 0;
|
|
323
|
-
for (const el of this) {
|
|
324
|
-
newStack.push(callback.call(thisArg, el, index, this));
|
|
325
|
-
index++;
|
|
326
|
-
}
|
|
327
|
-
return newStack;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Time Complexity: O(n)
|
|
331
|
-
* Space Complexity: O(n)
|
|
332
|
-
*
|
|
333
|
-
* Custom iterator for the Stack class.
|
|
334
|
-
* @returns An iterator object.
|
|
335
|
-
*/
|
|
336
|
-
*_getIterator() {
|
|
337
|
-
for (let i = 0; i < this.elements.length; i++) {
|
|
338
|
-
yield this.elements[i];
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
//# sourceMappingURL=stack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../src/data-structures/stack/stack.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgIG;AACH,MAAM,OAAO,KAAwB,SAAQ,mBAAyB;IACpE,YAAY,WAAsC,EAAE,EAAE,OAA4B;QAChF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAES,SAAS,GAAQ,EAAE,CAAC;IAE9B;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CAAI,QAAa;QAC/B,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO,SAAS,CAAC;QAErC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,OAAU;QACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,GAAG;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO;QAE3B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,QAAmC;QAC1C,MAAM,GAAG,GAAc,EAAE,CAAC;QAC1B,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC1B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAO,CAAC,CAAC,CAAC,CAAC;YACjD,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAO,CAAC,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,OAAU;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAa;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/C,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACH,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACH,KAAK;QACH,OAAO,IAAI,KAAK,CAAO,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,SAAyC,EAAE,OAAa;QAC7D,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAO,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACxE,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC7C,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC;YACD,KAAK,EAAE,CAAC;QACV,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAS,QAAmC,EAAE,WAAoC,EAAE,OAAa;QAClG,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAS,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QACxD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;YACtB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,KAAK,EAAE,CAAC;QACV,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACO,CAAC,YAAY;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './tree';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-structures/tree/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|