diff --git a/README.md b/README.md index d60d5104c385..b349d3dec907 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,336 @@ -# The Algorithms - Java +
+ +# ๐Ÿ”ท The Algorithms - Java + +Java Logo + +### All algorithms implemented in Java (for educational purposes) [![Build](https://github.com/TheAlgorithms/Java/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/TheAlgorithms/Java/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/TheAlgorithms/Java/graph/badge.svg?token=XAdPyqTIqR)](https://codecov.io/gh/TheAlgorithms/Java) [![Discord chat](https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=7289DA&style=flat-square)](https://discord.gg/c7MnfGFGa6) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/Java) +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Java) -You can run and edit the algorithms, or contribute to them using Gitpod.io (a free online development environment) with a single click. +--- -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Java) +**[๐Ÿ“š Explore Algorithms](DIRECTORY.md)** โ€ข **[๐Ÿค Contributing](CONTRIBUTING.md)** โ€ข **[๐Ÿ’ฌ Community](https://discord.gg/c7MnfGFGa6)** + +
+ +
+ +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ โ”‚ +โ”‚ ๐Ÿ“– Educational implementations of algorithms in Java โ”‚ +โ”‚ ๐ŸŽฏ Focus on code clarity and learning โ”‚ +โ”‚ ๐Ÿงช Comprehensive test coverage โ”‚ +โ”‚ ๐Ÿ“ Well-documented with JavaDoc โ”‚ +โ”‚ โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +## ๐Ÿ“– Overview + +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 | + +
+ +--- + +## ๐Ÿš€ Getting Started + + + + + + +
+ +### ๐Ÿ“‹ Prerequisites + +```bash +โ˜• Java 21+ +๐Ÿ“ฆ Maven 3.6+ +``` + + + +### โšก Quick Setup + +```bash +git clone https://github.com/TheAlgorithms/Java.git +cd Java +mvn clean compile +mvn test +``` + +
+ +--- + +## ๐Ÿ’ก Usage Examples + +
+ +```mermaid +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** +```java +import com.thealgorithms.dynamicprogramming.Fibonacci; + +int fib = Fibonacci.fibonacci(10); // 55 +``` + +**๐Ÿ”€ Sorting** +```java +import com.thealgorithms.sorts.QuickSort; + +int[] array = {64, 34, 25, 12, 22, 11, 90}; +QuickSort.quickSort(array, 0, array.length - 1); +``` + + + +**๐ŸŒ Graph Algorithms** +```java +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** +```java +import com.thealgorithms.datastructures.stacks.BalancedBrackets; + +boolean isBalanced = BalancedBrackets.isBalanced("{[()]}"); +``` + +
+ +--- + +## ๐Ÿ“š Algorithm Categories + +
+ +``` +โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— +โ•‘ ALGORITHM CATEGORIES โ•‘ +โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• +``` + +
+ + + + + + +
+ +### ๐Ÿ” Sorting & Searching +``` +โ”œโ”€โ”€ Binary Search +โ”œโ”€โ”€ Linear Search +โ”œโ”€โ”€ Jump Search +โ”œโ”€โ”€ Quick Sort +โ”œโ”€โ”€ Merge Sort +โ”œโ”€โ”€ Heap Sort +โ””โ”€โ”€ Radix Sort +``` + +### ๐ŸŒณ Data Structures +``` +โ”œโ”€โ”€ Trees +โ”‚ โ”œโ”€โ”€ BST +โ”‚ โ”œโ”€โ”€ AVL +โ”‚ โ””โ”€โ”€ Red-Black +โ”œโ”€โ”€ Graphs +โ”‚ โ”œโ”€โ”€ DFS / BFS +โ”‚ โ”œโ”€โ”€ Dijkstra +โ”‚ โ””โ”€โ”€ Bellman-Ford +โ””โ”€โ”€ Collections + โ”œโ”€โ”€ Stacks + โ”œโ”€โ”€ Queues + โ””โ”€โ”€ Heaps +``` + + + +### ๐ŸŽฏ Algorithm Techniques +``` +โ”œโ”€โ”€ Dynamic Programming +โ”‚ โ”œโ”€โ”€ Knapsack +โ”‚ โ”œโ”€โ”€ LCS +โ”‚ โ””โ”€โ”€ Edit Distance +โ”œโ”€โ”€ Greedy Algorithms +โ”œโ”€โ”€ Backtracking +โ”‚ โ”œโ”€โ”€ N-Queens +โ”‚ โ””โ”€โ”€ Sudoku Solver +โ””โ”€โ”€ Divide & Conquer +``` + +### ๐Ÿ” Other Topics +``` +โ”œโ”€โ”€ Cryptography & Ciphers +โ”œโ”€โ”€ Mathematical Algorithms +โ”œโ”€โ”€ String Manipulation +โ”œโ”€โ”€ Bit Operations +โ””โ”€โ”€ Audio Processing +``` + +
+ +
+ +๐Ÿ“‹ **[View Complete Directory โ†’](DIRECTORY.md)** + +
+ +--- + +## ๐Ÿค Contributing + +
+ +```mermaid +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](CONTRIBUTING.md)** before you contribute. + + + + + + +
+ +### ๐Ÿš€ Quick Start + +```bash +# 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 +``` + + + +### โœ… Requirements + +- **JavaDoc** - Document your code +- **Tests** - Include JUnit tests +- **Style** - Follow existing patterns +- **Directory** - Update DIRECTORY.md + +
+ +> โš ๏ธ **Note:** We do **not** accept LeetCode problems. Focus on well-known algorithms. + +
+ +--- + +## ๐ŸŒ Community & Support + +
+ + + + + + + +
+
+Discord
+Join discussions +
+
+Issues
+Report bugs +
+
+Website
+Explore more +
+ +
+ +--- + +
+ +## ๐Ÿ“„ License + +Licensed under the [MIT License](LICENSE). + +
+ +``` +โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— +โ•‘ Made with โค๏ธ by The Algorithms Community โ•‘ +โ•‘ โญ Star this repository if you find it helpful! โ•‘ +โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• +``` -### All algorithms are implemented in Java (for educational purposes) -These implementations are intended for learning purposes. As such, they may be less efficient than the Java standard library. +
-## Contribution Guidelines -Please read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute to this project. +**[โฌ† Back to Top](#-the-algorithms---java)** -## Algorithms -Our [directory](DIRECTORY.md) has the full list of applications. +