data-structure-typed 1.38.0 → 1.38.2
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/dist/{data-structures → cjs/data-structures}/binary-tree/avl-tree.js +22 -22
- 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.js +32 -32
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -0
- 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/{data-structures → cjs/data-structures}/binary-tree/tree-multiset.js +23 -23
- 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/{data-structures → cjs/data-structures}/hash/hash-map.js +59 -59
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -0
- package/dist/{data-structures → cjs/data-structures}/hash/hash-table.js +99 -99
- 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/{data-structures → cjs/data-structures}/heap/heap.js +167 -167
- 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/{data-structures → cjs/data-structures}/linked-list/doubly-linked-list.js +3 -3
- 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/{data-structures → cjs/data-structures}/linked-list/skip-linked-list.js +34 -34
- 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 +21 -13
- 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/{data-structures → cjs/data-structures}/trie/trie.js +6 -6
- 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/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/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 +32 -26
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-indexed-tree.js +12 -3
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-tree.js +90 -73
- 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 +42 -36
- 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 +70 -60
- package/{lib → dist/mjs}/data-structures/hash/hash-table.js +115 -103
- 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 +188 -172
- 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 +18 -9
- 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 +48 -36
- 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 +14 -11
- 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 +18 -8
- 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/{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/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/avl-tree.ts +28 -28
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +1 -1
- package/src/data-structures/binary-tree/binary-tree.ts +57 -57
- package/src/data-structures/binary-tree/bst.ts +4 -0
- package/src/data-structures/binary-tree/rb-tree.ts +2 -2
- package/src/data-structures/binary-tree/tree-multiset.ts +30 -31
- package/src/data-structures/graph/abstract-graph.ts +10 -11
- package/src/data-structures/graph/directed-graph.ts +1 -2
- package/src/data-structures/graph/undirected-graph.ts +4 -5
- package/src/data-structures/hash/hash-map.ts +82 -76
- package/src/data-structures/hash/hash-table.ts +112 -109
- package/src/data-structures/hash/tree-map.ts +2 -1
- package/src/data-structures/hash/tree-set.ts +2 -1
- package/src/data-structures/heap/heap.ts +182 -181
- package/src/data-structures/linked-list/doubly-linked-list.ts +4 -4
- package/src/data-structures/linked-list/singly-linked-list.ts +1 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +45 -38
- package/src/data-structures/matrix/matrix.ts +1 -1
- package/src/data-structures/matrix/matrix2d.ts +10 -10
- package/src/data-structures/matrix/vector2d.ts +2 -1
- package/src/data-structures/queue/deque.ts +5 -4
- package/src/data-structures/queue/queue.ts +1 -1
- package/src/data-structures/trie/trie.ts +9 -9
- package/src/types/data-structures/matrix/navigator.ts +1 -1
- package/src/types/helpers.ts +5 -1
- package/src/types/utils/utils.ts +1 -1
- package/src/types/utils/validate-type.ts +2 -2
- package/test/integration/bst.test.ts +1 -1
- package/test/integration/index.html +1 -2
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +3 -2
- package/test/unit/data-structures/binary-tree/bst.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/overall.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +1 -1
- package/test/unit/data-structures/hash/hash-table.test.ts +1 -1
- package/test/unit/data-structures/heap/heap.test.ts +2 -2
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +1 -1
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +2 -2
- package/test/unit/data-structures/matrix/navigator.test.ts +1 -1
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +2 -2
- package/test/unit/data-structures/queue/deque.test.ts +1 -1
- package/test/unit/data-structures/queue/queue.test.ts +1 -1
- package/test/utils/big-o.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 +9 -9
- 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.d.ts +31 -31
- package/dist/{data-structures → cjs/data-structures}/binary-tree/bst.d.ts +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 +1 -1
- 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 +9 -9
- 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/{lib → dist/cjs}/data-structures/hash/hash-map.d.ts +25 -25
- package/{lib → dist/cjs}/data-structures/hash/hash-table.d.ts +34 -34
- 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 +66 -66
- 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/{lib → dist/cjs}/data-structures/linked-list/doubly-linked-list.d.ts +1 -1
- 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 +17 -17
- 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/{lib → dist/cjs}/data-structures/matrix/matrix2d.d.ts +7 -7
- 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/{lib → dist/cjs}/data-structures/trie/trie.d.ts +2 -2
- 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.d.ts +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.d.ts +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 +9 -9
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -0
- package/{lib → dist/mjs}/data-structures/binary-tree/binary-tree.d.ts +31 -31
- package/{lib → dist/mjs}/data-structures/binary-tree/bst.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 +1 -1
- 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 +9 -9
- 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/dist/{data-structures → mjs/data-structures}/hash/hash-map.d.ts +25 -25
- package/dist/{data-structures → mjs/data-structures}/hash/hash-table.d.ts +34 -34
- 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 +66 -66
- 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/dist/{data-structures → mjs/data-structures}/linked-list/doubly-linked-list.d.ts +1 -1
- 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 +17 -17
- 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/dist/{data-structures → mjs/data-structures}/matrix/matrix2d.d.ts +7 -7
- 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/dist/{data-structures → mjs/data-structures}/trie/trie.d.ts +2 -2
- /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/binary-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/helpers.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
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BST = exports.BSTNode = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const binary_tree_1 = require("./binary-tree");
|
|
6
|
+
const queue_1 = require("../queue");
|
|
7
|
+
class BSTNode extends binary_tree_1.BinaryTreeNode {
|
|
5
8
|
constructor(key, val) {
|
|
6
9
|
super(key, val);
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
|
-
|
|
12
|
+
exports.BSTNode = BSTNode;
|
|
13
|
+
class BST extends binary_tree_1.BinaryTree {
|
|
10
14
|
/**
|
|
11
15
|
* The constructor function initializes a binary search tree object with an optional comparator
|
|
12
16
|
* function.
|
|
@@ -15,7 +19,6 @@ export class BST extends BinaryTree {
|
|
|
15
19
|
*/
|
|
16
20
|
constructor(options) {
|
|
17
21
|
super(options);
|
|
18
|
-
this._comparator = (a, b) => a - b;
|
|
19
22
|
if (options !== undefined) {
|
|
20
23
|
const { comparator } = options;
|
|
21
24
|
if (comparator !== undefined) {
|
|
@@ -67,7 +70,7 @@ export class BST extends BinaryTree {
|
|
|
67
70
|
let traversing = true;
|
|
68
71
|
while (traversing) {
|
|
69
72
|
if (cur !== null && newNode !== null) {
|
|
70
|
-
if (this._compare(cur.key, newNode.key) === CP.eq) {
|
|
73
|
+
if (this._compare(cur.key, newNode.key) === types_1.CP.eq) {
|
|
71
74
|
if (newNode) {
|
|
72
75
|
cur.val = newNode.val;
|
|
73
76
|
}
|
|
@@ -75,7 +78,7 @@ export class BST extends BinaryTree {
|
|
|
75
78
|
traversing = false;
|
|
76
79
|
inserted = cur;
|
|
77
80
|
}
|
|
78
|
-
else if (this._compare(cur.key, newNode.key) === CP.gt) {
|
|
81
|
+
else if (this._compare(cur.key, newNode.key) === types_1.CP.gt) {
|
|
79
82
|
// Traverse left of the node
|
|
80
83
|
if (cur.left === undefined) {
|
|
81
84
|
if (newNode) {
|
|
@@ -93,7 +96,7 @@ export class BST extends BinaryTree {
|
|
|
93
96
|
cur = cur.left;
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
|
-
else if (this._compare(cur.key, newNode.key) === CP.lt) {
|
|
99
|
+
else if (this._compare(cur.key, newNode.key) === types_1.CP.lt) {
|
|
97
100
|
// Traverse right of the node
|
|
98
101
|
if (cur.right === undefined) {
|
|
99
102
|
if (newNode) {
|
|
@@ -141,7 +144,7 @@ export class BST extends BinaryTree {
|
|
|
141
144
|
return super.addMany(keysOrNodes, data);
|
|
142
145
|
}
|
|
143
146
|
const inserted = [];
|
|
144
|
-
const combinedArr = keysOrNodes.map((value, index) => [value, data
|
|
147
|
+
const combinedArr = keysOrNodes.map((value, index) => [value, data?.[index]]);
|
|
145
148
|
let sorted = [];
|
|
146
149
|
function isNodeOrNullTuple(arr) {
|
|
147
150
|
for (const [keyOrNode] of arr)
|
|
@@ -171,10 +174,10 @@ export class BST extends BinaryTree {
|
|
|
171
174
|
if (arr.length === 0)
|
|
172
175
|
return;
|
|
173
176
|
const mid = Math.floor((arr.length - 1) / 2);
|
|
174
|
-
const newNode = this.add(arr[mid], data
|
|
177
|
+
const newNode = this.add(arr[mid], data?.[mid]);
|
|
175
178
|
inserted.push(newNode);
|
|
176
|
-
recursive(arr.slice(0, mid), data
|
|
177
|
-
recursive(arr.slice(mid + 1), data
|
|
179
|
+
recursive(arr.slice(0, mid), data?.slice(0, mid));
|
|
180
|
+
recursive(arr.slice(mid + 1), data?.slice(mid + 1));
|
|
178
181
|
};
|
|
179
182
|
const iterative = () => {
|
|
180
183
|
const n = sorted.length;
|
|
@@ -185,7 +188,7 @@ export class BST extends BinaryTree {
|
|
|
185
188
|
const [l, r] = popped;
|
|
186
189
|
if (l <= r) {
|
|
187
190
|
const m = l + Math.floor((r - l) / 2);
|
|
188
|
-
const newNode = this.add(sortedKeysOrNodes[m], sortedData
|
|
191
|
+
const newNode = this.add(sortedKeysOrNodes[m], sortedData?.[m]);
|
|
189
192
|
inserted.push(newNode);
|
|
190
193
|
stack.push([m + 1, r]);
|
|
191
194
|
stack.push([l, m - 1]);
|
|
@@ -193,7 +196,7 @@ export class BST extends BinaryTree {
|
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
};
|
|
196
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
199
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
197
200
|
recursive(sortedKeysOrNodes, sortedData);
|
|
198
201
|
}
|
|
199
202
|
else {
|
|
@@ -220,8 +223,7 @@ export class BST extends BinaryTree {
|
|
|
220
223
|
* matching node is found.
|
|
221
224
|
*/
|
|
222
225
|
get(nodeProperty, callback = this._defaultCallbackByKey, beginRoot = this.root, iterationType = this.iterationType) {
|
|
223
|
-
|
|
224
|
-
return (_a = this.getNodes(nodeProperty, callback, true, beginRoot, iterationType)[0]) !== null && _a !== void 0 ? _a : null;
|
|
226
|
+
return this.getNodes(nodeProperty, callback, true, beginRoot, iterationType)[0] ?? null;
|
|
225
227
|
}
|
|
226
228
|
/**
|
|
227
229
|
* The function `lastKey` returns the key of the rightmost node if the comparison result is less
|
|
@@ -239,13 +241,12 @@ export class BST extends BinaryTree {
|
|
|
239
241
|
* rightmost node otherwise. If no node is found, it returns 0.
|
|
240
242
|
*/
|
|
241
243
|
lastKey(beginRoot = this.root, iterationType = this.iterationType) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return (_d = (_c = this.getLeftMost(beginRoot, iterationType)) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : 0;
|
|
244
|
+
if (this._compare(0, 1) === types_1.CP.lt)
|
|
245
|
+
return this.getRightMost(beginRoot, iterationType)?.key ?? 0;
|
|
246
|
+
else if (this._compare(0, 1) === types_1.CP.gt)
|
|
247
|
+
return this.getLeftMost(beginRoot, iterationType)?.key ?? 0;
|
|
247
248
|
else
|
|
248
|
-
return
|
|
249
|
+
return this.getRightMost(beginRoot, iterationType)?.key ?? 0;
|
|
249
250
|
}
|
|
250
251
|
/**
|
|
251
252
|
* The function `getNodes` retrieves nodes from a binary tree based on a given node property or key,
|
|
@@ -272,7 +273,7 @@ export class BST extends BinaryTree {
|
|
|
272
273
|
if (!beginRoot)
|
|
273
274
|
return [];
|
|
274
275
|
const ans = [];
|
|
275
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
276
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
276
277
|
const _traverse = (cur) => {
|
|
277
278
|
const callbackResult = callback(cur);
|
|
278
279
|
if (callbackResult === nodeProperty) {
|
|
@@ -284,9 +285,9 @@ export class BST extends BinaryTree {
|
|
|
284
285
|
return;
|
|
285
286
|
// TODO potential bug
|
|
286
287
|
if (callback === this._defaultCallbackByKey) {
|
|
287
|
-
if (this._compare(cur.key, nodeProperty) === CP.gt)
|
|
288
|
+
if (this._compare(cur.key, nodeProperty) === types_1.CP.gt)
|
|
288
289
|
cur.left && _traverse(cur.left);
|
|
289
|
-
if (this._compare(cur.key, nodeProperty) === CP.lt)
|
|
290
|
+
if (this._compare(cur.key, nodeProperty) === types_1.CP.lt)
|
|
290
291
|
cur.right && _traverse(cur.right);
|
|
291
292
|
}
|
|
292
293
|
else {
|
|
@@ -297,7 +298,7 @@ export class BST extends BinaryTree {
|
|
|
297
298
|
_traverse(beginRoot);
|
|
298
299
|
}
|
|
299
300
|
else {
|
|
300
|
-
const queue = new Queue([beginRoot]);
|
|
301
|
+
const queue = new queue_1.Queue([beginRoot]);
|
|
301
302
|
while (queue.size > 0) {
|
|
302
303
|
const cur = queue.shift();
|
|
303
304
|
if (cur) {
|
|
@@ -309,9 +310,9 @@ export class BST extends BinaryTree {
|
|
|
309
310
|
}
|
|
310
311
|
// TODO potential bug
|
|
311
312
|
if (callback === this._defaultCallbackByKey) {
|
|
312
|
-
if (this._compare(cur.key, nodeProperty) === CP.gt)
|
|
313
|
+
if (this._compare(cur.key, nodeProperty) === types_1.CP.gt)
|
|
313
314
|
cur.left && queue.push(cur.left);
|
|
314
|
-
if (this._compare(cur.key, nodeProperty) === CP.lt)
|
|
315
|
+
if (this._compare(cur.key, nodeProperty) === types_1.CP.lt)
|
|
315
316
|
cur.right && queue.push(cur.right);
|
|
316
317
|
}
|
|
317
318
|
else {
|
|
@@ -341,7 +342,7 @@ export class BST extends BinaryTree {
|
|
|
341
342
|
* done recursively or iteratively. It can have two possible values:
|
|
342
343
|
* @returns The function `lesserOrGreaterTraverse` returns an array of `MapCallbackReturn<N>`.
|
|
343
344
|
*/
|
|
344
|
-
lesserOrGreaterTraverse(callback = this._defaultCallbackByKey, lesserOrGreater = CP.lt, targetNode = this.root, iterationType = this.iterationType) {
|
|
345
|
+
lesserOrGreaterTraverse(callback = this._defaultCallbackByKey, lesserOrGreater = types_1.CP.lt, targetNode = this.root, iterationType = this.iterationType) {
|
|
345
346
|
if (typeof targetNode === 'number')
|
|
346
347
|
targetNode = this.get(targetNode);
|
|
347
348
|
const ans = [];
|
|
@@ -350,7 +351,7 @@ export class BST extends BinaryTree {
|
|
|
350
351
|
const targetKey = targetNode.key;
|
|
351
352
|
if (!this.root)
|
|
352
353
|
return ans;
|
|
353
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
354
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
354
355
|
const _traverse = (cur) => {
|
|
355
356
|
const compared = this._compare(cur.key, targetKey);
|
|
356
357
|
if (compared === lesserOrGreater)
|
|
@@ -366,7 +367,7 @@ export class BST extends BinaryTree {
|
|
|
366
367
|
return ans;
|
|
367
368
|
}
|
|
368
369
|
else {
|
|
369
|
-
const queue = new Queue([this.root]);
|
|
370
|
+
const queue = new queue_1.Queue([this.root]);
|
|
370
371
|
while (queue.size > 0) {
|
|
371
372
|
const cur = queue.shift();
|
|
372
373
|
if (cur) {
|
|
@@ -404,7 +405,7 @@ export class BST extends BinaryTree {
|
|
|
404
405
|
this.clear();
|
|
405
406
|
if (sorted.length < 1)
|
|
406
407
|
return false;
|
|
407
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
408
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
408
409
|
const buildBalanceBST = (l, r) => {
|
|
409
410
|
if (l > r)
|
|
410
411
|
return;
|
|
@@ -442,11 +443,10 @@ export class BST extends BinaryTree {
|
|
|
442
443
|
* @returns a boolean value.
|
|
443
444
|
*/
|
|
444
445
|
isAVLBalanced(iterationType = this.iterationType) {
|
|
445
|
-
var _a, _b;
|
|
446
446
|
if (!this.root)
|
|
447
447
|
return true;
|
|
448
448
|
let balanced = true;
|
|
449
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
449
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
450
450
|
const _height = (cur) => {
|
|
451
451
|
if (!cur)
|
|
452
452
|
return 0;
|
|
@@ -471,8 +471,8 @@ export class BST extends BinaryTree {
|
|
|
471
471
|
if (!node.right || last === node.right) {
|
|
472
472
|
node = stack.pop();
|
|
473
473
|
if (node) {
|
|
474
|
-
const left = node.left ?
|
|
475
|
-
const right = node.right ?
|
|
474
|
+
const left = node.left ? depths.get(node.left) ?? -1 : -1;
|
|
475
|
+
const right = node.right ? depths.get(node.right) ?? -1 : -1;
|
|
476
476
|
if (Math.abs(left - right) > 1)
|
|
477
477
|
return false;
|
|
478
478
|
depths.set(node, 1 + Math.max(left, right));
|
|
@@ -487,6 +487,7 @@ export class BST extends BinaryTree {
|
|
|
487
487
|
}
|
|
488
488
|
return balanced;
|
|
489
489
|
}
|
|
490
|
+
_comparator = (a, b) => a - b;
|
|
490
491
|
/**
|
|
491
492
|
* The function compares two values using a comparator function and returns whether the first value
|
|
492
493
|
* is greater than, less than, or equal to the second value.
|
|
@@ -498,10 +499,11 @@ export class BST extends BinaryTree {
|
|
|
498
499
|
_compare(a, b) {
|
|
499
500
|
const compared = this._comparator(a, b);
|
|
500
501
|
if (compared > 0)
|
|
501
|
-
return CP.gt;
|
|
502
|
+
return types_1.CP.gt;
|
|
502
503
|
else if (compared < 0)
|
|
503
|
-
return CP.lt;
|
|
504
|
+
return types_1.CP.lt;
|
|
504
505
|
else
|
|
505
|
-
return CP.eq;
|
|
506
|
+
return types_1.CP.eq;
|
|
506
507
|
}
|
|
507
508
|
}
|
|
509
|
+
exports.BST = BST;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./binary-tree"), exports);
|
|
18
|
+
__exportStar(require("./bst"), exports);
|
|
19
|
+
__exportStar(require("./binary-indexed-tree"), exports);
|
|
20
|
+
__exportStar(require("./segment-tree"), exports);
|
|
21
|
+
__exportStar(require("./avl-tree"), exports);
|
|
22
|
+
__exportStar(require("./rb-tree"), exports);
|
|
23
|
+
__exportStar(require("./tree-multiset"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RBTree = exports.RBTreeNode = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const bst_1 = require("./bst");
|
|
6
|
+
class RBTreeNode extends bst_1.BSTNode {
|
|
7
|
+
constructor(key, val) {
|
|
8
|
+
super(key, val);
|
|
9
|
+
this._color = types_1.RBColor.RED;
|
|
10
|
+
}
|
|
11
|
+
_color;
|
|
12
|
+
get color() {
|
|
13
|
+
return this._color;
|
|
14
|
+
}
|
|
15
|
+
set color(value) {
|
|
16
|
+
this._color = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.RBTreeNode = RBTreeNode;
|
|
20
|
+
class RBTree extends bst_1.BST {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
super(options);
|
|
23
|
+
}
|
|
24
|
+
createNode(key, val) {
|
|
25
|
+
return new RBTreeNode(key, val);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.RBTree = RBTree;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* data-structure-typed
|
|
3
4
|
*
|
|
@@ -5,49 +6,51 @@
|
|
|
5
6
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
7
|
* @license MIT License
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SegmentTree = exports.SegmentTreeNode = void 0;
|
|
11
|
+
class SegmentTreeNode {
|
|
9
12
|
constructor(start, end, sum, val) {
|
|
10
|
-
this._start = 0;
|
|
11
|
-
this._end = 0;
|
|
12
|
-
this._val = null;
|
|
13
|
-
this._sum = 0;
|
|
14
|
-
this._left = null;
|
|
15
|
-
this._right = null;
|
|
16
13
|
this._start = start;
|
|
17
14
|
this._end = end;
|
|
18
15
|
this._sum = sum;
|
|
19
16
|
this._val = val || null;
|
|
20
17
|
}
|
|
18
|
+
_start = 0;
|
|
21
19
|
get start() {
|
|
22
20
|
return this._start;
|
|
23
21
|
}
|
|
24
22
|
set start(v) {
|
|
25
23
|
this._start = v;
|
|
26
24
|
}
|
|
25
|
+
_end = 0;
|
|
27
26
|
get end() {
|
|
28
27
|
return this._end;
|
|
29
28
|
}
|
|
30
29
|
set end(v) {
|
|
31
30
|
this._end = v;
|
|
32
31
|
}
|
|
32
|
+
_val = null;
|
|
33
33
|
get val() {
|
|
34
34
|
return this._val;
|
|
35
35
|
}
|
|
36
36
|
set val(v) {
|
|
37
37
|
this._val = v;
|
|
38
38
|
}
|
|
39
|
+
_sum = 0;
|
|
39
40
|
get sum() {
|
|
40
41
|
return this._sum;
|
|
41
42
|
}
|
|
42
43
|
set sum(v) {
|
|
43
44
|
this._sum = v;
|
|
44
45
|
}
|
|
46
|
+
_left = null;
|
|
45
47
|
get left() {
|
|
46
48
|
return this._left;
|
|
47
49
|
}
|
|
48
50
|
set left(v) {
|
|
49
51
|
this._left = v;
|
|
50
52
|
}
|
|
53
|
+
_right = null;
|
|
51
54
|
get right() {
|
|
52
55
|
return this._right;
|
|
53
56
|
}
|
|
@@ -55,7 +58,8 @@ export class SegmentTreeNode {
|
|
|
55
58
|
this._right = v;
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
|
|
61
|
+
exports.SegmentTreeNode = SegmentTreeNode;
|
|
62
|
+
class SegmentTree {
|
|
59
63
|
/**
|
|
60
64
|
* The constructor initializes the values, start, end, and root properties of an object.
|
|
61
65
|
* @param {number[]} values - An array of numbers that will be used to build a binary search tree.
|
|
@@ -66,8 +70,6 @@ export class SegmentTree {
|
|
|
66
70
|
* included in the range. If not provided, it defaults to the index of the last element in the "values" array.
|
|
67
71
|
*/
|
|
68
72
|
constructor(values, start, end) {
|
|
69
|
-
this._values = [];
|
|
70
|
-
this._start = 0;
|
|
71
73
|
start = start || 0;
|
|
72
74
|
end = end || values.length - 1;
|
|
73
75
|
this._values = values;
|
|
@@ -81,15 +83,19 @@ export class SegmentTree {
|
|
|
81
83
|
this._values = [];
|
|
82
84
|
}
|
|
83
85
|
}
|
|
86
|
+
_values = [];
|
|
84
87
|
get values() {
|
|
85
88
|
return this._values;
|
|
86
89
|
}
|
|
90
|
+
_start = 0;
|
|
87
91
|
get start() {
|
|
88
92
|
return this._start;
|
|
89
93
|
}
|
|
94
|
+
_end;
|
|
90
95
|
get end() {
|
|
91
96
|
return this._end;
|
|
92
97
|
}
|
|
98
|
+
_root;
|
|
93
99
|
get root() {
|
|
94
100
|
return this._root;
|
|
95
101
|
}
|
|
@@ -221,3 +227,4 @@ export class SegmentTree {
|
|
|
221
227
|
this._root = v;
|
|
222
228
|
}
|
|
223
229
|
}
|
|
230
|
+
exports.SegmentTree = SegmentTree;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TreeMultiset = exports.TreeMultisetNode = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const avl_tree_1 = require("./avl-tree");
|
|
6
|
+
class TreeMultisetNode extends avl_tree_1.AVLTreeNode {
|
|
7
|
+
count;
|
|
4
8
|
/**
|
|
5
9
|
* The constructor function initializes a BinaryTreeNode object with a key, value, and count.
|
|
6
10
|
* @param {BinaryTreeNodeKey} key - The `key` parameter is of type `BinaryTreeNodeKey` and represents the unique identifier
|
|
@@ -16,10 +20,11 @@ export class TreeMultisetNode extends AVLTreeNode {
|
|
|
16
20
|
this.count = count;
|
|
17
21
|
}
|
|
18
22
|
}
|
|
23
|
+
exports.TreeMultisetNode = TreeMultisetNode;
|
|
19
24
|
/**
|
|
20
25
|
* The only distinction between a TreeMultiset and a AVLTree lies in the ability of the former to store duplicate nodes through the utilization of counters.
|
|
21
26
|
*/
|
|
22
|
-
|
|
27
|
+
class TreeMultiset extends avl_tree_1.AVLTree {
|
|
23
28
|
/**
|
|
24
29
|
* The constructor function for a TreeMultiset class in TypeScript, which extends another class and sets an option to
|
|
25
30
|
* merge duplicated values.
|
|
@@ -28,8 +33,8 @@ export class TreeMultiset extends AVLTree {
|
|
|
28
33
|
*/
|
|
29
34
|
constructor(options) {
|
|
30
35
|
super(options);
|
|
31
|
-
this._count = 0;
|
|
32
36
|
}
|
|
37
|
+
_count = 0;
|
|
33
38
|
get count() {
|
|
34
39
|
return this._count;
|
|
35
40
|
}
|
|
@@ -45,29 +50,6 @@ export class TreeMultiset extends AVLTree {
|
|
|
45
50
|
createNode(key, val, count) {
|
|
46
51
|
return new TreeMultisetNode(key, val, count);
|
|
47
52
|
}
|
|
48
|
-
/**
|
|
49
|
-
* The function swaps the values of two nodes in a binary tree.
|
|
50
|
-
* @param {N} srcNode - The source node that needs to be swapped with the destination node.
|
|
51
|
-
* @param {N} destNode - The `destNode` parameter represents the destination node where the values
|
|
52
|
-
* from `srcNode` will be swapped into.
|
|
53
|
-
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
54
|
-
*/
|
|
55
|
-
_swap(srcNode, destNode) {
|
|
56
|
-
const { key, val, count, height } = destNode;
|
|
57
|
-
const tempNode = this.createNode(key, val, count);
|
|
58
|
-
if (tempNode) {
|
|
59
|
-
tempNode.height = height;
|
|
60
|
-
destNode.key = srcNode.key;
|
|
61
|
-
destNode.val = srcNode.val;
|
|
62
|
-
destNode.count = srcNode.count;
|
|
63
|
-
destNode.height = srcNode.height;
|
|
64
|
-
srcNode.key = tempNode.key;
|
|
65
|
-
srcNode.val = tempNode.val;
|
|
66
|
-
srcNode.count = tempNode.count;
|
|
67
|
-
srcNode.height = tempNode.height;
|
|
68
|
-
}
|
|
69
|
-
return destNode;
|
|
70
|
-
}
|
|
71
53
|
/**
|
|
72
54
|
* The `add` function adds a new node to a binary search tree, updating the count if the key already
|
|
73
55
|
* exists, and balancing the tree if necessary.
|
|
@@ -104,14 +86,14 @@ export class TreeMultiset extends AVLTree {
|
|
|
104
86
|
while (traversing) {
|
|
105
87
|
if (cur) {
|
|
106
88
|
if (newNode) {
|
|
107
|
-
if (this._compare(cur.key, newNode.key) === CP.eq) {
|
|
89
|
+
if (this._compare(cur.key, newNode.key) === types_1.CP.eq) {
|
|
108
90
|
cur.val = newNode.val;
|
|
109
91
|
cur.count += newNode.count;
|
|
110
92
|
this._setCount(this.count + newNode.count);
|
|
111
93
|
traversing = false;
|
|
112
94
|
inserted = cur;
|
|
113
95
|
}
|
|
114
|
-
else if (this._compare(cur.key, newNode.key) === CP.gt) {
|
|
96
|
+
else if (this._compare(cur.key, newNode.key) === types_1.CP.gt) {
|
|
115
97
|
// Traverse left of the node
|
|
116
98
|
if (cur.left === undefined) {
|
|
117
99
|
//Add to the left of the current node
|
|
@@ -127,7 +109,7 @@ export class TreeMultiset extends AVLTree {
|
|
|
127
109
|
cur = cur.left;
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
|
-
else if (this._compare(cur.key, newNode.key) === CP.lt) {
|
|
112
|
+
else if (this._compare(cur.key, newNode.key) === types_1.CP.lt) {
|
|
131
113
|
// Traverse right of the node
|
|
132
114
|
if (cur.right === undefined) {
|
|
133
115
|
//Add to the right of the current node
|
|
@@ -213,7 +195,7 @@ export class TreeMultiset extends AVLTree {
|
|
|
213
195
|
inserted.push(this.add(NaN, null, 0));
|
|
214
196
|
continue;
|
|
215
197
|
}
|
|
216
|
-
inserted.push(this.add(keyOrNode, data
|
|
198
|
+
inserted.push(this.add(keyOrNode, data?.[i], 1));
|
|
217
199
|
}
|
|
218
200
|
return inserted;
|
|
219
201
|
}
|
|
@@ -230,7 +212,7 @@ export class TreeMultiset extends AVLTree {
|
|
|
230
212
|
if (sorted.length < 1)
|
|
231
213
|
return false;
|
|
232
214
|
this.clear();
|
|
233
|
-
if (iterationType === IterationType.RECURSIVE) {
|
|
215
|
+
if (iterationType === types_1.IterationType.RECURSIVE) {
|
|
234
216
|
const buildBalanceBST = (l, r) => {
|
|
235
217
|
if (l > r)
|
|
236
218
|
return;
|
|
@@ -280,7 +262,7 @@ export class TreeMultiset extends AVLTree {
|
|
|
280
262
|
const curr = this.get(nodeOrKey);
|
|
281
263
|
if (!curr)
|
|
282
264
|
return bstDeletedResult;
|
|
283
|
-
const parent =
|
|
265
|
+
const parent = curr?.parent ? curr.parent : null;
|
|
284
266
|
let needBalanced = null, orgCurrent = curr;
|
|
285
267
|
if (curr.count > 1 && !ignoreCount) {
|
|
286
268
|
curr.count--;
|
|
@@ -294,10 +276,10 @@ export class TreeMultiset extends AVLTree {
|
|
|
294
276
|
}
|
|
295
277
|
else {
|
|
296
278
|
const { familyPosition: fp } = curr;
|
|
297
|
-
if (fp === FamilyPosition.LEFT || fp === FamilyPosition.ROOT_LEFT) {
|
|
279
|
+
if (fp === types_1.FamilyPosition.LEFT || fp === types_1.FamilyPosition.ROOT_LEFT) {
|
|
298
280
|
parent.left = curr.right;
|
|
299
281
|
}
|
|
300
|
-
else if (fp === FamilyPosition.RIGHT || fp === FamilyPosition.ROOT_RIGHT) {
|
|
282
|
+
else if (fp === types_1.FamilyPosition.RIGHT || fp === types_1.FamilyPosition.ROOT_RIGHT) {
|
|
301
283
|
parent.right = curr.right;
|
|
302
284
|
}
|
|
303
285
|
needBalanced = parent;
|
|
@@ -336,6 +318,29 @@ export class TreeMultiset extends AVLTree {
|
|
|
336
318
|
super.clear();
|
|
337
319
|
this._setCount(0);
|
|
338
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* The function swaps the values of two nodes in a binary tree.
|
|
323
|
+
* @param {N} srcNode - The source node that needs to be swapped with the destination node.
|
|
324
|
+
* @param {N} destNode - The `destNode` parameter represents the destination node where the values
|
|
325
|
+
* from `srcNode` will be swapped into.
|
|
326
|
+
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
327
|
+
*/
|
|
328
|
+
_swap(srcNode, destNode) {
|
|
329
|
+
const { key, val, count, height } = destNode;
|
|
330
|
+
const tempNode = this.createNode(key, val, count);
|
|
331
|
+
if (tempNode) {
|
|
332
|
+
tempNode.height = height;
|
|
333
|
+
destNode.key = srcNode.key;
|
|
334
|
+
destNode.val = srcNode.val;
|
|
335
|
+
destNode.count = srcNode.count;
|
|
336
|
+
destNode.height = srcNode.height;
|
|
337
|
+
srcNode.key = tempNode.key;
|
|
338
|
+
srcNode.val = tempNode.val;
|
|
339
|
+
srcNode.count = tempNode.count;
|
|
340
|
+
srcNode.height = tempNode.height;
|
|
341
|
+
}
|
|
342
|
+
return destNode;
|
|
343
|
+
}
|
|
339
344
|
/**
|
|
340
345
|
* The function sets the value of the "_count" property.
|
|
341
346
|
* @param {number} v - number
|
|
@@ -344,3 +349,4 @@ export class TreeMultiset extends AVLTree {
|
|
|
344
349
|
this._count = v;
|
|
345
350
|
}
|
|
346
351
|
}
|
|
352
|
+
exports.TreeMultiset = TreeMultiset;
|