data-structure-typed 1.38.1 → 1.38.3
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 +1 -1
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/{data-structures → cjs/data-structures}/binary-tree/binary-tree.d.ts +9 -9
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/{lib → dist/cjs}/data-structures/binary-tree/bst.d.ts +4 -4
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/data-structures/index.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/data-structures/matrix/matrix.js.map +1 -0
- package/{lib → dist/cjs}/data-structures/matrix/matrix2d.js +13 -5
- package/dist/cjs/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces/binary-tree.js.map +1 -0
- package/dist/cjs/interfaces/doubly-linked-list.js.map +1 -0
- package/dist/{interfaces → cjs/interfaces}/graph.js.map +1 -1
- package/dist/{interfaces → cjs/interfaces}/heap.js.map +1 -1
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/{interfaces → cjs/interfaces}/navigator.js.map +1 -1
- package/dist/cjs/interfaces/priority-queue.js.map +1 -0
- package/dist/cjs/interfaces/segment-tree.js.map +1 -0
- package/dist/cjs/interfaces/singly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/{lib → dist/cjs}/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/types/data-structures/index.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/types/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/types/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/types/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/types/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/types/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/types/data-structures/trie/trie.js.map +1 -0
- package/{lib → dist/cjs}/types/helpers.d.ts +1 -1
- package/dist/cjs/types/helpers.js.map +1 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/utils/index.js.map +1 -0
- package/dist/{types → cjs/types}/utils/utils.js.map +1 -1
- package/dist/cjs/types/utils/validate-type.js.map +1 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/utils.js.map +1 -0
- package/{lib → dist/mjs}/data-structures/binary-tree/avl-tree.js +10 -4
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-indexed-tree.js +12 -3
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-tree.d.ts +9 -9
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-tree.js +66 -49
- package/dist/{data-structures → mjs/data-structures}/binary-tree/bst.d.ts +4 -4
- package/{lib → dist/mjs}/data-structures/binary-tree/bst.js +42 -40
- package/dist/mjs/data-structures/binary-tree/index.js +23 -0
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +28 -0
- package/{lib → dist/mjs}/data-structures/binary-tree/segment-tree.js +17 -10
- package/{lib → dist/mjs}/data-structures/binary-tree/tree-multiset.js +19 -13
- package/{lib → dist/mjs}/data-structures/graph/abstract-graph.js +29 -24
- package/{lib → dist/mjs}/data-structures/graph/directed-graph.js +22 -14
- package/dist/mjs/data-structures/graph/index.js +20 -0
- package/{lib → dist/mjs}/data-structures/graph/map-graph.js +14 -5
- package/{lib → dist/mjs}/data-structures/graph/undirected-graph.js +19 -13
- package/{lib → dist/mjs}/data-structures/hash/coordinate-map.js +6 -2
- package/{lib → dist/mjs}/data-structures/hash/coordinate-set.js +6 -2
- package/{lib → dist/mjs}/data-structures/hash/hash-map.js +11 -1
- package/{lib → dist/mjs}/data-structures/hash/hash-table.js +16 -4
- package/dist/mjs/data-structures/hash/index.js +22 -0
- package/dist/mjs/data-structures/hash/tree-map.js +6 -0
- package/dist/mjs/data-structures/hash/tree-set.js +6 -0
- package/{lib → dist/mjs}/data-structures/heap/heap.js +23 -7
- package/dist/mjs/data-structures/heap/index.js +19 -0
- package/{lib → dist/mjs}/data-structures/heap/max-heap.js +6 -2
- package/{lib → dist/mjs}/data-structures/heap/min-heap.js +6 -2
- package/dist/mjs/data-structures/index.js +27 -0
- package/{lib → dist/mjs}/data-structures/linked-list/doubly-linked-list.js +15 -6
- package/dist/mjs/data-structures/linked-list/index.js +19 -0
- package/{lib → dist/mjs}/data-structures/linked-list/singly-linked-list.js +12 -2
- package/{lib → dist/mjs}/data-structures/linked-list/skip-linked-list.js +14 -2
- package/dist/mjs/data-structures/matrix/index.js +20 -0
- package/{lib → dist/mjs}/data-structures/matrix/matrix.js +6 -1
- package/dist/{data-structures → mjs/data-structures}/matrix/matrix2d.js +5 -2
- package/{lib → dist/mjs}/data-structures/matrix/navigator.js +14 -2
- package/{lib → dist/mjs}/data-structures/matrix/vector2d.js +9 -2
- package/dist/mjs/data-structures/priority-queue/index.js +19 -0
- package/{lib → dist/mjs}/data-structures/priority-queue/max-priority-queue.js +6 -2
- package/{lib → dist/mjs}/data-structures/priority-queue/min-priority-queue.js +6 -2
- package/dist/mjs/data-structures/priority-queue/priority-queue.js +17 -0
- package/{lib → dist/mjs}/data-structures/queue/deque.js +21 -22
- package/dist/mjs/data-structures/queue/index.js +18 -0
- package/{lib → dist/mjs}/data-structures/queue/queue.js +11 -5
- package/dist/mjs/data-structures/stack/index.js +17 -0
- package/{lib → dist/mjs}/data-structures/stack/stack.js +6 -1
- package/dist/mjs/data-structures/tree/index.js +17 -0
- package/{lib → dist/mjs}/data-structures/tree/tree.js +8 -1
- package/dist/mjs/data-structures/trie/index.js +17 -0
- package/{lib → dist/mjs}/data-structures/trie/trie.js +12 -2
- package/dist/mjs/index.js +20 -0
- package/dist/mjs/interfaces/binary-tree.js +2 -0
- package/dist/mjs/interfaces/doubly-linked-list.js +2 -0
- package/dist/mjs/interfaces/graph.js +2 -0
- package/dist/mjs/interfaces/heap.js +2 -0
- package/dist/mjs/interfaces/index.js +24 -0
- package/dist/mjs/interfaces/navigator.js +2 -0
- package/dist/mjs/interfaces/priority-queue.js +2 -0
- package/dist/mjs/interfaces/segment-tree.js +2 -0
- package/dist/mjs/interfaces/singly-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/avl-tree.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
- package/dist/{types → mjs/types}/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/{lib → dist/mjs}/types/data-structures/binary-tree/binary-tree.js +7 -4
- package/dist/mjs/types/data-structures/binary-tree/bst.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/index.js +22 -0
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.js +8 -0
- package/dist/mjs/types/data-structures/binary-tree/segment-tree.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/tree-multiset.js +2 -0
- package/dist/mjs/types/data-structures/graph/abstract-graph.js +2 -0
- package/dist/mjs/types/data-structures/graph/directed-graph.js +9 -0
- package/dist/mjs/types/data-structures/graph/index.js +19 -0
- package/dist/mjs/types/data-structures/graph/map-graph.js +2 -0
- package/dist/mjs/types/data-structures/graph/undirected-graph.js +2 -0
- package/dist/mjs/types/data-structures/hash/coordinate-map.js +2 -0
- package/dist/mjs/types/data-structures/hash/coordinate-set.js +2 -0
- package/dist/mjs/types/data-structures/hash/hash-map.js +2 -0
- package/dist/mjs/types/data-structures/hash/hash-table.js +2 -0
- package/dist/mjs/types/data-structures/hash/index.js +2 -0
- package/dist/mjs/types/data-structures/hash/tree-map.js +2 -0
- package/dist/mjs/types/data-structures/hash/tree-set.js +2 -0
- package/dist/mjs/types/data-structures/heap/heap.js +2 -0
- package/dist/mjs/types/data-structures/heap/index.js +17 -0
- package/dist/mjs/types/data-structures/heap/max-heap.js +2 -0
- package/dist/mjs/types/data-structures/heap/min-heap.js +2 -0
- package/dist/mjs/types/data-structures/index.js +27 -0
- package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/linked-list/index.js +18 -0
- package/dist/mjs/types/data-structures/linked-list/singly-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/linked-list/skip-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/matrix/index.js +17 -0
- package/dist/mjs/types/data-structures/matrix/matrix.js +2 -0
- package/dist/mjs/types/data-structures/matrix/matrix2d.js +2 -0
- package/dist/mjs/types/data-structures/matrix/navigator.js +2 -0
- package/dist/mjs/types/data-structures/matrix/vector2d.js +2 -0
- package/dist/mjs/types/data-structures/priority-queue/index.js +19 -0
- package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.js +2 -0
- package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.js +2 -0
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.js +2 -0
- package/dist/mjs/types/data-structures/queue/deque.js +2 -0
- package/dist/mjs/types/data-structures/queue/index.js +18 -0
- package/dist/mjs/types/data-structures/queue/queue.js +2 -0
- package/dist/mjs/types/data-structures/stack/index.js +17 -0
- package/dist/mjs/types/data-structures/stack/stack.js +2 -0
- package/dist/mjs/types/data-structures/tree/index.js +17 -0
- package/dist/mjs/types/data-structures/tree/tree.js +2 -0
- package/dist/mjs/types/data-structures/trie/index.js +17 -0
- package/dist/mjs/types/data-structures/trie/trie.js +2 -0
- package/dist/{types → mjs/types}/helpers.d.ts +1 -1
- package/dist/mjs/types/helpers.js +9 -0
- package/dist/mjs/types/index.js +19 -0
- package/dist/mjs/types/utils/index.js +18 -0
- package/dist/mjs/types/utils/utils.js +2 -0
- package/dist/mjs/types/utils/validate-type.js +2 -0
- package/dist/mjs/utils/index.js +17 -0
- package/dist/mjs/utils/utils.js +64 -0
- package/dist/umd/index.global.js +27 -0
- package/dist/umd/index.global.js.map +1 -0
- package/package.json +21 -23
- package/src/data-structures/binary-tree/binary-tree.ts +19 -19
- package/src/data-structures/binary-tree/bst.ts +7 -7
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
- package/src/types/helpers.ts +1 -1
- package/test/integration/index.html +3 -4
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +23 -7
- package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +2 -1
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +20 -1
- package/test/unit/data-structures/hash/hash-table.test.ts +1 -1
- package/test/unit/data-structures/matrix/navigator.test.ts +1 -1
- package/test/unit/data-structures/queue/deque.test.ts +1 -1
- package/test/unit/data-structures/queue/queue.test.ts +1 -1
- package/tsconfig-base.json +27 -0
- package/tsconfig-cjs.json +9 -0
- package/tsup.config.js +11 -0
- package/umd/bundle.min.js +1 -1
- package/umd/bundle.min.js.map +1 -1
- package/dist/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/data-structures/binary-tree/index.js.map +0 -1
- package/dist/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/tree-multiset.js.map +0 -1
- package/dist/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/data-structures/graph/index.js.map +0 -1
- package/dist/data-structures/graph/map-graph.js.map +0 -1
- package/dist/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/data-structures/hash/hash-map.js.map +0 -1
- package/dist/data-structures/hash/hash-table.js.map +0 -1
- package/dist/data-structures/hash/index.js.map +0 -1
- package/dist/data-structures/hash/tree-map.js.map +0 -1
- package/dist/data-structures/hash/tree-set.js.map +0 -1
- package/dist/data-structures/heap/heap.js.map +0 -1
- package/dist/data-structures/heap/index.js.map +0 -1
- package/dist/data-structures/heap/max-heap.js.map +0 -1
- package/dist/data-structures/heap/min-heap.js.map +0 -1
- package/dist/data-structures/index.js.map +0 -1
- package/dist/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/data-structures/linked-list/index.js.map +0 -1
- package/dist/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/data-structures/matrix/index.js.map +0 -1
- package/dist/data-structures/matrix/matrix.js.map +0 -1
- package/dist/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/data-structures/matrix/navigator.js.map +0 -1
- package/dist/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/data-structures/priority-queue/index.js.map +0 -1
- package/dist/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/data-structures/queue/deque.js.map +0 -1
- package/dist/data-structures/queue/index.js.map +0 -1
- package/dist/data-structures/queue/queue.js.map +0 -1
- package/dist/data-structures/stack/index.js.map +0 -1
- package/dist/data-structures/stack/stack.js.map +0 -1
- package/dist/data-structures/tree/index.js.map +0 -1
- package/dist/data-structures/tree/tree.js.map +0 -1
- package/dist/data-structures/trie/index.js.map +0 -1
- package/dist/data-structures/trie/trie.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interfaces/binary-tree.js.map +0 -1
- package/dist/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/priority-queue.js.map +0 -1
- package/dist/interfaces/segment-tree.js.map +0 -1
- package/dist/interfaces/singly-linked-list.js.map +0 -1
- package/dist/types/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/types/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/types/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/types/data-structures/binary-tree/index.js.map +0 -1
- package/dist/types/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/types/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/types/data-structures/binary-tree/tree-multiset.js.map +0 -1
- package/dist/types/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/types/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/types/data-structures/graph/index.js.map +0 -1
- package/dist/types/data-structures/graph/map-graph.js.map +0 -1
- package/dist/types/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/types/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/types/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/types/data-structures/hash/hash-map.js.map +0 -1
- package/dist/types/data-structures/hash/hash-table.js.map +0 -1
- package/dist/types/data-structures/hash/index.js.map +0 -1
- package/dist/types/data-structures/hash/tree-map.js.map +0 -1
- package/dist/types/data-structures/hash/tree-set.js.map +0 -1
- package/dist/types/data-structures/heap/heap.js.map +0 -1
- package/dist/types/data-structures/heap/index.js.map +0 -1
- package/dist/types/data-structures/heap/max-heap.js.map +0 -1
- package/dist/types/data-structures/heap/min-heap.js.map +0 -1
- package/dist/types/data-structures/index.js.map +0 -1
- package/dist/types/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/types/data-structures/linked-list/index.js.map +0 -1
- package/dist/types/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/types/data-structures/matrix/index.js.map +0 -1
- package/dist/types/data-structures/matrix/matrix.js.map +0 -1
- package/dist/types/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/types/data-structures/matrix/navigator.js.map +0 -1
- package/dist/types/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/types/data-structures/priority-queue/index.js.map +0 -1
- package/dist/types/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/types/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/types/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/types/data-structures/queue/deque.js.map +0 -1
- package/dist/types/data-structures/queue/index.js.map +0 -1
- package/dist/types/data-structures/queue/queue.js.map +0 -1
- package/dist/types/data-structures/stack/index.js.map +0 -1
- package/dist/types/data-structures/stack/stack.js.map +0 -1
- package/dist/types/data-structures/tree/index.js.map +0 -1
- package/dist/types/data-structures/tree/tree.js.map +0 -1
- package/dist/types/data-structures/trie/index.js.map +0 -1
- package/dist/types/data-structures/trie/trie.js.map +0 -1
- package/dist/types/helpers.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/utils/index.js.map +0 -1
- package/dist/types/utils/validate-type.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/utils.js.map +0 -1
- package/lib/data-structures/binary-tree/index.js +0 -7
- package/lib/data-structures/binary-tree/rb-tree.js +0 -22
- package/lib/data-structures/graph/index.js +0 -4
- package/lib/data-structures/hash/index.js +0 -6
- package/lib/data-structures/hash/tree-map.js +0 -2
- package/lib/data-structures/hash/tree-set.js +0 -2
- package/lib/data-structures/heap/index.js +0 -3
- package/lib/data-structures/index.js +0 -11
- package/lib/data-structures/linked-list/index.js +0 -3
- package/lib/data-structures/matrix/index.js +0 -4
- package/lib/data-structures/priority-queue/index.js +0 -3
- package/lib/data-structures/priority-queue/priority-queue.js +0 -13
- package/lib/data-structures/queue/index.js +0 -2
- package/lib/data-structures/stack/index.js +0 -1
- package/lib/data-structures/tree/index.js +0 -1
- package/lib/data-structures/trie/index.js +0 -1
- package/lib/index.js +0 -4
- package/lib/interfaces/binary-tree.js +0 -1
- package/lib/interfaces/doubly-linked-list.js +0 -1
- package/lib/interfaces/graph.js +0 -1
- package/lib/interfaces/heap.js +0 -1
- package/lib/interfaces/index.js +0 -8
- package/lib/interfaces/navigator.js +0 -1
- package/lib/interfaces/priority-queue.js +0 -1
- package/lib/interfaces/segment-tree.js +0 -1
- package/lib/interfaces/singly-linked-list.js +0 -1
- package/lib/types/data-structures/binary-tree/avl-tree.js +0 -1
- package/lib/types/data-structures/binary-tree/binary-indexed-tree.js +0 -1
- package/lib/types/data-structures/binary-tree/bst.js +0 -1
- package/lib/types/data-structures/binary-tree/index.js +0 -6
- package/lib/types/data-structures/binary-tree/rb-tree.js +0 -5
- package/lib/types/data-structures/binary-tree/segment-tree.js +0 -1
- package/lib/types/data-structures/binary-tree/tree-multiset.js +0 -1
- package/lib/types/data-structures/graph/abstract-graph.js +0 -1
- package/lib/types/data-structures/graph/directed-graph.js +0 -6
- package/lib/types/data-structures/graph/index.js +0 -3
- package/lib/types/data-structures/graph/map-graph.js +0 -1
- package/lib/types/data-structures/graph/undirected-graph.js +0 -1
- package/lib/types/data-structures/hash/coordinate-map.js +0 -1
- package/lib/types/data-structures/hash/coordinate-set.js +0 -1
- package/lib/types/data-structures/hash/hash-map.js +0 -1
- package/lib/types/data-structures/hash/hash-table.js +0 -1
- package/lib/types/data-structures/hash/index.js +0 -1
- package/lib/types/data-structures/hash/tree-map.js +0 -1
- package/lib/types/data-structures/hash/tree-set.js +0 -1
- package/lib/types/data-structures/heap/heap.js +0 -1
- package/lib/types/data-structures/heap/index.js +0 -1
- package/lib/types/data-structures/heap/max-heap.js +0 -1
- package/lib/types/data-structures/heap/min-heap.js +0 -1
- package/lib/types/data-structures/index.js +0 -11
- package/lib/types/data-structures/linked-list/doubly-linked-list.js +0 -1
- package/lib/types/data-structures/linked-list/index.js +0 -2
- package/lib/types/data-structures/linked-list/singly-linked-list.js +0 -1
- package/lib/types/data-structures/linked-list/skip-linked-list.js +0 -1
- package/lib/types/data-structures/matrix/index.js +0 -1
- package/lib/types/data-structures/matrix/matrix.js +0 -1
- package/lib/types/data-structures/matrix/matrix2d.js +0 -1
- package/lib/types/data-structures/matrix/navigator.js +0 -1
- package/lib/types/data-structures/matrix/vector2d.js +0 -1
- package/lib/types/data-structures/priority-queue/index.js +0 -3
- package/lib/types/data-structures/priority-queue/max-priority-queue.js +0 -1
- package/lib/types/data-structures/priority-queue/min-priority-queue.js +0 -1
- package/lib/types/data-structures/priority-queue/priority-queue.js +0 -1
- package/lib/types/data-structures/queue/deque.js +0 -1
- package/lib/types/data-structures/queue/index.js +0 -2
- package/lib/types/data-structures/queue/queue.js +0 -1
- package/lib/types/data-structures/stack/index.js +0 -1
- package/lib/types/data-structures/stack/stack.js +0 -1
- package/lib/types/data-structures/tree/index.js +0 -1
- package/lib/types/data-structures/tree/tree.js +0 -1
- package/lib/types/data-structures/trie/index.js +0 -1
- package/lib/types/data-structures/trie/trie.js +0 -1
- package/lib/types/helpers.js +0 -6
- package/lib/types/index.js +0 -3
- package/lib/types/utils/index.js +0 -2
- package/lib/types/utils/utils.js +0 -1
- package/lib/types/utils/validate-type.js +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/utils.js +0 -63
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/avl-tree.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/binary-tree.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/bst.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/rb-tree.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/segment-tree.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/tree-multiset.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/binary-tree/tree-multiset.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/abstract-graph.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/abstract-graph.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/directed-graph.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/directed-graph.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/map-graph.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/map-graph.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/undirected-graph.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/undirected-graph.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/coordinate-map.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/coordinate-map.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/coordinate-set.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/coordinate-set.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/hash-map.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/hash-map.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/hash-table.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/hash-table.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-map.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-map.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-set.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-set.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/heap.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/heap.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/max-heap.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/max-heap.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/min-heap.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/min-heap.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/doubly-linked-list.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/singly-linked-list.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/skip-linked-list.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/matrix.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/matrix.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/matrix2d.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/navigator.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/navigator.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/vector2d.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/vector2d.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/max-priority-queue.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/min-priority-queue.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/priority-queue.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/deque.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/deque.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/queue.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/queue.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/stack/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/stack/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/stack/stack.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/stack/stack.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/tree/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/tree/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/tree/tree.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/tree/tree.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/trie/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/trie/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/trie/trie.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/trie/trie.js +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{index.js → cjs/index.js} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/binary-tree.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/binary-tree.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/doubly-linked-list.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/graph.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/graph.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/heap.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/heap.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/index.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/navigator.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/navigator.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/priority-queue.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/priority-queue.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/segment-tree.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/segment-tree.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/singly-linked-list.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/avl-tree.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/binary-indexed-tree.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/binary-tree.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/bst.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/bst.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/rb-tree.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/rb-tree.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/segment-tree.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/tree-multiset.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/binary-tree/tree-multiset.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/abstract-graph.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/directed-graph.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/map-graph.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/map-graph.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/graph/undirected-graph.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/coordinate-map.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/coordinate-map.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/coordinate-set.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/coordinate-set.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/hash-map.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/hash-map.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/hash-table.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/hash-table.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/tree-map.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/tree-map.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/tree-set.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/hash/tree-set.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/heap.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/heap.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/max-heap.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/max-heap.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/min-heap.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/heap/min-heap.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/doubly-linked-list.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/singly-linked-list.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/linked-list/skip-linked-list.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/matrix.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/matrix.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/matrix2d.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/matrix2d.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/navigator.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/navigator.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/vector2d.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/matrix/vector2d.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/max-priority-queue.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/min-priority-queue.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/priority-queue/priority-queue.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/queue/deque.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/queue/deque.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/queue/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/queue/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/queue/queue.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/queue/queue.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/stack/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/stack/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/stack/stack.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/stack/stack.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/tree/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/tree/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/tree/tree.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/tree/tree.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/trie/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/trie/index.js +0 -0
- /package/dist/{types → cjs/types}/data-structures/trie/trie.d.ts +0 -0
- /package/dist/{types → cjs/types}/data-structures/trie/trie.js +0 -0
- /package/dist/{types → cjs/types}/helpers.js +0 -0
- /package/dist/{types → cjs/types}/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/index.js +0 -0
- /package/dist/{types → cjs/types}/utils/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/utils/index.js +0 -0
- /package/dist/{types → cjs/types}/utils/utils.d.ts +0 -0
- /package/dist/{types → cjs/types}/utils/utils.js +0 -0
- /package/dist/{types → cjs/types}/utils/validate-type.d.ts +0 -0
- /package/dist/{types → cjs/types}/utils/validate-type.js +0 -0
- /package/dist/{utils → cjs/utils}/index.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/index.js +0 -0
- /package/dist/{utils → cjs/utils}/utils.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/utils.js +0 -0
- /package/{lib → dist/mjs}/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/binary-tree/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/binary-tree/rb-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/binary-tree/tree-multiset.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/graph/directed-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/graph/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/graph/map-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/coordinate-map.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/coordinate-set.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/hash-map.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/hash-table.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/tree-map.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/tree-set.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/heap/heap.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/heap/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/heap/max-heap.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/heap/min-heap.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/linked-list/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/matrix/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/matrix/matrix.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/matrix/matrix2d.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/matrix/navigator.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/matrix/vector2d.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/priority-queue/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/queue/deque.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/queue/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/queue/queue.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/stack/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/stack/stack.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/tree/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/tree/tree.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/trie/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/trie/trie.d.ts +0 -0
- /package/{lib → dist/mjs}/index.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/binary-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/doubly-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/graph.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/heap.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/index.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/navigator.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/segment-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/interfaces/singly-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/avl-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/bst.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/rb-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/segment-tree.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/binary-tree/tree-multiset.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/graph/abstract-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/graph/directed-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/graph/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/graph/map-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/graph/undirected-graph.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/coordinate-map.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/coordinate-set.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/hash-map.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/hash-table.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/tree-map.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/hash/tree-set.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/heap/heap.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/heap/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/heap/max-heap.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/heap/min-heap.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/linked-list/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/linked-list/singly-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/linked-list/skip-linked-list.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/matrix/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/matrix/matrix.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/matrix/matrix2d.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/matrix/navigator.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/matrix/vector2d.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/priority-queue/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/priority-queue/priority-queue.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/queue/deque.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/queue/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/queue/queue.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/stack/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/stack/stack.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/tree/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/tree/tree.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/trie/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/data-structures/trie/trie.d.ts +0 -0
- /package/{lib → dist/mjs}/types/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/utils/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/utils/utils.d.ts +0 -0
- /package/{lib → dist/mjs}/types/utils/validate-type.d.ts +0 -0
- /package/{lib → dist/mjs}/utils/index.d.ts +0 -0
- /package/{lib → dist/mjs}/utils/utils.d.ts +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { BFSCallback,
|
|
8
|
+
import type { BFSCallback, BinaryTreeNodeKey, BinaryTreeNodeNested, BinaryTreeOptions, MapCallback } from '../../types';
|
|
9
9
|
import { BinaryTreeDeletedResult, DFSOrderPattern, FamilyPosition, IterationType } from '../../types';
|
|
10
10
|
import { IBinaryTree } from '../../interfaces';
|
|
11
11
|
/**
|
|
@@ -207,7 +207,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
207
207
|
* traverse the binary tree. It can have two possible values:
|
|
208
208
|
* @returns The function `getNodes` returns an array of nodes (`N[]`).
|
|
209
209
|
*/
|
|
210
|
-
getNodes(nodeProperty: BinaryTreeNodeKey | N, callback?:
|
|
210
|
+
getNodes<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(nodeProperty: BinaryTreeNodeKey | N, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
|
|
211
211
|
/**
|
|
212
212
|
* The function checks if a binary tree has a node with a given property or key.
|
|
213
213
|
* @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter is the key or value of
|
|
@@ -225,7 +225,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
225
225
|
* performed when searching for nodes in the binary tree. It can have one of the following values:
|
|
226
226
|
* @returns a boolean value.
|
|
227
227
|
*/
|
|
228
|
-
has(nodeProperty: BinaryTreeNodeKey | N, callback?:
|
|
228
|
+
has<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(nodeProperty: BinaryTreeNodeKey | N, callback?: C, beginRoot?: N | null, iterationType?: IterationType): boolean;
|
|
229
229
|
/**
|
|
230
230
|
* The function `get` returns the first node in a binary tree that matches the given property or key.
|
|
231
231
|
* @param {BinaryTreeNodeKey | N} nodeProperty - The `nodeProperty` parameter is the key or value of
|
|
@@ -241,7 +241,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
241
241
|
* performed when searching for a node in the binary tree. It can have one of the following values:
|
|
242
242
|
* @returns either the found node (of type N) or null if no node is found.
|
|
243
243
|
*/
|
|
244
|
-
get(nodeProperty: BinaryTreeNodeKey | N, callback?:
|
|
244
|
+
get<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(nodeProperty: BinaryTreeNodeKey | N, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
|
|
245
245
|
/**
|
|
246
246
|
* The function `getPathToRoot` returns an array of nodes starting from a given node and traversing
|
|
247
247
|
* up to the root node, with the option to reverse the order of the nodes.
|
|
@@ -310,7 +310,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
310
310
|
* performed on the binary tree. It can have two possible values:
|
|
311
311
|
* @returns The function `subTreeTraverse` returns an array of `MapCallbackReturn<N>`.
|
|
312
312
|
*/
|
|
313
|
-
subTreeTraverse
|
|
313
|
+
subTreeTraverse<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(callback?: C, beginRoot?: N | BinaryTreeNodeKey | null, iterationType?: IterationType): ReturnType<C>[];
|
|
314
314
|
/**
|
|
315
315
|
* The `dfs` function performs a depth-first search traversal on a binary tree, executing a callback
|
|
316
316
|
* function on each node according to a specified order pattern.
|
|
@@ -326,7 +326,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
326
326
|
* iteration used in the depth-first search algorithm. It can have two possible values:
|
|
327
327
|
* @returns The function `dfs` returns an array of `MapCallbackReturn<N>` values.
|
|
328
328
|
*/
|
|
329
|
-
dfs
|
|
329
|
+
dfs<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
|
|
330
330
|
/**
|
|
331
331
|
* The bfs function performs a breadth-first search traversal on a binary tree, executing a callback
|
|
332
332
|
* function on each node.
|
|
@@ -344,7 +344,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
344
344
|
* in the breadth-first search (BFS) algorithm. It can have two possible values:
|
|
345
345
|
* @returns The function `bfs` returns an array of `BFSCallbackReturn<N>[]`.
|
|
346
346
|
*/
|
|
347
|
-
bfs
|
|
347
|
+
bfs<C extends BFSCallback<N> = BFSCallback<N, BinaryTreeNodeKey>>(callback?: C, withLevel?: boolean, beginRoot?: N | null, iterationType?: IterationType): ReturnType<C>[];
|
|
348
348
|
/**
|
|
349
349
|
* The function returns the predecessor node of a given node in a binary tree.
|
|
350
350
|
* @param {N} node - The parameter "node" represents a node in a binary tree.
|
|
@@ -365,7 +365,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
365
365
|
* `beginRoot` is `null`, an empty array will be returned.
|
|
366
366
|
* @returns The `morris` function returns an array of `MapCallbackReturn<N>` values.
|
|
367
367
|
*/
|
|
368
|
-
morris
|
|
368
|
+
morris<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(callback?: C, pattern?: DFSOrderPattern, beginRoot?: N | null): ReturnType<C>[];
|
|
369
369
|
/**
|
|
370
370
|
* Swap the data of two nodes in the binary tree.
|
|
371
371
|
* @param {N} srcNode - The source node to swap.
|
|
@@ -380,7 +380,7 @@ export declare class BinaryTree<N extends BinaryTreeNode<N['val'], N> = BinaryTr
|
|
|
380
380
|
* the tree's structure should be restored to its original state to maintain the tree's integrity.
|
|
381
381
|
* This is because the purpose of the Morris algorithm is to save space rather than permanently alter the tree's shape.
|
|
382
382
|
*/
|
|
383
|
-
protected _defaultCallbackByKey:
|
|
383
|
+
protected _defaultCallbackByKey: (node: N) => number;
|
|
384
384
|
/**
|
|
385
385
|
* The function `_addTo` adds a new node to a binary tree if there is an available position.
|
|
386
386
|
* @param {N | null} newNode - The `newNode` parameter represents the node that you want to add to
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* data-structure-typed
|
|
3
4
|
*
|
|
@@ -5,15 +6,29 @@
|
|
|
5
6
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
7
|
* @license MIT License
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BinaryTree = exports.BinaryTreeNode = void 0;
|
|
11
|
+
const types_1 = require("../../types");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
const queue_1 = require("../queue");
|
|
11
14
|
/**
|
|
12
15
|
* Represents a node in a binary tree.
|
|
13
16
|
* @template V - The type of data stored in the node.
|
|
14
17
|
* @template FAMILY - The type of the family relationship in the binary tree.
|
|
15
18
|
*/
|
|
16
|
-
|
|
19
|
+
class BinaryTreeNode {
|
|
20
|
+
/**
|
|
21
|
+
* The key associated with the node.
|
|
22
|
+
*/
|
|
23
|
+
key;
|
|
24
|
+
/**
|
|
25
|
+
* The value stored in the node.
|
|
26
|
+
*/
|
|
27
|
+
val;
|
|
28
|
+
/**
|
|
29
|
+
* The parent node of the current node.
|
|
30
|
+
*/
|
|
31
|
+
parent;
|
|
17
32
|
/**
|
|
18
33
|
* Creates a new instance of BinaryTreeNode.
|
|
19
34
|
* @param {BinaryTreeNodeKey} key - The key associated with the node.
|
|
@@ -23,6 +38,7 @@ export class BinaryTreeNode {
|
|
|
23
38
|
this.key = key;
|
|
24
39
|
this.val = val;
|
|
25
40
|
}
|
|
41
|
+
_left;
|
|
26
42
|
/**
|
|
27
43
|
* Get the left child node.
|
|
28
44
|
*/
|
|
@@ -39,6 +55,7 @@ export class BinaryTreeNode {
|
|
|
39
55
|
}
|
|
40
56
|
this._left = v;
|
|
41
57
|
}
|
|
58
|
+
_right;
|
|
42
59
|
/**
|
|
43
60
|
* Get the right child node.
|
|
44
61
|
*/
|
|
@@ -64,66 +81,59 @@ export class BinaryTreeNode {
|
|
|
64
81
|
if (that.parent) {
|
|
65
82
|
if (that.parent.left === that) {
|
|
66
83
|
if (that.left || that.right) {
|
|
67
|
-
return FamilyPosition.ROOT_LEFT;
|
|
84
|
+
return types_1.FamilyPosition.ROOT_LEFT;
|
|
68
85
|
}
|
|
69
86
|
else {
|
|
70
|
-
return FamilyPosition.LEFT;
|
|
87
|
+
return types_1.FamilyPosition.LEFT;
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
else if (that.parent.right === that) {
|
|
74
91
|
if (that.left || that.right) {
|
|
75
|
-
return FamilyPosition.ROOT_RIGHT;
|
|
92
|
+
return types_1.FamilyPosition.ROOT_RIGHT;
|
|
76
93
|
}
|
|
77
94
|
else {
|
|
78
|
-
return FamilyPosition.RIGHT;
|
|
95
|
+
return types_1.FamilyPosition.RIGHT;
|
|
79
96
|
}
|
|
80
97
|
}
|
|
81
98
|
else {
|
|
82
|
-
return FamilyPosition.MAL_NODE;
|
|
99
|
+
return types_1.FamilyPosition.MAL_NODE;
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
102
|
else {
|
|
86
103
|
if (that.left || that.right) {
|
|
87
|
-
return FamilyPosition.ROOT;
|
|
104
|
+
return types_1.FamilyPosition.ROOT;
|
|
88
105
|
}
|
|
89
106
|
else {
|
|
90
|
-
return FamilyPosition.ISOLATED;
|
|
107
|
+
return types_1.FamilyPosition.ISOLATED;
|
|
91
108
|
}
|
|
92
109
|
}
|
|
93
110
|
}
|
|
94
111
|
}
|
|
112
|
+
exports.BinaryTreeNode = BinaryTreeNode;
|
|
95
113
|
/**
|
|
96
114
|
* Represents a binary tree data structure.
|
|
97
115
|
* @template N - The type of the binary tree's nodes.
|
|
98
116
|
*/
|
|
99
|
-
|
|
117
|
+
class BinaryTree {
|
|
118
|
+
_loopType = types_1.IterationType.ITERATIVE;
|
|
100
119
|
/**
|
|
101
120
|
* Creates a new instance of BinaryTree.
|
|
102
121
|
* @param {BinaryTreeOptions} [options] - The options for the binary tree.
|
|
103
122
|
*/
|
|
104
123
|
constructor(options) {
|
|
105
|
-
this._loopType = IterationType.ITERATIVE;
|
|
106
|
-
this._root = null;
|
|
107
|
-
this._size = 0;
|
|
108
|
-
/**
|
|
109
|
-
* Time complexity is O(n)
|
|
110
|
-
* Space complexity of Iterative dfs equals to recursive dfs which is O(n) because of the stack
|
|
111
|
-
* The Morris algorithm only modifies the tree's structure during traversal; once the traversal is complete,
|
|
112
|
-
* the tree's structure should be restored to its original state to maintain the tree's integrity.
|
|
113
|
-
* This is because the purpose of the Morris algorithm is to save space rather than permanently alter the tree's shape.
|
|
114
|
-
*/
|
|
115
|
-
this._defaultCallbackByKey = node => node.key;
|
|
116
124
|
if (options !== undefined) {
|
|
117
|
-
const { iterationType = IterationType.ITERATIVE } = options;
|
|
125
|
+
const { iterationType = types_1.IterationType.ITERATIVE } = options;
|
|
118
126
|
this._loopType = iterationType;
|
|
119
127
|
}
|
|
120
128
|
}
|
|
129
|
+
_root = null;
|
|
121
130
|
/**
|
|
122
131
|
* Get the root node of the binary tree.
|
|
123
132
|
*/
|
|
124
133
|
get root() {
|
|
125
134
|
return this._root;
|
|
126
135
|
}
|
|
136
|
+
_size = 0;
|
|
127
137
|
/**
|
|
128
138
|
* Get the number of nodes in the binary tree.
|
|
129
139
|
*/
|
|
@@ -174,7 +184,7 @@ export class BinaryTree {
|
|
|
174
184
|
*/
|
|
175
185
|
add(keyOrNode, val) {
|
|
176
186
|
const _bfs = (root, newNode) => {
|
|
177
|
-
const queue = new Queue([root]);
|
|
187
|
+
const queue = new queue_1.Queue([root]);
|
|
178
188
|
while (queue.size > 0) {
|
|
179
189
|
const cur = queue.shift();
|
|
180
190
|
if (cur) {
|
|
@@ -251,7 +261,7 @@ export class BinaryTree {
|
|
|
251
261
|
inserted.push(this.add(null));
|
|
252
262
|
continue;
|
|
253
263
|
}
|
|
254
|
-
const val = values
|
|
264
|
+
const val = values?.[i];
|
|
255
265
|
inserted.push(this.add(keyOrNode, val));
|
|
256
266
|
}
|
|
257
267
|
return inserted;
|
|
@@ -284,7 +294,7 @@ export class BinaryTree {
|
|
|
284
294
|
const curr = typeof nodeOrKey === 'number' ? this.get(nodeOrKey) : nodeOrKey;
|
|
285
295
|
if (!curr)
|
|
286
296
|
return bstDeletedResult;
|
|
287
|
-
const parent =
|
|
297
|
+
const parent = curr?.parent ? curr.parent : null;
|
|
288
298
|
let needBalanced = null, orgCurrent = curr;
|
|
289
299
|
if (!curr.left) {
|
|
290
300
|
if (!parent) {
|
|
@@ -293,10 +303,10 @@ export class BinaryTree {
|
|
|
293
303
|
}
|
|
294
304
|
else {
|
|
295
305
|
const { familyPosition: fp } = curr;
|
|
296
|
-
if (fp === FamilyPosition.LEFT || fp === FamilyPosition.ROOT_LEFT) {
|
|
306
|
+
if (fp === types_1.FamilyPosition.LEFT || fp === types_1.FamilyPosition.ROOT_LEFT) {
|
|
297
307
|
parent.left = curr.right;
|
|
298
308
|
}
|
|
299
|
-
else if (fp === FamilyPosition.RIGHT || fp === FamilyPosition.ROOT_RIGHT) {
|
|
309
|
+
else if (fp === types_1.FamilyPosition.RIGHT || fp === types_1.FamilyPosition.ROOT_RIGHT) {
|
|
300
310
|
parent.right = curr.right;
|
|
301
311
|
}
|
|
302
312
|
needBalanced = parent;
|
|
@@ -338,7 +348,7 @@ export class BinaryTree {
|
|
|
338
348
|
if (typeof beginRoot === 'number')
|
|
339
349
|
beginRoot = this.get(beginRoot);
|
|
340
350
|
let depth = 0;
|
|
341
|
-
while (distNode
|
|
351
|
+
while (distNode?.parent) {
|
|
342
352
|
if (distNode === beginRoot) {
|
|
343
353
|
return depth;
|
|
344
354
|
}
|
|
@@ -364,7 +374,7 @@ export class BinaryTree {
|
|
|
364
374
|
beginRoot = this.get(beginRoot);
|
|
365
375
|
if (!beginRoot)
|
|
366
376
|
return -1;
|
|
367
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
377
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
368
378
|
const _getMaxHeight = (cur) => {
|
|
369
379
|
if (!cur)
|
|
370
380
|
return -1;
|
|
@@ -404,10 +414,9 @@ export class BinaryTree {
|
|
|
404
414
|
* @returns The function `getMinHeight` returns the minimum height of a binary tree.
|
|
405
415
|
*/
|
|
406
416
|
getMinHeight(beginRoot = this.root, iterationType = this.iterationType) {
|
|
407
|
-
var _a, _b, _c;
|
|
408
417
|
if (!beginRoot)
|
|
409
418
|
return -1;
|
|
410
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
419
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
411
420
|
const _getMinHeight = (cur) => {
|
|
412
421
|
if (!cur)
|
|
413
422
|
return 0;
|
|
@@ -433,8 +442,8 @@ export class BinaryTree {
|
|
|
433
442
|
if (!node.right || last === node.right) {
|
|
434
443
|
node = stack.pop();
|
|
435
444
|
if (node) {
|
|
436
|
-
const leftMinHeight = node.left ?
|
|
437
|
-
const rightMinHeight = node.right ?
|
|
445
|
+
const leftMinHeight = node.left ? depths.get(node.left) ?? -1 : -1;
|
|
446
|
+
const rightMinHeight = node.right ? depths.get(node.right) ?? -1 : -1;
|
|
438
447
|
depths.set(node, 1 + Math.min(leftMinHeight, rightMinHeight));
|
|
439
448
|
last = node;
|
|
440
449
|
node = null;
|
|
@@ -444,7 +453,7 @@ export class BinaryTree {
|
|
|
444
453
|
node = node.right;
|
|
445
454
|
}
|
|
446
455
|
}
|
|
447
|
-
return
|
|
456
|
+
return depths.get(beginRoot) ?? -1;
|
|
448
457
|
}
|
|
449
458
|
}
|
|
450
459
|
/**
|
|
@@ -482,7 +491,7 @@ export class BinaryTree {
|
|
|
482
491
|
if (!beginRoot)
|
|
483
492
|
return [];
|
|
484
493
|
const ans = [];
|
|
485
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
494
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
486
495
|
const _traverse = (cur) => {
|
|
487
496
|
if (callback(cur) === nodeProperty) {
|
|
488
497
|
ans.push(cur);
|
|
@@ -497,7 +506,7 @@ export class BinaryTree {
|
|
|
497
506
|
_traverse(beginRoot);
|
|
498
507
|
}
|
|
499
508
|
else {
|
|
500
|
-
const queue = new Queue([beginRoot]);
|
|
509
|
+
const queue = new queue_1.Queue([beginRoot]);
|
|
501
510
|
while (queue.size > 0) {
|
|
502
511
|
const cur = queue.shift();
|
|
503
512
|
if (cur) {
|
|
@@ -550,9 +559,8 @@ export class BinaryTree {
|
|
|
550
559
|
* @returns either the found node (of type N) or null if no node is found.
|
|
551
560
|
*/
|
|
552
561
|
get(nodeProperty, callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
|
|
553
|
-
var _a;
|
|
554
562
|
// TODO may support finding node by value equal
|
|
555
|
-
return
|
|
563
|
+
return this.getNodes(nodeProperty, callback, true, beginRoot, iterationType)[0] ?? null;
|
|
556
564
|
}
|
|
557
565
|
/**
|
|
558
566
|
* The function `getPathToRoot` returns an array of nodes starting from a given node and traversing
|
|
@@ -592,7 +600,7 @@ export class BinaryTree {
|
|
|
592
600
|
beginRoot = this.get(beginRoot);
|
|
593
601
|
if (!beginRoot)
|
|
594
602
|
return beginRoot;
|
|
595
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
603
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
596
604
|
const _traverse = (cur) => {
|
|
597
605
|
if (!cur.left)
|
|
598
606
|
return cur;
|
|
@@ -602,7 +610,7 @@ export class BinaryTree {
|
|
|
602
610
|
}
|
|
603
611
|
else {
|
|
604
612
|
// Indirect implementation of iteration using tail recursion optimization
|
|
605
|
-
const _traverse = trampoline((cur) => {
|
|
613
|
+
const _traverse = (0, utils_1.trampoline)((cur) => {
|
|
606
614
|
if (!cur.left)
|
|
607
615
|
return cur;
|
|
608
616
|
return _traverse.cont(cur.left);
|
|
@@ -625,7 +633,7 @@ export class BinaryTree {
|
|
|
625
633
|
// TODO support get right most by passing key in
|
|
626
634
|
if (!beginRoot)
|
|
627
635
|
return beginRoot;
|
|
628
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
636
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
629
637
|
const _traverse = (cur) => {
|
|
630
638
|
if (!cur.right)
|
|
631
639
|
return cur;
|
|
@@ -635,7 +643,7 @@ export class BinaryTree {
|
|
|
635
643
|
}
|
|
636
644
|
else {
|
|
637
645
|
// Indirect implementation of iteration using tail recursion optimization
|
|
638
|
-
const _traverse = trampoline((cur) => {
|
|
646
|
+
const _traverse = (0, utils_1.trampoline)((cur) => {
|
|
639
647
|
if (!cur.right)
|
|
640
648
|
return cur;
|
|
641
649
|
return _traverse.cont(cur.right);
|
|
@@ -656,7 +664,7 @@ export class BinaryTree {
|
|
|
656
664
|
// TODO there is a bug
|
|
657
665
|
if (!beginRoot)
|
|
658
666
|
return true;
|
|
659
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
667
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
660
668
|
const dfs = (cur, min, max) => {
|
|
661
669
|
if (!cur)
|
|
662
670
|
return true;
|
|
@@ -716,7 +724,7 @@ export class BinaryTree {
|
|
|
716
724
|
const ans = [];
|
|
717
725
|
if (!beginRoot)
|
|
718
726
|
return ans;
|
|
719
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
727
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
720
728
|
const _traverse = (cur) => {
|
|
721
729
|
ans.push(callback(cur));
|
|
722
730
|
cur.left && _traverse(cur.left);
|
|
@@ -750,11 +758,11 @@ export class BinaryTree {
|
|
|
750
758
|
* iteration used in the depth-first search algorithm. It can have two possible values:
|
|
751
759
|
* @returns The function `dfs` returns an array of `MapCallbackReturn<N>` values.
|
|
752
760
|
*/
|
|
753
|
-
dfs(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root, iterationType = IterationType.ITERATIVE) {
|
|
761
|
+
dfs(callback = this._defaultCallbackByKey, pattern = 'in', beginRoot = this.root, iterationType = types_1.IterationType.ITERATIVE) {
|
|
754
762
|
if (!beginRoot)
|
|
755
763
|
return [];
|
|
756
764
|
const ans = [];
|
|
757
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
765
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
758
766
|
const _traverse = (node) => {
|
|
759
767
|
switch (pattern) {
|
|
760
768
|
case 'in':
|
|
@@ -841,7 +849,7 @@ export class BinaryTree {
|
|
|
841
849
|
if (!beginRoot)
|
|
842
850
|
return [];
|
|
843
851
|
const ans = [];
|
|
844
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
852
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
845
853
|
const _recursive = (node, level) => {
|
|
846
854
|
callback && ans.push(callback(node, withLevel ? level : undefined));
|
|
847
855
|
if (node.left)
|
|
@@ -1000,6 +1008,14 @@ export class BinaryTree {
|
|
|
1000
1008
|
}
|
|
1001
1009
|
return destNode;
|
|
1002
1010
|
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Time complexity is O(n)
|
|
1013
|
+
* Space complexity of Iterative dfs equals to recursive dfs which is O(n) because of the stack
|
|
1014
|
+
* The Morris algorithm only modifies the tree's structure during traversal; once the traversal is complete,
|
|
1015
|
+
* the tree's structure should be restored to its original state to maintain the tree's integrity.
|
|
1016
|
+
* This is because the purpose of the Morris algorithm is to save space rather than permanently alter the tree's shape.
|
|
1017
|
+
*/
|
|
1018
|
+
_defaultCallbackByKey = node => node.key;
|
|
1003
1019
|
/**
|
|
1004
1020
|
* The function `_addTo` adds a new node to a binary tree if there is an available position.
|
|
1005
1021
|
* @param {N | null} newNode - The `newNode` parameter represents the node that you want to add to
|
|
@@ -1058,3 +1074,4 @@ export class BinaryTree {
|
|
|
1058
1074
|
this._size = v;
|
|
1059
1075
|
}
|
|
1060
1076
|
}
|
|
1077
|
+
exports.BinaryTree = BinaryTree;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, MapCallback
|
|
8
|
+
import type { BinaryTreeNodeKey, BSTComparator, BSTNodeNested, BSTOptions, MapCallback } from '../../types';
|
|
9
9
|
import { CP, IterationType } from '../../types';
|
|
10
10
|
import { BinaryTree, BinaryTreeNode } from './binary-tree';
|
|
11
11
|
import { IBinaryTree } from '../../interfaces';
|
|
@@ -72,7 +72,7 @@ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends Binar
|
|
|
72
72
|
* @returns either the first node that matches the given nodeProperty and callback, or null if no
|
|
73
73
|
* matching node is found.
|
|
74
74
|
*/
|
|
75
|
-
get(nodeProperty: BinaryTreeNodeKey | N, callback?:
|
|
75
|
+
get<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(nodeProperty: BinaryTreeNodeKey | N, callback?: C, beginRoot?: N | null, iterationType?: IterationType): N | null;
|
|
76
76
|
/**
|
|
77
77
|
* The function `lastKey` returns the key of the rightmost node if the comparison result is less
|
|
78
78
|
* than, the key of the leftmost node if the comparison result is greater than, and the key of the
|
|
@@ -110,7 +110,7 @@ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends Binar
|
|
|
110
110
|
* traverse the binary tree. It can have one of the following values:
|
|
111
111
|
* @returns an array of nodes (N[]).
|
|
112
112
|
*/
|
|
113
|
-
getNodes(nodeProperty: BinaryTreeNodeKey | N, callback?:
|
|
113
|
+
getNodes<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(nodeProperty: BinaryTreeNodeKey | N, callback?: C, onlyOne?: boolean, beginRoot?: N | null, iterationType?: IterationType): N[];
|
|
114
114
|
/**
|
|
115
115
|
* The `lesserOrGreaterTraverse` function traverses a binary tree and applies a callback function to
|
|
116
116
|
* nodes that have a key value lesser or greater than a target key value.
|
|
@@ -128,7 +128,7 @@ export declare class BST<N extends BSTNode<N['val'], N> = BSTNode> extends Binar
|
|
|
128
128
|
* done recursively or iteratively. It can have two possible values:
|
|
129
129
|
* @returns The function `lesserOrGreaterTraverse` returns an array of `MapCallbackReturn<N>`.
|
|
130
130
|
*/
|
|
131
|
-
lesserOrGreaterTraverse
|
|
131
|
+
lesserOrGreaterTraverse<C extends MapCallback<N> = MapCallback<N, BinaryTreeNodeKey>>(callback?: C, lesserOrGreater?: CP, targetNode?: N | BinaryTreeNodeKey | null, iterationType?: IterationType): ReturnType<C>[];
|
|
132
132
|
/**
|
|
133
133
|
* Balancing Adjustment:
|
|
134
134
|
* Perfectly Balanced Binary Tree: Since the balance of a perfectly balanced binary tree is already fixed, no additional balancing adjustment is needed. Any insertion or deletion operation will disrupt the perfect balance, often requiring a complete reconstruction of the tree.
|