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,474 +0,0 @@
|
|
|
1
|
-
import {SinglyLinkedList, SinglyLinkedListNode} from '../../../../src';
|
|
2
|
-
|
|
3
|
-
describe('SinglyLinkedListNode', () => {
|
|
4
|
-
it('should SinglyLinkedList', () => {
|
|
5
|
-
const node1 = new SinglyLinkedListNode<number>(2);
|
|
6
|
-
expect(node1.value).toBe(2);
|
|
7
|
-
node1.value = 1;
|
|
8
|
-
expect(node1.value).toBe(1);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe('SinglyLinkedList Operation Test', () => {
|
|
13
|
-
let list: SinglyLinkedList<number>;
|
|
14
|
-
let objectList: SinglyLinkedList<{keyA: number}>;
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
list = new SinglyLinkedList<number>();
|
|
17
|
-
objectList = new SinglyLinkedList<{keyA: number}>();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('push', () => {
|
|
21
|
-
it('should add elements to the end of the list', () => {
|
|
22
|
-
list.push(1);
|
|
23
|
-
list.push(2);
|
|
24
|
-
expect(list.toArray()).toEqual([1, 2]);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('pop', () => {
|
|
29
|
-
it('should delete and return the last element of the list', () => {
|
|
30
|
-
list.push(1);
|
|
31
|
-
list.push(2);
|
|
32
|
-
list.push(3);
|
|
33
|
-
const popped = list.pop();
|
|
34
|
-
expect(popped).toBe(3);
|
|
35
|
-
expect(list.popLast()).toBe(2);
|
|
36
|
-
expect(list.toArray()).toEqual([1]);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should return undefined if the list is empty', () => {
|
|
40
|
-
const popped = list.pop();
|
|
41
|
-
expect(popped).toBeUndefined();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('shift', () => {
|
|
46
|
-
it('should delete and return the first element of the list', () => {
|
|
47
|
-
list.push(1);
|
|
48
|
-
list.push(2);
|
|
49
|
-
list.push(3);
|
|
50
|
-
const shifted = list.shift();
|
|
51
|
-
expect(shifted).toBe(1);
|
|
52
|
-
expect(list.popFirst()).toBe(2);
|
|
53
|
-
expect(list.toArray()).toEqual([3]);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should return undefined if the list is empty', () => {
|
|
57
|
-
const shifted = list.shift();
|
|
58
|
-
expect(shifted).toBeUndefined();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe('unshift', () => {
|
|
63
|
-
it('should add elements to the beginning of the list', () => {
|
|
64
|
-
list.unshift(1);
|
|
65
|
-
list.addFirst(2);
|
|
66
|
-
expect(list.toArray()).toEqual([2, 1]);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('get', () => {
|
|
71
|
-
it('should return the element at the specified index', () => {
|
|
72
|
-
list.push(1);
|
|
73
|
-
list.push(2);
|
|
74
|
-
list.push(3);
|
|
75
|
-
const element = list.getAt(1);
|
|
76
|
-
expect(element).toBe(2);
|
|
77
|
-
expect(list.getNodeAt(2)?.value).toBe(3);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should return undefined for an out-of-bounds index', () => {
|
|
81
|
-
list.push(1);
|
|
82
|
-
const element = list.getAt(1);
|
|
83
|
-
expect(element).toBeUndefined();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('insertAfter', () => {
|
|
88
|
-
it('should insert an element after an existing value', () => {
|
|
89
|
-
list.push(1);
|
|
90
|
-
list.push(2);
|
|
91
|
-
list.push(3);
|
|
92
|
-
list.insertAfter(2, 4);
|
|
93
|
-
expect(list.toArray()).toEqual([1, 2, 4, 3]);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('should return false if the existing value is not found', () => {
|
|
97
|
-
list.push(1);
|
|
98
|
-
list.push(2);
|
|
99
|
-
list.push(3);
|
|
100
|
-
const result = list.insertAfter(5, 4);
|
|
101
|
-
expect(result).toBe(false);
|
|
102
|
-
expect(list.toArray()).toEqual([1, 2, 3]);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
describe('countOccurrences', () => {
|
|
107
|
-
it('should count occurrences of a value in the list', () => {
|
|
108
|
-
list.push(1);
|
|
109
|
-
list.push(2);
|
|
110
|
-
list.push(2);
|
|
111
|
-
list.push(3);
|
|
112
|
-
const count = list.countOccurrences(2);
|
|
113
|
-
expect(count).toBe(2);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('should return 0 if the value is not found', () => {
|
|
117
|
-
list.push(1);
|
|
118
|
-
list.push(2);
|
|
119
|
-
const count = list.countOccurrences(3);
|
|
120
|
-
expect(count).toBe(0);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
describe('removeValue', () => {
|
|
125
|
-
it('should delete the first occurrence of a value from the list', () => {
|
|
126
|
-
list.push(1);
|
|
127
|
-
list.push(2);
|
|
128
|
-
list.push(3);
|
|
129
|
-
list.push(4);
|
|
130
|
-
list.push(5);
|
|
131
|
-
expect(list.delete(2)).toBe(true);
|
|
132
|
-
expect(list.toArray()).toEqual([1, 3, 4, 5]);
|
|
133
|
-
expect(list.delete(1)).toBe(true);
|
|
134
|
-
expect(list.toArray()).toEqual([3, 4, 5]);
|
|
135
|
-
expect(list.delete(5)).toBe(true);
|
|
136
|
-
expect(list.toArray()).toEqual([3, 4]);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should return false if the value is not found', () => {
|
|
140
|
-
list.push(1);
|
|
141
|
-
list.push(2);
|
|
142
|
-
list.push(3);
|
|
143
|
-
const removed = list.delete(4);
|
|
144
|
-
expect(removed).toBe(false);
|
|
145
|
-
expect(list.toArray()).toEqual([1, 2, 3]);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe('isEmpty', () => {
|
|
150
|
-
it('should return true for an empty list', () => {
|
|
151
|
-
expect(list.isEmpty()).toBe(true);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('should return false for a non-empty list', () => {
|
|
155
|
-
list.push(1);
|
|
156
|
-
expect(list.isEmpty()).toBe(false);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
describe('clear', () => {
|
|
161
|
-
it('should clear all elements from the list', () => {
|
|
162
|
-
list.push(1);
|
|
163
|
-
list.push(2);
|
|
164
|
-
list.push(3);
|
|
165
|
-
list.clear();
|
|
166
|
-
expect(list.toArray()).toEqual([]);
|
|
167
|
-
expect(list.length).toBe(0);
|
|
168
|
-
expect(list.isEmpty()).toBe(true);
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
describe('reverse', () => {
|
|
173
|
-
it('should reverse the order of elements in the list', () => {
|
|
174
|
-
list.push(1);
|
|
175
|
-
list.push(2);
|
|
176
|
-
list.push(3);
|
|
177
|
-
list.reverse();
|
|
178
|
-
expect(list.toArray()).toEqual([3, 2, 1]);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('should handle an empty list', () => {
|
|
182
|
-
list.reverse();
|
|
183
|
-
expect(list.toArray()).toEqual([]);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it('should handle a list with a single element', () => {
|
|
187
|
-
list.push(1);
|
|
188
|
-
list.reverse();
|
|
189
|
-
expect(list.toArray()).toEqual([1]);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
describe('indexOf', () => {
|
|
194
|
-
it('should return the index of the first occurrence of a value', () => {
|
|
195
|
-
list.push(1);
|
|
196
|
-
list.push(2);
|
|
197
|
-
list.push(3);
|
|
198
|
-
const index = list.indexOf(2);
|
|
199
|
-
expect(index).toBe(1);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('should return -1 if the value is not found', () => {
|
|
203
|
-
list.push(1);
|
|
204
|
-
list.push(2);
|
|
205
|
-
list.push(3);
|
|
206
|
-
const index = list.indexOf(4);
|
|
207
|
-
expect(index).toBe(-1);
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe('toArray', () => {
|
|
212
|
-
it('should convert the list to an array', () => {
|
|
213
|
-
list.push(1);
|
|
214
|
-
list.push(2);
|
|
215
|
-
list.push(3);
|
|
216
|
-
const array = list.toArray();
|
|
217
|
-
expect(array).toEqual([1, 2, 3]);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it('should return an empty array for an empty list', () => {
|
|
221
|
-
const array = list.toArray();
|
|
222
|
-
expect(array).toEqual([]);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe('insertBefore', () => {
|
|
227
|
-
it('should insert an element before an existing value', () => {
|
|
228
|
-
list.push(1);
|
|
229
|
-
list.push(2);
|
|
230
|
-
list.push(3);
|
|
231
|
-
list.insertBefore(2, 4);
|
|
232
|
-
expect(list.toArray()).toEqual([1, 4, 2, 3]);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('should insert an element at the beginning', () => {
|
|
236
|
-
list.push(1);
|
|
237
|
-
list.push(2);
|
|
238
|
-
list.insertBefore(1, 3);
|
|
239
|
-
expect(list.toArray()).toEqual([3, 1, 2]);
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it('should return false if the existing value is not found', () => {
|
|
243
|
-
list.push(1);
|
|
244
|
-
list.push(2);
|
|
245
|
-
list.push(3);
|
|
246
|
-
const result = list.insertBefore(5, 4);
|
|
247
|
-
expect(result).toBe(false);
|
|
248
|
-
expect(list.toArray()).toEqual([1, 2, 3]);
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
describe('getLength', () => {
|
|
253
|
-
it('should return the correct length of the list', () => {
|
|
254
|
-
expect(list.length).toBe(0);
|
|
255
|
-
list.push(1);
|
|
256
|
-
list.push(2);
|
|
257
|
-
expect(list.length).toBe(2);
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
describe('delete', () => {
|
|
262
|
-
it('should delete and return the element at the specified index', () => {
|
|
263
|
-
list.push(1);
|
|
264
|
-
list.push(2);
|
|
265
|
-
list.push(3);
|
|
266
|
-
const removed = list.deleteAt(1);
|
|
267
|
-
expect(removed).toBe(2);
|
|
268
|
-
expect(list.toArray()).toEqual([1, 3]);
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
it('should return undefined for an out-of-bounds index', () => {
|
|
272
|
-
list.push(1);
|
|
273
|
-
const removed = list.deleteAt(1);
|
|
274
|
-
expect(removed).toBeUndefined();
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
it('should delete and return the first element', () => {
|
|
278
|
-
list.push(1);
|
|
279
|
-
list.push(2);
|
|
280
|
-
const removed = list.deleteAt(0);
|
|
281
|
-
expect(removed).toBe(1);
|
|
282
|
-
expect(list.toArray()).toEqual([2]);
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it('should delete and return the last element', () => {
|
|
286
|
-
list.push(1);
|
|
287
|
-
list.push(2);
|
|
288
|
-
const removed = list.deleteAt(1);
|
|
289
|
-
expect(removed).toBe(2);
|
|
290
|
-
expect(list.toArray()).toEqual([1]);
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
describe('push and pop', () => {
|
|
295
|
-
it('should push and pop elements correctly', () => {
|
|
296
|
-
list.push(1);
|
|
297
|
-
list.push(2);
|
|
298
|
-
expect(list.pop()).toBe(2);
|
|
299
|
-
expect(list.pop()).toBe(1);
|
|
300
|
-
expect(list.pop()).toBeUndefined();
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
describe('shift and unshift', () => {
|
|
305
|
-
it('should shift and unshift elements correctly', () => {
|
|
306
|
-
list.unshift(1);
|
|
307
|
-
list.unshift(2);
|
|
308
|
-
expect(list.shift()).toBe(2);
|
|
309
|
-
expect(list.shift()).toBe(1);
|
|
310
|
-
expect(list.shift()).toBeUndefined();
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
describe('insert and toArray', () => {
|
|
315
|
-
it('should insert elements and return array correctly', () => {
|
|
316
|
-
list.insertAt(0, 1);
|
|
317
|
-
list.insertAt(1, 3);
|
|
318
|
-
list.insertAt(1, 2);
|
|
319
|
-
expect(list.toArray()).toEqual([1, 2, 3]);
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
describe('find', () => {
|
|
324
|
-
it('should find elements using a callback function', () => {
|
|
325
|
-
list.push(1);
|
|
326
|
-
list.push(2);
|
|
327
|
-
list.push(3);
|
|
328
|
-
const result = list.find(data => data % 2 === 0);
|
|
329
|
-
expect(result).toBe(2);
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it('should return undefined if element is not found', () => {
|
|
333
|
-
list.push(1);
|
|
334
|
-
list.push(3);
|
|
335
|
-
const result = list.find(data => data % 2 === 0);
|
|
336
|
-
expect(result).toBeNull();
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
describe('reverse', () => {
|
|
341
|
-
it('should reverse the order of elements', () => {
|
|
342
|
-
list.push(1);
|
|
343
|
-
list.push(2);
|
|
344
|
-
list.push(3);
|
|
345
|
-
list.reverse();
|
|
346
|
-
expect(list.toArray()).toEqual([3, 2, 1]);
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
describe('countOccurrences', () => {
|
|
351
|
-
it('should count occurrences of a value', () => {
|
|
352
|
-
list.push(1);
|
|
353
|
-
list.push(2);
|
|
354
|
-
list.push(2);
|
|
355
|
-
list.push(3);
|
|
356
|
-
const count = list.countOccurrences(2);
|
|
357
|
-
expect(count).toBe(2);
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
it('should return 0 if value is not found', () => {
|
|
361
|
-
list.push(1);
|
|
362
|
-
list.push(2);
|
|
363
|
-
const count = list.countOccurrences(3);
|
|
364
|
-
expect(count).toBe(0);
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('should insert and manipulate objects with numeric properties', () => {
|
|
369
|
-
const obj1 = {keyA: 1};
|
|
370
|
-
const obj2 = {keyA: 2};
|
|
371
|
-
const obj3 = {keyA: 3};
|
|
372
|
-
|
|
373
|
-
objectList.push(obj1);
|
|
374
|
-
objectList.push(obj2);
|
|
375
|
-
objectList.push(obj3);
|
|
376
|
-
|
|
377
|
-
expect(objectList.toArray()).toEqual([obj1, obj2, obj3]);
|
|
378
|
-
|
|
379
|
-
const newObj = {keyA: 2.5}; // Corrected newObj value
|
|
380
|
-
const insertSuccess = objectList.insertBefore(obj2, newObj);
|
|
381
|
-
expect(insertSuccess).toBe(true);
|
|
382
|
-
|
|
383
|
-
const getNode = objectList.getNode(newObj); // Use newObj instead of obj2
|
|
384
|
-
expect(getNode?.value).toEqual(newObj);
|
|
385
|
-
|
|
386
|
-
const deleted = objectList.delete(newObj); // Use newObj instead of obj2
|
|
387
|
-
expect(deleted).toBe(true);
|
|
388
|
-
|
|
389
|
-
const poppedObj = objectList.pop();
|
|
390
|
-
expect(poppedObj).toBe(obj3);
|
|
391
|
-
|
|
392
|
-
const shiftedObj = objectList.shift();
|
|
393
|
-
expect(shiftedObj).toBe(obj1);
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
describe('SinglyLinkedList', () => {
|
|
398
|
-
let list: SinglyLinkedList<number>;
|
|
399
|
-
|
|
400
|
-
beforeEach(() => {
|
|
401
|
-
list = new SinglyLinkedList<number>();
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
it('should initialize an empty list', () => {
|
|
405
|
-
expect(list.head).toBeNull();
|
|
406
|
-
expect(list.tail).toBeNull();
|
|
407
|
-
expect(list.length).toBe(0);
|
|
408
|
-
});
|
|
409
|
-
|
|
410
|
-
it('should push elements to the end of the list', () => {
|
|
411
|
-
list.push(1);
|
|
412
|
-
list.push(2);
|
|
413
|
-
expect(list.head!.value).toBe(1);
|
|
414
|
-
expect(list.tail!.value).toBe(2);
|
|
415
|
-
expect(list.length).toBe(2);
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
it('should pop elements from the end of the list', () => {
|
|
419
|
-
list.push(1);
|
|
420
|
-
list.push(2);
|
|
421
|
-
const popped = list.pop();
|
|
422
|
-
expect(popped).toBe(2);
|
|
423
|
-
expect(list.head!.value).toBe(1);
|
|
424
|
-
expect(list.tail!.value).toBe(1);
|
|
425
|
-
expect(list.length).toBe(1);
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
it('should reverse the list', () => {
|
|
429
|
-
list.push(1);
|
|
430
|
-
list.push(2);
|
|
431
|
-
list.push(3);
|
|
432
|
-
list.reverse();
|
|
433
|
-
expect(list.head!.value).toBe(3);
|
|
434
|
-
expect(list.tail!.value).toBe(1);
|
|
435
|
-
// Add more assertions for reversed order.
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
it('should convert the list to an array', () => {
|
|
439
|
-
list.push(1);
|
|
440
|
-
list.push(2);
|
|
441
|
-
list.push(3);
|
|
442
|
-
const array = list.toArray();
|
|
443
|
-
expect(array).toEqual([1, 2, 3]);
|
|
444
|
-
// @ts-ignore
|
|
445
|
-
expect([...list]).toEqual([1, 2, 3]);
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
it('should filter the list', () => {
|
|
449
|
-
list.push(1);
|
|
450
|
-
list.push(2);
|
|
451
|
-
list.push(3);
|
|
452
|
-
expect(list.filter(value => value !== 2).toArray()).toEqual([1, 3]);
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
it('should forEach the list', () => {
|
|
456
|
-
list.push(1);
|
|
457
|
-
list.push(2);
|
|
458
|
-
list.push(3);
|
|
459
|
-
list.forEach(value => value++);
|
|
460
|
-
expect(list.toArray()).toEqual([1, 2, 3]);
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
it('should map the list', () => {
|
|
464
|
-
list.addLast(1);
|
|
465
|
-
list.push(2);
|
|
466
|
-
list.push(3);
|
|
467
|
-
expect(list.map(value => value * 2).toArray()).toEqual([2, 4, 6]);
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
it('should reduce the list', () => {
|
|
471
|
-
const list1 = SinglyLinkedList.fromArray([1, 2, 3]);
|
|
472
|
-
expect(list1.reduce((acc, value) => acc + value, 0)).toEqual(6);
|
|
473
|
-
});
|
|
474
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// import {SkipLinkedList} from '../../../../src'
|
|
2
|
-
|
|
3
|
-
describe('SkipLinkedList Operation Test', () => {
|
|
4
|
-
it('should xxx', function () {
|
|
5
|
-
expect(true).toBeTruthy();
|
|
6
|
-
});
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
describe('SkipLinkedList Performance Test', () => {
|
|
10
|
-
it('should xxx', function () {
|
|
11
|
-
expect(true).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {SkipList} from '../../../../src';
|
|
2
|
-
|
|
3
|
-
describe('SkipList', () => {
|
|
4
|
-
let skipList: SkipList<number, string>;
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
skipList = new SkipList<number, string>();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should insert and retrieve elements correctly', () => {
|
|
11
|
-
skipList.add(1, 'One');
|
|
12
|
-
skipList.add(2, 'Two');
|
|
13
|
-
skipList.add(3, 'Three');
|
|
14
|
-
|
|
15
|
-
expect(skipList.get(1)).toBe('One');
|
|
16
|
-
expect(skipList.get(2)).toBe('Two');
|
|
17
|
-
expect(skipList.get(3)).toBe('Three');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should return undefined for non-existent keys', () => {
|
|
21
|
-
skipList.add(1, 'One');
|
|
22
|
-
skipList.add(2, 'Two');
|
|
23
|
-
|
|
24
|
-
expect(skipList.get(3)).toBeUndefined();
|
|
25
|
-
expect(skipList.get(0)).toBeUndefined();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should delete elements correctly', () => {
|
|
29
|
-
skipList.add(1, 'One');
|
|
30
|
-
skipList.add(2, 'Two');
|
|
31
|
-
skipList.add(3, 'Three');
|
|
32
|
-
|
|
33
|
-
skipList.delete(2);
|
|
34
|
-
|
|
35
|
-
expect(skipList.get(2)).toBeUndefined(); // 修改这里的断言
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should handle random data correctly', () => {
|
|
39
|
-
const randomData: Array<[number, string]> = [
|
|
40
|
-
[5, 'Five'],
|
|
41
|
-
[1, 'One'],
|
|
42
|
-
[3, 'Three'],
|
|
43
|
-
[2, 'Two'],
|
|
44
|
-
[4, 'Four']
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
for (const [key, value] of randomData) {
|
|
48
|
-
skipList.add(key, value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
expect(skipList.get(3)).toBe('Three');
|
|
52
|
-
expect(skipList.get(5)).toBe('Five');
|
|
53
|
-
expect(skipList.get(4)).toBe('Four');
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe('SkipList', () => {
|
|
58
|
-
let skipList: SkipList<number, string>;
|
|
59
|
-
|
|
60
|
-
beforeEach(() => {
|
|
61
|
-
skipList = new SkipList();
|
|
62
|
-
skipList.add(1, 'One');
|
|
63
|
-
skipList.add(2, 'Two');
|
|
64
|
-
skipList.add(3, 'Three');
|
|
65
|
-
skipList.add(4, 'Four');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('getFirst() should return the getFirst element', () => {
|
|
69
|
-
expect(skipList.getFirst()).toBe('One');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('getLast() should return the getLast element', () => {
|
|
73
|
-
expect(skipList.getLast()).toBe('Four');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('higher(key) should return the getFirst element greater than the given key', () => {
|
|
77
|
-
expect(skipList.higher(2)).toBe('Three');
|
|
78
|
-
expect(skipList.higher(3)).toBe('Four');
|
|
79
|
-
expect(skipList.higher(4)).toBeUndefined();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('lower(key) should return the getLast element less than the given key', () => {
|
|
83
|
-
expect(skipList.lower(2)).toBe('One');
|
|
84
|
-
expect(skipList.lower(1)).toBe(null);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {MatrixNTI2D} from '../../../../src';
|
|
2
|
-
|
|
3
|
-
describe('MatrixNTI2D', () => {
|
|
4
|
-
it('should initialize a matrix with rows and columns', () => {
|
|
5
|
-
const numRows = 3;
|
|
6
|
-
const numCols = 4;
|
|
7
|
-
const matrix = new MatrixNTI2D({row: numRows, col: numCols});
|
|
8
|
-
|
|
9
|
-
expect(matrix.toArray().length).toBe(numRows);
|
|
10
|
-
expect(matrix.toArray()[0].length).toBe(numCols);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should initialize all elements with the provided initial value', () => {
|
|
14
|
-
const numRows = 3;
|
|
15
|
-
const numCols = 4;
|
|
16
|
-
const initialValue = 42;
|
|
17
|
-
const matrix = new MatrixNTI2D({row: numRows, col: numCols, initialVal: initialValue});
|
|
18
|
-
|
|
19
|
-
const matrixArray = matrix.toArray();
|
|
20
|
-
for (let i = 0; i < numRows; i++) {
|
|
21
|
-
for (let j = 0; j < numCols; j++) {
|
|
22
|
-
expect(matrixArray[i][j]).toBe(initialValue);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should initialize all elements with 0 if no initial value is provided', () => {
|
|
28
|
-
const numRows = 3;
|
|
29
|
-
const numCols = 4;
|
|
30
|
-
const matrix = new MatrixNTI2D({row: numRows, col: numCols});
|
|
31
|
-
|
|
32
|
-
const matrixArray = matrix.toArray();
|
|
33
|
-
for (let i = 0; i < numRows; i++) {
|
|
34
|
-
for (let j = 0; j < numCols; j++) {
|
|
35
|
-
expect(matrixArray[i][j]).toBe(0);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should convert the matrix to a two-dimensional array', () => {
|
|
41
|
-
const numRows = 2;
|
|
42
|
-
const numCols = 3;
|
|
43
|
-
const matrix = new MatrixNTI2D({row: numRows, col: numCols, initialVal: 1});
|
|
44
|
-
|
|
45
|
-
const matrixArray = matrix.toArray();
|
|
46
|
-
expect(matrixArray.length).toBe(numRows);
|
|
47
|
-
for (let i = 0; i < numRows; i++) {
|
|
48
|
-
expect(matrixArray[i].length).toBe(numCols);
|
|
49
|
-
for (let j = 0; j < numCols; j++) {
|
|
50
|
-
expect(matrixArray[i][j]).toBe(1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|