diff --git a/README.md b/README.md index 72884a98..5b1c0787 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,15 @@ * **Math** * [Factorial](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/factorial) * [Fibonacci Number](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/fibonacci) - * [Cartesian Product](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/cartesian-product) - product of multiple sets - * [Power Set](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/power-set) - all subsets of the set - * [Permutations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/permutations) (with and without repetitions) - * [Combinations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/combinations) (with and without repetitions) * [Primality Test](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/primality-test) (trial division method) * [Euclidean Algorithm](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD) * [Least Common Multiple](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/least-common-multiple) (LCM) - * [Fisher–Yates Shuffle](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/fisher-yates) - random permutation of a finite sequence +* **Sets** + * [Cartesian Product](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/cartesian-product) - product of multiple sets + * [Power Set](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/power-set) - all subsets of the set + * [Permutations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/permutations) (with and without repetitions) + * [Combinations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/combinations) (with and without repetitions) + * [Fisher–Yates Shuffle](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/fisher-yates) - random permutation of a finite sequence * **String** * [Levenshtein Distance](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/string/levenshtein-distance) - minimum edit distance between two sequences * [Hamming Distance](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/string/hamming-distance) - number of positions at which the symbols are different diff --git a/src/algorithms/math/cartesian-product/README.md b/src/algorithms/sets/cartesian-product/README.md similarity index 100% rename from src/algorithms/math/cartesian-product/README.md rename to src/algorithms/sets/cartesian-product/README.md diff --git a/src/algorithms/math/cartesian-product/__test__/cartesianProduct.test.js b/src/algorithms/sets/cartesian-product/__test__/cartesianProduct.test.js similarity index 100% rename from src/algorithms/math/cartesian-product/__test__/cartesianProduct.test.js rename to src/algorithms/sets/cartesian-product/__test__/cartesianProduct.test.js diff --git a/src/algorithms/math/cartesian-product/cartesianProduct.js b/src/algorithms/sets/cartesian-product/cartesianProduct.js similarity index 100% rename from src/algorithms/math/cartesian-product/cartesianProduct.js rename to src/algorithms/sets/cartesian-product/cartesianProduct.js diff --git a/src/algorithms/math/combinations/README.md b/src/algorithms/sets/combinations/README.md similarity index 100% rename from src/algorithms/math/combinations/README.md rename to src/algorithms/sets/combinations/README.md diff --git a/src/algorithms/math/combinations/__test__/combineWithRepetitions.test.js b/src/algorithms/sets/combinations/__test__/combineWithRepetitions.test.js similarity index 96% rename from src/algorithms/math/combinations/__test__/combineWithRepetitions.test.js rename to src/algorithms/sets/combinations/__test__/combineWithRepetitions.test.js index 25c8a20c..90c38958 100644 --- a/src/algorithms/math/combinations/__test__/combineWithRepetitions.test.js +++ b/src/algorithms/sets/combinations/__test__/combineWithRepetitions.test.js @@ -1,5 +1,5 @@ import combineWithRepetitions from '../combineWithRepetitions'; -import factorial from '../../factorial/factorial'; +import factorial from '../../../math/factorial/factorial'; describe('combineWithRepetitions', () => { it('should combine string with repetitions', () => { diff --git a/src/algorithms/math/combinations/__test__/combineWithoutRepetitions.test.js b/src/algorithms/sets/combinations/__test__/combineWithoutRepetitions.test.js similarity index 96% rename from src/algorithms/math/combinations/__test__/combineWithoutRepetitions.test.js rename to src/algorithms/sets/combinations/__test__/combineWithoutRepetitions.test.js index 1c048ada..186e9a73 100644 --- a/src/algorithms/math/combinations/__test__/combineWithoutRepetitions.test.js +++ b/src/algorithms/sets/combinations/__test__/combineWithoutRepetitions.test.js @@ -1,5 +1,5 @@ import combineWithoutRepetitions from '../combineWithoutRepetitions'; -import factorial from '../../factorial/factorial'; +import factorial from '../../../math/factorial/factorial'; describe('combineWithoutRepetitions', () => { it('should combine string without repetitions', () => { diff --git a/src/algorithms/math/combinations/combineWithRepetitions.js b/src/algorithms/sets/combinations/combineWithRepetitions.js similarity index 100% rename from src/algorithms/math/combinations/combineWithRepetitions.js rename to src/algorithms/sets/combinations/combineWithRepetitions.js diff --git a/src/algorithms/math/combinations/combineWithoutRepetitions.js b/src/algorithms/sets/combinations/combineWithoutRepetitions.js similarity index 100% rename from src/algorithms/math/combinations/combineWithoutRepetitions.js rename to src/algorithms/sets/combinations/combineWithoutRepetitions.js diff --git a/src/algorithms/math/fisher-yates/README.md b/src/algorithms/sets/fisher-yates/README.md similarity index 100% rename from src/algorithms/math/fisher-yates/README.md rename to src/algorithms/sets/fisher-yates/README.md diff --git a/src/algorithms/math/fisher-yates/__test__/fisherYates.test.js b/src/algorithms/sets/fisher-yates/__test__/fisherYates.test.js similarity index 100% rename from src/algorithms/math/fisher-yates/__test__/fisherYates.test.js rename to src/algorithms/sets/fisher-yates/__test__/fisherYates.test.js diff --git a/src/algorithms/math/fisher-yates/fisherYates.js b/src/algorithms/sets/fisher-yates/fisherYates.js similarity index 100% rename from src/algorithms/math/fisher-yates/fisherYates.js rename to src/algorithms/sets/fisher-yates/fisherYates.js diff --git a/src/algorithms/math/permutations/README.md b/src/algorithms/sets/permutations/README.md similarity index 100% rename from src/algorithms/math/permutations/README.md rename to src/algorithms/sets/permutations/README.md diff --git a/src/algorithms/math/permutations/__test__/permutateWithRepetitions.test.js b/src/algorithms/sets/permutations/__test__/permutateWithRepetitions.test.js similarity index 100% rename from src/algorithms/math/permutations/__test__/permutateWithRepetitions.test.js rename to src/algorithms/sets/permutations/__test__/permutateWithRepetitions.test.js diff --git a/src/algorithms/math/permutations/__test__/permutateWithoutRepetitions.test.js b/src/algorithms/sets/permutations/__test__/permutateWithoutRepetitions.test.js similarity index 97% rename from src/algorithms/math/permutations/__test__/permutateWithoutRepetitions.test.js rename to src/algorithms/sets/permutations/__test__/permutateWithoutRepetitions.test.js index 3d082c90..f717d0ca 100644 --- a/src/algorithms/math/permutations/__test__/permutateWithoutRepetitions.test.js +++ b/src/algorithms/sets/permutations/__test__/permutateWithoutRepetitions.test.js @@ -1,5 +1,5 @@ import permutateWithoutRepetitions from '../permutateWithoutRepetitions'; -import factorial from '../../factorial/factorial'; +import factorial from '../../../math/factorial/factorial'; describe('permutateWithoutRepetitions', () => { it('should permutate string', () => { diff --git a/src/algorithms/math/permutations/permutateWithRepetitions.js b/src/algorithms/sets/permutations/permutateWithRepetitions.js similarity index 100% rename from src/algorithms/math/permutations/permutateWithRepetitions.js rename to src/algorithms/sets/permutations/permutateWithRepetitions.js diff --git a/src/algorithms/math/permutations/permutateWithoutRepetitions.js b/src/algorithms/sets/permutations/permutateWithoutRepetitions.js similarity index 100% rename from src/algorithms/math/permutations/permutateWithoutRepetitions.js rename to src/algorithms/sets/permutations/permutateWithoutRepetitions.js diff --git a/src/algorithms/math/power-set/README.md b/src/algorithms/sets/power-set/README.md similarity index 100% rename from src/algorithms/math/power-set/README.md rename to src/algorithms/sets/power-set/README.md diff --git a/src/algorithms/math/power-set/__test__/powerSet.test.js b/src/algorithms/sets/power-set/__test__/powerSet.test.js similarity index 100% rename from src/algorithms/math/power-set/__test__/powerSet.test.js rename to src/algorithms/sets/power-set/__test__/powerSet.test.js diff --git a/src/algorithms/math/power-set/powerSet.js b/src/algorithms/sets/power-set/powerSet.js similarity index 100% rename from src/algorithms/math/power-set/powerSet.js rename to src/algorithms/sets/power-set/powerSet.js