@raikuxq/alg-ds 1.1.5 → 1.2.0
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/README.md +67 -92
- package/lib/{algorithms → app/algorithms}/binary-search.d.ts +0 -0
- package/lib/app/algorithms/binary-search.js +27 -0
- package/lib/{algorithms → app/algorithms}/factorial.d.ts +0 -0
- package/lib/{algorithms → app/algorithms}/factorial.js +1 -1
- package/lib/{algorithms → app/algorithms}/fibonacci.d.ts +0 -0
- package/lib/app/algorithms/fibonacci.js +17 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/AbstractGraphIterator.d.ts +0 -0
- package/lib/app/algorithms/graph/iterator/AbstractGraphIterator.js +83 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/GraphIteratorBFS.d.ts +0 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/GraphIteratorBFS.js +2 -2
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/GraphIteratorDFS.d.ts +0 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/GraphIteratorDFS.js +2 -2
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/GraphIteratorDijkstra.d.ts +0 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/iterator/GraphIteratorDijkstra.js +3 -5
- package/lib/{data-structures/Graph/strategy → app/algorithms/graph/iterator-strategy}/BFSIterationStrategy.d.ts +0 -0
- package/lib/{data-structures/Graph/strategy → app/algorithms/graph/iterator-strategy}/BFSIterationStrategy.js +1 -1
- package/lib/{data-structures/Graph/strategy → app/algorithms/graph/iterator-strategy}/DFSIterationStrategy.d.ts +0 -0
- package/lib/{data-structures/Graph/strategy → app/algorithms/graph/iterator-strategy}/DFSIterationStrategy.js +1 -1
- package/lib/{data-structures/Graph/strategy → app/algorithms/graph/iterator-strategy}/DijkstraIterationStrategy.d.ts +0 -0
- package/lib/{data-structures/Graph/strategy → app/algorithms/graph/iterator-strategy}/DijkstraIterationStrategy.js +1 -1
- package/lib/{data-structures/Graph → app/algorithms/graph}/presenter/presenterAdjacencyLists.d.ts +0 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/presenter/presenterAdjacencyLists.js +1 -1
- package/lib/{data-structures/Graph → app/algorithms/graph}/presenter/presenterAdjacencyMatrix.d.ts +2 -2
- package/lib/{data-structures/Graph → app/algorithms/graph}/presenter/presenterAdjacencyMatrix.js +1 -1
- package/lib/{data-structures/Graph → app/algorithms/graph}/searching/hasPath.d.ts +0 -0
- package/lib/app/algorithms/graph/searching/hasPath.js +30 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/searching/shortestPath.d.ts +0 -0
- package/lib/app/algorithms/graph/searching/shortestPath.js +30 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/transposing/transposeDirectedGraph.d.ts +0 -0
- package/lib/{data-structures/Graph → app/algorithms/graph}/transposing/transposeDirectedGraph.js +3 -3
- package/lib/{algorithms → app/algorithms}/memoize.d.ts +0 -0
- package/lib/{algorithms → app/algorithms}/memoize.js +1 -1
- package/lib/{algorithms → app/algorithms}/sorts/bubble-sort.d.ts +0 -0
- package/lib/{algorithms → app/algorithms}/sorts/bubble-sort.js +1 -1
- package/lib/{algorithms → app/algorithms}/sorts/insertion-sort.d.ts +0 -0
- package/lib/app/algorithms/sorts/insertion-sort.js +25 -0
- package/lib/{algorithms → app/algorithms}/sorts/merge-sort.d.ts +0 -0
- package/lib/app/algorithms/sorts/merge-sort.js +61 -0
- package/lib/{algorithms → app/algorithms}/sorts/quick-sort.d.ts +0 -0
- package/lib/{algorithms → app/algorithms}/sorts/quick-sort.js +1 -1
- package/lib/{algorithms → app/algorithms}/sorts/select-sort.d.ts +0 -0
- package/lib/{algorithms → app/algorithms}/sorts/select-sort.js +1 -1
- package/lib/app/algorithms/transpose-matrix.d.ts +5 -0
- package/lib/app/algorithms/transpose-matrix.js +18 -0
- package/lib/{constants.d.ts → app/constants.d.ts} +0 -0
- package/lib/{constants.js → app/constants.js} +1 -1
- package/lib/{data-structures → app/data-structures}/BinaryTree/AbstractBinaryTree/AbstractBinaryNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/BinaryTree/AbstractBinaryTree/AbstractBinaryNode.js +1 -1
- package/lib/{data-structures → app/data-structures}/BinaryTree/AbstractBinaryTree/AbstractBinaryTree.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/BinaryTree/AbstractBinaryTree/AbstractBinaryTree.js +1 -1
- package/lib/{data-structures → app/data-structures}/BinaryTree/BinarySearchTree/BinarySearchNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/BinaryTree/BinarySearchTree/BinarySearchNode.js +1 -1
- package/lib/{data-structures → app/data-structures}/BinaryTree/BinarySearchTree/BinarySearchTree.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/BinaryTree/BinarySearchTree/BinarySearchTree.js +7 -4
- package/lib/{data-structures → app/data-structures}/BinaryTree/RandBinarySearchTree/RandBinarySearchNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/BinaryTree/RandBinarySearchTree/RandBinarySearchNode.js +1 -1
- package/lib/{data-structures → app/data-structures}/BinaryTree/RandBinarySearchTree/RandBinarySearchTree.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/BinaryTree/RandBinarySearchTree/RandBinarySearchTree.js +3 -2
- package/lib/app/data-structures/BinaryTree/_helpers/createBinaryTree.d.ts +6 -0
- package/lib/app/data-structures/BinaryTree/_helpers/createBinaryTree.js +22 -0
- package/lib/{data-structures → app/data-structures}/Graph/AbstractGraph.d.ts +0 -0
- package/lib/app/data-structures/Graph/AbstractGraph.js +143 -0
- package/lib/{data-structures → app/data-structures}/Graph/DirectedGraph.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/Graph/DirectedGraph.js +5 -4
- package/lib/{data-structures → app/data-structures}/Graph/GraphEdge.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/Graph/GraphEdge.js +1 -1
- package/lib/{data-structures → app/data-structures}/Graph/UndirectedGraph.d.ts +0 -0
- package/lib/app/data-structures/Graph/UndirectedGraph.js +103 -0
- package/lib/app/data-structures/Graph/_helpers/createGraph.d.ts +6 -0
- package/lib/app/data-structures/Graph/_helpers/createGraph.js +22 -0
- package/lib/app/data-structures/Graph/_helpers/createGraphFromMatrix.d.ts +7 -0
- package/lib/app/data-structures/Graph/_helpers/createGraphFromMatrix.js +42 -0
- package/lib/{data-structures/Graph/demo → app/data-structures/Graph/_helpers}/generateRandomGraph.d.ts +0 -0
- package/lib/app/data-structures/Graph/_helpers/generateRandomGraph.js +67 -0
- package/lib/{data-structures → app/data-structures}/HashTable/HashTable.d.ts +0 -0
- package/lib/app/data-structures/HashTable/HashTable.js +171 -0
- package/lib/{data-structures → app/data-structures}/HashTable/HashTableNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/HashTable/HashTableNode.js +1 -1
- package/lib/{data-structures → app/data-structures}/LinkedList/AbstractLinkedList/AbstractLinkedList.d.ts +2 -2
- package/lib/app/data-structures/LinkedList/AbstractLinkedList/AbstractLinkedList.js +241 -0
- package/lib/{data-structures → app/data-structures}/LinkedList/AbstractLinkedList/AbstractLinkedNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/LinkedList/AbstractLinkedList/AbstractLinkedNode.js +1 -1
- package/lib/{data-structures → app/data-structures}/LinkedList/DoubleLinkedList/DoubleLinkedList.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/LinkedList/DoubleLinkedList/DoubleLinkedList.js +4 -3
- package/lib/{data-structures → app/data-structures}/LinkedList/DoubleLinkedList/DoubleLinkedNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/LinkedList/DoubleLinkedList/DoubleLinkedNode.js +1 -1
- package/lib/{data-structures → app/data-structures}/LinkedList/SingleLinkedList/SingleLinkedList.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/LinkedList/SingleLinkedList/SingleLinkedList.js +3 -2
- package/lib/{data-structures → app/data-structures}/LinkedList/SingleLinkedList/SingleLinkedNode.d.ts +0 -0
- package/lib/{data-structures → app/data-structures}/LinkedList/SingleLinkedList/SingleLinkedNode.js +1 -1
- package/lib/app/data-structures/LinkedList/_helpers/createLinkedList.d.ts +3 -0
- package/lib/app/data-structures/LinkedList/_helpers/createLinkedList.js +19 -0
- package/lib/{data-structures → app/data-structures}/LoopedArray/LoopedArray.d.ts +0 -3
- package/lib/{data-structures → app/data-structures}/LoopedArray/LoopedArray.js +17 -9
- package/lib/{data-structures → app/data-structures}/Queue/Queue.d.ts +0 -0
- package/lib/app/data-structures/Queue/Queue.js +85 -0
- package/lib/{data-structures → app/data-structures}/Stack/Stack.d.ts +0 -0
- package/lib/app/data-structures/Stack/Stack.js +85 -0
- package/lib/app/exceptions/CollectionIsEmptyException.d.ts +4 -0
- package/lib/app/exceptions/CollectionIsEmptyException.js +28 -0
- package/lib/app/exceptions/CollectionIsFullException.d.ts +4 -0
- package/lib/app/exceptions/CollectionIsFullException.js +28 -0
- package/lib/app/exceptions/IndexOutOfBoundsException.d.ts +4 -0
- package/lib/app/exceptions/IndexOutOfBoundsException.js +28 -0
- package/lib/app/exceptions/IsAlreadyExistsException.d.ts +4 -0
- package/lib/app/exceptions/IsAlreadyExistsException.js +28 -0
- package/lib/app/exceptions/IsNotFoundException.d.ts +4 -0
- package/lib/app/exceptions/IsNotFoundException.js +28 -0
- package/lib/app/exceptions/ValueOutOfRangeException.d.ts +4 -0
- package/lib/app/exceptions/ValueOutOfRangeException.js +28 -0
- package/lib/app/exceptions/base/IllegalArgumentException.d.ts +3 -0
- package/lib/app/exceptions/base/IllegalArgumentException.js +27 -0
- package/lib/app/exceptions/base/IllegalStateException.d.ts +3 -0
- package/lib/app/exceptions/base/IllegalStateException.js +27 -0
- package/lib/{types → app/types}/EnumBinarySearchTreeType.d.ts +0 -0
- package/lib/{types → app/types}/EnumBinarySearchTreeType.js +1 -1
- package/lib/app/types/EnumGraphTraversalType.d.ts +5 -0
- package/lib/app/types/EnumGraphTraversalType.js +10 -0
- package/lib/{types → app/types}/EnumGraphType.d.ts +0 -0
- package/lib/{types → app/types}/EnumGraphType.js +1 -1
- package/lib/{types → app/types}/EnumLinkedListType.d.ts +0 -0
- package/lib/{types → app/types}/EnumLinkedListType.js +1 -1
- package/lib/{types → app/types}/EnumRandomGenerationFormat.d.ts +0 -0
- package/lib/{types → app/types}/EnumRandomGenerationFormat.js +1 -1
- package/lib/app/types/EnumSortType.d.ts +7 -0
- package/lib/app/types/EnumSortType.js +12 -0
- package/lib/{types → app/types}/EnumTreeTraversalType.d.ts +0 -0
- package/lib/{types → app/types}/EnumTreeTraversalType.js +1 -1
- package/lib/{types → app/types}/FnCompareTwo.d.ts +0 -0
- package/lib/{types → app/types}/FnCompareTwo.js +1 -1
- package/lib/{types → app/types}/FnToMemoize.d.ts +0 -0
- package/lib/{types → app/types}/FnToMemoize.js +1 -1
- package/lib/{types → app/types}/IArrayFacade.d.ts +0 -0
- package/lib/{types → app/types}/IArrayFacade.js +1 -1
- package/lib/{types → app/types}/IBiDirectIterable.d.ts +0 -0
- package/lib/{types → app/types}/IBiDirectIterable.js +1 -1
- package/lib/{types → app/types}/IBiDirectIterator.d.ts +0 -0
- package/lib/{types → app/types}/IBiDirectIterator.js +1 -1
- package/lib/{types → app/types}/IBinaryTree.d.ts +0 -0
- package/lib/{types → app/types}/IBinaryTree.js +1 -1
- package/lib/{types → app/types}/IConvertableToArray.d.ts +0 -0
- package/lib/{types → app/types}/IConvertableToArray.js +1 -1
- package/lib/{types → app/types}/IGraph.d.ts +0 -0
- package/lib/{types → app/types}/IGraph.js +1 -1
- package/lib/{types → app/types}/IGraphIterationStrategy.d.ts +0 -0
- package/lib/{types → app/types}/IGraphIterationStrategy.js +1 -1
- package/lib/{types → app/types}/IGraphIterator.d.ts +0 -0
- package/lib/{types → app/types}/IGraphIterator.js +1 -1
- package/lib/{types → app/types}/IIterable.d.ts +0 -0
- package/lib/{types → app/types}/IIterable.js +1 -1
- package/lib/{types → app/types}/IIterator.d.ts +0 -0
- package/lib/{types → app/types}/IIterator.js +1 -1
- package/lib/{types → app/types}/IKeyValueStorage.d.ts +0 -0
- package/lib/{types → app/types}/IKeyValueStorage.js +1 -1
- package/lib/{types → app/types}/ILinearStorage.d.ts +0 -0
- package/lib/{types → app/types}/ILinearStorage.js +1 -1
- package/lib/{types → app/types}/ILinearStorageRA.d.ts +0 -0
- package/lib/{types → app/types}/ILinearStorageRA.js +1 -1
- package/lib/{types → app/types}/ILinkedList.d.ts +0 -0
- package/lib/{types → app/types}/ILinkedList.js +1 -1
- package/lib/app/types/TypeArrayMatrix.d.ts +1 -0
- package/lib/app/types/TypeArrayMatrix.js +3 -0
- package/lib/{utils.d.ts → app/utils.d.ts} +8 -0
- package/lib/{utils.js → app/utils.js} +21 -2
- package/lib/exports/algorithms.d.ts +15 -15
- package/lib/exports/algorithms.js +16 -16
- package/lib/exports/constants.d.ts +1 -1
- package/lib/exports/constants.js +2 -2
- package/lib/exports/data-structures.d.ts +10 -10
- package/lib/exports/data-structures.js +11 -11
- package/lib/exports/helpers.d.ts +5 -5
- package/lib/exports/helpers.js +6 -6
- package/lib/exports/sorts.d.ts +5 -5
- package/lib/exports/sorts.js +6 -6
- package/lib/exports/types.d.ts +16 -0
- package/lib/exports/types.js +34 -0
- package/lib/exports/utils.d.ts +2 -2
- package/lib/exports/utils.js +3 -3
- package/lib/exports.d.ts +47 -38
- package/lib/exports.js +56 -40
- package/lib/index.js +1 -2
- package/package.json +11 -6
- package/lib/algorithms/binary-search.js +0 -27
- package/lib/algorithms/fibonacci.js +0 -17
- package/lib/algorithms/sorts/insertion-sort.js +0 -25
- package/lib/algorithms/sorts/merge-sort.js +0 -61
- package/lib/algorithms/transpose-matrix.d.ts +0 -5
- package/lib/algorithms/transpose-matrix.js +0 -20
- package/lib/data-structures/Graph/AbstractGraph.js +0 -141
- package/lib/data-structures/Graph/UndirectedGraph.js +0 -102
- package/lib/data-structures/Graph/demo/generateRandomGraph.js +0 -72
- package/lib/data-structures/Graph/iterator/AbstractGraphIterator.js +0 -90
- package/lib/data-structures/Graph/searching/hasPath.js +0 -29
- package/lib/data-structures/Graph/searching/shortestPath.js +0 -29
- package/lib/data-structures/HashTable/HashTable.js +0 -169
- package/lib/data-structures/LinkedList/AbstractLinkedList/AbstractLinkedList.js +0 -236
- package/lib/data-structures/Queue/Queue.js +0 -83
- package/lib/data-structures/Stack/Stack.js +0 -83
- package/lib/helpers/createBinaryTree.d.ts +0 -6
- package/lib/helpers/createBinaryTree.js +0 -22
- package/lib/helpers/createGraph.d.ts +0 -6
- package/lib/helpers/createGraph.js +0 -24
- package/lib/helpers/createGraphFromMatrix.d.ts +0 -7
- package/lib/helpers/createGraphFromMatrix.js +0 -37
- package/lib/helpers/createLinkedList.d.ts +0 -3
- package/lib/helpers/createLinkedList.js +0 -21
- package/lib/types/ArrayMatrix.d.ts +0 -1
- package/lib/types/ArrayMatrix.js +0 -3
package/lib/exports.d.ts
CHANGED
|
@@ -1,44 +1,53 @@
|
|
|
1
|
-
import { factorial, memoizedFactorial } from "./algorithms/factorial";
|
|
2
|
-
import { fibonacci, memoizedFibonacci } from "./algorithms/fibonacci";
|
|
3
|
-
import { binarySearch } from "./algorithms/binary-search";
|
|
4
|
-
import { transposeMatrix } from "./algorithms/transpose-matrix";
|
|
5
|
-
import { transposeDirectedGraph } from "./
|
|
6
|
-
import BFSIterationStrategy from "./
|
|
7
|
-
import DFSIterationStrategy from "./
|
|
8
|
-
import DijkstraIterationStrategy from "./
|
|
9
|
-
import GraphIteratorBFS from "./
|
|
10
|
-
import GraphIteratorDFS from "./
|
|
11
|
-
import GraphIteratorDijkstra from "./
|
|
12
|
-
import { hasPath } from "./
|
|
13
|
-
import { shortestPath } from "./
|
|
14
|
-
import { presenterAdjacencyMatrix } from "./
|
|
15
|
-
import { presenterAdjacencyLists } from "./
|
|
16
|
-
import { generateRandomGraph } from "./data-structures/Graph/
|
|
17
|
-
import { createLinkedList } from "./
|
|
18
|
-
import { createBinaryTree } from "./
|
|
19
|
-
import { createGraph } from "./
|
|
20
|
-
import { createGraphFromMatrix } from "./
|
|
21
|
-
import { EDGE_EXISTS_STATE, EDGE_NOT_EXISTS_STATE } from "./constants";
|
|
22
|
-
import Queue from "./data-structures/Queue/Queue";
|
|
23
|
-
import Stack from "./data-structures/Stack/Stack";
|
|
24
|
-
import UndirectedGraph from "./data-structures/Graph/UndirectedGraph";
|
|
25
|
-
import DirectedGraph from "./data-structures/Graph/DirectedGraph";
|
|
26
|
-
import BinarySearchTree from "./data-structures/BinaryTree/BinarySearchTree/BinarySearchTree";
|
|
27
|
-
import RandBinarySearchTree from "./data-structures/BinaryTree/RandBinarySearchTree/RandBinarySearchTree";
|
|
28
|
-
import DoubleLinkedList from "./data-structures/LinkedList/DoubleLinkedList/DoubleLinkedList";
|
|
29
|
-
import SingleLinkedList from "./data-structures/LinkedList/SingleLinkedList/SingleLinkedList";
|
|
30
|
-
import LoopedArray from "./data-structures/LoopedArray/LoopedArray";
|
|
31
|
-
import HashTable from "./data-structures/HashTable/HashTable";
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
1
|
+
import { factorial, memoizedFactorial } from "./app/algorithms/factorial";
|
|
2
|
+
import { fibonacci, memoizedFibonacci } from "./app/algorithms/fibonacci";
|
|
3
|
+
import { binarySearch } from "./app/algorithms/binary-search";
|
|
4
|
+
import { transposeMatrix } from "./app/algorithms/transpose-matrix";
|
|
5
|
+
import { transposeDirectedGraph } from "./app/algorithms/graph/transposing/transposeDirectedGraph";
|
|
6
|
+
import BFSIterationStrategy from "./app/algorithms/graph/iterator-strategy/BFSIterationStrategy";
|
|
7
|
+
import DFSIterationStrategy from "./app/algorithms/graph/iterator-strategy/DFSIterationStrategy";
|
|
8
|
+
import DijkstraIterationStrategy from "./app/algorithms/graph/iterator-strategy/DijkstraIterationStrategy";
|
|
9
|
+
import GraphIteratorBFS from "./app/algorithms/graph/iterator/GraphIteratorBFS";
|
|
10
|
+
import GraphIteratorDFS from "./app/algorithms/graph/iterator/GraphIteratorDFS";
|
|
11
|
+
import GraphIteratorDijkstra from "./app/algorithms/graph/iterator/GraphIteratorDijkstra";
|
|
12
|
+
import { hasPath } from "./app/algorithms/graph/searching/hasPath";
|
|
13
|
+
import { shortestPath } from "./app/algorithms/graph/searching/shortestPath";
|
|
14
|
+
import { presenterAdjacencyMatrix } from "./app/algorithms/graph/presenter/presenterAdjacencyMatrix";
|
|
15
|
+
import { presenterAdjacencyLists } from "./app/algorithms/graph/presenter/presenterAdjacencyLists";
|
|
16
|
+
import { generateRandomGraph } from "./app/data-structures/Graph/_helpers/generateRandomGraph";
|
|
17
|
+
import { createLinkedList } from "./app/data-structures/LinkedList/_helpers/createLinkedList";
|
|
18
|
+
import { createBinaryTree } from "./app/data-structures/BinaryTree/_helpers/createBinaryTree";
|
|
19
|
+
import { createGraph } from "./app/data-structures/Graph/_helpers/createGraph";
|
|
20
|
+
import { createGraphFromMatrix } from "./app/data-structures/Graph/_helpers/createGraphFromMatrix";
|
|
21
|
+
import { EDGE_EXISTS_STATE, EDGE_NOT_EXISTS_STATE } from "./app/constants";
|
|
22
|
+
import Queue from "./app/data-structures/Queue/Queue";
|
|
23
|
+
import Stack from "./app/data-structures/Stack/Stack";
|
|
24
|
+
import UndirectedGraph from "./app/data-structures/Graph/UndirectedGraph";
|
|
25
|
+
import DirectedGraph from "./app/data-structures/Graph/DirectedGraph";
|
|
26
|
+
import BinarySearchTree from "./app/data-structures/BinaryTree/BinarySearchTree/BinarySearchTree";
|
|
27
|
+
import RandBinarySearchTree from "./app/data-structures/BinaryTree/RandBinarySearchTree/RandBinarySearchTree";
|
|
28
|
+
import DoubleLinkedList from "./app/data-structures/LinkedList/DoubleLinkedList/DoubleLinkedList";
|
|
29
|
+
import SingleLinkedList from "./app/data-structures/LinkedList/SingleLinkedList/SingleLinkedList";
|
|
30
|
+
import LoopedArray from "./app/data-structures/LoopedArray/LoopedArray";
|
|
31
|
+
import HashTable from "./app/data-structures/HashTable/HashTable";
|
|
32
|
+
import IsNotFoundException from "./app/exceptions/IsNotFoundException";
|
|
33
|
+
import IsAlreadyExistsException from "./app/exceptions/IsAlreadyExistsException";
|
|
34
|
+
import ValueOutOfRangeException from "./app/exceptions/ValueOutOfRangeException";
|
|
35
|
+
import IllegalArgumentException from "./app/exceptions/base/IllegalArgumentException";
|
|
36
|
+
import IllegalStateException from "./app/exceptions/base/IllegalStateException";
|
|
37
|
+
import IndexOutOfBoundsException from "./app/exceptions/IndexOutOfBoundsException";
|
|
38
|
+
import CollectionIsEmptyException from "./app/exceptions/CollectionIsEmptyException";
|
|
39
|
+
import CollectionIsFullException from "./app/exceptions/CollectionIsFullException";
|
|
40
|
+
import { bubbleSort } from "./app/algorithms/sorts/bubble-sort";
|
|
41
|
+
import { selectSort } from "./app/algorithms/sorts/select-sort";
|
|
42
|
+
import { mergeSort } from "./app/algorithms/sorts/merge-sort";
|
|
43
|
+
import { insertionSort } from "./app/algorithms/sorts/insertion-sort";
|
|
44
|
+
import { quickSort } from "./app/algorithms/sorts/quick-sort";
|
|
45
|
+
import { memoize } from "./app/algorithms/memoize";
|
|
46
|
+
import { getMinIndex, getMinIndexFromIndex, perf, randomizeNumberInRange, roundNumber, swapArrayItems, perfAsync } from "./app/utils";
|
|
39
47
|
export { perf, getMinIndex, getMinIndexFromIndex, memoize, perfAsync, roundNumber, randomizeNumberInRange, swapArrayItems, };
|
|
40
48
|
export { bubbleSort, insertionSort, mergeSort, selectSort, quickSort };
|
|
41
49
|
export { Stack, Queue, SingleLinkedList, DoubleLinkedList, RandBinarySearchTree, BinarySearchTree, DirectedGraph, UndirectedGraph, LoopedArray, HashTable, };
|
|
42
50
|
export { EDGE_NOT_EXISTS_STATE, EDGE_EXISTS_STATE };
|
|
43
51
|
export { createGraph, createGraphFromMatrix, createBinaryTree, createLinkedList, generateRandomGraph, };
|
|
44
52
|
export { binarySearch, factorial, memoizedFactorial, memoizedFibonacci, fibonacci, transposeMatrix, GraphIteratorDFS, presenterAdjacencyLists, presenterAdjacencyMatrix, hasPath, shortestPath, DijkstraIterationStrategy, DFSIterationStrategy, BFSIterationStrategy, GraphIteratorBFS, GraphIteratorDijkstra, transposeDirectedGraph, };
|
|
53
|
+
export { CollectionIsEmptyException, CollectionIsFullException, IsNotFoundException, IsAlreadyExistsException, ValueOutOfRangeException, IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, };
|
package/lib/exports.js
CHANGED
|
@@ -1,84 +1,100 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transposeDirectedGraph = exports.GraphIteratorDijkstra = exports.GraphIteratorBFS = exports.BFSIterationStrategy = exports.DFSIterationStrategy = exports.DijkstraIterationStrategy = exports.shortestPath = exports.hasPath = exports.presenterAdjacencyMatrix = exports.presenterAdjacencyLists = exports.GraphIteratorDFS = exports.transposeMatrix = exports.fibonacci = exports.memoizedFibonacci = exports.memoizedFactorial = exports.factorial = exports.binarySearch = exports.generateRandomGraph = exports.createLinkedList = exports.createBinaryTree = exports.createGraphFromMatrix = exports.createGraph = exports.EDGE_EXISTS_STATE = exports.EDGE_NOT_EXISTS_STATE = exports.HashTable = exports.LoopedArray = exports.UndirectedGraph = exports.DirectedGraph = exports.BinarySearchTree = exports.RandBinarySearchTree = exports.DoubleLinkedList = exports.SingleLinkedList = exports.Queue = exports.Stack = exports.quickSort = exports.selectSort = exports.mergeSort = exports.insertionSort = exports.bubbleSort = exports.swapArrayItems = exports.randomizeNumberInRange = exports.roundNumber = exports.perfAsync = exports.memoize = exports.getMinIndexFromIndex = exports.getMinIndex = exports.perf = void 0;
|
|
4
|
-
var factorial_1 = require("./algorithms/factorial");
|
|
3
|
+
exports.IndexOutOfBoundsException = exports.IllegalStateException = exports.IllegalArgumentException = exports.ValueOutOfRangeException = exports.IsAlreadyExistsException = exports.IsNotFoundException = exports.CollectionIsFullException = exports.CollectionIsEmptyException = exports.transposeDirectedGraph = exports.GraphIteratorDijkstra = exports.GraphIteratorBFS = exports.BFSIterationStrategy = exports.DFSIterationStrategy = exports.DijkstraIterationStrategy = exports.shortestPath = exports.hasPath = exports.presenterAdjacencyMatrix = exports.presenterAdjacencyLists = exports.GraphIteratorDFS = exports.transposeMatrix = exports.fibonacci = exports.memoizedFibonacci = exports.memoizedFactorial = exports.factorial = exports.binarySearch = exports.generateRandomGraph = exports.createLinkedList = exports.createBinaryTree = exports.createGraphFromMatrix = exports.createGraph = exports.EDGE_EXISTS_STATE = exports.EDGE_NOT_EXISTS_STATE = exports.HashTable = exports.LoopedArray = exports.UndirectedGraph = exports.DirectedGraph = exports.BinarySearchTree = exports.RandBinarySearchTree = exports.DoubleLinkedList = exports.SingleLinkedList = exports.Queue = exports.Stack = exports.quickSort = exports.selectSort = exports.mergeSort = exports.insertionSort = exports.bubbleSort = exports.swapArrayItems = exports.randomizeNumberInRange = exports.roundNumber = exports.perfAsync = exports.memoize = exports.getMinIndexFromIndex = exports.getMinIndex = exports.perf = void 0;
|
|
4
|
+
var factorial_1 = require("./app/algorithms/factorial");
|
|
5
5
|
Object.defineProperty(exports, "factorial", { enumerable: true, get: function () { return factorial_1.factorial; } });
|
|
6
6
|
Object.defineProperty(exports, "memoizedFactorial", { enumerable: true, get: function () { return factorial_1.memoizedFactorial; } });
|
|
7
|
-
var fibonacci_1 = require("./algorithms/fibonacci");
|
|
7
|
+
var fibonacci_1 = require("./app/algorithms/fibonacci");
|
|
8
8
|
Object.defineProperty(exports, "fibonacci", { enumerable: true, get: function () { return fibonacci_1.fibonacci; } });
|
|
9
9
|
Object.defineProperty(exports, "memoizedFibonacci", { enumerable: true, get: function () { return fibonacci_1.memoizedFibonacci; } });
|
|
10
|
-
var binary_search_1 = require("./algorithms/binary-search");
|
|
10
|
+
var binary_search_1 = require("./app/algorithms/binary-search");
|
|
11
11
|
Object.defineProperty(exports, "binarySearch", { enumerable: true, get: function () { return binary_search_1.binarySearch; } });
|
|
12
|
-
var transpose_matrix_1 = require("./algorithms/transpose-matrix");
|
|
12
|
+
var transpose_matrix_1 = require("./app/algorithms/transpose-matrix");
|
|
13
13
|
Object.defineProperty(exports, "transposeMatrix", { enumerable: true, get: function () { return transpose_matrix_1.transposeMatrix; } });
|
|
14
|
-
var transposeDirectedGraph_1 = require("./
|
|
14
|
+
var transposeDirectedGraph_1 = require("./app/algorithms/graph/transposing/transposeDirectedGraph");
|
|
15
15
|
Object.defineProperty(exports, "transposeDirectedGraph", { enumerable: true, get: function () { return transposeDirectedGraph_1.transposeDirectedGraph; } });
|
|
16
|
-
var BFSIterationStrategy_1 = require("./
|
|
16
|
+
var BFSIterationStrategy_1 = require("./app/algorithms/graph/iterator-strategy/BFSIterationStrategy");
|
|
17
17
|
exports.BFSIterationStrategy = BFSIterationStrategy_1.default;
|
|
18
|
-
var DFSIterationStrategy_1 = require("./
|
|
18
|
+
var DFSIterationStrategy_1 = require("./app/algorithms/graph/iterator-strategy/DFSIterationStrategy");
|
|
19
19
|
exports.DFSIterationStrategy = DFSIterationStrategy_1.default;
|
|
20
|
-
var DijkstraIterationStrategy_1 = require("./
|
|
20
|
+
var DijkstraIterationStrategy_1 = require("./app/algorithms/graph/iterator-strategy/DijkstraIterationStrategy");
|
|
21
21
|
exports.DijkstraIterationStrategy = DijkstraIterationStrategy_1.default;
|
|
22
|
-
var GraphIteratorBFS_1 = require("./
|
|
22
|
+
var GraphIteratorBFS_1 = require("./app/algorithms/graph/iterator/GraphIteratorBFS");
|
|
23
23
|
exports.GraphIteratorBFS = GraphIteratorBFS_1.default;
|
|
24
|
-
var GraphIteratorDFS_1 = require("./
|
|
24
|
+
var GraphIteratorDFS_1 = require("./app/algorithms/graph/iterator/GraphIteratorDFS");
|
|
25
25
|
exports.GraphIteratorDFS = GraphIteratorDFS_1.default;
|
|
26
|
-
var GraphIteratorDijkstra_1 = require("./
|
|
26
|
+
var GraphIteratorDijkstra_1 = require("./app/algorithms/graph/iterator/GraphIteratorDijkstra");
|
|
27
27
|
exports.GraphIteratorDijkstra = GraphIteratorDijkstra_1.default;
|
|
28
|
-
var hasPath_1 = require("./
|
|
28
|
+
var hasPath_1 = require("./app/algorithms/graph/searching/hasPath");
|
|
29
29
|
Object.defineProperty(exports, "hasPath", { enumerable: true, get: function () { return hasPath_1.hasPath; } });
|
|
30
|
-
var shortestPath_1 = require("./
|
|
30
|
+
var shortestPath_1 = require("./app/algorithms/graph/searching/shortestPath");
|
|
31
31
|
Object.defineProperty(exports, "shortestPath", { enumerable: true, get: function () { return shortestPath_1.shortestPath; } });
|
|
32
|
-
var presenterAdjacencyMatrix_1 = require("./
|
|
32
|
+
var presenterAdjacencyMatrix_1 = require("./app/algorithms/graph/presenter/presenterAdjacencyMatrix");
|
|
33
33
|
Object.defineProperty(exports, "presenterAdjacencyMatrix", { enumerable: true, get: function () { return presenterAdjacencyMatrix_1.presenterAdjacencyMatrix; } });
|
|
34
|
-
var presenterAdjacencyLists_1 = require("./
|
|
34
|
+
var presenterAdjacencyLists_1 = require("./app/algorithms/graph/presenter/presenterAdjacencyLists");
|
|
35
35
|
Object.defineProperty(exports, "presenterAdjacencyLists", { enumerable: true, get: function () { return presenterAdjacencyLists_1.presenterAdjacencyLists; } });
|
|
36
|
-
var generateRandomGraph_1 = require("./data-structures/Graph/
|
|
36
|
+
var generateRandomGraph_1 = require("./app/data-structures/Graph/_helpers/generateRandomGraph");
|
|
37
37
|
Object.defineProperty(exports, "generateRandomGraph", { enumerable: true, get: function () { return generateRandomGraph_1.generateRandomGraph; } });
|
|
38
|
-
var createLinkedList_1 = require("./
|
|
38
|
+
var createLinkedList_1 = require("./app/data-structures/LinkedList/_helpers/createLinkedList");
|
|
39
39
|
Object.defineProperty(exports, "createLinkedList", { enumerable: true, get: function () { return createLinkedList_1.createLinkedList; } });
|
|
40
|
-
var createBinaryTree_1 = require("./
|
|
40
|
+
var createBinaryTree_1 = require("./app/data-structures/BinaryTree/_helpers/createBinaryTree");
|
|
41
41
|
Object.defineProperty(exports, "createBinaryTree", { enumerable: true, get: function () { return createBinaryTree_1.createBinaryTree; } });
|
|
42
|
-
var createGraph_1 = require("./
|
|
42
|
+
var createGraph_1 = require("./app/data-structures/Graph/_helpers/createGraph");
|
|
43
43
|
Object.defineProperty(exports, "createGraph", { enumerable: true, get: function () { return createGraph_1.createGraph; } });
|
|
44
|
-
var createGraphFromMatrix_1 = require("./
|
|
44
|
+
var createGraphFromMatrix_1 = require("./app/data-structures/Graph/_helpers/createGraphFromMatrix");
|
|
45
45
|
Object.defineProperty(exports, "createGraphFromMatrix", { enumerable: true, get: function () { return createGraphFromMatrix_1.createGraphFromMatrix; } });
|
|
46
|
-
var constants_1 = require("./constants");
|
|
46
|
+
var constants_1 = require("./app/constants");
|
|
47
47
|
Object.defineProperty(exports, "EDGE_EXISTS_STATE", { enumerable: true, get: function () { return constants_1.EDGE_EXISTS_STATE; } });
|
|
48
48
|
Object.defineProperty(exports, "EDGE_NOT_EXISTS_STATE", { enumerable: true, get: function () { return constants_1.EDGE_NOT_EXISTS_STATE; } });
|
|
49
|
-
var Queue_1 = require("./data-structures/Queue/Queue");
|
|
49
|
+
var Queue_1 = require("./app/data-structures/Queue/Queue");
|
|
50
50
|
exports.Queue = Queue_1.default;
|
|
51
|
-
var Stack_1 = require("./data-structures/Stack/Stack");
|
|
51
|
+
var Stack_1 = require("./app/data-structures/Stack/Stack");
|
|
52
52
|
exports.Stack = Stack_1.default;
|
|
53
|
-
var UndirectedGraph_1 = require("./data-structures/Graph/UndirectedGraph");
|
|
53
|
+
var UndirectedGraph_1 = require("./app/data-structures/Graph/UndirectedGraph");
|
|
54
54
|
exports.UndirectedGraph = UndirectedGraph_1.default;
|
|
55
|
-
var DirectedGraph_1 = require("./data-structures/Graph/DirectedGraph");
|
|
55
|
+
var DirectedGraph_1 = require("./app/data-structures/Graph/DirectedGraph");
|
|
56
56
|
exports.DirectedGraph = DirectedGraph_1.default;
|
|
57
|
-
var BinarySearchTree_1 = require("./data-structures/BinaryTree/BinarySearchTree/BinarySearchTree");
|
|
57
|
+
var BinarySearchTree_1 = require("./app/data-structures/BinaryTree/BinarySearchTree/BinarySearchTree");
|
|
58
58
|
exports.BinarySearchTree = BinarySearchTree_1.default;
|
|
59
|
-
var RandBinarySearchTree_1 = require("./data-structures/BinaryTree/RandBinarySearchTree/RandBinarySearchTree");
|
|
59
|
+
var RandBinarySearchTree_1 = require("./app/data-structures/BinaryTree/RandBinarySearchTree/RandBinarySearchTree");
|
|
60
60
|
exports.RandBinarySearchTree = RandBinarySearchTree_1.default;
|
|
61
|
-
var DoubleLinkedList_1 = require("./data-structures/LinkedList/DoubleLinkedList/DoubleLinkedList");
|
|
61
|
+
var DoubleLinkedList_1 = require("./app/data-structures/LinkedList/DoubleLinkedList/DoubleLinkedList");
|
|
62
62
|
exports.DoubleLinkedList = DoubleLinkedList_1.default;
|
|
63
|
-
var SingleLinkedList_1 = require("./data-structures/LinkedList/SingleLinkedList/SingleLinkedList");
|
|
63
|
+
var SingleLinkedList_1 = require("./app/data-structures/LinkedList/SingleLinkedList/SingleLinkedList");
|
|
64
64
|
exports.SingleLinkedList = SingleLinkedList_1.default;
|
|
65
|
-
var LoopedArray_1 = require("./data-structures/LoopedArray/LoopedArray");
|
|
65
|
+
var LoopedArray_1 = require("./app/data-structures/LoopedArray/LoopedArray");
|
|
66
66
|
exports.LoopedArray = LoopedArray_1.default;
|
|
67
|
-
var HashTable_1 = require("./data-structures/HashTable/HashTable");
|
|
67
|
+
var HashTable_1 = require("./app/data-structures/HashTable/HashTable");
|
|
68
68
|
exports.HashTable = HashTable_1.default;
|
|
69
|
-
var
|
|
69
|
+
var IsNotFoundException_1 = require("./app/exceptions/IsNotFoundException");
|
|
70
|
+
exports.IsNotFoundException = IsNotFoundException_1.default;
|
|
71
|
+
var IsAlreadyExistsException_1 = require("./app/exceptions/IsAlreadyExistsException");
|
|
72
|
+
exports.IsAlreadyExistsException = IsAlreadyExistsException_1.default;
|
|
73
|
+
var ValueOutOfRangeException_1 = require("./app/exceptions/ValueOutOfRangeException");
|
|
74
|
+
exports.ValueOutOfRangeException = ValueOutOfRangeException_1.default;
|
|
75
|
+
var IllegalArgumentException_1 = require("./app/exceptions/base/IllegalArgumentException");
|
|
76
|
+
exports.IllegalArgumentException = IllegalArgumentException_1.default;
|
|
77
|
+
var IllegalStateException_1 = require("./app/exceptions/base/IllegalStateException");
|
|
78
|
+
exports.IllegalStateException = IllegalStateException_1.default;
|
|
79
|
+
var IndexOutOfBoundsException_1 = require("./app/exceptions/IndexOutOfBoundsException");
|
|
80
|
+
exports.IndexOutOfBoundsException = IndexOutOfBoundsException_1.default;
|
|
81
|
+
var CollectionIsEmptyException_1 = require("./app/exceptions/CollectionIsEmptyException");
|
|
82
|
+
exports.CollectionIsEmptyException = CollectionIsEmptyException_1.default;
|
|
83
|
+
var CollectionIsFullException_1 = require("./app/exceptions/CollectionIsFullException");
|
|
84
|
+
exports.CollectionIsFullException = CollectionIsFullException_1.default;
|
|
85
|
+
var bubble_sort_1 = require("./app/algorithms/sorts/bubble-sort");
|
|
70
86
|
Object.defineProperty(exports, "bubbleSort", { enumerable: true, get: function () { return bubble_sort_1.bubbleSort; } });
|
|
71
|
-
var select_sort_1 = require("./algorithms/sorts/select-sort");
|
|
87
|
+
var select_sort_1 = require("./app/algorithms/sorts/select-sort");
|
|
72
88
|
Object.defineProperty(exports, "selectSort", { enumerable: true, get: function () { return select_sort_1.selectSort; } });
|
|
73
|
-
var merge_sort_1 = require("./algorithms/sorts/merge-sort");
|
|
89
|
+
var merge_sort_1 = require("./app/algorithms/sorts/merge-sort");
|
|
74
90
|
Object.defineProperty(exports, "mergeSort", { enumerable: true, get: function () { return merge_sort_1.mergeSort; } });
|
|
75
|
-
var insertion_sort_1 = require("./algorithms/sorts/insertion-sort");
|
|
91
|
+
var insertion_sort_1 = require("./app/algorithms/sorts/insertion-sort");
|
|
76
92
|
Object.defineProperty(exports, "insertionSort", { enumerable: true, get: function () { return insertion_sort_1.insertionSort; } });
|
|
77
|
-
var quick_sort_1 = require("./algorithms/sorts/quick-sort");
|
|
93
|
+
var quick_sort_1 = require("./app/algorithms/sorts/quick-sort");
|
|
78
94
|
Object.defineProperty(exports, "quickSort", { enumerable: true, get: function () { return quick_sort_1.quickSort; } });
|
|
79
|
-
var memoize_1 = require("./algorithms/memoize");
|
|
95
|
+
var memoize_1 = require("./app/algorithms/memoize");
|
|
80
96
|
Object.defineProperty(exports, "memoize", { enumerable: true, get: function () { return memoize_1.memoize; } });
|
|
81
|
-
var utils_1 = require("./utils");
|
|
97
|
+
var utils_1 = require("./app/utils");
|
|
82
98
|
Object.defineProperty(exports, "getMinIndex", { enumerable: true, get: function () { return utils_1.getMinIndex; } });
|
|
83
99
|
Object.defineProperty(exports, "getMinIndexFromIndex", { enumerable: true, get: function () { return utils_1.getMinIndexFromIndex; } });
|
|
84
100
|
Object.defineProperty(exports, "perf", { enumerable: true, get: function () { return utils_1.perf; } });
|
|
@@ -86,4 +102,4 @@ Object.defineProperty(exports, "randomizeNumberInRange", { enumerable: true, get
|
|
|
86
102
|
Object.defineProperty(exports, "roundNumber", { enumerable: true, get: function () { return utils_1.roundNumber; } });
|
|
87
103
|
Object.defineProperty(exports, "swapArrayItems", { enumerable: true, get: function () { return utils_1.swapArrayItems; } });
|
|
88
104
|
Object.defineProperty(exports, "perfAsync", { enumerable: true, get: function () { return utils_1.perfAsync; } });
|
|
89
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
105
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwb3J0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9leHBvcnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHdEQUEwRTtBQTZGeEUsMEZBN0ZPLHFCQUFTLE9BNkZQO0FBQ1Qsa0dBOUZrQiw2QkFBaUIsT0E4RmxCO0FBN0ZuQix3REFBMEU7QUErRnhFLDBGQS9GTyxxQkFBUyxPQStGUDtBQURULGtHQTlGa0IsNkJBQWlCLE9BOEZsQjtBQTdGbkIsZ0VBQThEO0FBMEY1RCw2RkExRk8sNEJBQVksT0EwRlA7QUF6RmQsc0VBQW9FO0FBOEZsRSxnR0E5Rk8sa0NBQWUsT0E4RlA7QUE3RmpCLG9HQUFtRztBQXdHakcsdUdBeEdPLCtDQUFzQixPQXdHUDtBQXZHeEIsc0dBQWlHO0FBb0cvRiwrQkFwR0ssOEJBQW9CLENBb0dMO0FBbkd0QixzR0FBaUc7QUFrRy9GLCtCQWxHSyw4QkFBb0IsQ0FrR0w7QUFqR3RCLGdIQUEyRztBQWdHekcsb0NBaEdLLG1DQUF5QixDQWdHTDtBQS9GM0IscUZBQWdGO0FBa0c5RSwyQkFsR0ssMEJBQWdCLENBa0dMO0FBakdsQixxRkFBZ0Y7QUF5RjlFLDJCQXpGSywwQkFBZ0IsQ0F5Rkw7QUF4RmxCLCtGQUEwRjtBQWlHeEYsZ0NBakdLLCtCQUFxQixDQWlHTDtBQWhHdkIsb0VBQW1FO0FBMEZqRSx3RkExRk8saUJBQU8sT0EwRlA7QUF6RlQsOEVBQTZFO0FBMEYzRSw2RkExRk8sMkJBQVksT0EwRlA7QUF6RmQsc0dBQXFHO0FBdUZuRyx5R0F2Rk8sbURBQXdCLE9BdUZQO0FBdEYxQixvR0FBbUc7QUFxRmpHLHdHQXJGTyxpREFBdUIsT0FxRlA7QUFwRnpCLGdHQUErRjtBQXlFN0Ysb0dBekVPLHlDQUFtQixPQXlFUDtBQXhFckIsK0ZBQThGO0FBdUU1RixpR0F2RU8sbUNBQWdCLE9BdUVQO0FBdEVsQiwrRkFBOEY7QUFxRTVGLGlHQXJFTyxtQ0FBZ0IsT0FxRVA7QUFwRWxCLGdGQUErRTtBQWtFN0UsNEZBbEVPLHlCQUFXLE9Ba0VQO0FBakViLG9HQUFtRztBQWtFakcsc0dBbEVPLDZDQUFxQixPQWtFUDtBQWpFdkIsNkNBQTJFO0FBNkQzQyxrR0E3RHZCLDZCQUFpQixPQTZEdUI7QUFBeEMsc0dBN0RtQixpQ0FBcUIsT0E2RG5CO0FBNUQ5QiwyREFBc0Q7QUFpRHBELGdCQWpESyxlQUFLLENBaURMO0FBaERQLDJEQUFzRDtBQStDcEQsZ0JBL0NLLGVBQUssQ0ErQ0w7QUE5Q1AsK0VBQTBFO0FBcUR4RSwwQkFyREsseUJBQWUsQ0FxREw7QUFwRGpCLDJFQUFzRTtBQW1EcEUsd0JBbkRLLHVCQUFhLENBbURMO0FBbERmLHVHQUFrRztBQWlEaEcsMkJBakRLLDBCQUFnQixDQWlETDtBQWhEbEIsbUhBQThHO0FBK0M1RywrQkEvQ0ssOEJBQW9CLENBK0NMO0FBOUN0Qix1R0FBa0c7QUE2Q2hHLDJCQTdDSywwQkFBZ0IsQ0E2Q0w7QUE1Q2xCLHVHQUFrRztBQTJDaEcsMkJBM0NLLDBCQUFnQixDQTJDTDtBQTFDbEIsNkVBQXdFO0FBZ0R0RSxzQkFoREsscUJBQVcsQ0FnREw7QUEvQ2IsdUVBQWtFO0FBZ0RoRSxvQkFoREssbUJBQVMsQ0FnREw7QUEvQ1gsNEVBQXVFO0FBbUZyRSw4QkFuRkssNkJBQW1CLENBbUZMO0FBbEZyQixzRkFBaUY7QUFtRi9FLG1DQW5GSyxrQ0FBd0IsQ0FtRkw7QUFsRjFCLHNGQUFpRjtBQW1GL0UsbUNBbkZLLGtDQUF3QixDQW1GTDtBQWxGMUIsMkZBQXNGO0FBbUZwRixtQ0FuRkssa0NBQXdCLENBbUZMO0FBbEYxQixxRkFBZ0Y7QUFtRjlFLGdDQW5GSywrQkFBcUIsQ0FtRkw7QUFsRnZCLHdGQUFtRjtBQW1GakYsb0NBbkZLLG1DQUF5QixDQW1GTDtBQWxGM0IsMEZBQXFGO0FBMkVuRixxQ0EzRUssb0NBQTBCLENBMkVMO0FBMUU1Qix3RkFBbUY7QUEyRWpGLG9DQTNFSyxtQ0FBeUIsQ0EyRUw7QUExRTNCLGtFQUFnRTtBQTJCdkQsMkZBM0JBLHdCQUFVLE9BMkJBO0FBMUJuQixrRUFBZ0U7QUEwQmpCLDJGQTFCdEMsd0JBQVUsT0EwQnNDO0FBekJ6RCxnRUFBOEQ7QUF5QjFCLDBGQXpCM0Isc0JBQVMsT0F5QjJCO0FBeEI3Qyx3RUFBc0U7QUF3QmpELDhGQXhCWiw4QkFBYSxPQXdCWTtBQXZCbEMsZ0VBQThEO0FBdUJILDBGQXZCbEQsc0JBQVMsT0F1QmtEO0FBdEJwRSxvREFBbUQ7QUFlakQsd0ZBZk8saUJBQU8sT0FlUDtBQWRULHFDQVFxQjtBQUluQiw0RkFYQSxtQkFBVyxPQVdBO0FBQ1gscUdBWEEsNEJBQW9CLE9BV0E7QUFGcEIscUZBUkEsWUFBSSxPQVFBO0FBTUosdUdBYkEsOEJBQXNCLE9BYUE7QUFEdEIsNEZBWEEsbUJBQVcsT0FXQTtBQUVYLCtGQVpBLHNCQUFjLE9BWUE7QUFIZCwwRkFSQSxpQkFBUyxPQVFBIn0=
|
package/lib/index.js
CHANGED
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Write your code here
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOztHQUVHO0FBRUgsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQyJ9
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOztHQUVHIn0=
|
package/package.json
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
"scripts": {
|
|
4
4
|
"test": "jest",
|
|
5
5
|
"dev": "nodemon",
|
|
6
|
-
"build": "rimraf ./
|
|
6
|
+
"build": "rimraf ./lib && tsc",
|
|
7
7
|
"start": "npm run build && node lib/index.js",
|
|
8
8
|
"lint": "yarn eslint . --ext .ts",
|
|
9
|
-
"lint:fix": "yarn eslint --fix . --ext .ts"
|
|
9
|
+
"lint:fix": "yarn eslint --fix . --ext .ts",
|
|
10
|
+
"docs:dev": "vuepress dev docs",
|
|
11
|
+
"docs:build": "vuepress build docs"
|
|
10
12
|
},
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
13
15
|
"url": "https://github.com/raikuxq/lab-ts-algorithms"
|
|
14
16
|
},
|
|
15
|
-
"main": "./lib/exports.js",
|
|
16
|
-
"types": "./lib/exports.d.ts",
|
|
17
|
+
"main": "./lib/src/exports.js",
|
|
18
|
+
"types": "./lib/src/exports.d.ts",
|
|
17
19
|
"files": [
|
|
18
20
|
"lib",
|
|
19
21
|
"README.md",
|
|
@@ -24,6 +26,8 @@
|
|
|
24
26
|
"@types/node": "^14.0.24",
|
|
25
27
|
"@typescript-eslint/eslint-plugin": "^4.4.0",
|
|
26
28
|
"@typescript-eslint/parser": "^4.4.0",
|
|
29
|
+
"@vuepress/plugin-search": "^2.0.0-beta.48",
|
|
30
|
+
"@vuepress/theme-default": "^2.0.0-beta.48",
|
|
27
31
|
"eslint": "^7.11.0",
|
|
28
32
|
"eslint-config-prettier": "^6.12.0",
|
|
29
33
|
"eslint-config-recommended": "^4.1.0",
|
|
@@ -35,8 +39,9 @@
|
|
|
35
39
|
"ts-jest": "^26.4.1",
|
|
36
40
|
"ts-node": "^10.7.0",
|
|
37
41
|
"ts-node-esm": "^0.0.6",
|
|
38
|
-
"typescript": "^4.0.3"
|
|
42
|
+
"typescript": "^4.0.3",
|
|
43
|
+
"vuepress": "^2.0.0-beta.48"
|
|
39
44
|
},
|
|
40
45
|
"dependencies": {},
|
|
41
|
-
"version": "1.
|
|
46
|
+
"version": "1.2.0"
|
|
42
47
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.binarySearch = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Find element's index in sorted array
|
|
6
|
-
* Time complexity: O(log(n))
|
|
7
|
-
*/
|
|
8
|
-
exports.binarySearch = function (elements, searchElement) {
|
|
9
|
-
var length = elements.length;
|
|
10
|
-
var leftIndex = 0;
|
|
11
|
-
var rightIndex = length - 1;
|
|
12
|
-
while (leftIndex <= rightIndex) {
|
|
13
|
-
var midIndex = Math.ceil((leftIndex + rightIndex) / 2);
|
|
14
|
-
var midEl = elements[midIndex];
|
|
15
|
-
if (searchElement == midEl) {
|
|
16
|
-
return midIndex;
|
|
17
|
-
}
|
|
18
|
-
else if (midEl > searchElement) {
|
|
19
|
-
rightIndex = midIndex - 1;
|
|
20
|
-
}
|
|
21
|
-
else if (midEl < searchElement) {
|
|
22
|
-
leftIndex = midIndex + 1;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluYXJ5LXNlYXJjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hbGdvcml0aG1zL2JpbmFyeS1zZWFyY2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUE7OztHQUdHO0FBQ1UsUUFBQSxZQUFZLEdBQUcsVUFDMUIsUUFBdUIsRUFDdkIsYUFBcUI7SUFFckIsSUFBTSxNQUFNLEdBQVcsUUFBUSxDQUFDLE1BQU0sQ0FBQztJQUV2QyxJQUFJLFNBQVMsR0FBRyxDQUFDLENBQUM7SUFDbEIsSUFBSSxVQUFVLEdBQVcsTUFBTSxHQUFHLENBQUMsQ0FBQztJQUVwQyxPQUFPLFNBQVMsSUFBSSxVQUFVLEVBQUU7UUFDOUIsSUFBTSxRQUFRLEdBQVcsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLFNBQVMsR0FBRyxVQUFVLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztRQUNqRSxJQUFNLEtBQUssR0FBVyxRQUFRLENBQUMsUUFBUSxDQUFDLENBQUM7UUFFekMsSUFBSSxhQUFhLElBQUksS0FBSyxFQUFFO1lBQzFCLE9BQU8sUUFBUSxDQUFDO1NBQ2pCO2FBQU0sSUFBSSxLQUFLLEdBQUcsYUFBYSxFQUFFO1lBQ2hDLFVBQVUsR0FBRyxRQUFRLEdBQUcsQ0FBQyxDQUFDO1NBQzNCO2FBQU0sSUFBSSxLQUFLLEdBQUcsYUFBYSxFQUFFO1lBQ2hDLFNBQVMsR0FBRyxRQUFRLEdBQUcsQ0FBQyxDQUFDO1NBQzFCO0tBQ0Y7SUFFRCxPQUFPLElBQUksQ0FBQztBQUNkLENBQUMsQ0FBQyJ9
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.memoizedFibonacci = exports.fibonacci = void 0;
|
|
4
|
-
var memoize_1 = require("./memoize");
|
|
5
|
-
/**
|
|
6
|
-
* Time complexity: O(n!)
|
|
7
|
-
*/
|
|
8
|
-
exports.fibonacci = function (n) {
|
|
9
|
-
return n > 1 ? exports.fibonacci(n - 1) + exports.fibonacci(n - 2) : n;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Time complexity: O(n) - due to caching
|
|
13
|
-
*/
|
|
14
|
-
exports.memoizedFibonacci = memoize_1.memoize(function (n) {
|
|
15
|
-
return n > 1 ? exports.memoizedFibonacci(n - 1) + exports.memoizedFibonacci(n - 2) : n;
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlib25hY2NpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FsZ29yaXRobXMvZmlib25hY2NpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLHFDQUFvQztBQUVwQzs7R0FFRztBQUNVLFFBQUEsU0FBUyxHQUFHLFVBQUMsQ0FBUztJQUNqQyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLGlCQUFTLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLGlCQUFTLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDekQsQ0FBQyxDQUFDO0FBRUY7O0dBRUc7QUFDVSxRQUFBLGlCQUFpQixHQUFnQyxpQkFBTyxDQUNuRSxVQUFDLENBQVM7SUFDUixPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLHlCQUFpQixDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyx5QkFBaUIsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUN6RSxDQUFDLENBQ0YsQ0FBQyJ9
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertionSort = void 0;
|
|
4
|
-
var utils_1 = require("../../utils");
|
|
5
|
-
/**
|
|
6
|
-
* Insertion sorting algorithm
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Time complexity: Best O(n); Avg O(n \^ 2); Worst O(n \^ 2);
|
|
10
|
-
* @description
|
|
11
|
-
* Memory complexity: Worst case: O(1)
|
|
12
|
-
*/
|
|
13
|
-
exports.insertionSort = function (arr) {
|
|
14
|
-
for (var i = 1; i < arr.length; i++) {
|
|
15
|
-
var current = arr[i];
|
|
16
|
-
var j = i - 1;
|
|
17
|
-
while (j >= 0 && arr[j] > current) {
|
|
18
|
-
utils_1.swapArrayItems(arr, j + 1, j);
|
|
19
|
-
j--;
|
|
20
|
-
}
|
|
21
|
-
arr[j + 1] = current;
|
|
22
|
-
}
|
|
23
|
-
return arr;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zZXJ0aW9uLXNvcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYWxnb3JpdGhtcy9zb3J0cy9pbnNlcnRpb24tc29ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxQ0FBNkM7QUFFN0M7Ozs7Ozs7R0FPRztBQUNVLFFBQUEsYUFBYSxHQUFHLFVBQUMsR0FBa0I7SUFDOUMsS0FBSyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUFFLEVBQUU7UUFDbkMsSUFBTSxPQUFPLEdBQUcsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ3ZCLElBQUksQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUM7UUFFZCxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksR0FBRyxDQUFDLENBQUMsQ0FBQyxHQUFHLE9BQU8sRUFBRTtZQUNqQyxzQkFBYyxDQUFDLEdBQUcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO1lBQzlCLENBQUMsRUFBRSxDQUFDO1NBQ0w7UUFFRCxHQUFHLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLE9BQU8sQ0FBQztLQUN0QjtJQUVELE9BQU8sR0FBRyxDQUFDO0FBQ2IsQ0FBQyxDQUFDIn0=
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeSort = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Merge two sorted arrays into one array
|
|
6
|
-
*/
|
|
7
|
-
var merge = function (arr, leftIndex, midIndex, rightIndex) {
|
|
8
|
-
var container = arr.slice(leftIndex, rightIndex + 1);
|
|
9
|
-
var resultArrIndex = leftIndex;
|
|
10
|
-
var leftHalfIndex = leftIndex;
|
|
11
|
-
var rightHalfIndex = midIndex + 1;
|
|
12
|
-
/** While both halves of array are not ended */
|
|
13
|
-
while (leftHalfIndex <= midIndex && rightHalfIndex <= rightIndex) {
|
|
14
|
-
var leftHalfElement = container[leftHalfIndex - leftIndex];
|
|
15
|
-
var rightHalfElement = container[rightHalfIndex - leftIndex];
|
|
16
|
-
if (leftHalfElement < rightHalfElement) {
|
|
17
|
-
arr[resultArrIndex] = leftHalfElement;
|
|
18
|
-
leftHalfIndex++;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
arr[resultArrIndex] = rightHalfElement;
|
|
22
|
-
rightHalfIndex++;
|
|
23
|
-
}
|
|
24
|
-
resultArrIndex++;
|
|
25
|
-
}
|
|
26
|
-
/** If one of halves is ended, the remaining one will just be pushed to result */
|
|
27
|
-
while (leftHalfIndex <= midIndex) {
|
|
28
|
-
arr[resultArrIndex] = container[leftHalfIndex - leftIndex];
|
|
29
|
-
resultArrIndex++;
|
|
30
|
-
leftHalfIndex++;
|
|
31
|
-
}
|
|
32
|
-
while (rightHalfIndex <= rightIndex) {
|
|
33
|
-
arr[resultArrIndex] = container[rightHalfIndex - leftIndex];
|
|
34
|
-
resultArrIndex++;
|
|
35
|
-
rightHalfIndex++;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Divide array into 2 halves and merge them
|
|
40
|
-
*/
|
|
41
|
-
var sortRange = function (arr, leftIndex, rightIndex) {
|
|
42
|
-
if (rightIndex > leftIndex) {
|
|
43
|
-
var midIndex = Math.floor(leftIndex + (rightIndex - leftIndex) / 2);
|
|
44
|
-
sortRange(arr, leftIndex, midIndex);
|
|
45
|
-
sortRange(arr, midIndex + 1, rightIndex);
|
|
46
|
-
merge(arr, leftIndex, midIndex, rightIndex);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Merge sorting algorithm
|
|
51
|
-
*
|
|
52
|
-
* @description
|
|
53
|
-
* Time complexity: Best O(n * log(n)); Avg O(n * log(n)); Worst O(n * log(n))
|
|
54
|
-
* @description
|
|
55
|
-
* Memory complexity: Worst case: O(n)
|
|
56
|
-
*/
|
|
57
|
-
exports.mergeSort = function (arr) {
|
|
58
|
-
sortRange(arr, 0, arr.length - 1);
|
|
59
|
-
return arr;
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVyZ2Utc29ydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hbGdvcml0aG1zL3NvcnRzL21lcmdlLXNvcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUE7O0dBRUc7QUFDSCxJQUFNLEtBQUssR0FBRyxVQUNaLEdBQWtCLEVBQ2xCLFNBQWlCLEVBQ2pCLFFBQWdCLEVBQ2hCLFVBQWtCO0lBRWxCLElBQU0sU0FBUyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsU0FBUyxFQUFFLFVBQVUsR0FBRyxDQUFDLENBQUMsQ0FBQztJQUV2RCxJQUFJLGNBQWMsR0FBRyxTQUFTLENBQUM7SUFDL0IsSUFBSSxhQUFhLEdBQUcsU0FBUyxDQUFDO0lBQzlCLElBQUksY0FBYyxHQUFHLFFBQVEsR0FBRyxDQUFDLENBQUM7SUFFbEMsK0NBQStDO0lBQy9DLE9BQU8sYUFBYSxJQUFJLFFBQVEsSUFBSSxjQUFjLElBQUksVUFBVSxFQUFFO1FBQ2hFLElBQU0sZUFBZSxHQUFHLFNBQVMsQ0FBQyxhQUFhLEdBQUcsU0FBUyxDQUFDLENBQUM7UUFDN0QsSUFBTSxnQkFBZ0IsR0FBRyxTQUFTLENBQUMsY0FBYyxHQUFHLFNBQVMsQ0FBQyxDQUFDO1FBRS9ELElBQUksZUFBZSxHQUFHLGdCQUFnQixFQUFFO1lBQ3RDLEdBQUcsQ0FBQyxjQUFjLENBQUMsR0FBRyxlQUFlLENBQUM7WUFDdEMsYUFBYSxFQUFFLENBQUM7U0FDakI7YUFBTTtZQUNMLEdBQUcsQ0FBQyxjQUFjLENBQUMsR0FBRyxnQkFBZ0IsQ0FBQztZQUN2QyxjQUFjLEVBQUUsQ0FBQztTQUNsQjtRQUNELGNBQWMsRUFBRSxDQUFDO0tBQ2xCO0lBRUQsaUZBQWlGO0lBQ2pGLE9BQU8sYUFBYSxJQUFJLFFBQVEsRUFBRTtRQUNoQyxHQUFHLENBQUMsY0FBYyxDQUFDLEdBQUcsU0FBUyxDQUFDLGFBQWEsR0FBRyxTQUFTLENBQUMsQ0FBQztRQUMzRCxjQUFjLEVBQUUsQ0FBQztRQUNqQixhQUFhLEVBQUUsQ0FBQztLQUNqQjtJQUNELE9BQU8sY0FBYyxJQUFJLFVBQVUsRUFBRTtRQUNuQyxHQUFHLENBQUMsY0FBYyxDQUFDLEdBQUcsU0FBUyxDQUFDLGNBQWMsR0FBRyxTQUFTLENBQUMsQ0FBQztRQUM1RCxjQUFjLEVBQUUsQ0FBQztRQUNqQixjQUFjLEVBQUUsQ0FBQztLQUNsQjtBQUNILENBQUMsQ0FBQztBQUVGOztHQUVHO0FBQ0gsSUFBTSxTQUFTLEdBQUcsVUFDaEIsR0FBa0IsRUFDbEIsU0FBaUIsRUFDakIsVUFBa0I7SUFFbEIsSUFBSSxVQUFVLEdBQUcsU0FBUyxFQUFFO1FBQzFCLElBQU0sUUFBUSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsU0FBUyxHQUFHLENBQUMsVUFBVSxHQUFHLFNBQVMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBRXRFLFNBQVMsQ0FBQyxHQUFHLEVBQUUsU0FBUyxFQUFFLFFBQVEsQ0FBQyxDQUFDO1FBQ3BDLFNBQVMsQ0FBQyxHQUFHLEVBQUUsUUFBUSxHQUFHLENBQUMsRUFBRSxVQUFVLENBQUMsQ0FBQztRQUV6QyxLQUFLLENBQUMsR0FBRyxFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsVUFBVSxDQUFDLENBQUM7S0FDN0M7QUFDSCxDQUFDLENBQUM7QUFFRjs7Ozs7OztHQU9HO0FBQ1UsUUFBQSxTQUFTLEdBQUcsVUFBQyxHQUFrQjtJQUMxQyxTQUFTLENBQUMsR0FBRyxFQUFFLENBQUMsRUFBRSxHQUFHLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDO0lBRWxDLE9BQU8sR0FBRyxDQUFDO0FBQ2IsQ0FBQyxDQUFDIn0=
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transposeMatrix = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Will flips a matrix over its diagonal
|
|
6
|
-
*/
|
|
7
|
-
exports.transposeMatrix = function (matrix) {
|
|
8
|
-
/** Validation */
|
|
9
|
-
matrix.forEach(function (subArray) {
|
|
10
|
-
var checkIsSameLength = subArray.length === matrix.length;
|
|
11
|
-
if (!checkIsSameLength) {
|
|
12
|
-
throw new Error("Given array is not a matrix");
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return matrix.reduce(function (acc, current, currentIndex) {
|
|
16
|
-
acc[currentIndex] = matrix.map(function (rowArr) { return rowArr[currentIndex]; });
|
|
17
|
-
return acc;
|
|
18
|
-
}, new Array(matrix.length));
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNwb3NlLW1hdHJpeC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hbGdvcml0aG1zL3RyYW5zcG9zZS1tYXRyaXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUE7O0dBRUc7QUFDVSxRQUFBLGVBQWUsR0FBRyxVQUFDLE1BQW1CO0lBQ2pELGlCQUFpQjtJQUNqQixNQUFNLENBQUMsT0FBTyxDQUFDLFVBQUMsUUFBUTtRQUN0QixJQUFNLGlCQUFpQixHQUFHLFFBQVEsQ0FBQyxNQUFNLEtBQUssTUFBTSxDQUFDLE1BQU0sQ0FBQztRQUM1RCxJQUFJLENBQUMsaUJBQWlCLEVBQUU7WUFDdEIsTUFBTSxJQUFJLEtBQUssQ0FBQyw2QkFBNkIsQ0FBQyxDQUFDO1NBQ2hEO0lBQ0gsQ0FBQyxDQUFDLENBQUM7SUFFSCxPQUFPLE1BQU0sQ0FBQyxNQUFNLENBQUMsVUFBQyxHQUFHLEVBQUUsT0FBTyxFQUFFLFlBQVk7UUFDOUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxHQUFHLE1BQU0sQ0FBQyxHQUFHLENBQUMsVUFBQyxNQUFNLElBQUssT0FBQSxNQUFNLENBQUMsWUFBWSxDQUFDLEVBQXBCLENBQW9CLENBQUMsQ0FBQztRQUNqRSxPQUFPLEdBQUcsQ0FBQztJQUNiLENBQUMsRUFBRSxJQUFJLEtBQUssQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQztBQUMvQixDQUFDLENBQUMifQ==
|