Skip to content

divinixx/Java

Β 
Β 

Repository files navigation

πŸ”· The Algorithms - Java

Java Logo

All algorithms implemented in Java (for educational purposes)

Build codecov Discord chat Gitpod ready-to-code

Open in Gitpod


πŸ“š Explore Algorithms β€’ 🀝 Contributing β€’ πŸ’¬ Community


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                 β”‚
β”‚  πŸ“–  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

β˜• Java 21+
πŸ“¦ Maven 3.6+

⚑ Quick Setup

git clone https://github.com/TheAlgorithms/Java.git
cd Java
mvn clean compile
mvn test

πŸ’‘ Usage Examples

graph LR
    A[Import Algorithm] --> B[Call Method]
    B --> C[Get Result]
    style A fill:#e1f5ff
    style B fill:#fff3e0
    style C fill:#e8f5e9
Loading

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

╔═══════════════════════════════════════════════════════════════╗
β•‘                    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

🀝 Contributing

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
Loading

We welcome contributions! Please read our Contribution Guidelines before you contribute.

πŸš€ Quick Start

# 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.


╔════════════════════════════════════════════════════════╗
β•‘  Made with ❀️ by The Algorithms Community              β•‘
β•‘  ⭐ Star this repository if you find it helpful!       β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

⬆ Back to Top

About

All Algorithms implemented in Java

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.9%
  • Dockerfile 0.1%