data-structure-typed 1.41.4 → 1.41.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +21 -302
- package/benchmark/report.html +18 -10
- package/benchmark/report.json +223 -117
- package/dist/cjs/{data-structures → src/data-structures}/binary-tree/avl-tree.d.ts +1 -1
- package/dist/cjs/{data-structures → src/data-structures}/binary-tree/avl-tree.js +2 -2
- package/dist/cjs/src/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/src/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/cjs/{data-structures → src/data-structures}/binary-tree/binary-tree.d.ts +4 -3
- package/dist/cjs/{data-structures → src/data-structures}/binary-tree/binary-tree.js +19 -18
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/{mjs → cjs/src}/data-structures/binary-tree/bst.d.ts +1 -20
- package/dist/cjs/{data-structures → src/data-structures}/binary-tree/bst.js +5 -27
- package/dist/cjs/src/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/src/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/src/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/src/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/{mjs → cjs/src}/data-structures/binary-tree/tree-multiset.d.ts +1 -1
- package/dist/cjs/{data-structures → src/data-structures}/binary-tree/tree-multiset.js +2 -2
- package/dist/cjs/src/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/cjs/src/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/src/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/src/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/src/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/src/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/src/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/src/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/src/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/src/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/src/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/src/data-structures/index.js.map +1 -0
- package/dist/cjs/src/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/src/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/src/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/src/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/src/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/src/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/src/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/src/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/src/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/src/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/src/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/src/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/src/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/src/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/src/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/src/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/src/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/src/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/src/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/src/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/src/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/src/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/cjs/src/interfaces/binary-tree.js.map +1 -0
- package/dist/cjs/src/interfaces/doubly-linked-list.js.map +1 -0
- package/dist/cjs/{interfaces → src/interfaces}/graph.js.map +1 -1
- package/dist/cjs/{interfaces → src/interfaces}/heap.js.map +1 -1
- package/dist/cjs/src/interfaces/index.js.map +1 -0
- package/dist/cjs/src/interfaces/navigator.js.map +1 -0
- package/dist/cjs/src/interfaces/priority-queue.js.map +1 -0
- package/dist/cjs/src/interfaces/segment-tree.js.map +1 -0
- package/dist/cjs/src/interfaces/singly-linked-list.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/src/types/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/cjs/src/types/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/src/types/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/src/types/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/src/types/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/src/types/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/src/types/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/src/types/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/src/types/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/src/types/data-structures/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/src/types/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/src/types/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/src/types/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/src/types/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/src/types/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/src/types/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/src/types/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/src/types/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/src/types/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/src/types/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/src/types/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/src/types/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/src/types/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/src/types/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/src/types/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/src/types/helpers.js.map +1 -0
- package/dist/cjs/src/types/index.js.map +1 -0
- package/dist/cjs/src/types/utils/index.js.map +1 -0
- package/dist/cjs/{types → src/types}/utils/utils.js.map +1 -1
- package/dist/cjs/src/types/utils/validate-type.js.map +1 -0
- package/dist/cjs/src/utils/index.js.map +1 -0
- package/dist/cjs/src/utils/utils.js.map +1 -0
- package/dist/mjs/{data-structures → src/data-structures}/binary-tree/avl-tree.d.ts +1 -1
- package/dist/mjs/{data-structures → src/data-structures}/binary-tree/avl-tree.js +2 -2
- package/dist/mjs/{data-structures → src/data-structures}/binary-tree/binary-tree.d.ts +4 -3
- package/dist/mjs/{data-structures → src/data-structures}/binary-tree/binary-tree.js +19 -18
- package/dist/{cjs → mjs/src}/data-structures/binary-tree/bst.d.ts +1 -20
- package/dist/mjs/{data-structures → src/data-structures}/binary-tree/bst.js +5 -26
- package/dist/{cjs → mjs/src}/data-structures/binary-tree/tree-multiset.d.ts +1 -1
- package/dist/mjs/{data-structures → src/data-structures}/binary-tree/tree-multiset.js +2 -2
- package/dist/umd/data-structure-typed.min.js +1 -1
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +11 -8
- package/src/data-structures/binary-tree/avl-tree.ts +2 -2
- package/src/data-structures/binary-tree/binary-tree.ts +20 -18
- package/src/data-structures/binary-tree/bst.ts +6 -33
- package/src/data-structures/binary-tree/tree-multiset.ts +2 -2
- package/tsconfig-base.json +20 -24
- package/tsconfig-cjs.json +5 -1
- package/tsconfig-mjs.json +12 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +0 -1
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/cjs/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/cjs/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/data-structures/hash/hash-table.js.map +0 -1
- package/dist/cjs/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/data-structures/hash/tree-map.js.map +0 -1
- package/dist/cjs/data-structures/hash/tree-set.js.map +0 -1
- package/dist/cjs/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/data-structures/index.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/index.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/cjs/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/cjs/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/index.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/cjs/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/interfaces/binary-tree.js.map +0 -1
- package/dist/cjs/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/cjs/interfaces/index.js.map +0 -1
- package/dist/cjs/interfaces/navigator.js.map +0 -1
- package/dist/cjs/interfaces/priority-queue.js.map +0 -1
- package/dist/cjs/interfaces/segment-tree.js.map +0 -1
- package/dist/cjs/interfaces/singly-linked-list.js.map +0 -1
- 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.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/cjs/types/data-structures/binary-tree/tree-multiset.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/index.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/hash-table.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/index.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/tree-map.js.map +0 -1
- package/dist/cjs/types/data-structures/hash/tree-set.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/heap.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/index.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/cjs/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/cjs/types/data-structures/index.js.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/cjs/types/data-structures/matrix/index.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/cjs/types/data-structures/matrix/vector2d.js.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/cjs/types/data-structures/queue/deque.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/index.js.map +0 -1
- package/dist/cjs/types/data-structures/queue/queue.js.map +0 -1
- package/dist/cjs/types/data-structures/stack/index.js.map +0 -1
- package/dist/cjs/types/data-structures/stack/stack.js.map +0 -1
- package/dist/cjs/types/data-structures/tree/index.js.map +0 -1
- package/dist/cjs/types/data-structures/tree/tree.js.map +0 -1
- package/dist/cjs/types/data-structures/trie/index.js.map +0 -1
- package/dist/cjs/types/data-structures/trie/trie.js.map +0 -1
- package/dist/cjs/types/helpers.js.map +0 -1
- package/dist/cjs/types/index.js.map +0 -1
- package/dist/cjs/types/utils/index.js.map +0 -1
- package/dist/cjs/types/utils/validate-type.js.map +0 -1
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/utils.js.map +0 -1
- package/test/config.ts +0 -1
- package/test/integration/avl-tree.test.ts +0 -110
- package/test/integration/bst.test.ts +0 -385
- package/test/integration/heap.test.js +0 -16
- package/test/integration/index.html +0 -51
- package/test/performance/data-structures/binary-tree/avl-tree.test.ts +0 -24
- package/test/performance/data-structures/binary-tree/binary-index-tree.test.ts +0 -0
- package/test/performance/data-structures/binary-tree/binary-tree.test.ts +0 -25
- package/test/performance/data-structures/binary-tree/bst.test.ts +0 -24
- package/test/performance/data-structures/binary-tree/overall.test.ts +0 -0
- package/test/performance/data-structures/binary-tree/rb-tree.test.ts +0 -0
- package/test/performance/data-structures/binary-tree/segment-tree.test.ts +0 -0
- package/test/performance/data-structures/binary-tree/tree-multiset.test.ts +0 -0
- package/test/performance/data-structures/graph/abstract-graph.test.ts +0 -0
- package/test/performance/data-structures/graph/directed-graph.test.ts +0 -0
- package/test/performance/data-structures/graph/map-graph.test.ts +0 -0
- package/test/performance/data-structures/graph/overall.test.ts +0 -0
- package/test/performance/data-structures/graph/undirected-graph.test.ts +0 -0
- package/test/performance/data-structures/hash/coordinate-map.test.ts +0 -0
- package/test/performance/data-structures/hash/coordinate-set.test.ts +0 -0
- package/test/performance/data-structures/hash/hash-map.test.ts +0 -0
- package/test/performance/data-structures/hash/hash-table.test.ts +0 -0
- package/test/performance/data-structures/heap/heap.test.ts +0 -30
- package/test/performance/data-structures/heap/max-heap.test.ts +0 -0
- package/test/performance/data-structures/heap/min-heap.test.ts +0 -0
- package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +0 -40
- package/test/performance/data-structures/linked-list/linked-list.test.ts +0 -0
- package/test/performance/data-structures/linked-list/singly-linked-list.test.ts +0 -34
- package/test/performance/data-structures/linked-list/skip-linked-list.test.ts +0 -0
- package/test/performance/data-structures/linked-list/skip-list.test.ts +0 -0
- package/test/performance/data-structures/matrix/matrix.test.ts +0 -0
- package/test/performance/data-structures/matrix/matrix2d.test.ts +0 -0
- package/test/performance/data-structures/matrix/navigator.test.ts +0 -0
- package/test/performance/data-structures/matrix/vector2d.test.ts +0 -0
- package/test/performance/data-structures/priority-queue/max-priority-queue.test.ts +0 -19
- package/test/performance/data-structures/priority-queue/min-priority-queue.test.ts +0 -0
- package/test/performance/data-structures/priority-queue/priority-queue.test.ts +0 -0
- package/test/performance/data-structures/queue/deque.test.ts +0 -21
- package/test/performance/data-structures/queue/queue.test.ts +0 -25
- package/test/performance/data-structures/stack/stack.test.ts +0 -0
- package/test/performance/data-structures/tree/tree.test.ts +0 -0
- package/test/performance/data-structures/trie/trie.test.ts +0 -0
- package/test/performance/reportor.ts +0 -174
- package/test/performance/types/index.ts +0 -1
- package/test/performance/types/reportor.ts +0 -3
- package/test/types/index.ts +0 -1
- package/test/types/utils/big-o.ts +0 -1
- package/test/types/utils/index.ts +0 -2
- package/test/types/utils/json2html.ts +0 -1
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +0 -269
- package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +0 -320
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +0 -486
- package/test/unit/data-structures/binary-tree/bst.test.ts +0 -840
- package/test/unit/data-structures/binary-tree/overall.test.ts +0 -66
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +0 -435
- package/test/unit/data-structures/binary-tree/segment-tree.test.ts +0 -50
- package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +0 -542
- package/test/unit/data-structures/graph/abstract-graph.test.ts +0 -100
- package/test/unit/data-structures/graph/directed-graph.test.ts +0 -564
- package/test/unit/data-structures/graph/map-graph.test.ts +0 -126
- package/test/unit/data-structures/graph/overall.test.ts +0 -49
- package/test/unit/data-structures/graph/undirected-graph.test.ts +0 -149
- package/test/unit/data-structures/hash/coordinate-map.test.ts +0 -74
- package/test/unit/data-structures/hash/coordinate-set.test.ts +0 -66
- package/test/unit/data-structures/hash/hash-map.test.ts +0 -103
- package/test/unit/data-structures/hash/hash-table.test.ts +0 -186
- package/test/unit/data-structures/heap/heap.test.ts +0 -253
- package/test/unit/data-structures/heap/max-heap.test.ts +0 -52
- package/test/unit/data-structures/heap/min-heap.test.ts +0 -52
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +0 -400
- package/test/unit/data-structures/linked-list/linked-list.test.ts +0 -8
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +0 -474
- package/test/unit/data-structures/linked-list/skip-linked-list.test.ts +0 -13
- package/test/unit/data-structures/linked-list/skip-list.test.ts +0 -86
- package/test/unit/data-structures/matrix/matrix.test.ts +0 -54
- package/test/unit/data-structures/matrix/matrix2d.test.ts +0 -345
- package/test/unit/data-structures/matrix/navigator.test.ts +0 -244
- package/test/unit/data-structures/matrix/vector2d.test.ts +0 -171
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +0 -73
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +0 -63
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +0 -53
- package/test/unit/data-structures/queue/deque.test.ts +0 -410
- package/test/unit/data-structures/queue/queue.test.ts +0 -207
- package/test/unit/data-structures/stack/stack.test.ts +0 -67
- package/test/unit/data-structures/tree/tree.test.ts +0 -39
- package/test/unit/data-structures/trie/trie.test.ts +0 -825
- package/test/utils/array.ts +0 -5
- package/test/utils/big-o.ts +0 -201
- package/test/utils/console.ts +0 -30
- package/test/utils/index.ts +0 -6
- package/test/utils/is.ts +0 -56
- package/test/utils/json2html.ts +0 -322
- package/test/utils/number.ts +0 -13
- package/umd/bundle.min.js +0 -3
- package/umd/bundle.min.js.LICENSE.txt +0 -28
- package/umd/bundle.min.js.map +0 -1
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/rb-tree.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/binary-tree/segment-tree.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/abstract-graph.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/abstract-graph.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/directed-graph.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/directed-graph.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/map-graph.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/map-graph.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/undirected-graph.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/graph/undirected-graph.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/coordinate-map.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/coordinate-map.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/coordinate-set.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/coordinate-set.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/hash-map.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/hash-map.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/hash-table.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/hash-table.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/tree-map.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/tree-map.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/tree-set.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/hash/tree-set.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/heap.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/heap.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/max-heap.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/max-heap.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/min-heap.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/heap/min-heap.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/doubly-linked-list.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/singly-linked-list.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/linked-list/skip-linked-list.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/matrix.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/matrix.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/matrix2d.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/matrix2d.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/navigator.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/navigator.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/vector2d.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/matrix/vector2d.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/max-priority-queue.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/min-priority-queue.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/priority-queue/priority-queue.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/queue/deque.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/queue/deque.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/queue/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/queue/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/queue/queue.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/queue/queue.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/stack/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/stack/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/stack/stack.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/stack/stack.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/tree/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/tree/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/tree/tree.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/tree/tree.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/trie/index.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/trie/index.js +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/trie/trie.d.ts +0 -0
- /package/dist/cjs/{data-structures → src/data-structures}/trie/trie.js +0 -0
- /package/dist/cjs/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/cjs/{index.js → src/index.js} +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/binary-tree.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/binary-tree.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/doubly-linked-list.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/graph.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/graph.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/heap.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/heap.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/index.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/index.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/navigator.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/navigator.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/priority-queue.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/priority-queue.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/segment-tree.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/segment-tree.js +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/cjs/{interfaces → src/interfaces}/singly-linked-list.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/avl-tree.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/binary-tree.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/binary-tree.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/bst.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/bst.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/rb-tree.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/segment-tree.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/tree-multiset.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/binary-tree/tree-multiset.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/abstract-graph.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/directed-graph.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/map-graph.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/graph/undirected-graph.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/coordinate-map.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/coordinate-map.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/coordinate-set.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/coordinate-set.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/hash-map.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/hash-table.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/hash-table.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/tree-map.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/tree-map.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/tree-set.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/hash/tree-set.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/heap.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/heap.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/max-heap.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/heap/min-heap.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/doubly-linked-list.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/singly-linked-list.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/linked-list/skip-linked-list.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/matrix.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/matrix2d.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/matrix2d.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/navigator.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/vector2d.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/matrix/vector2d.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/max-priority-queue.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/min-priority-queue.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/priority-queue/priority-queue.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/queue/deque.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/queue/deque.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/queue/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/queue/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/queue/queue.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/queue/queue.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/stack/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/stack/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/stack/stack.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/stack/stack.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/tree/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/tree/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/tree/tree.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/tree/tree.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/trie/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/trie/index.js +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/trie/trie.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/data-structures/trie/trie.js +0 -0
- /package/dist/cjs/{types → src/types}/helpers.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/helpers.js +0 -0
- /package/dist/cjs/{types → src/types}/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/index.js +0 -0
- /package/dist/cjs/{types → src/types}/utils/index.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/utils/index.js +0 -0
- /package/dist/cjs/{types → src/types}/utils/utils.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/utils/utils.js +0 -0
- /package/dist/cjs/{types → src/types}/utils/validate-type.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/utils/validate-type.js +0 -0
- /package/dist/cjs/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/cjs/{utils → src/utils}/index.js +0 -0
- /package/dist/cjs/{utils → src/utils}/utils.d.ts +0 -0
- /package/dist/cjs/{utils → src/utils}/utils.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/rb-tree.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/binary-tree/segment-tree.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/abstract-graph.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/abstract-graph.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/directed-graph.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/directed-graph.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/map-graph.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/map-graph.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/undirected-graph.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/graph/undirected-graph.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/coordinate-map.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/coordinate-map.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/coordinate-set.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/coordinate-set.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/hash-map.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/hash-map.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/hash-table.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/hash-table.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/tree-map.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/tree-map.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/tree-set.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/hash/tree-set.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/heap.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/heap.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/max-heap.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/max-heap.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/min-heap.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/heap/min-heap.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/doubly-linked-list.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/singly-linked-list.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/linked-list/skip-linked-list.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/matrix.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/matrix.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/matrix2d.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/matrix2d.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/navigator.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/navigator.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/vector2d.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/matrix/vector2d.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/max-priority-queue.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/min-priority-queue.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/priority-queue/priority-queue.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/queue/deque.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/queue/deque.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/queue/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/queue/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/queue/queue.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/queue/queue.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/stack/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/stack/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/stack/stack.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/stack/stack.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/tree/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/tree/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/tree/tree.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/tree/tree.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/trie/index.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/trie/index.js +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/trie/trie.d.ts +0 -0
- /package/dist/mjs/{data-structures → src/data-structures}/trie/trie.js +0 -0
- /package/dist/mjs/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/mjs/{index.js → src/index.js} +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/binary-tree.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/binary-tree.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/doubly-linked-list.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/graph.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/graph.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/heap.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/heap.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/index.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/index.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/navigator.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/navigator.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/priority-queue.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/priority-queue.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/segment-tree.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/segment-tree.js +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/mjs/{interfaces → src/interfaces}/singly-linked-list.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/avl-tree.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/binary-tree.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/binary-tree.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/bst.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/bst.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/rb-tree.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/segment-tree.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/tree-multiset.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/binary-tree/tree-multiset.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/abstract-graph.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/directed-graph.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/map-graph.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/graph/undirected-graph.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/coordinate-map.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/coordinate-map.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/coordinate-set.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/coordinate-set.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/hash-map.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/hash-table.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/hash-table.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/tree-map.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/tree-map.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/tree-set.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/hash/tree-set.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/heap.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/heap.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/max-heap.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/heap/min-heap.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/doubly-linked-list.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/singly-linked-list.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/linked-list/skip-linked-list.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/matrix.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/matrix2d.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/matrix2d.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/navigator.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/vector2d.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/matrix/vector2d.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/max-priority-queue.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/min-priority-queue.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/priority-queue/priority-queue.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/queue/deque.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/queue/deque.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/queue/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/queue/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/queue/queue.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/queue/queue.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/stack/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/stack/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/stack/stack.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/stack/stack.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/tree/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/tree/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/tree/tree.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/tree/tree.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/trie/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/trie/index.js +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/trie/trie.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/data-structures/trie/trie.js +0 -0
- /package/dist/mjs/{types → src/types}/helpers.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/helpers.js +0 -0
- /package/dist/mjs/{types → src/types}/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/index.js +0 -0
- /package/dist/mjs/{types → src/types}/utils/index.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/utils/index.js +0 -0
- /package/dist/mjs/{types → src/types}/utils/utils.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/utils/utils.js +0 -0
- /package/dist/mjs/{types → src/types}/utils/validate-type.d.ts +0 -0
- /package/dist/mjs/{types → src/types}/utils/validate-type.js +0 -0
- /package/dist/mjs/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/mjs/{utils → src/utils}/index.js +0 -0
- /package/dist/mjs/{utils → src/utils}/utils.d.ts +0 -0
- /package/dist/mjs/{utils → src/utils}/utils.js +0 -0
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
import {ArrayDeque, Deque, ObjectDeque} from '../../../../src';
|
|
2
|
-
import {bigO} from '../../../utils';
|
|
3
|
-
import {isDebugTest} from '../../../config';
|
|
4
|
-
|
|
5
|
-
const isDebug = isDebugTest;
|
|
6
|
-
describe('Deque Tests', () => {
|
|
7
|
-
// Test cases for the Deque class (DoublyLinkedList-based)
|
|
8
|
-
describe('Deque (DoublyLinkedList-based)', () => {
|
|
9
|
-
let deque: Deque<number>;
|
|
10
|
-
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
deque = new Deque<number>();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should add elements at the beginning and end', () => {
|
|
16
|
-
deque.addFirst(1);
|
|
17
|
-
deque.addLast(2);
|
|
18
|
-
expect(deque.getFirst()).toBe(1);
|
|
19
|
-
expect(deque.getLast()).toBe(2);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should delete elements from the beginning and end', () => {
|
|
23
|
-
deque.addFirst(1);
|
|
24
|
-
deque.addLast(2);
|
|
25
|
-
deque.popFirst();
|
|
26
|
-
deque.popLast();
|
|
27
|
-
expect(deque.isEmpty()).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should handle edge case when removing from an empty deque', () => {
|
|
31
|
-
const result = deque.popFirst();
|
|
32
|
-
expect(result).toBeUndefined();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should correctly report its size', () => {
|
|
36
|
-
deque.addFirst(1);
|
|
37
|
-
deque.addLast(2);
|
|
38
|
-
expect(deque.size).toBe(2);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should handle adding and removing elements alternately', () => {
|
|
42
|
-
deque.addFirst(1);
|
|
43
|
-
expect(deque.popFirst()).toBe(1);
|
|
44
|
-
deque.addLast(2);
|
|
45
|
-
expect(deque.popLast()).toBe(2);
|
|
46
|
-
expect(deque.isEmpty()).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should handle adding and removing elements in a cyclic manner', () => {
|
|
50
|
-
deque.addFirst(1);
|
|
51
|
-
deque.addLast(2);
|
|
52
|
-
expect(deque.popFirst()).toBe(1);
|
|
53
|
-
deque.addFirst(3);
|
|
54
|
-
expect(deque.popLast()).toBe(2);
|
|
55
|
-
expect(deque.size).toBe(1);
|
|
56
|
-
});
|
|
57
|
-
// Add more test cases as needed
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Test cases for the ObjectDeque class
|
|
61
|
-
describe('ObjectDeque', () => {
|
|
62
|
-
let objectDeque: ObjectDeque<string>;
|
|
63
|
-
|
|
64
|
-
beforeEach(() => {
|
|
65
|
-
objectDeque = new ObjectDeque<string>();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should add elements at the beginning and end', () => {
|
|
69
|
-
objectDeque.addFirst('one');
|
|
70
|
-
objectDeque.addLast('two');
|
|
71
|
-
expect(objectDeque.getFirst()).toBe('one');
|
|
72
|
-
expect(objectDeque.getLast()).toBe('two');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should delete elements from the beginning and end', () => {
|
|
76
|
-
objectDeque.addFirst('one');
|
|
77
|
-
objectDeque.addLast('two');
|
|
78
|
-
objectDeque.popFirst();
|
|
79
|
-
objectDeque.popLast();
|
|
80
|
-
expect(objectDeque.isEmpty()).toBe(true);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should handle edge case when removing from an empty deque', () => {
|
|
84
|
-
const result = objectDeque.popFirst();
|
|
85
|
-
expect(result).toBeUndefined();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should correctly report its size', () => {
|
|
89
|
-
objectDeque.addFirst('one');
|
|
90
|
-
objectDeque.addLast('two');
|
|
91
|
-
expect(objectDeque.size).toBe(2);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// Add more test cases as needed
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Test cases for the ArrayDeque class
|
|
98
|
-
describe('ArrayDeque', () => {
|
|
99
|
-
let arrayDeque: ArrayDeque<number>;
|
|
100
|
-
|
|
101
|
-
beforeEach(() => {
|
|
102
|
-
arrayDeque = new ArrayDeque<number>();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should add elements at the beginning and end', () => {
|
|
106
|
-
arrayDeque.addFirst(1);
|
|
107
|
-
arrayDeque.addLast(2);
|
|
108
|
-
expect(arrayDeque.getFirst()).toBe(1);
|
|
109
|
-
expect(arrayDeque.getLast()).toBe(2);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should delete elements from the beginning and end', () => {
|
|
113
|
-
arrayDeque.addFirst(1);
|
|
114
|
-
arrayDeque.addLast(2);
|
|
115
|
-
arrayDeque.popFirst();
|
|
116
|
-
arrayDeque.popLast();
|
|
117
|
-
expect(arrayDeque.isEmpty()).toBe(true);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('should handle edge case when removing from an empty deque', () => {
|
|
121
|
-
const result = arrayDeque.popFirst();
|
|
122
|
-
expect(result).toBeNull();
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('should correctly report its size', () => {
|
|
126
|
-
arrayDeque.addFirst(1);
|
|
127
|
-
arrayDeque.addLast(2);
|
|
128
|
-
expect(arrayDeque.size).toBe(2);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Add more test cases as needed
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('Deque Performance Test', () => {
|
|
136
|
-
const dataSize = 10000;
|
|
137
|
-
it('should numeric queue be efficient', function () {
|
|
138
|
-
const startTime = performance.now();
|
|
139
|
-
const queue = new Deque<number>();
|
|
140
|
-
for (let i = 0; i < dataSize; i++) {
|
|
141
|
-
queue.unshift(i);
|
|
142
|
-
}
|
|
143
|
-
for (let i = 0; i < dataSize; i++) {
|
|
144
|
-
queue.pop();
|
|
145
|
-
}
|
|
146
|
-
isDebug && console.log(`Queue Deque Test: ${performance.now() - startTime} ms`);
|
|
147
|
-
expect(performance.now() - startTime).toBeLessThan(bigO.LINEAR * 100);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
describe('Deque', () => {
|
|
152
|
-
let deque: Deque<number>;
|
|
153
|
-
|
|
154
|
-
beforeEach(() => {
|
|
155
|
-
deque = new Deque<number>();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test('should initialize an empty deque', () => {
|
|
159
|
-
expect(deque.size).toBe(0);
|
|
160
|
-
expect(deque.isEmpty()).toBe(true);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
test('should add elements to the front and back', () => {
|
|
164
|
-
deque.addFirst(1);
|
|
165
|
-
deque.addLast(2);
|
|
166
|
-
|
|
167
|
-
expect(deque.size).toBe(2);
|
|
168
|
-
expect(deque.getFirst()).toBe(1);
|
|
169
|
-
expect(deque.getLast()).toBe(2);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
test('should remove elements from the front and back', () => {
|
|
173
|
-
deque.addFirst(1);
|
|
174
|
-
deque.addLast(2);
|
|
175
|
-
|
|
176
|
-
const firstElement = deque.popFirst();
|
|
177
|
-
const lastElement = deque.popLast();
|
|
178
|
-
|
|
179
|
-
expect(deque.size).toBe(0);
|
|
180
|
-
expect(firstElement).toBe(1);
|
|
181
|
-
expect(lastElement).toBe(2);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
test('should get elements by index', () => {
|
|
185
|
-
deque.addLast(1);
|
|
186
|
-
deque.addLast(2);
|
|
187
|
-
deque.addLast(3);
|
|
188
|
-
|
|
189
|
-
expect(deque.getAt(0)).toBe(1);
|
|
190
|
-
expect(deque.getAt(1)).toBe(2);
|
|
191
|
-
expect(deque.getAt(2)).toBe(3);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
test('should return null for out-of-bounds index', () => {
|
|
195
|
-
expect(deque.getAt(0)).toBe(undefined);
|
|
196
|
-
expect(deque.getAt(1)).toBe(undefined);
|
|
197
|
-
expect(deque.getAt(-1)).toBe(undefined);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
test('should check if the deque is empty', () => {
|
|
201
|
-
expect(deque.isEmpty()).toBe(true);
|
|
202
|
-
|
|
203
|
-
deque.addLast(1);
|
|
204
|
-
expect(deque.isEmpty()).toBe(false);
|
|
205
|
-
|
|
206
|
-
deque.popFirst();
|
|
207
|
-
expect(deque.isEmpty()).toBe(true);
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe('ArrayDeque', () => {
|
|
212
|
-
let deque: ArrayDeque<number>;
|
|
213
|
-
|
|
214
|
-
beforeEach(() => {
|
|
215
|
-
deque = new ArrayDeque<number>();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
test('should initialize an empty deque', () => {
|
|
219
|
-
expect(deque.size).toBe(0);
|
|
220
|
-
expect(deque.isEmpty()).toBe(true);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
test('should add elements to the front and back', () => {
|
|
224
|
-
deque.addFirst(1);
|
|
225
|
-
deque.addLast(2);
|
|
226
|
-
|
|
227
|
-
expect(deque.size).toBe(2);
|
|
228
|
-
expect(deque.getFirst()).toBe(1);
|
|
229
|
-
expect(deque.getLast()).toBe(2);
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
test('should remove elements from the front and back', () => {
|
|
233
|
-
deque.addFirst(1);
|
|
234
|
-
deque.addLast(2);
|
|
235
|
-
|
|
236
|
-
const firstElement = deque.popFirst();
|
|
237
|
-
const lastElement = deque.popLast();
|
|
238
|
-
|
|
239
|
-
expect(deque.size).toBe(0);
|
|
240
|
-
expect(firstElement).toBe(1);
|
|
241
|
-
expect(lastElement).toBe(2);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('should get elements by index', () => {
|
|
245
|
-
deque.addLast(1);
|
|
246
|
-
deque.addLast(2);
|
|
247
|
-
deque.addLast(3);
|
|
248
|
-
|
|
249
|
-
expect(deque.get(0)).toBe(1);
|
|
250
|
-
expect(deque.get(1)).toBe(2);
|
|
251
|
-
expect(deque.get(2)).toBe(3);
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
test('should return null for out-of-bounds index', () => {
|
|
255
|
-
expect(deque.get(0)).toBe(null);
|
|
256
|
-
expect(deque.get(1)).toBe(null);
|
|
257
|
-
expect(deque.get(-1)).toBe(null);
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
test('should check if the deque is empty', () => {
|
|
261
|
-
expect(deque.isEmpty()).toBe(true);
|
|
262
|
-
|
|
263
|
-
deque.addLast(1);
|
|
264
|
-
expect(deque.isEmpty()).toBe(false);
|
|
265
|
-
|
|
266
|
-
deque.popFirst();
|
|
267
|
-
expect(deque.isEmpty()).toBe(true);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
test('should set elements at a specific index', () => {
|
|
271
|
-
deque.addLast(1);
|
|
272
|
-
deque.addLast(2);
|
|
273
|
-
deque.addLast(3);
|
|
274
|
-
|
|
275
|
-
deque.set(1, 4);
|
|
276
|
-
|
|
277
|
-
expect(deque.get(0)).toBe(1);
|
|
278
|
-
expect(deque.get(1)).toBe(4);
|
|
279
|
-
expect(deque.get(2)).toBe(3);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
test('should insert elements at a specific index', () => {
|
|
283
|
-
deque.addLast(1);
|
|
284
|
-
deque.addLast(2);
|
|
285
|
-
deque.addLast(3);
|
|
286
|
-
|
|
287
|
-
deque.insert(1, 4);
|
|
288
|
-
|
|
289
|
-
expect(deque.size).toBe(4);
|
|
290
|
-
expect(deque.get(0)).toBe(1);
|
|
291
|
-
expect(deque.get(1)).toBe(4);
|
|
292
|
-
expect(deque.get(2)).toBe(2);
|
|
293
|
-
expect(deque.get(3)).toBe(3);
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
test('should delete elements at a specific index', () => {
|
|
297
|
-
deque.addLast(1);
|
|
298
|
-
deque.addLast(2);
|
|
299
|
-
deque.addLast(3);
|
|
300
|
-
|
|
301
|
-
const deletedElement = deque.delete(1);
|
|
302
|
-
|
|
303
|
-
expect(deque.size).toBe(2);
|
|
304
|
-
expect(deletedElement[0]).toBe(2);
|
|
305
|
-
expect(deque.get(0)).toBe(1);
|
|
306
|
-
expect(deque.get(1)).toBe(3);
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
describe('ObjectDeque', () => {
|
|
311
|
-
let deque: ObjectDeque<number>;
|
|
312
|
-
|
|
313
|
-
beforeEach(() => {
|
|
314
|
-
deque = new ObjectDeque<number>();
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
test('should add elements to the front of the deque', () => {
|
|
318
|
-
deque.addFirst(1);
|
|
319
|
-
deque.addFirst(2);
|
|
320
|
-
|
|
321
|
-
expect(deque.size).toBe(2);
|
|
322
|
-
expect(deque.getFirst()).toBe(2);
|
|
323
|
-
expect(deque.getLast()).toBe(1);
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
test('should add elements to the end of the deque', () => {
|
|
327
|
-
deque.addLast(1);
|
|
328
|
-
deque.addLast(2);
|
|
329
|
-
|
|
330
|
-
expect(deque.size).toBe(2);
|
|
331
|
-
expect(deque.getFirst()).toBe(1);
|
|
332
|
-
expect(deque.getLast()).toBe(2);
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
test('should remove elements from the front of the deque', () => {
|
|
336
|
-
deque.addLast(1);
|
|
337
|
-
deque.addLast(2);
|
|
338
|
-
|
|
339
|
-
const removedElement = deque.popFirst();
|
|
340
|
-
|
|
341
|
-
expect(deque.size).toBe(1);
|
|
342
|
-
expect(removedElement).toBe(1);
|
|
343
|
-
expect(deque.getFirst()).toBe(2);
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
test('should remove elements from the end of the deque', () => {
|
|
347
|
-
deque.addLast(1);
|
|
348
|
-
deque.addLast(2);
|
|
349
|
-
|
|
350
|
-
const removedElement = deque.popFirst();
|
|
351
|
-
|
|
352
|
-
expect(deque.size).toBe(1);
|
|
353
|
-
expect(removedElement).toBe(1);
|
|
354
|
-
expect(deque.getLast()).toBe(2);
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
test('should return the element at the front of the deque without removing it', () => {
|
|
358
|
-
deque.addFirst(1);
|
|
359
|
-
deque.addFirst(2);
|
|
360
|
-
|
|
361
|
-
expect(deque.getFirst()).toBe(2);
|
|
362
|
-
expect(deque.size).toBe(2);
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
test('should return the element at the end of the deque without removing it', () => {
|
|
366
|
-
deque.addLast(1);
|
|
367
|
-
deque.addLast(2);
|
|
368
|
-
|
|
369
|
-
expect(deque.getLast()).toBe(2);
|
|
370
|
-
expect(deque.size).toBe(2);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
test('should return the correct size of the deque', () => {
|
|
374
|
-
deque.addFirst(1);
|
|
375
|
-
deque.addLast(2);
|
|
376
|
-
deque.addLast(3);
|
|
377
|
-
|
|
378
|
-
expect(deque.size).toBe(3);
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
test('should check if the deque is empty', () => {
|
|
382
|
-
expect(deque.isEmpty()).toBe(true);
|
|
383
|
-
|
|
384
|
-
deque.addFirst(1);
|
|
385
|
-
|
|
386
|
-
expect(deque.isEmpty()).toBe(false);
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
test('should set elements at a specific index', () => {
|
|
390
|
-
deque.addFirst(1);
|
|
391
|
-
deque.addLast(2);
|
|
392
|
-
deque.addLast(3);
|
|
393
|
-
|
|
394
|
-
expect(deque.getFirst()).toBe(1);
|
|
395
|
-
expect(deque.get(1)).toBe(2);
|
|
396
|
-
expect(deque.getLast()).toBe(3);
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
test('should insert elements at a specific index', () => {
|
|
400
|
-
deque.addFirst(1);
|
|
401
|
-
deque.addLast(2);
|
|
402
|
-
deque.addLast(3);
|
|
403
|
-
|
|
404
|
-
expect(deque.size).toBe(3);
|
|
405
|
-
expect(deque.getFirst()).toBe(1);
|
|
406
|
-
expect(deque.get(1)).toBe(2);
|
|
407
|
-
expect(deque.get(2)).toBe(3);
|
|
408
|
-
expect(deque.getLast()).toBe(3);
|
|
409
|
-
});
|
|
410
|
-
});
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import {LinkedListQueue, Queue} from '../../../../src';
|
|
2
|
-
import {bigO} from '../../../utils';
|
|
3
|
-
import {isDebugTest} from '../../../config';
|
|
4
|
-
|
|
5
|
-
const isDebug = isDebugTest;
|
|
6
|
-
describe('Queue Operation Test', () => {
|
|
7
|
-
it('should validate a queue', () => {
|
|
8
|
-
const queue = new Queue<number>();
|
|
9
|
-
for (let i = 0; i < 1000; i++) {
|
|
10
|
-
queue.enqueue(i);
|
|
11
|
-
}
|
|
12
|
-
let last: number | undefined = 0;
|
|
13
|
-
for (let i = 0; i < 1000; i++) {
|
|
14
|
-
last = queue.dequeue();
|
|
15
|
-
}
|
|
16
|
-
expect(last).toBe(999);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('Queue', () => {
|
|
21
|
-
let queue: Queue<number>;
|
|
22
|
-
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
queue = new Queue<number>();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should initialize an empty queue', () => {
|
|
28
|
-
expect(queue.size).toBe(0);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should push elements to the end of the queue', () => {
|
|
32
|
-
queue.push(1);
|
|
33
|
-
queue.push(2);
|
|
34
|
-
expect(queue.peek()).toBe(1);
|
|
35
|
-
expect(queue.size).toBe(2);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('Queue', () => {
|
|
40
|
-
let queue: Queue<number>;
|
|
41
|
-
|
|
42
|
-
beforeEach(() => {
|
|
43
|
-
queue = new Queue<number>();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should initialize an empty queue', () => {
|
|
47
|
-
expect(queue.size).toBe(0);
|
|
48
|
-
expect(queue.isEmpty()).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should push elements to the end of the queue', () => {
|
|
52
|
-
queue.push(1);
|
|
53
|
-
queue.push(2);
|
|
54
|
-
expect(queue.size).toBe(2);
|
|
55
|
-
expect(queue.peek()).toBe(1);
|
|
56
|
-
expect(queue.getLast()).toBe(2);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should shift elements from the front of the queue', () => {
|
|
60
|
-
queue.push(1);
|
|
61
|
-
queue.push(2);
|
|
62
|
-
const shifted = queue.shift();
|
|
63
|
-
expect(shifted).toBe(1);
|
|
64
|
-
expect(queue.size).toBe(1);
|
|
65
|
-
expect(queue.peek()).toBe(2);
|
|
66
|
-
expect(queue.getLast()).toBe(2);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should handle shifting when queue reaches half size', () => {
|
|
70
|
-
for (let i = 1; i <= 5; i++) {
|
|
71
|
-
queue.push(i);
|
|
72
|
-
}
|
|
73
|
-
for (let i = 1; i <= 3; i++) {
|
|
74
|
-
queue.shift();
|
|
75
|
-
}
|
|
76
|
-
// Queue size should be 2, but internal array size is still 5.
|
|
77
|
-
// Test that shifting optimizes the internal array.
|
|
78
|
-
expect(queue.size).toBe(2);
|
|
79
|
-
expect(queue.nodes.length).toBe(2);
|
|
80
|
-
expect(queue.peek()).toBe(4);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should peek at the front and end of the queue', () => {
|
|
84
|
-
queue.push(1);
|
|
85
|
-
queue.push(2);
|
|
86
|
-
expect(queue.peek()).toBe(1);
|
|
87
|
-
expect(queue.getLast()).toBe(2);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('should handle shifting when the queue is empty', () => {
|
|
91
|
-
const shifted = queue.shift();
|
|
92
|
-
expect(shifted).toBeUndefined();
|
|
93
|
-
expect(queue.size).toBe(0);
|
|
94
|
-
expect(queue.peek()).toBeUndefined();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should handle peeking when the queue is empty', () => {
|
|
98
|
-
expect(queue.peek()).toBeUndefined();
|
|
99
|
-
expect(queue.getLast()).toBeUndefined();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should handle clearing the queue', () => {
|
|
103
|
-
for (let i = 1; i <= 3; i++) {
|
|
104
|
-
queue.push(i);
|
|
105
|
-
}
|
|
106
|
-
queue.clear();
|
|
107
|
-
expect(queue.size).toBe(0);
|
|
108
|
-
expect(queue.peek()).toBeUndefined();
|
|
109
|
-
expect(queue.getLast()).toBeUndefined();
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should clone the queue', () => {
|
|
113
|
-
for (let i = 1; i <= 3; i++) {
|
|
114
|
-
queue.push(i);
|
|
115
|
-
}
|
|
116
|
-
const clonedQueue = queue.clone();
|
|
117
|
-
expect(clonedQueue.size).toBe(3);
|
|
118
|
-
expect(clonedQueue.peek()).toBe(1);
|
|
119
|
-
expect(clonedQueue.getLast()).toBe(3);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('should handle creating a queue from an array', () => {
|
|
123
|
-
const elements = [1, 2, 3, 4, 5];
|
|
124
|
-
const newQueue = Queue.fromArray(elements);
|
|
125
|
-
expect(newQueue.size).toBe(5);
|
|
126
|
-
expect(newQueue.peek()).toBe(1);
|
|
127
|
-
expect(newQueue.getLast()).toBe(5);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('should iterate through the queue', () => {
|
|
131
|
-
for (let i = 1; i <= 3; i++) {
|
|
132
|
-
queue.push(i);
|
|
133
|
-
}
|
|
134
|
-
const values = Array.from(queue);
|
|
135
|
-
expect(values).toEqual([1, 2, 3]);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe('LinkedListQueue', () => {
|
|
139
|
-
let queue: LinkedListQueue<string>;
|
|
140
|
-
|
|
141
|
-
beforeEach(() => {
|
|
142
|
-
queue = new LinkedListQueue<string>();
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('should enqueue elements to the end of the queue', () => {
|
|
146
|
-
queue.enqueue('A');
|
|
147
|
-
queue.enqueue('B');
|
|
148
|
-
expect(queue.peek()).toBe('A');
|
|
149
|
-
expect(queue.length).toBe(2);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should dequeue elements from the front of the queue', () => {
|
|
153
|
-
queue.enqueue('A');
|
|
154
|
-
queue.enqueue('B');
|
|
155
|
-
const dequeued = queue.dequeue();
|
|
156
|
-
expect(dequeued).toBe('A');
|
|
157
|
-
expect(queue.peek()).toBe('B');
|
|
158
|
-
expect(queue.length).toBe(1);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('should peek at the front of the queue', () => {
|
|
162
|
-
queue.enqueue('A');
|
|
163
|
-
queue.enqueue('B');
|
|
164
|
-
expect(queue.peek()).toBe('A');
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
describe('Queue Performance Test', () => {
|
|
169
|
-
const dataSize = 10000;
|
|
170
|
-
it('should numeric queue be efficient', function () {
|
|
171
|
-
const startTime = performance.now();
|
|
172
|
-
const queue = new Queue<number>();
|
|
173
|
-
for (let i = 0; i < dataSize; i++) {
|
|
174
|
-
queue.enqueue(i);
|
|
175
|
-
}
|
|
176
|
-
for (let i = 0; i < dataSize; i++) {
|
|
177
|
-
queue.dequeue();
|
|
178
|
-
}
|
|
179
|
-
isDebug && console.log(`Queue Performance Test: ${performance.now() - startTime} ms`);
|
|
180
|
-
expect(performance.now() - startTime).toBeLessThan(bigO.LINEAR * 100);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('should numeric Array be more efficient than Queue when the data size is 10000', function () {
|
|
184
|
-
const startTime2 = performance.now();
|
|
185
|
-
const queue2: number[] = [];
|
|
186
|
-
for (let i = 0; i < dataSize; i++) {
|
|
187
|
-
queue2.push(i);
|
|
188
|
-
}
|
|
189
|
-
for (let i = 0; i < dataSize; i++) {
|
|
190
|
-
queue2.shift();
|
|
191
|
-
}
|
|
192
|
-
expect(performance.now() - startTime2).toBeLessThan(bigO.CUBED * 100);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('should numeric LinkedListQueue be efficient', function () {
|
|
196
|
-
const startTime = performance.now();
|
|
197
|
-
const queue = new LinkedListQueue<number>();
|
|
198
|
-
for (let i = 0; i < dataSize; i++) {
|
|
199
|
-
queue.enqueue(i);
|
|
200
|
-
}
|
|
201
|
-
for (let i = 0; i < dataSize; i++) {
|
|
202
|
-
queue.dequeue();
|
|
203
|
-
}
|
|
204
|
-
// console.log(`LinkedListQueue Performance Test: ${performance.now() - startTime} ms`);
|
|
205
|
-
expect(performance.now() - startTime).toBeLessThan(bigO.LINEAR * 100);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {Stack} from '../../../../src';
|
|
2
|
-
|
|
3
|
-
describe('Stack', () => {
|
|
4
|
-
let stack: Stack<number>;
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
stack = new Stack<number>();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should be empty when initialized', () => {
|
|
11
|
-
expect(stack.isEmpty()).toBe(true);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should push elements onto the stack', () => {
|
|
15
|
-
stack.push(1);
|
|
16
|
-
stack.push(2);
|
|
17
|
-
stack.push(3);
|
|
18
|
-
expect(stack.size()).toBe(3);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should peek at the top element without removing it', () => {
|
|
22
|
-
stack.push(1);
|
|
23
|
-
stack.push(2);
|
|
24
|
-
stack.push(3);
|
|
25
|
-
expect(stack.peek()).toBe(3);
|
|
26
|
-
expect(stack.size()).toBe(3);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should pop elements from the stack', () => {
|
|
30
|
-
stack.push(1);
|
|
31
|
-
stack.push(2);
|
|
32
|
-
stack.push(3);
|
|
33
|
-
const poppedElement = stack.pop();
|
|
34
|
-
expect(poppedElement).toBe(3);
|
|
35
|
-
expect(stack.size()).toBe(2);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should return null when popping from an empty stack', () => {
|
|
39
|
-
const poppedElement = stack.pop();
|
|
40
|
-
expect(poppedElement).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should convert the stack to an array', () => {
|
|
44
|
-
stack.push(1);
|
|
45
|
-
stack.push(2);
|
|
46
|
-
stack.push(3);
|
|
47
|
-
const stackArray = stack.toArray();
|
|
48
|
-
expect(stackArray).toEqual([1, 2, 3]);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should clear all elements from the stack', () => {
|
|
52
|
-
stack.push(1);
|
|
53
|
-
stack.push(2);
|
|
54
|
-
stack.push(3);
|
|
55
|
-
stack.clear();
|
|
56
|
-
expect(stack.size()).toBe(0);
|
|
57
|
-
expect(stack.isEmpty()).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should clone the stack', () => {
|
|
61
|
-
stack.push(1);
|
|
62
|
-
stack.push(2);
|
|
63
|
-
const clonedStack = stack.clone();
|
|
64
|
-
expect(clonedStack.size()).toBe(2);
|
|
65
|
-
expect(clonedStack.pop()).toBe(2);
|
|
66
|
-
});
|
|
67
|
-
});
|