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,14 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* data-structure-typed
|
|
3
4
|
* @author Kirk Qi
|
|
4
5
|
* @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
|
|
5
6
|
* @license MIT License
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FibonacciHeap = exports.FibonacciHeapNode = exports.Heap = void 0;
|
|
10
|
+
class Heap {
|
|
11
|
+
nodes = [];
|
|
12
|
+
comparator;
|
|
8
13
|
constructor(comparator) {
|
|
9
|
-
this.nodes = [];
|
|
10
14
|
this.comparator = comparator;
|
|
11
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the size (number of elements) of the heap.
|
|
18
|
+
*/
|
|
19
|
+
get size() {
|
|
20
|
+
return this.nodes.length;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the last element in the heap, which is not necessarily a leaf node.
|
|
24
|
+
* @returns The last element or undefined if the heap is empty.
|
|
25
|
+
*/
|
|
26
|
+
get leaf() {
|
|
27
|
+
return this.nodes[this.size - 1] ?? undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Static method that creates a binary heap from an array of nodes and a comparison function.
|
|
31
|
+
* @param nodes
|
|
32
|
+
* @param comparator - Comparison function.
|
|
33
|
+
* @returns A new Heap instance.
|
|
34
|
+
*/
|
|
35
|
+
static heapify(nodes, comparator) {
|
|
36
|
+
const binaryHeap = new Heap(comparator);
|
|
37
|
+
binaryHeap.nodes = [...nodes];
|
|
38
|
+
binaryHeap.fix(); // Fix heap properties
|
|
39
|
+
return binaryHeap;
|
|
40
|
+
}
|
|
12
41
|
/**
|
|
13
42
|
* Insert an element into the heap and maintain the heap properties.
|
|
14
43
|
* @param element - The element to be inserted.
|
|
@@ -48,54 +77,6 @@ export class Heap {
|
|
|
48
77
|
pop() {
|
|
49
78
|
return this.poll();
|
|
50
79
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Float operation to maintain heap properties after adding an element.
|
|
53
|
-
* @param index - The index of the newly added element.
|
|
54
|
-
*/
|
|
55
|
-
bubbleUp(index) {
|
|
56
|
-
const element = this.nodes[index];
|
|
57
|
-
while (index > 0) {
|
|
58
|
-
const parentIndex = Math.floor((index - 1) / 2);
|
|
59
|
-
const parent = this.nodes[parentIndex];
|
|
60
|
-
if (this.comparator(element, parent) < 0) {
|
|
61
|
-
this.nodes[index] = parent;
|
|
62
|
-
this.nodes[parentIndex] = element;
|
|
63
|
-
index = parentIndex;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Sinking operation to maintain heap properties after removing the top element.
|
|
72
|
-
* @param index - The index from which to start sinking.
|
|
73
|
-
*/
|
|
74
|
-
sinkDown(index) {
|
|
75
|
-
const leftChildIndex = 2 * index + 1;
|
|
76
|
-
const rightChildIndex = 2 * index + 2;
|
|
77
|
-
const length = this.nodes.length;
|
|
78
|
-
let targetIndex = index;
|
|
79
|
-
if (leftChildIndex < length && this.comparator(this.nodes[leftChildIndex], this.nodes[targetIndex]) < 0) {
|
|
80
|
-
targetIndex = leftChildIndex;
|
|
81
|
-
}
|
|
82
|
-
if (rightChildIndex < length && this.comparator(this.nodes[rightChildIndex], this.nodes[targetIndex]) < 0) {
|
|
83
|
-
targetIndex = rightChildIndex;
|
|
84
|
-
}
|
|
85
|
-
if (targetIndex !== index) {
|
|
86
|
-
const temp = this.nodes[index];
|
|
87
|
-
this.nodes[index] = this.nodes[targetIndex];
|
|
88
|
-
this.nodes[targetIndex] = temp;
|
|
89
|
-
this.sinkDown(targetIndex);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Fix the entire heap to maintain heap properties.
|
|
94
|
-
*/
|
|
95
|
-
fix() {
|
|
96
|
-
for (let i = Math.floor(this.size / 2); i >= 0; i--)
|
|
97
|
-
this.sinkDown(i);
|
|
98
|
-
}
|
|
99
80
|
/**
|
|
100
81
|
* Peek at the top element of the heap without removing it.
|
|
101
82
|
* @returns The top element or undefined if the heap is empty.
|
|
@@ -106,20 +87,6 @@ export class Heap {
|
|
|
106
87
|
}
|
|
107
88
|
return this.nodes[0];
|
|
108
89
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Get the size (number of elements) of the heap.
|
|
111
|
-
*/
|
|
112
|
-
get size() {
|
|
113
|
-
return this.nodes.length;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get the last element in the heap, which is not necessarily a leaf node.
|
|
117
|
-
* @returns The last element or undefined if the heap is empty.
|
|
118
|
-
*/
|
|
119
|
-
get leaf() {
|
|
120
|
-
var _a;
|
|
121
|
-
return (_a = this.nodes[this.size - 1]) !== null && _a !== void 0 ? _a : undefined;
|
|
122
|
-
}
|
|
123
90
|
/**
|
|
124
91
|
* Check if the heap is empty.
|
|
125
92
|
* @returns True if the heap is empty, otherwise false.
|
|
@@ -213,47 +180,82 @@ export class Heap {
|
|
|
213
180
|
return visitedNode;
|
|
214
181
|
}
|
|
215
182
|
/**
|
|
216
|
-
*
|
|
217
|
-
* @param
|
|
218
|
-
* @param comparator - Comparison function.
|
|
219
|
-
* @returns A new Heap instance.
|
|
183
|
+
* Float operation to maintain heap properties after adding an element.
|
|
184
|
+
* @param index - The index of the newly added element.
|
|
220
185
|
*/
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
186
|
+
bubbleUp(index) {
|
|
187
|
+
const element = this.nodes[index];
|
|
188
|
+
while (index > 0) {
|
|
189
|
+
const parentIndex = Math.floor((index - 1) / 2);
|
|
190
|
+
const parent = this.nodes[parentIndex];
|
|
191
|
+
if (this.comparator(element, parent) < 0) {
|
|
192
|
+
this.nodes[index] = parent;
|
|
193
|
+
this.nodes[parentIndex] = element;
|
|
194
|
+
index = parentIndex;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Sinking operation to maintain heap properties after removing the top element.
|
|
203
|
+
* @param index - The index from which to start sinking.
|
|
204
|
+
*/
|
|
205
|
+
sinkDown(index) {
|
|
206
|
+
const leftChildIndex = 2 * index + 1;
|
|
207
|
+
const rightChildIndex = 2 * index + 2;
|
|
208
|
+
const length = this.nodes.length;
|
|
209
|
+
let targetIndex = index;
|
|
210
|
+
if (leftChildIndex < length && this.comparator(this.nodes[leftChildIndex], this.nodes[targetIndex]) < 0) {
|
|
211
|
+
targetIndex = leftChildIndex;
|
|
212
|
+
}
|
|
213
|
+
if (rightChildIndex < length && this.comparator(this.nodes[rightChildIndex], this.nodes[targetIndex]) < 0) {
|
|
214
|
+
targetIndex = rightChildIndex;
|
|
215
|
+
}
|
|
216
|
+
if (targetIndex !== index) {
|
|
217
|
+
const temp = this.nodes[index];
|
|
218
|
+
this.nodes[index] = this.nodes[targetIndex];
|
|
219
|
+
this.nodes[targetIndex] = temp;
|
|
220
|
+
this.sinkDown(targetIndex);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Fix the entire heap to maintain heap properties.
|
|
225
|
+
*/
|
|
226
|
+
fix() {
|
|
227
|
+
for (let i = Math.floor(this.size / 2); i >= 0; i--)
|
|
228
|
+
this.sinkDown(i);
|
|
226
229
|
}
|
|
227
230
|
}
|
|
228
|
-
|
|
231
|
+
exports.Heap = Heap;
|
|
232
|
+
class FibonacciHeapNode {
|
|
233
|
+
element;
|
|
234
|
+
degree;
|
|
235
|
+
left;
|
|
236
|
+
right;
|
|
237
|
+
child;
|
|
238
|
+
parent;
|
|
239
|
+
marked;
|
|
229
240
|
constructor(element, degree = 0) {
|
|
230
241
|
this.element = element;
|
|
231
242
|
this.degree = degree;
|
|
232
243
|
this.marked = false;
|
|
233
244
|
}
|
|
234
245
|
}
|
|
235
|
-
|
|
246
|
+
exports.FibonacciHeapNode = FibonacciHeapNode;
|
|
247
|
+
class FibonacciHeap {
|
|
248
|
+
root;
|
|
249
|
+
size = 0;
|
|
250
|
+
min;
|
|
251
|
+
comparator;
|
|
236
252
|
constructor(comparator) {
|
|
237
|
-
this.size = 0;
|
|
238
253
|
this.clear();
|
|
239
254
|
this.comparator = comparator || this.defaultComparator;
|
|
240
255
|
if (typeof this.comparator !== 'function') {
|
|
241
256
|
throw new Error('FibonacciHeap constructor: given comparator should be a function.');
|
|
242
257
|
}
|
|
243
258
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Default comparator function used by the heap.
|
|
246
|
-
* @param {E} a
|
|
247
|
-
* @param {E} b
|
|
248
|
-
* @protected
|
|
249
|
-
*/
|
|
250
|
-
defaultComparator(a, b) {
|
|
251
|
-
if (a < b)
|
|
252
|
-
return -1;
|
|
253
|
-
if (a > b)
|
|
254
|
-
return 1;
|
|
255
|
-
return 0;
|
|
256
|
-
}
|
|
257
259
|
/**
|
|
258
260
|
* Get the size (number of elements) of the heap.
|
|
259
261
|
* @returns {number} The size of the heap. Returns 0 if the heap is empty. Returns -1 if the heap is invalid.
|
|
@@ -263,29 +265,6 @@ export class FibonacciHeap {
|
|
|
263
265
|
this.min = undefined;
|
|
264
266
|
this.size = 0;
|
|
265
267
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Create a new node.
|
|
268
|
-
* @param element
|
|
269
|
-
* @protected
|
|
270
|
-
*/
|
|
271
|
-
createNode(element) {
|
|
272
|
-
return new FibonacciHeapNode(element);
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Merge the given node with the root list.
|
|
276
|
-
* @param node - The node to be merged.
|
|
277
|
-
*/
|
|
278
|
-
mergeWithRoot(node) {
|
|
279
|
-
if (!this.root) {
|
|
280
|
-
this.root = node;
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
node.right = this.root.right;
|
|
284
|
-
node.left = this.root;
|
|
285
|
-
this.root.right.left = node;
|
|
286
|
-
this.root.right = node;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
268
|
/**
|
|
290
269
|
* O(1) time operation.
|
|
291
270
|
* Insert an element into the heap and maintain the heap properties.
|
|
@@ -346,20 +325,6 @@ export class FibonacciHeap {
|
|
|
346
325
|
}
|
|
347
326
|
return nodes;
|
|
348
327
|
}
|
|
349
|
-
/**
|
|
350
|
-
* O(log n) time operation.
|
|
351
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
352
|
-
* @param node - The node to be removed.
|
|
353
|
-
* @protected
|
|
354
|
-
*/
|
|
355
|
-
removeFromRoot(node) {
|
|
356
|
-
if (this.root === node)
|
|
357
|
-
this.root = node.right;
|
|
358
|
-
if (node.left)
|
|
359
|
-
node.left.right = node.right;
|
|
360
|
-
if (node.right)
|
|
361
|
-
node.right.left = node.left;
|
|
362
|
-
}
|
|
363
328
|
/**
|
|
364
329
|
* O(log n) time operation.
|
|
365
330
|
* Remove and return the top element (smallest or largest element) from the heap.
|
|
@@ -377,52 +342,6 @@ export class FibonacciHeap {
|
|
|
377
342
|
parent.child.right = node;
|
|
378
343
|
}
|
|
379
344
|
}
|
|
380
|
-
/**
|
|
381
|
-
* O(log n) time operation.
|
|
382
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
383
|
-
* @param y
|
|
384
|
-
* @param x
|
|
385
|
-
* @protected
|
|
386
|
-
*/
|
|
387
|
-
link(y, x) {
|
|
388
|
-
this.removeFromRoot(y);
|
|
389
|
-
y.left = y;
|
|
390
|
-
y.right = y;
|
|
391
|
-
this.mergeWithChild(x, y);
|
|
392
|
-
x.degree++;
|
|
393
|
-
y.parent = x;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* O(log n) time operation.
|
|
397
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
398
|
-
* @protected
|
|
399
|
-
*/
|
|
400
|
-
consolidate() {
|
|
401
|
-
const A = new Array(this.size);
|
|
402
|
-
const nodes = this.consumeLinkedList(this.root);
|
|
403
|
-
let x, y, d, t;
|
|
404
|
-
for (const node of nodes) {
|
|
405
|
-
x = node;
|
|
406
|
-
d = x.degree;
|
|
407
|
-
while (A[d]) {
|
|
408
|
-
y = A[d];
|
|
409
|
-
if (this.comparator(x.element, y.element) > 0) {
|
|
410
|
-
t = x;
|
|
411
|
-
x = y;
|
|
412
|
-
y = t;
|
|
413
|
-
}
|
|
414
|
-
this.link(y, x);
|
|
415
|
-
A[d] = undefined;
|
|
416
|
-
d++;
|
|
417
|
-
}
|
|
418
|
-
A[d] = x;
|
|
419
|
-
}
|
|
420
|
-
for (let i = 0; i < this.size; i++) {
|
|
421
|
-
if (A[i] && this.comparator(A[i].element, this.min.element) <= 0) {
|
|
422
|
-
this.min = A[i];
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
345
|
/**
|
|
427
346
|
* O(log n) time operation.
|
|
428
347
|
* Remove and return the top element (smallest or largest element) from the heap.
|
|
@@ -488,4 +407,101 @@ export class FibonacciHeap {
|
|
|
488
407
|
// Clear the heap that was merged
|
|
489
408
|
heapToMerge.clear();
|
|
490
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Default comparator function used by the heap.
|
|
412
|
+
* @param {E} a
|
|
413
|
+
* @param {E} b
|
|
414
|
+
* @protected
|
|
415
|
+
*/
|
|
416
|
+
defaultComparator(a, b) {
|
|
417
|
+
if (a < b)
|
|
418
|
+
return -1;
|
|
419
|
+
if (a > b)
|
|
420
|
+
return 1;
|
|
421
|
+
return 0;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Create a new node.
|
|
425
|
+
* @param element
|
|
426
|
+
* @protected
|
|
427
|
+
*/
|
|
428
|
+
createNode(element) {
|
|
429
|
+
return new FibonacciHeapNode(element);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Merge the given node with the root list.
|
|
433
|
+
* @param node - The node to be merged.
|
|
434
|
+
*/
|
|
435
|
+
mergeWithRoot(node) {
|
|
436
|
+
if (!this.root) {
|
|
437
|
+
this.root = node;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
node.right = this.root.right;
|
|
441
|
+
node.left = this.root;
|
|
442
|
+
this.root.right.left = node;
|
|
443
|
+
this.root.right = node;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* O(log n) time operation.
|
|
448
|
+
* Remove and return the top element (smallest or largest element) from the heap.
|
|
449
|
+
* @param node - The node to be removed.
|
|
450
|
+
* @protected
|
|
451
|
+
*/
|
|
452
|
+
removeFromRoot(node) {
|
|
453
|
+
if (this.root === node)
|
|
454
|
+
this.root = node.right;
|
|
455
|
+
if (node.left)
|
|
456
|
+
node.left.right = node.right;
|
|
457
|
+
if (node.right)
|
|
458
|
+
node.right.left = node.left;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* O(log n) time operation.
|
|
462
|
+
* Remove and return the top element (smallest or largest element) from the heap.
|
|
463
|
+
* @param y
|
|
464
|
+
* @param x
|
|
465
|
+
* @protected
|
|
466
|
+
*/
|
|
467
|
+
link(y, x) {
|
|
468
|
+
this.removeFromRoot(y);
|
|
469
|
+
y.left = y;
|
|
470
|
+
y.right = y;
|
|
471
|
+
this.mergeWithChild(x, y);
|
|
472
|
+
x.degree++;
|
|
473
|
+
y.parent = x;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* O(log n) time operation.
|
|
477
|
+
* Remove and return the top element (smallest or largest element) from the heap.
|
|
478
|
+
* @protected
|
|
479
|
+
*/
|
|
480
|
+
consolidate() {
|
|
481
|
+
const A = new Array(this.size);
|
|
482
|
+
const nodes = this.consumeLinkedList(this.root);
|
|
483
|
+
let x, y, d, t;
|
|
484
|
+
for (const node of nodes) {
|
|
485
|
+
x = node;
|
|
486
|
+
d = x.degree;
|
|
487
|
+
while (A[d]) {
|
|
488
|
+
y = A[d];
|
|
489
|
+
if (this.comparator(x.element, y.element) > 0) {
|
|
490
|
+
t = x;
|
|
491
|
+
x = y;
|
|
492
|
+
y = t;
|
|
493
|
+
}
|
|
494
|
+
this.link(y, x);
|
|
495
|
+
A[d] = undefined;
|
|
496
|
+
d++;
|
|
497
|
+
}
|
|
498
|
+
A[d] = x;
|
|
499
|
+
}
|
|
500
|
+
for (let i = 0; i < this.size; i++) {
|
|
501
|
+
if (A[i] && this.comparator(A[i].element, this.min.element) <= 0) {
|
|
502
|
+
this.min = A[i];
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
491
506
|
}
|
|
507
|
+
exports.FibonacciHeap = FibonacciHeap;
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./max-heap"), exports);
|
|
18
|
+
__exportStar(require("./min-heap"), exports);
|
|
19
|
+
__exportStar(require("./heap"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* data-structure-typed
|
|
3
4
|
*
|
|
@@ -5,8 +6,10 @@
|
|
|
5
6
|
* @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
|
|
6
7
|
* @license MIT License
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MaxHeap = void 0;
|
|
11
|
+
const heap_1 = require("./heap");
|
|
12
|
+
class MaxHeap extends heap_1.Heap {
|
|
10
13
|
constructor(comparator = (a, b) => {
|
|
11
14
|
if (!(typeof a === 'number' && typeof b === 'number')) {
|
|
12
15
|
throw new Error('The a, b params of compare function must be number');
|
|
@@ -18,3 +21,4 @@ export class MaxHeap extends Heap {
|
|
|
18
21
|
super(comparator);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
24
|
+
exports.MaxHeap = MaxHeap;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* data-structure-typed
|
|
3
4
|
*
|
|
@@ -5,8 +6,10 @@
|
|
|
5
6
|
* @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
|
|
6
7
|
* @license MIT License
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MinHeap = void 0;
|
|
11
|
+
const heap_1 = require("./heap");
|
|
12
|
+
class MinHeap extends heap_1.Heap {
|
|
10
13
|
constructor(comparator = (a, b) => {
|
|
11
14
|
if (!(typeof a === 'number' && typeof b === 'number')) {
|
|
12
15
|
throw new Error('The a, b params of compare function must be number');
|
|
@@ -18,3 +21,4 @@ export class MinHeap extends Heap {
|
|
|
18
21
|
super(comparator);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
24
|
+
exports.MinHeap = MinHeap;
|
|
@@ -0,0 +1,27 @@
|
|
|
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("./hash"), exports);
|
|
18
|
+
__exportStar(require("./linked-list"), exports);
|
|
19
|
+
__exportStar(require("./stack"), exports);
|
|
20
|
+
__exportStar(require("./queue"), exports);
|
|
21
|
+
__exportStar(require("./graph"), exports);
|
|
22
|
+
__exportStar(require("./binary-tree"), exports);
|
|
23
|
+
__exportStar(require("./tree"), exports);
|
|
24
|
+
__exportStar(require("./heap"), exports);
|
|
25
|
+
__exportStar(require("./priority-queue"), exports);
|
|
26
|
+
__exportStar(require("./matrix"), exports);
|
|
27
|
+
__exportStar(require("./trie"), exports);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoublyLinkedList = exports.DoublyLinkedListNode = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* data-structure-typed
|
|
3
6
|
*
|
|
@@ -5,7 +8,7 @@
|
|
|
5
8
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
9
|
* @license MIT License
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
class DoublyLinkedListNode {
|
|
9
12
|
/**
|
|
10
13
|
* The constructor function initializes the value, next, and previous properties of an object.
|
|
11
14
|
* @param {E} val - The "val" parameter is the value that will be stored in the node. It can be of any data type, as it
|
|
@@ -16,18 +19,21 @@ export class DoublyLinkedListNode {
|
|
|
16
19
|
this._next = null;
|
|
17
20
|
this._prev = null;
|
|
18
21
|
}
|
|
22
|
+
_val;
|
|
19
23
|
get val() {
|
|
20
24
|
return this._val;
|
|
21
25
|
}
|
|
22
26
|
set val(value) {
|
|
23
27
|
this._val = value;
|
|
24
28
|
}
|
|
29
|
+
_next;
|
|
25
30
|
get next() {
|
|
26
31
|
return this._next;
|
|
27
32
|
}
|
|
28
33
|
set next(value) {
|
|
29
34
|
this._next = value;
|
|
30
35
|
}
|
|
36
|
+
_prev;
|
|
31
37
|
get prev() {
|
|
32
38
|
return this._prev;
|
|
33
39
|
}
|
|
@@ -35,7 +41,8 @@ export class DoublyLinkedListNode {
|
|
|
35
41
|
this._prev = value;
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
|
-
|
|
44
|
+
exports.DoublyLinkedListNode = DoublyLinkedListNode;
|
|
45
|
+
class DoublyLinkedList {
|
|
39
46
|
/**
|
|
40
47
|
* The constructor initializes the linked list with an empty head, tail, and length.
|
|
41
48
|
*/
|
|
@@ -44,21 +51,27 @@ export class DoublyLinkedList {
|
|
|
44
51
|
this._tail = null;
|
|
45
52
|
this._length = 0;
|
|
46
53
|
}
|
|
54
|
+
_head;
|
|
47
55
|
get head() {
|
|
48
56
|
return this._head;
|
|
49
57
|
}
|
|
50
58
|
set head(value) {
|
|
51
59
|
this._head = value;
|
|
52
60
|
}
|
|
61
|
+
_tail;
|
|
53
62
|
get tail() {
|
|
54
63
|
return this._tail;
|
|
55
64
|
}
|
|
56
65
|
set tail(value) {
|
|
57
66
|
this._tail = value;
|
|
58
67
|
}
|
|
68
|
+
_length;
|
|
59
69
|
get length() {
|
|
60
70
|
return this._length;
|
|
61
71
|
}
|
|
72
|
+
get size() {
|
|
73
|
+
return this.length;
|
|
74
|
+
}
|
|
62
75
|
/**
|
|
63
76
|
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
64
77
|
* given array.
|
|
@@ -183,19 +196,14 @@ export class DoublyLinkedList {
|
|
|
183
196
|
* @returns The method `peekFirst()` returns the first node of the doubly linked list, or `null` if the list is empty.
|
|
184
197
|
*/
|
|
185
198
|
peekFirst() {
|
|
186
|
-
|
|
187
|
-
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.val;
|
|
199
|
+
return this.head?.val;
|
|
188
200
|
}
|
|
189
201
|
/**
|
|
190
202
|
* The `peekLast` function returns the last node in a doubly linked list, or null if the list is empty.
|
|
191
203
|
* @returns The method `peekLast()` returns the last node of the doubly linked list, or `null` if the list is empty.
|
|
192
204
|
*/
|
|
193
205
|
peekLast() {
|
|
194
|
-
|
|
195
|
-
return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.val;
|
|
196
|
-
}
|
|
197
|
-
get size() {
|
|
198
|
-
return this.length;
|
|
206
|
+
return this.tail?.val;
|
|
199
207
|
}
|
|
200
208
|
/**
|
|
201
209
|
* The `getAt` function returns the value at a specified index in a linked list, or null if the index is out of bounds.
|
|
@@ -576,3 +584,4 @@ export class DoublyLinkedList {
|
|
|
576
584
|
return false;
|
|
577
585
|
}
|
|
578
586
|
}
|
|
587
|
+
exports.DoublyLinkedList = DoublyLinkedList;
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./singly-linked-list"), exports);
|
|
18
|
+
__exportStar(require("./doubly-linked-list"), exports);
|
|
19
|
+
__exportStar(require("./skip-linked-list"), exports);
|