From c62a6ceabf930bb3b120262222bbf44c342f9c12 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Thu, 26 Apr 2018 07:26:12 +0300 Subject: [PATCH] Restructure folders. --- README.md | 11 ++++++----- .../{math => sets}/cartesian-product/README.md | 0 .../__test__/cartesianProduct.test.js | 0 .../cartesian-product/cartesianProduct.js | 0 src/algorithms/{math => sets}/combinations/README.md | 0 .../__test__/combineWithRepetitions.test.js | 2 +- .../__test__/combineWithoutRepetitions.test.js | 2 +- .../combinations/combineWithRepetitions.js | 0 .../combinations/combineWithoutRepetitions.js | 0 src/algorithms/{math => sets}/fisher-yates/README.md | 0 .../fisher-yates/__test__/fisherYates.test.js | 0 .../{math => sets}/fisher-yates/fisherYates.js | 0 src/algorithms/{math => sets}/permutations/README.md | 0 .../__test__/permutateWithRepetitions.test.js | 0 .../__test__/permutateWithoutRepetitions.test.js | 2 +- .../permutations/permutateWithRepetitions.js | 0 .../permutations/permutateWithoutRepetitions.js | 0 src/algorithms/{math => sets}/power-set/README.md | 0 .../power-set/__test__/powerSet.test.js | 0 src/algorithms/{math => sets}/power-set/powerSet.js | 0 20 files changed, 9 insertions(+), 8 deletions(-) rename src/algorithms/{math => sets}/cartesian-product/README.md (100%) rename src/algorithms/{math => sets}/cartesian-product/__test__/cartesianProduct.test.js (100%) rename src/algorithms/{math => sets}/cartesian-product/cartesianProduct.js (100%) rename src/algorithms/{math => sets}/combinations/README.md (100%) rename src/algorithms/{math => sets}/combinations/__test__/combineWithRepetitions.test.js (96%) rename src/algorithms/{math => sets}/combinations/__test__/combineWithoutRepetitions.test.js (96%) rename src/algorithms/{math => sets}/combinations/combineWithRepetitions.js (100%) rename src/algorithms/{math => sets}/combinations/combineWithoutRepetitions.js (100%) rename src/algorithms/{math => sets}/fisher-yates/README.md (100%) rename src/algorithms/{math => sets}/fisher-yates/__test__/fisherYates.test.js (100%) rename src/algorithms/{math => sets}/fisher-yates/fisherYates.js (100%) rename src/algorithms/{math => sets}/permutations/README.md (100%) rename src/algorithms/{math => sets}/permutations/__test__/permutateWithRepetitions.test.js (100%) rename src/algorithms/{math => sets}/permutations/__test__/permutateWithoutRepetitions.test.js (97%) rename src/algorithms/{math => sets}/permutations/permutateWithRepetitions.js (100%) rename src/algorithms/{math => sets}/permutations/permutateWithoutRepetitions.js (100%) rename src/algorithms/{math => sets}/power-set/README.md (100%) rename src/algorithms/{math => sets}/power-set/__test__/powerSet.test.js (100%) rename src/algorithms/{math => sets}/power-set/powerSet.js (100%) 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