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
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { ElementCallback, IterableElementBaseOptions, ReduceElementCallback } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Base class that makes a data structure iterable and provides common
|
|
4
|
+
* element-wise utilities (e.g., map/filter/reduce/find).
|
|
5
|
+
*
|
|
6
|
+
* @template E The public element type yielded by the structure.
|
|
7
|
+
* @template R The underlying "raw" element type used internally or by converters.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class implements the JavaScript iteration protocol (via `Symbol.iterator`)
|
|
11
|
+
* and offers array-like helpers with predictable time/space complexity.
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class IterableElementBase<E, R> implements Iterable<E> {
|
|
14
|
+
/**
|
|
15
|
+
* Create a new iterable base.
|
|
16
|
+
*
|
|
17
|
+
* @param options Optional behavior overrides. When provided, a `toElementFn`
|
|
18
|
+
* is used to convert a raw element (`R`) into a public element (`E`).
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Time O(1), Space O(1).
|
|
22
|
+
*/
|
|
23
|
+
protected constructor(options?: IterableElementBaseOptions<E, R>);
|
|
24
|
+
/**
|
|
25
|
+
* The converter used to transform a raw element (`R`) into a public element (`E`).
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Time O(1), Space O(1).
|
|
29
|
+
*/
|
|
30
|
+
protected _toElementFn?: (rawElement: R) => E;
|
|
31
|
+
/**
|
|
32
|
+
* Exposes the current `toElementFn`, if configured.
|
|
33
|
+
*
|
|
34
|
+
* @returns The converter function or `undefined` when not set.
|
|
35
|
+
* @remarks
|
|
36
|
+
* Time O(1), Space O(1).
|
|
37
|
+
*/
|
|
38
|
+
get toElementFn(): ((rawElement: R) => E) | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Returns an iterator over the structure's elements.
|
|
41
|
+
*
|
|
42
|
+
* @param args Optional iterator arguments forwarded to the internal iterator.
|
|
43
|
+
* @returns An `IterableIterator<E>` that yields the elements in traversal order.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Producing the iterator is O(1); consuming the entire iterator is Time O(n) with O(1) extra space.
|
|
47
|
+
*/
|
|
48
|
+
[Symbol.iterator](...args: unknown[]): IterableIterator<E>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns an iterator over the values (alias of the default iterator).
|
|
51
|
+
*
|
|
52
|
+
* @returns An `IterableIterator<E>` over all elements.
|
|
53
|
+
* @remarks
|
|
54
|
+
* Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
|
|
55
|
+
*/
|
|
56
|
+
values(): IterableIterator<E>;
|
|
57
|
+
/**
|
|
58
|
+
* Tests whether all elements satisfy the predicate.
|
|
59
|
+
*
|
|
60
|
+
* @template TReturn
|
|
61
|
+
* @param predicate Function invoked for each element with signature `(value, index, self)`.
|
|
62
|
+
* @param thisArg Optional `this` binding for the predicate.
|
|
63
|
+
* @returns `true` if every element passes; otherwise `false`.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Time O(n) in the worst case; may exit early when the first failure is found. Space O(1).
|
|
67
|
+
*/
|
|
68
|
+
every(predicate: ElementCallback<E, R, boolean>, thisArg?: unknown): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Tests whether at least one element satisfies the predicate.
|
|
71
|
+
*
|
|
72
|
+
* @param predicate Function invoked for each element with signature `(value, index, self)`.
|
|
73
|
+
* @param thisArg Optional `this` binding for the predicate.
|
|
74
|
+
* @returns `true` if any element passes; otherwise `false`.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Time O(n) in the worst case; may exit early on first success. Space O(1).
|
|
78
|
+
*/
|
|
79
|
+
some(predicate: ElementCallback<E, R, boolean>, thisArg?: unknown): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Invokes a callback for each element in iteration order.
|
|
82
|
+
*
|
|
83
|
+
* @param callbackfn Function invoked per element with signature `(value, index, self)`.
|
|
84
|
+
* @param thisArg Optional `this` binding for the callback.
|
|
85
|
+
* @returns `void`.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Time O(n), Space O(1).
|
|
89
|
+
*/
|
|
90
|
+
forEach(callbackfn: ElementCallback<E, R, void>, thisArg?: unknown): void;
|
|
91
|
+
/**
|
|
92
|
+
* Finds the first element that satisfies the predicate and returns it.
|
|
93
|
+
*
|
|
94
|
+
* @overload
|
|
95
|
+
* Finds the first element of type `S` (a subtype of `E`) that satisfies the predicate and returns it.
|
|
96
|
+
* @template S
|
|
97
|
+
* @param predicate Type-guard predicate: `(value, index, self) => value is S`.
|
|
98
|
+
* @param thisArg Optional `this` binding for the predicate.
|
|
99
|
+
* @returns The matched element typed as `S`, or `undefined` if not found.
|
|
100
|
+
*
|
|
101
|
+
* @overload
|
|
102
|
+
* @param predicate Boolean predicate: `(value, index, self) => boolean`.
|
|
103
|
+
* @param thisArg Optional `this` binding for the predicate.
|
|
104
|
+
* @returns The first matching element as `E`, or `undefined` if not found.
|
|
105
|
+
*
|
|
106
|
+
* @remarks
|
|
107
|
+
* Time O(n) in the worst case; may exit early on the first match. Space O(1).
|
|
108
|
+
*/
|
|
109
|
+
find<S extends E>(predicate: ElementCallback<E, R, S>, thisArg?: unknown): S | undefined;
|
|
110
|
+
find(predicate: ElementCallback<E, R, unknown>, thisArg?: unknown): E | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Checks whether a strictly-equal element exists in the structure.
|
|
113
|
+
*
|
|
114
|
+
* @param element The element to test with `===` equality.
|
|
115
|
+
* @returns `true` if an equal element is found; otherwise `false`.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* Time O(n) in the worst case. Space O(1).
|
|
119
|
+
*/
|
|
120
|
+
has(element: E): boolean;
|
|
121
|
+
reduce(callbackfn: ReduceElementCallback<E, R>): E;
|
|
122
|
+
reduce(callbackfn: ReduceElementCallback<E, R>, initialValue: E): E;
|
|
123
|
+
reduce<U>(callbackfn: ReduceElementCallback<E, R, U>, initialValue: U): U;
|
|
124
|
+
/**
|
|
125
|
+
* Materializes the elements into a new array.
|
|
126
|
+
*
|
|
127
|
+
* @returns A shallow array copy of the iteration order.
|
|
128
|
+
* @remarks
|
|
129
|
+
* Time O(n), Space O(n).
|
|
130
|
+
*/
|
|
131
|
+
toArray(): E[];
|
|
132
|
+
/**
|
|
133
|
+
* Returns a representation of the structure suitable for quick visualization.
|
|
134
|
+
* Defaults to an array of elements; subclasses may override to provide richer visuals.
|
|
135
|
+
*
|
|
136
|
+
* @returns A visual representation (array by default).
|
|
137
|
+
* @remarks
|
|
138
|
+
* Time O(n), Space O(n).
|
|
139
|
+
*/
|
|
140
|
+
toVisual(): E[];
|
|
141
|
+
/**
|
|
142
|
+
* Prints `toVisual()` to the console. Intended for quick debugging.
|
|
143
|
+
*
|
|
144
|
+
* @returns `void`.
|
|
145
|
+
* @remarks
|
|
146
|
+
* Time O(n) due to materialization, Space O(n) for the intermediate representation.
|
|
147
|
+
*/
|
|
148
|
+
print(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Indicates whether the structure currently contains no elements.
|
|
151
|
+
*
|
|
152
|
+
* @returns `true` if empty; otherwise `false`.
|
|
153
|
+
* @remarks
|
|
154
|
+
* Expected Time O(1), Space O(1) for most implementations.
|
|
155
|
+
*/
|
|
156
|
+
abstract isEmpty(): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Removes all elements from the structure.
|
|
159
|
+
*
|
|
160
|
+
* @returns `void`.
|
|
161
|
+
* @remarks
|
|
162
|
+
* Expected Time O(1) or O(n) depending on the implementation; Space O(1).
|
|
163
|
+
*/
|
|
164
|
+
abstract clear(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a structural copy with the same element values and configuration.
|
|
167
|
+
*
|
|
168
|
+
* @returns A clone of the current instance (same concrete type).
|
|
169
|
+
* @remarks
|
|
170
|
+
* Expected Time O(n) to copy elements; Space O(n).
|
|
171
|
+
*/
|
|
172
|
+
abstract clone(): this;
|
|
173
|
+
/**
|
|
174
|
+
* Maps each element to a new element and returns a new iterable structure.
|
|
175
|
+
*
|
|
176
|
+
* @template EM The mapped element type.
|
|
177
|
+
* @template RM The mapped raw element type used internally by the target structure.
|
|
178
|
+
* @param callback Function with signature `(value, index, self) => mapped`.
|
|
179
|
+
* @param options Optional options for the returned structure, including its `toElementFn`.
|
|
180
|
+
* @param thisArg Optional `this` binding for the callback.
|
|
181
|
+
* @returns A new `IterableElementBase<EM, RM>` containing mapped elements.
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
* Time O(n), Space O(n).
|
|
185
|
+
*/
|
|
186
|
+
abstract map<EM, RM>(callback: ElementCallback<E, R, EM>, options?: IterableElementBaseOptions<EM, RM>, thisArg?: unknown): IterableElementBase<EM, RM>;
|
|
187
|
+
/**
|
|
188
|
+
* Maps each element to the same element type and returns the same concrete structure type.
|
|
189
|
+
*
|
|
190
|
+
* @param callback Function with signature `(value, index, self) => mappedValue`.
|
|
191
|
+
* @param thisArg Optional `this` binding for the callback.
|
|
192
|
+
* @returns A new instance of the same concrete type with mapped elements.
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* Time O(n), Space O(n).
|
|
196
|
+
*/
|
|
197
|
+
abstract mapSame(callback: ElementCallback<E, R, E>, thisArg?: unknown): this;
|
|
198
|
+
/**
|
|
199
|
+
* Filters elements using the provided predicate and returns the same concrete structure type.
|
|
200
|
+
*
|
|
201
|
+
* @param predicate Function with signature `(value, index, self) => boolean`.
|
|
202
|
+
* @param thisArg Optional `this` binding for the predicate.
|
|
203
|
+
* @returns A new instance of the same concrete type containing only elements that pass the predicate.
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* Time O(n), Space O(k) where `k` is the number of kept elements.
|
|
207
|
+
*/
|
|
208
|
+
abstract filter(predicate: ElementCallback<E, R, boolean>, thisArg?: unknown): this;
|
|
209
|
+
/**
|
|
210
|
+
* Internal iterator factory used by the default iterator.
|
|
211
|
+
*
|
|
212
|
+
* @param args Optional iterator arguments.
|
|
213
|
+
* @returns An iterator over elements.
|
|
214
|
+
*
|
|
215
|
+
* @remarks
|
|
216
|
+
* Implementations should yield in O(1) per element with O(1) extra space when possible.
|
|
217
|
+
*/
|
|
218
|
+
protected abstract _getIterator(...args: unknown[]): IterableIterator<E>;
|
|
219
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { EntryCallback, ReduceEntryCallback } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Iterable view over key-value entries.
|
|
4
|
+
* @template K - Key type.
|
|
5
|
+
* @template V - Value type.
|
|
6
|
+
* @remarks Time O(1), Space O(1)
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class IterableEntryBase<K = any, V = any> {
|
|
9
|
+
/**
|
|
10
|
+
* Total number of entries.
|
|
11
|
+
* @returns Entry count.
|
|
12
|
+
* @remarks Time O(1), Space O(1)
|
|
13
|
+
*/
|
|
14
|
+
abstract get size(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Default iterator yielding `[key, value]` entries.
|
|
17
|
+
* @returns Iterator of `[K, V]`.
|
|
18
|
+
* @remarks Time O(n) to iterate, Space O(1)
|
|
19
|
+
*/
|
|
20
|
+
[Symbol.iterator](...args: any[]): IterableIterator<[K, V]>;
|
|
21
|
+
/**
|
|
22
|
+
* Iterate over `[key, value]` pairs (may yield `undefined` values).
|
|
23
|
+
* @returns Iterator of `[K, V | undefined]`.
|
|
24
|
+
* @remarks Time O(n), Space O(1)
|
|
25
|
+
*/
|
|
26
|
+
entries(): IterableIterator<[K, V | undefined]>;
|
|
27
|
+
/**
|
|
28
|
+
* Iterate over keys only.
|
|
29
|
+
* @returns Iterator of keys.
|
|
30
|
+
* @remarks Time O(n), Space O(1)
|
|
31
|
+
*/
|
|
32
|
+
keys(): IterableIterator<K>;
|
|
33
|
+
/**
|
|
34
|
+
* Iterate over values only.
|
|
35
|
+
* @returns Iterator of values.
|
|
36
|
+
* @remarks Time O(n), Space O(1)
|
|
37
|
+
*/
|
|
38
|
+
values(): IterableIterator<V>;
|
|
39
|
+
/**
|
|
40
|
+
* Test whether all entries satisfy the predicate.
|
|
41
|
+
* @param predicate - `(key, value, index, self) => boolean`.
|
|
42
|
+
* @param thisArg - Optional `this` for callback.
|
|
43
|
+
* @returns `true` if all pass; otherwise `false`.
|
|
44
|
+
* @remarks Time O(n), Space O(1)
|
|
45
|
+
*/
|
|
46
|
+
every(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Test whether any entry satisfies the predicate.
|
|
49
|
+
* @param predicate - `(key, value, index, self) => boolean`.
|
|
50
|
+
* @param thisArg - Optional `this` for callback.
|
|
51
|
+
* @returns `true` if any passes; otherwise `false`.
|
|
52
|
+
* @remarks Time O(n), Space O(1)
|
|
53
|
+
*/
|
|
54
|
+
some(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Visit each entry, left-to-right.
|
|
57
|
+
* @param callbackfn - `(key, value, index, self) => void`.
|
|
58
|
+
* @param thisArg - Optional `this` for callback.
|
|
59
|
+
* @remarks Time O(n), Space O(1)
|
|
60
|
+
*/
|
|
61
|
+
forEach(callbackfn: EntryCallback<K, V, void>, thisArg?: any): void;
|
|
62
|
+
/**
|
|
63
|
+
* Find the first entry that matches a predicate.
|
|
64
|
+
* @param callbackfn - `(key, value, index, self) => boolean`.
|
|
65
|
+
* @param thisArg - Optional `this` for callback.
|
|
66
|
+
* @returns Matching `[key, value]` or `undefined`.
|
|
67
|
+
* @remarks Time O(n), Space O(1)
|
|
68
|
+
*/
|
|
69
|
+
find(callbackfn: EntryCallback<K, V, boolean>, thisArg?: any): [K, V] | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the given key exists.
|
|
72
|
+
* @param key - Key to test.
|
|
73
|
+
* @returns `true` if found; otherwise `false`.
|
|
74
|
+
* @remarks Time O(n) generic, Space O(1)
|
|
75
|
+
*/
|
|
76
|
+
has(key: K): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether there exists an entry with the given value.
|
|
79
|
+
* @param value - Value to test.
|
|
80
|
+
* @returns `true` if found; otherwise `false`.
|
|
81
|
+
* @remarks Time O(n), Space O(1)
|
|
82
|
+
*/
|
|
83
|
+
hasValue(value: V): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Get the value under a key.
|
|
86
|
+
* @param key - Key to look up.
|
|
87
|
+
* @returns Value or `undefined`.
|
|
88
|
+
* @remarks Time O(n) generic, Space O(1)
|
|
89
|
+
*/
|
|
90
|
+
get(key: K): V | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Reduce entries into a single accumulator.
|
|
93
|
+
* @param callbackfn - `(acc, value, key, index, self) => acc`.
|
|
94
|
+
* @param initialValue - Initial accumulator.
|
|
95
|
+
* @returns Final accumulator.
|
|
96
|
+
* @remarks Time O(n), Space O(1)
|
|
97
|
+
*/
|
|
98
|
+
reduce<U>(callbackfn: ReduceEntryCallback<K, V, U>, initialValue: U): U;
|
|
99
|
+
/**
|
|
100
|
+
* Visualize the iterable as an array of `[key, value]` pairs (or a custom string).
|
|
101
|
+
* @returns Array of entries (default) or a string.
|
|
102
|
+
* @remarks Time O(n), Space O(n)
|
|
103
|
+
*/
|
|
104
|
+
toVisual(): [K, V][] | string;
|
|
105
|
+
/**
|
|
106
|
+
* Print a human-friendly representation to the console.
|
|
107
|
+
* @remarks Time O(n), Space O(n)
|
|
108
|
+
*/
|
|
109
|
+
print(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Whether there are no entries.
|
|
112
|
+
* @returns `true` if empty; `false` otherwise.
|
|
113
|
+
* @remarks Time O(1) typical, Space O(1)
|
|
114
|
+
*/
|
|
115
|
+
abstract isEmpty(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Remove all entries.
|
|
118
|
+
* @remarks Time O(n) typical, Space O(1)
|
|
119
|
+
*/
|
|
120
|
+
abstract clear(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Deep clone preserving the concrete subtype.
|
|
123
|
+
* @returns A new instance of the same concrete class (`this` type).
|
|
124
|
+
* @remarks Time O(n) typical, Space O(n)
|
|
125
|
+
*/
|
|
126
|
+
abstract clone(): this;
|
|
127
|
+
/**
|
|
128
|
+
* Map entries using an implementation-specific strategy.
|
|
129
|
+
* @remarks Time O(n), Space O(n)
|
|
130
|
+
*/
|
|
131
|
+
abstract map(...args: any[]): any;
|
|
132
|
+
/**
|
|
133
|
+
* Filter entries and return the same-species structure.
|
|
134
|
+
* @returns A new instance of the same concrete class (`this` type).
|
|
135
|
+
* @remarks Time O(n), Space O(n)
|
|
136
|
+
*/
|
|
137
|
+
abstract filter(...args: any[]): this;
|
|
138
|
+
/**
|
|
139
|
+
* Underlying iterator for the default iteration protocol.
|
|
140
|
+
* @returns Iterator of `[K, V]`.
|
|
141
|
+
* @remarks Time O(n), Space O(1)
|
|
142
|
+
*/
|
|
143
|
+
protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;
|
|
144
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import type { ElementCallback, LinearBaseOptions, ReduceLinearCallback } from '../../types';
|
|
2
|
+
import { IterableElementBase } from './iterable-element-base';
|
|
3
|
+
/**
|
|
4
|
+
* Singly-linked list node.
|
|
5
|
+
* @template E - Element type.
|
|
6
|
+
* @remarks Time O(1), Space O(1)
|
|
7
|
+
*/
|
|
8
|
+
export declare class LinkedListNode<E = any> {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize a node.
|
|
11
|
+
* @param value - Element value.
|
|
12
|
+
* @remarks Time O(1), Space O(1)
|
|
13
|
+
*/
|
|
14
|
+
constructor(value: E);
|
|
15
|
+
protected _value: E;
|
|
16
|
+
/**
|
|
17
|
+
* Element payload getter.
|
|
18
|
+
* @returns Element value.
|
|
19
|
+
* @remarks Time O(1), Space O(1)
|
|
20
|
+
*/
|
|
21
|
+
get value(): E;
|
|
22
|
+
/**
|
|
23
|
+
* Element payload setter.
|
|
24
|
+
* @param value - New value.
|
|
25
|
+
* @remarks Time O(1), Space O(1)
|
|
26
|
+
*/
|
|
27
|
+
set value(value: E);
|
|
28
|
+
protected _next: LinkedListNode<E> | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Next node getter.
|
|
31
|
+
* @returns Next node or `undefined`.
|
|
32
|
+
* @remarks Time O(1), Space O(1)
|
|
33
|
+
*/
|
|
34
|
+
get next(): LinkedListNode<E> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Next node setter.
|
|
37
|
+
* @param value - Next node or `undefined`.
|
|
38
|
+
* @remarks Time O(1), Space O(1)
|
|
39
|
+
*/
|
|
40
|
+
set next(value: LinkedListNode<E> | undefined);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Abstract linear container with array-like utilities.
|
|
44
|
+
* @template E - Element type.
|
|
45
|
+
* @template R - Return type for mapped/derived views.
|
|
46
|
+
* @template NODE - Linked node type used by some implementations.
|
|
47
|
+
* @remarks Time O(1), Space O(1)
|
|
48
|
+
*/
|
|
49
|
+
export declare abstract class LinearBase<E, R = any, NODE extends LinkedListNode<E> = LinkedListNode<E>> extends IterableElementBase<E, R> {
|
|
50
|
+
/**
|
|
51
|
+
* Construct a linear container with runtime options.
|
|
52
|
+
* @param options - `{ maxLen?, ... }` bounds/behavior options.
|
|
53
|
+
* @remarks Time O(1), Space O(1)
|
|
54
|
+
*/
|
|
55
|
+
protected constructor(options?: LinearBaseOptions<E, R>);
|
|
56
|
+
/**
|
|
57
|
+
* Element count.
|
|
58
|
+
* @returns Number of elements.
|
|
59
|
+
* @remarks Time O(1), Space O(1)
|
|
60
|
+
*/
|
|
61
|
+
abstract get length(): number;
|
|
62
|
+
protected _maxLen: number;
|
|
63
|
+
/**
|
|
64
|
+
* Upper bound for length (if positive), or `-1` when unbounded.
|
|
65
|
+
* @returns Maximum allowed length.
|
|
66
|
+
* @remarks Time O(1), Space O(1)
|
|
67
|
+
*/
|
|
68
|
+
get maxLen(): number;
|
|
69
|
+
/**
|
|
70
|
+
* First index of a value from the left.
|
|
71
|
+
* @param searchElement - Value to match.
|
|
72
|
+
* @param fromIndex - Start position (supports negative index).
|
|
73
|
+
* @returns Index or `-1` if not found.
|
|
74
|
+
* @remarks Time O(n), Space O(1)
|
|
75
|
+
*/
|
|
76
|
+
indexOf(searchElement: E, fromIndex?: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* Last index of a value from the right.
|
|
79
|
+
* @param searchElement - Value to match.
|
|
80
|
+
* @param fromIndex - Start position (supports negative index).
|
|
81
|
+
* @returns Index or `-1` if not found.
|
|
82
|
+
* @remarks Time O(n), Space O(1)
|
|
83
|
+
*/
|
|
84
|
+
lastIndexOf(searchElement: E, fromIndex?: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Find the first index matching a predicate.
|
|
87
|
+
* @param predicate - `(element, index, self) => boolean`.
|
|
88
|
+
* @param thisArg - Optional `this` for callback.
|
|
89
|
+
* @returns Index or `-1`.
|
|
90
|
+
* @remarks Time O(n), Space O(1)
|
|
91
|
+
*/
|
|
92
|
+
findIndex(predicate: ElementCallback<E, R, boolean>, thisArg?: any): number;
|
|
93
|
+
/**
|
|
94
|
+
* Concatenate multiple containers of the same species.
|
|
95
|
+
* @param items - Other lists to append.
|
|
96
|
+
* @returns New container with combined elements (`this` type).
|
|
97
|
+
* @remarks Time O(sum(length)), Space O(sum(length))
|
|
98
|
+
*/
|
|
99
|
+
concat(...items: this[]): this;
|
|
100
|
+
/**
|
|
101
|
+
* In-place stable order via array sort semantics.
|
|
102
|
+
* @param compareFn - Comparator `(a, b) => number`.
|
|
103
|
+
* @returns This container.
|
|
104
|
+
* @remarks Time O(n log n), Space O(n) (materializes to array temporarily)
|
|
105
|
+
*/
|
|
106
|
+
sort(compareFn?: (a: E, b: E) => number): this;
|
|
107
|
+
/**
|
|
108
|
+
* Remove and/or insert elements at a position (array-compatible).
|
|
109
|
+
* @param start - Start index (supports negative index).
|
|
110
|
+
* @param deleteCount - How many to remove.
|
|
111
|
+
* @param items - Elements to insert.
|
|
112
|
+
* @returns Removed elements as a new list (`this` type).
|
|
113
|
+
* @remarks Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
114
|
+
*/
|
|
115
|
+
splice(start: number, deleteCount?: number, ...items: E[]): this;
|
|
116
|
+
/**
|
|
117
|
+
* Join all elements into a string.
|
|
118
|
+
* @param separator - Separator string.
|
|
119
|
+
* @returns Concatenated string.
|
|
120
|
+
* @remarks Time O(n), Space O(n)
|
|
121
|
+
*/
|
|
122
|
+
join(separator?: string): string;
|
|
123
|
+
/**
|
|
124
|
+
* Snapshot elements into a reversed array.
|
|
125
|
+
* @returns New reversed array.
|
|
126
|
+
* @remarks Time O(n), Space O(n)
|
|
127
|
+
*/
|
|
128
|
+
toReversedArray(): E[];
|
|
129
|
+
reduceRight(callbackfn: ReduceLinearCallback<E>): E;
|
|
130
|
+
reduceRight(callbackfn: ReduceLinearCallback<E>, initialValue: E): E;
|
|
131
|
+
/**
|
|
132
|
+
* Right-to-left reduction over elements.
|
|
133
|
+
* @param callbackfn - `(acc, element, index, self) => acc`.
|
|
134
|
+
* @param initialValue - Initial accumulator (optional generic overloads supported).
|
|
135
|
+
* @returns Final accumulator.
|
|
136
|
+
* @remarks Time O(n), Space O(1)
|
|
137
|
+
*/
|
|
138
|
+
reduceRight<U>(callbackfn: ReduceLinearCallback<E, U>, initialValue: U): U;
|
|
139
|
+
/**
|
|
140
|
+
* Create a shallow copy of a subrange.
|
|
141
|
+
* @param start - Inclusive start (supports negative index).
|
|
142
|
+
* @param end - Exclusive end (supports negative index).
|
|
143
|
+
* @returns New list with the range (`this` type).
|
|
144
|
+
* @remarks Time O(n), Space O(n)
|
|
145
|
+
*/
|
|
146
|
+
slice(start?: number, end?: number): this;
|
|
147
|
+
/**
|
|
148
|
+
* Fill a range with a value.
|
|
149
|
+
* @param value - Value to set.
|
|
150
|
+
* @param start - Inclusive start.
|
|
151
|
+
* @param end - Exclusive end.
|
|
152
|
+
* @returns This list.
|
|
153
|
+
* @remarks Time O(n), Space O(1)
|
|
154
|
+
*/
|
|
155
|
+
fill(value: E, start?: number, end?: number): this;
|
|
156
|
+
/**
|
|
157
|
+
* Set the value at an index.
|
|
158
|
+
* @param index - Position (0-based).
|
|
159
|
+
* @param value - New value.
|
|
160
|
+
* @returns `true` if updated.
|
|
161
|
+
* @remarks Time O(1) typical, Space O(1)
|
|
162
|
+
*/
|
|
163
|
+
abstract setAt(index: number, value: E): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Deep clone while preserving concrete subtype.
|
|
166
|
+
* @returns New list of the same species (`this` type).
|
|
167
|
+
* @remarks Time O(n), Space O(n)
|
|
168
|
+
*/
|
|
169
|
+
abstract clone(): this;
|
|
170
|
+
/**
|
|
171
|
+
* Reverse the order of elements in-place (or equivalent).
|
|
172
|
+
* @returns This list.
|
|
173
|
+
* @remarks Time O(n), Space O(1)
|
|
174
|
+
*/
|
|
175
|
+
abstract reverse(): this;
|
|
176
|
+
/**
|
|
177
|
+
* Append one element or node to the tail.
|
|
178
|
+
* @param elementOrNode - Element or node.
|
|
179
|
+
* @returns `true` if appended.
|
|
180
|
+
* @remarks Time O(1) amortized typical, Space O(1)
|
|
181
|
+
*/
|
|
182
|
+
abstract push(elementOrNode: E | NODE): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Append many elements/nodes at once.
|
|
185
|
+
* @param elements - Iterable of elements or nodes.
|
|
186
|
+
* @returns Array of booleans indicating append success.
|
|
187
|
+
* @remarks Time O(n), Space O(1)
|
|
188
|
+
*/
|
|
189
|
+
abstract pushMany(elements: Iterable<E> | Iterable<R> | Iterable<NODE>): boolean[];
|
|
190
|
+
/**
|
|
191
|
+
* Remove one element or node if present.
|
|
192
|
+
* @param elementOrNode - Element or node to delete.
|
|
193
|
+
* @returns `true` if removed.
|
|
194
|
+
* @remarks Time O(1)~O(n) depending on implementation, Space O(1)
|
|
195
|
+
*/
|
|
196
|
+
abstract delete(elementOrNode: E | NODE | undefined): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Get element at an index.
|
|
199
|
+
* @param index - Position (0-based).
|
|
200
|
+
* @returns Element or `undefined`.
|
|
201
|
+
* @remarks Time O(1)~O(n) depending on implementation, Space O(1)
|
|
202
|
+
*/
|
|
203
|
+
abstract at(index: number): E | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Remove element at a position.
|
|
206
|
+
* @param pos - Position (0-based).
|
|
207
|
+
* @returns Removed element or `undefined`.
|
|
208
|
+
* @remarks Time O(1)~O(n) depending on implementation, Space O(1)
|
|
209
|
+
*/
|
|
210
|
+
abstract deleteAt(pos: number): E | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Insert an element/node at a position.
|
|
213
|
+
* @param index - Position (0-based).
|
|
214
|
+
* @param newElementOrNode - Element or node to insert.
|
|
215
|
+
* @returns `true` if inserted.
|
|
216
|
+
* @remarks Time O(1)~O(n) depending on implementation, Space O(1)
|
|
217
|
+
*/
|
|
218
|
+
abstract addAt(index: number, newElementOrNode: E | NODE): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Create an empty list of the same species.
|
|
221
|
+
* @param options - Runtime options to carry.
|
|
222
|
+
* @returns Empty list (`this` type).
|
|
223
|
+
* @remarks Time O(1), Space O(1)
|
|
224
|
+
*/
|
|
225
|
+
protected abstract _createInstance(options?: LinearBaseOptions<E, R>): this;
|
|
226
|
+
/**
|
|
227
|
+
* Reverse-direction iterator over elements.
|
|
228
|
+
* @returns Iterator of elements from tail to head.
|
|
229
|
+
* @remarks Time O(n), Space O(1)
|
|
230
|
+
*/
|
|
231
|
+
protected abstract _getReverseIterator(...args: any[]): IterableIterator<E>;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Linked-list specialized linear container.
|
|
235
|
+
* @template E - Element type.
|
|
236
|
+
* @template R - Return type for mapped/derived views.
|
|
237
|
+
* @template NODE - Linked node type.
|
|
238
|
+
* @remarks Time O(1), Space O(1)
|
|
239
|
+
*/
|
|
240
|
+
export declare abstract class LinearLinkedBase<E, R = any, NODE extends LinkedListNode<E> = LinkedListNode<E>> extends LinearBase<E, R, NODE> {
|
|
241
|
+
protected constructor(options?: LinearBaseOptions<E, R>);
|
|
242
|
+
/**
|
|
243
|
+
* Linked-list optimized `indexOf` (forwards scan).
|
|
244
|
+
* @param searchElement - Value to match.
|
|
245
|
+
* @param fromIndex - Start position.
|
|
246
|
+
* @returns Index or `-1`.
|
|
247
|
+
* @remarks Time O(n), Space O(1)
|
|
248
|
+
*/
|
|
249
|
+
indexOf(searchElement: E, fromIndex?: number): number;
|
|
250
|
+
/**
|
|
251
|
+
* Linked-list optimized `lastIndexOf` (reverse scan).
|
|
252
|
+
* @param searchElement - Value to match.
|
|
253
|
+
* @param fromIndex - Start position.
|
|
254
|
+
* @returns Index or `-1`.
|
|
255
|
+
* @remarks Time O(n), Space O(1)
|
|
256
|
+
*/
|
|
257
|
+
lastIndexOf(searchElement: E, fromIndex?: number): number;
|
|
258
|
+
/**
|
|
259
|
+
* Concatenate lists/elements preserving order.
|
|
260
|
+
* @param items - Elements or `LinearBase` instances.
|
|
261
|
+
* @returns New list with combined elements (`this` type).
|
|
262
|
+
* @remarks Time O(sum(length)), Space O(sum(length))
|
|
263
|
+
*/
|
|
264
|
+
concat(...items: LinearBase<E, R>[]): this;
|
|
265
|
+
/**
|
|
266
|
+
* Slice via forward iteration (no random access required).
|
|
267
|
+
* @param start - Inclusive start (supports negative index).
|
|
268
|
+
* @param end - Exclusive end (supports negative index).
|
|
269
|
+
* @returns New list (`this` type).
|
|
270
|
+
* @remarks Time O(n), Space O(n)
|
|
271
|
+
*/
|
|
272
|
+
slice(start?: number, end?: number): this;
|
|
273
|
+
/**
|
|
274
|
+
* Splice by walking node iterators from the start index.
|
|
275
|
+
* @param start - Start index.
|
|
276
|
+
* @param deleteCount - How many elements to remove.
|
|
277
|
+
* @param items - Elements to insert after the splice point.
|
|
278
|
+
* @returns Removed elements as a new list (`this` type).
|
|
279
|
+
* @remarks Time O(n + m), Space O(min(n, m)) where `m = items.length`
|
|
280
|
+
*/
|
|
281
|
+
splice(start: number, deleteCount?: number, ...items: E[]): this;
|
|
282
|
+
reduceRight(callbackfn: ReduceLinearCallback<E>): E;
|
|
283
|
+
reduceRight(callbackfn: ReduceLinearCallback<E>, initialValue: E): E;
|
|
284
|
+
/**
|
|
285
|
+
* Right-to-left reduction using reverse iterator.
|
|
286
|
+
* @param callbackfn - `(acc, element, index, self) => acc`.
|
|
287
|
+
* @param initialValue - Initial accumulator.
|
|
288
|
+
* @returns Final accumulator.
|
|
289
|
+
* @remarks Time O(n), Space O(1)
|
|
290
|
+
*/
|
|
291
|
+
reduceRight<U>(callbackfn: ReduceLinearCallback<E, U>, initialValue: U): U;
|
|
292
|
+
/**
|
|
293
|
+
* Delete by element or node in a linked list.
|
|
294
|
+
* @param elementOrNode - Element or node.
|
|
295
|
+
* @returns `true` if removed.
|
|
296
|
+
* @remarks Time O(1)~O(n) depending on availability of links, Space O(1)
|
|
297
|
+
*/
|
|
298
|
+
abstract delete(elementOrNode: E | NODE | undefined): boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Insert new element/node before an existing node.
|
|
301
|
+
* @param existingElementOrNode - Reference element/node.
|
|
302
|
+
* @param newElementOrNode - Element/node to insert.
|
|
303
|
+
* @returns `true` if inserted.
|
|
304
|
+
* @remarks Time O(1)~O(n) depending on reference access, Space O(1)
|
|
305
|
+
*/
|
|
306
|
+
abstract addBefore(existingElementOrNode: E | NODE, newElementOrNode: E | NODE): boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Insert new element/node after an existing node.
|
|
309
|
+
* @param existingElementOrNode - Reference element/node.
|
|
310
|
+
* @param newElementOrNode - Element/node to insert.
|
|
311
|
+
* @returns `true` if inserted.
|
|
312
|
+
* @remarks Time O(1)~O(n) depending on reference access, Space O(1)
|
|
313
|
+
*/
|
|
314
|
+
abstract addAfter(existingElementOrNode: E | NODE, newElementOrNode: E | NODE): boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Node at index (for random-access emulation).
|
|
317
|
+
* @param index - Position (0-based).
|
|
318
|
+
* @returns Node or `undefined`.
|
|
319
|
+
* @remarks Time O(n), Space O(1)
|
|
320
|
+
*/
|
|
321
|
+
abstract getNodeAt(index: number): NODE | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* Iterate linked nodes from head to tail.
|
|
324
|
+
* @returns Iterator over nodes.
|
|
325
|
+
* @remarks Time O(n), Space O(1)
|
|
326
|
+
*/
|
|
327
|
+
protected abstract _getNodeIterator(...args: any[]): IterableIterator<NODE>;
|
|
328
|
+
/**
|
|
329
|
+
* Get previous node of a given node.
|
|
330
|
+
* @param node - Current node.
|
|
331
|
+
* @returns Previous node or `undefined`.
|
|
332
|
+
* @remarks Time O(1)~O(n) depending on list variant (singly vs doubly), Space O(1)
|
|
333
|
+
*/
|
|
334
|
+
protected abstract _getPrevNode(node: NODE): NODE | undefined;
|
|
335
|
+
}
|