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,486 +0,0 @@
|
|
|
1
|
-
import {AVLTree, AVLTreeNode, BinaryTree, BinaryTreeNode, IterationType} from '../../../../src';
|
|
2
|
-
import {isDebugTest} from '../../../config';
|
|
3
|
-
|
|
4
|
-
const isDebug = isDebugTest;
|
|
5
|
-
// const isDebug = true;
|
|
6
|
-
|
|
7
|
-
describe('BinaryTreeNode', () => {
|
|
8
|
-
it('should create an instance of BinaryTreeNode', () => {
|
|
9
|
-
const node = new BinaryTreeNode<number>(1);
|
|
10
|
-
expect(node).toBeInstanceOf(BinaryTreeNode);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should set and get the ID correctly', () => {
|
|
14
|
-
const node = new BinaryTreeNode<number>(1);
|
|
15
|
-
expect(node.key).toBe(1);
|
|
16
|
-
|
|
17
|
-
node.key = 2;
|
|
18
|
-
expect(node.key).toBe(2);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should set and get the value correctly', () => {
|
|
22
|
-
const node: BinaryTreeNode<number> = new BinaryTreeNode<number>(1, 42);
|
|
23
|
-
expect(node.value).toBe(42);
|
|
24
|
-
|
|
25
|
-
node.value = 55;
|
|
26
|
-
expect(node.value).toBe(55);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should set and get the left child correctly', () => {
|
|
30
|
-
const node1 = new BinaryTreeNode<number>(1);
|
|
31
|
-
const node2 = new BinaryTreeNode<number>(2);
|
|
32
|
-
|
|
33
|
-
node1.left = node2;
|
|
34
|
-
|
|
35
|
-
expect(node1.left).toBe(node2);
|
|
36
|
-
expect(node2.parent).toBe(node1);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should set and get the right child correctly', () => {
|
|
40
|
-
const node1 = new BinaryTreeNode<number>(1);
|
|
41
|
-
const node2 = new BinaryTreeNode<number>(2);
|
|
42
|
-
|
|
43
|
-
node1.right = node2;
|
|
44
|
-
|
|
45
|
-
expect(node1.right).toBe(node2);
|
|
46
|
-
expect(node2.parent).toBe(node1);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should set and get the parent correctly', () => {
|
|
50
|
-
const node1 = new BinaryTreeNode<number>(1);
|
|
51
|
-
const node2 = new BinaryTreeNode<number>(2);
|
|
52
|
-
|
|
53
|
-
node1.left = node2;
|
|
54
|
-
|
|
55
|
-
expect(node2.parent).toBe(node1);
|
|
56
|
-
expect(node1.left).toBe(node2);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should determine family position correctly', () => {
|
|
60
|
-
const root = new BinaryTreeNode<number>(1);
|
|
61
|
-
const leftChild = new BinaryTreeNode<number>(2);
|
|
62
|
-
const rightChild = new BinaryTreeNode<number>(3);
|
|
63
|
-
|
|
64
|
-
root.left = leftChild;
|
|
65
|
-
root.right = rightChild;
|
|
66
|
-
|
|
67
|
-
expect(leftChild.familyPosition).toBe('LEFT');
|
|
68
|
-
expect(rightChild.familyPosition).toBe('RIGHT');
|
|
69
|
-
expect(root.familyPosition).toBe('ROOT');
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('BinaryTree', () => {
|
|
74
|
-
let tree: BinaryTree<number>;
|
|
75
|
-
|
|
76
|
-
beforeEach(() => {
|
|
77
|
-
tree = new BinaryTree<number>();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
afterEach(() => {
|
|
81
|
-
tree.clear();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should add a node', () => {
|
|
85
|
-
const node = tree.add(1);
|
|
86
|
-
expect(node).not.toBeNull();
|
|
87
|
-
expect(tree.size).toBe(1);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('should delete a node', () => {
|
|
91
|
-
const node = tree.add(1);
|
|
92
|
-
expect(tree.size).toBe(1);
|
|
93
|
-
|
|
94
|
-
if (node) {
|
|
95
|
-
const result = tree.delete(node, node => node);
|
|
96
|
-
expect(result).toHaveLength(1);
|
|
97
|
-
expect(tree.size).toBe(0);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should add and find nodes', () => {
|
|
102
|
-
tree.add(1, 1);
|
|
103
|
-
tree.add(2, 2);
|
|
104
|
-
tree.add(3, 3);
|
|
105
|
-
|
|
106
|
-
expect(tree.has(1)).toBe(true);
|
|
107
|
-
expect(tree.has(2)).toBe(true);
|
|
108
|
-
expect(tree.has(3)).toBe(true);
|
|
109
|
-
expect(tree.has(4)).toBe(false);
|
|
110
|
-
const node4 = tree.getNode(4);
|
|
111
|
-
expect(tree.has(node4)).toBe(false);
|
|
112
|
-
expect(tree.has(node4, node => node)).toBe(false);
|
|
113
|
-
expect(tree.has('3', node => node.value?.toString())).toBe(true);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('should getDepth return correct depth', () => {
|
|
117
|
-
tree.add(1);
|
|
118
|
-
expect(tree.getDepth(1)).toBe(0);
|
|
119
|
-
tree.add(2);
|
|
120
|
-
expect(tree.getDepth(2)).toBe(1);
|
|
121
|
-
tree.add(3);
|
|
122
|
-
expect(tree.getDepth(3, 1)).toBe(1);
|
|
123
|
-
tree.add(4);
|
|
124
|
-
expect(tree.getDepth(4, 1)).toBe(2);
|
|
125
|
-
expect(tree.getDepth(4)).toBe(2);
|
|
126
|
-
expect(tree.getDepth(4, 2)).toBe(1);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should traverse in-order', () => {
|
|
130
|
-
tree.add(null);
|
|
131
|
-
tree.delete(1);
|
|
132
|
-
expect(tree.getHeight()).toBe(-1);
|
|
133
|
-
tree.add(4);
|
|
134
|
-
tree.add(2);
|
|
135
|
-
expect(tree.getHeight()).toBe(1);
|
|
136
|
-
tree.iterationType = IterationType.RECURSIVE;
|
|
137
|
-
expect(tree.getHeight()).toBe(1);
|
|
138
|
-
tree.iterationType = IterationType.ITERATIVE;
|
|
139
|
-
|
|
140
|
-
tree.add(6);
|
|
141
|
-
tree.add(1);
|
|
142
|
-
tree.add(new BinaryTreeNode(3));
|
|
143
|
-
tree.add(5);
|
|
144
|
-
tree.add(7);
|
|
145
|
-
|
|
146
|
-
const inOrder = tree.dfs(node => node.key);
|
|
147
|
-
|
|
148
|
-
expect(inOrder).toEqual([1, 2, 3, 4, 5, 6, 7]);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('should getLeftMost', () => {
|
|
152
|
-
tree.addMany([4, 2, 6, 1, 3, 5, 7]);
|
|
153
|
-
|
|
154
|
-
const leftMost = tree.getLeftMost(tree.root, IterationType.RECURSIVE);
|
|
155
|
-
expect(leftMost?.key).toEqual(1);
|
|
156
|
-
const rightMost = tree.getRightMost(tree.root, IterationType.RECURSIVE);
|
|
157
|
-
expect(rightMost?.key).toEqual(7);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('should isSubtreeBST', () => {
|
|
161
|
-
tree.addMany([
|
|
162
|
-
new BinaryTreeNode(4, 4),
|
|
163
|
-
new BinaryTreeNode(2, 2),
|
|
164
|
-
new BinaryTreeNode(6, 6),
|
|
165
|
-
new BinaryTreeNode(1, 1),
|
|
166
|
-
new BinaryTreeNode(3, 3),
|
|
167
|
-
new BinaryTreeNode(5, 5),
|
|
168
|
-
new BinaryTreeNode(7, 7),
|
|
169
|
-
new BinaryTreeNode(4, 4)
|
|
170
|
-
]);
|
|
171
|
-
|
|
172
|
-
expect(tree.isSubtreeBST(tree.getNode(4), IterationType.RECURSIVE)).toBe(true);
|
|
173
|
-
expect(tree.isSubtreeBST(tree.getNode(4), IterationType.ITERATIVE)).toBe(true);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('should subTreeTraverse', () => {
|
|
177
|
-
tree.addMany([4, 2, 6, 1, 3, 5, 7]);
|
|
178
|
-
expect(tree.subTreeTraverse(node => node.key, tree.getNode(6), IterationType.RECURSIVE)).toEqual([6, 5, 7]);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('should clear the tree', () => {
|
|
182
|
-
tree.add(1);
|
|
183
|
-
tree.add(2);
|
|
184
|
-
|
|
185
|
-
expect(tree.size).toBe(2);
|
|
186
|
-
|
|
187
|
-
tree.clear();
|
|
188
|
-
|
|
189
|
-
expect(tree.size).toBe(0);
|
|
190
|
-
expect(tree.root).toBeNull();
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
describe('BinaryTree Morris Traversal', () => {
|
|
195
|
-
// Create a binary tree
|
|
196
|
-
const tree = new BinaryTree<BinaryTreeNode<number>>();
|
|
197
|
-
tree.add(1);
|
|
198
|
-
tree.add(2);
|
|
199
|
-
tree.add(3);
|
|
200
|
-
tree.add(4);
|
|
201
|
-
tree.add(5);
|
|
202
|
-
it('should perform in-order Morris traversal correctly as dfs traversal', () => {
|
|
203
|
-
// Perform in-order Morris traversal
|
|
204
|
-
const result = tree.morris(node => node.key, 'in');
|
|
205
|
-
|
|
206
|
-
// Expected in-order traversal result
|
|
207
|
-
const expected = [4, 2, 5, 1, 3];
|
|
208
|
-
|
|
209
|
-
expect(result).toEqual(expected);
|
|
210
|
-
expect(tree.dfs(node => node.key, 'in')).toEqual(expected);
|
|
211
|
-
expect(tree.dfs(node => node.key, 'in', tree.root, IterationType.RECURSIVE)).toEqual(expected);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it('should perform pre-order Morris traversal correctly as dfs traversal', () => {
|
|
215
|
-
// Perform pre-order Morris traversal
|
|
216
|
-
const result = tree.morris(node => node.key, 'pre');
|
|
217
|
-
|
|
218
|
-
// Expected pre-order traversal result
|
|
219
|
-
const expected = [1, 2, 4, 5, 3];
|
|
220
|
-
|
|
221
|
-
expect(result).toEqual(expected);
|
|
222
|
-
expect(tree.dfs(node => node.key, 'pre')).toEqual(expected);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it('should perform post-order Morris traversal correctly as dfs traversal', () => {
|
|
226
|
-
// Perform post-order Morris traversal
|
|
227
|
-
const result = tree.morris(node => node.key, 'post');
|
|
228
|
-
|
|
229
|
-
// Expected post-order traversal result
|
|
230
|
-
const expected = [4, 5, 2, 3, 1];
|
|
231
|
-
|
|
232
|
-
expect(result).toEqual([4, 5, 2, 3, 1]);
|
|
233
|
-
expect(tree.dfs(node => node.key, 'post')).toEqual(expected);
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it('after morris traversals should the structure of the tree be correct', () => {
|
|
237
|
-
const node1 = tree.getNode(1);
|
|
238
|
-
const node2 = tree.getNode(2);
|
|
239
|
-
const node3 = tree.getNode(3);
|
|
240
|
-
expect(node1?.left).toBe(node2);
|
|
241
|
-
expect(node1?.right).toBe(node3);
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
describe('BinaryTree APIs test', () => {
|
|
246
|
-
const avl = new AVLTree<{id: number; text: string}>();
|
|
247
|
-
beforeEach(() => {
|
|
248
|
-
avl.clear();
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('add', () => {
|
|
252
|
-
avl.add(1);
|
|
253
|
-
const node2 = new AVLTreeNode(2);
|
|
254
|
-
avl.add(node2);
|
|
255
|
-
const node3 = new AVLTreeNode(3, {id: 3, text: 'text3'});
|
|
256
|
-
avl.add(node3);
|
|
257
|
-
avl.add(node3, {id: 3, text: 'text33'});
|
|
258
|
-
|
|
259
|
-
const bfsRes = avl.bfs(node => node);
|
|
260
|
-
expect(bfsRes[0]?.key).toBe(2);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
describe('BinaryTree traversals', () => {
|
|
265
|
-
const tree = new BinaryTree<number>();
|
|
266
|
-
|
|
267
|
-
const arr = [35, 20, 40, 15, 29, null, 50, null, 16, 28, 30, 45, 55];
|
|
268
|
-
tree.refill(arr);
|
|
269
|
-
expect(tree.dfs(node => node.key, 'pre')).toEqual([35, 20, 15, 16, 29, 28, 30, 40, 50, 45, 55]);
|
|
270
|
-
expect(tree.dfs(node => node.key, 'pre', tree.root, IterationType.RECURSIVE)).toEqual([
|
|
271
|
-
35, 20, 15, 16, 29, 28, 30, 40, 50, 45, 55
|
|
272
|
-
]);
|
|
273
|
-
expect(tree.dfs(node => node.key, 'in')).toEqual([15, 16, 20, 28, 29, 30, 35, 40, 45, 50, 55]);
|
|
274
|
-
expect(tree.dfs(node => node.key, 'post')).toEqual([16, 15, 28, 30, 29, 20, 45, 55, 50, 40, 35]);
|
|
275
|
-
expect(tree.dfs(node => node.key, 'post', tree.root, IterationType.RECURSIVE)).toEqual([
|
|
276
|
-
16, 15, 28, 30, 29, 20, 45, 55, 50, 40, 35
|
|
277
|
-
]);
|
|
278
|
-
expect(tree.bfs(node => node.key, tree.root, IterationType.RECURSIVE)).toEqual([
|
|
279
|
-
35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55
|
|
280
|
-
]);
|
|
281
|
-
expect(tree.bfs(node => node.key, tree.root, IterationType.ITERATIVE)).toEqual([
|
|
282
|
-
35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55
|
|
283
|
-
]);
|
|
284
|
-
|
|
285
|
-
const levels = tree.listLevels(node => node.key);
|
|
286
|
-
expect(levels).toEqual([[35], [20, 40], [15, 29, 50], [16, 28, 30, 45, 55]]);
|
|
287
|
-
isDebug && console.log(levels);
|
|
288
|
-
|
|
289
|
-
expect(tree.listLevels(node => node.key, tree.root, IterationType.RECURSIVE)).toEqual([
|
|
290
|
-
[35],
|
|
291
|
-
[20, 40],
|
|
292
|
-
[15, 29, 50],
|
|
293
|
-
[16, 28, 30, 45, 55]
|
|
294
|
-
]);
|
|
295
|
-
isDebug && console.log(levels);
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
describe('BinaryTree', () => {
|
|
299
|
-
let tree: BinaryTree<string>;
|
|
300
|
-
|
|
301
|
-
beforeEach(() => {
|
|
302
|
-
tree = new BinaryTree<string>({iterationType: IterationType.RECURSIVE});
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
afterEach(() => {
|
|
306
|
-
tree.clear();
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
it('should create an empty BinaryTree', () => {
|
|
310
|
-
expect(tree.size).toBe(0);
|
|
311
|
-
expect(tree.isEmpty()).toBe(true);
|
|
312
|
-
expect(tree.root).toBe(null);
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
it('should add nodes to the tree', () => {
|
|
316
|
-
tree.add(5, 'A');
|
|
317
|
-
tree.add(3, 'B');
|
|
318
|
-
tree.add(7, 'C');
|
|
319
|
-
|
|
320
|
-
expect(tree.size).toBe(3);
|
|
321
|
-
expect(tree.isEmpty()).toBe(false);
|
|
322
|
-
expect(tree.root?.key).toBe(5);
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
it('should clear the BinaryTree', () => {
|
|
326
|
-
tree.add(5, 'A');
|
|
327
|
-
tree.add(3, 'B');
|
|
328
|
-
tree.add(7, 'C');
|
|
329
|
-
|
|
330
|
-
tree.clear();
|
|
331
|
-
|
|
332
|
-
expect(tree.size).toBe(0);
|
|
333
|
-
expect(tree.isEmpty()).toBe(true);
|
|
334
|
-
expect(tree.root).toBe(null);
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
it('should get nodes by key', () => {
|
|
338
|
-
tree.add(5, 'A');
|
|
339
|
-
tree.add(3, 'B');
|
|
340
|
-
tree.add(7, 'C');
|
|
341
|
-
|
|
342
|
-
const nodeA = tree.getNode(5);
|
|
343
|
-
const nodeB = tree.getNode(3);
|
|
344
|
-
|
|
345
|
-
expect(nodeA?.key).toBe(5);
|
|
346
|
-
expect(nodeA?.value).toBe('A');
|
|
347
|
-
expect(nodeB?.key).toBe(3);
|
|
348
|
-
expect(nodeB?.value).toBe('B');
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it('should return null when getting a non-existent node', () => {
|
|
352
|
-
tree.add(5, 'A');
|
|
353
|
-
|
|
354
|
-
const node = tree.getNode(3);
|
|
355
|
-
|
|
356
|
-
expect(node).toBe(null);
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it('should get the depth of a node', () => {
|
|
360
|
-
tree.add(5, 'A');
|
|
361
|
-
tree.add(3, 'B');
|
|
362
|
-
tree.add(7, 'C');
|
|
363
|
-
|
|
364
|
-
expect(tree.getDepth(7)).toBe(1);
|
|
365
|
-
expect(tree.getDepth(3)).toBe(1);
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('should get the height of the tree', () => {
|
|
369
|
-
tree.add(5, 'A');
|
|
370
|
-
tree.add(3, 'B');
|
|
371
|
-
tree.add(7, 'C');
|
|
372
|
-
|
|
373
|
-
expect(tree.getHeight()).toBe(1);
|
|
374
|
-
expect(tree.getHeight(undefined, IterationType.RECURSIVE)).toBe(1);
|
|
375
|
-
expect(tree.getMinHeight(undefined, IterationType.RECURSIVE)).toBe(1);
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
it('should check if the tree is a binary search tree', () => {
|
|
379
|
-
tree.add(5, 'A');
|
|
380
|
-
tree.add(3, 'B');
|
|
381
|
-
tree.add(7, 'C');
|
|
382
|
-
|
|
383
|
-
expect(tree.isBST()).toBe(true);
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
it('should perform a depth-first traversal', () => {
|
|
387
|
-
tree.add(5, 'A');
|
|
388
|
-
tree.add(3, 'B');
|
|
389
|
-
tree.add(7, 'C');
|
|
390
|
-
|
|
391
|
-
const result = tree.dfs();
|
|
392
|
-
expect(result).toEqual([3, 5, 7]);
|
|
393
|
-
// Add assertions for the result of depth-first traversal
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
it('should perform a breadth-first traversal', () => {
|
|
397
|
-
tree.add(5, 'A');
|
|
398
|
-
tree.add(3, 'B');
|
|
399
|
-
tree.add(7, 'C');
|
|
400
|
-
|
|
401
|
-
const result = tree.bfs(node => node.key);
|
|
402
|
-
expect(result).toEqual([5, 3, 7]);
|
|
403
|
-
// Add assertions for the result of breadth-first traversal
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
it('should list levels of the tree', () => {
|
|
407
|
-
tree.add(5, 'A');
|
|
408
|
-
tree.add(3, 'B');
|
|
409
|
-
tree.add(7, 'C');
|
|
410
|
-
|
|
411
|
-
const levels = tree.listLevels();
|
|
412
|
-
expect(levels).toEqual([[5], [3, 7]]);
|
|
413
|
-
// Add assertions for the levels of the tree
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
it('should delete nodes from the tree', () => {
|
|
417
|
-
tree.add(5, 'A');
|
|
418
|
-
tree.add(3, 'B');
|
|
419
|
-
tree.add(7, 'C');
|
|
420
|
-
|
|
421
|
-
tree.delete(3);
|
|
422
|
-
|
|
423
|
-
expect(tree.size).toBe(2);
|
|
424
|
-
expect(tree.getNode(3)).toBe(null);
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
it('should check if the tree is perfectly balanced', () => {
|
|
428
|
-
tree.add(5, 'A');
|
|
429
|
-
tree.add(3, 'B');
|
|
430
|
-
tree.add(7, 'C');
|
|
431
|
-
|
|
432
|
-
expect(tree.isPerfectlyBalanced()).toBe(true);
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
it('should get nodes by a custom callback', () => {
|
|
436
|
-
tree.add(5, 'A');
|
|
437
|
-
tree.add(3, 'B');
|
|
438
|
-
tree.add(7, 'C');
|
|
439
|
-
|
|
440
|
-
const nodes = tree.getNodes('B', (node: BinaryTreeNode<string>) => node.value);
|
|
441
|
-
|
|
442
|
-
expect(nodes.length).toBe(1);
|
|
443
|
-
expect(nodes[0].key).toBe(3);
|
|
444
|
-
|
|
445
|
-
const nodesRec = tree.getNodes(
|
|
446
|
-
'B',
|
|
447
|
-
(node: BinaryTreeNode<string>) => node.value,
|
|
448
|
-
false,
|
|
449
|
-
tree.root,
|
|
450
|
-
IterationType.RECURSIVE
|
|
451
|
-
);
|
|
452
|
-
|
|
453
|
-
expect(nodesRec.length).toBe(1);
|
|
454
|
-
expect(nodesRec[0].key).toBe(3);
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
it('should perform Morris traversal', () => {
|
|
458
|
-
tree.add(5, 'A');
|
|
459
|
-
tree.add(3, 'B');
|
|
460
|
-
tree.add(7, 'C');
|
|
461
|
-
|
|
462
|
-
tree.iterationType = IterationType.ITERATIVE;
|
|
463
|
-
// @ts-ignore
|
|
464
|
-
expect([...tree]).toEqual([3, 5, 7]);
|
|
465
|
-
tree.iterationType = IterationType.RECURSIVE;
|
|
466
|
-
// @ts-ignore
|
|
467
|
-
expect([...tree]).toEqual([3, 5, 7]);
|
|
468
|
-
tree.iterationType = IterationType.ITERATIVE;
|
|
469
|
-
|
|
470
|
-
const result = tree.morris();
|
|
471
|
-
expect(result).toEqual([3, 5, 7]);
|
|
472
|
-
// Add assertions for the result of Morris traversal
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
it('should perform delete all', () => {
|
|
476
|
-
tree.add(5, 'A');
|
|
477
|
-
tree.add(3, 'B');
|
|
478
|
-
tree.add(7, 'C');
|
|
479
|
-
|
|
480
|
-
tree.delete(5);
|
|
481
|
-
tree.delete(7);
|
|
482
|
-
tree.delete(3);
|
|
483
|
-
expect(tree.root).toBe(null);
|
|
484
|
-
expect(tree.getHeight()).toBe(-1);
|
|
485
|
-
});
|
|
486
|
-
});
|