Algorithms using Java built with ❤️ using Maven
This repository is contribution friendly. If you'd like to add or improve an algorithm, your contribution is welcome!
Please go through this comprehensive guide to setup the repository in your local enviornment using this guide CONTRIBUTING.md.
If you're an algorithms enthusiast and want to add or improve an algorithm your contribution is welcome! Please be sure to include tests
➜ algorithms git:(master) ./mvnw verify
- If there doesn't already exist an issue, then file a new issue explaining the algorithm/change you want to do.
- Make sure the algorithm doesn't already exist! We don't want duplicate algorithms.
- Identify the category folder your algorithm belongs to. For example, a sorting snippet would belong to the
src/main/java/xyz/subho/algorithms/sort
folder. You may also create a new category folder if appropriate. - Add the algorithm implementation to:
src/main/java/xyz/subho/algorithms/category/FooAlgorithm.java
- Add tests for FooAlgorithm in:
src/test/java/xyz/subho/algorithms/category/FooAlgorithmTest.java
- Test your algorithm thoroughly.
- Run
./mvnw spotless:apply
to format all Java code according to Google Style Guide. - Send pull request for review.
To compile and run any of the algorithms here, you need at least JDK version 11. Maven can make things more convenient for you, but it is not required.
This project supports the Maven Wrapper. The Maven wrapper automatically downloads dependecies at the first time it runs, so expect a delay when running the first command below.
If you are on Windows, use mvnw
instead of ./mvnw
below.
Run a single algorithm like this:
./mvnw compile exec:java -Dexec.mainClass="<algorithm-subpackage>.<algorithm-class>"
For instance:
./mvnw compile exec:java -Dexec.mainClass="xyz.subho.algorithms.sort.QuickSort"
cd algorithms
mkdir classes
javac -sourcepath src/main/java -d classes src/main/java/ <relative-path-to-java-source-file>
java -cp classes <class-fully-qualified-name>
Thanks goes to these wonderful people (emoji key):
Subhrodip Mohanta 📆 🚧 |
Souptik Hari 💻 |
SUBHADEEP MAITI 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!