βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β π Educational implementations of algorithms in Java β
β π― Focus on code clarity and learning β
β π§ͺ Comprehensive test coverage β
β π Well-documented with JavaDoc β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
This repository contains Java implementations of common algorithms and data structures. These implementations are for learning purposes and prioritize code clarity over performance. They may be less efficient than the Java standard library.
π What's Inside?
| Feature | Description |
|---|---|
| π Clean Code | Readable implementations with clear variable names |
| π§ͺ Test Coverage | JUnit test coverage for most algorithms |
| π Documentation | JavaDoc comments with time/space complexity |
| β Modern Java | Leverages Java 21 features |
| ποΈ Organized | Algorithms grouped by category |
β Java 21+
π¦ Maven 3.6+ |
git clone https://github.com/TheAlgorithms/Java.git
cd Java
mvn clean compile
mvn test |
graph LR
A[Import Algorithm] --> B[Call Method]
B --> C[Get Result]
style A fill:#e1f5ff
style B fill:#fff3e0
style C fill:#e8f5e9
All algorithms are implemented as static methods. Import and use them directly:
|
π Dynamic Programming import com.thealgorithms.dynamicprogramming.Fibonacci;
int fib = Fibonacci.fibonacci(10); // 55π Sorting import com.thealgorithms.sorts.QuickSort;
int[] array = {64, 34, 25, 12, 22, 11, 90};
QuickSort.quickSort(array, 0, array.length - 1); |
π Graph Algorithms import com.thealgorithms.datastructures.graphs.DijkstraAlgorithm;
int[][] graph = {{0, 4, 0}, {4, 0, 8}, {0, 8, 0}};
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(3);
int[] distances = dijkstra.run(graph, 0);π¦ Data Structures import com.thealgorithms.datastructures.stacks.BalancedBrackets;
boolean isBalanced = BalancedBrackets.isBalanced("{[()]}"); |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ALGORITHM CATEGORIES β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
graph LR
A[π΄ Fork] --> B[π¨ Code]
B --> C[β
Test]
C --> D[π€ PR]
D --> E[π Merge]
style A fill:#e3f2fd
style B fill:#fff3e0
style C fill:#e8f5e9
style D fill:#fce4ec
style E fill:#f3e5f5
We welcome contributions! Please read our Contribution Guidelines before you contribute.
# 1. Fork & Clone
git clone https://github.com/YOUR_USERNAME/Java.git
# 2. Create Branch
git checkout -b feature/your-algorithm
# 3. Make Changes & Commit
git commit -m "Add: Algorithm name"
# 4. Push & Create PR
git push origin feature/your-algorithm |
|
|
Discord Join discussions |
Issues Report bugs |
Website Explore more |
Licensed under the MIT License.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Made with β€οΈ by The Algorithms Community β
β β Star this repository if you find it helpful! β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ