Hey there, fellow developer!
Whether you're just starting your Java journey or looking to strengthen your algorithmic problem-solving skills, you’re in the right place.
I have personally taken the time to write, explain, and implement each algorithm in this repository. Every implementation is designed to help learners understand the logic behind each algorithm, see how it works through demo examples, and experiment with it to strengthen understanding.
This repository is built for beginners and enthusiasts alike — to help you learn, practice, and master algorithms through clear explanations, well-commented Java code, and hands-on exercises.
Every algorithm here is designed to make learning fun, practical, and easy to understand, no matter your experience level. It comes with:
- Addictive Learning: Designed to make exploring algorithms fun and interactive rather than boring.
- Comprehensiveness: Covers almost every classical algorithm needed to master data structures and algorithms.
- Clear explanations of what it does and why it matters
- Use cases for real-world scenarios
- Time & space complexity
- Step-by-step approach so you can follow the logic
- Readable, beginner-friendly code
“The best way to learn algorithms is not just to read them — it’s to build them, run them, and break them.”
Data Structures and Algorithms
├── data_structures/
| ├── Linear Data Structures/
| | ├── Arrays/
| | | ├── Array Basics.java
| | | └── Dynamic Array.java
| | |
| | ├── Linked-lists/
| | | ├── Circular-linked-list.java
| | | ├── Circular-linked-list.java
| | | ├── Doubly-linked-list.java
| | | └── Singly-linked-list.java
| | ├── Queues/
| | | ├── Dequeue.java
| | | ├── Queue Array.java
| | | └── Queue Linked-list.java
| | |
| | └── Stacks/
| | ├── Stack Array.java
| | └── Stack Linked-list.java
| |
│ └── Non-linear Data Structures/
| ├── Graphs/
| | ├── Edge.java
| | ├── Graph Utils.java
| | ├── Graph.java
| | └── Node.java
| └── Trees/
| ├── AVL Tree.java
| ├── Binary Search Tree.java
| ├── Binary Tree.java
| ├── Red-Black Tree.java
| └── Segment Tree.java
└── algorithms/
├── search/
│ ├── LinearSearch.java
│ ├── BinarySearch.java
│ ├── JumpSearch.java
│ ├── InterpolationSearch.java
│ ├── ExponentialSearch.java
│ └── TernarySearch.java
├── sorting/
│ ├── BubbleSort.java
│ ├── SelectionSort.java
│ ├── InsertionSort.java
│ ├── MergeSort.java
│ ├── QuickSort.java
│ ├── HeapSort.java
│ ├── ShellSort.java
│ ├── CountingSort.java
│ ├── RadixSort.java
│ └── BucketSort.java
├── hashing/
│ ├── HashTableChaining.java
│ ├── HashTableOpenAddressing.java
│ ├── HashFunctions.java
│ └── CustomHashMap.java
├── graph_algorithms/
│ ├── DFS.java
│ ├── BFS.java
│ ├── Dijkstra.java
│ ├── BellmanFord.java
│ ├── FloydWarshall.java
│ └── AStar.java
├── greedy/
│ ├── ActivitySelection.java
│ ├── FractionalKnapsack.java
│ ├── HuffmanCoding.java
│ ├── JobSequencing.java
│ ├── MinimumSpanningTree/
│ ├── Kruskal.java
│ └── Prim.java
├── dynamic_programming/
│ ├── FibonacciDP.java
│ ├── LongestCommonSubsequence.java
│ ├── LongestIncreasingSubsequence.java
│ ├── EditDistance.java
│ ├── Knapsack01.java
│ ├── CoinChange.java
│ └── MatrixChainMultiplication.java
└── string_algorithms/
├── NaiveStringSearch.java
├── KMP.java
├── BoyerMoore.java
├── RabinKarp.java
├── ZAlgorithm.java
├── LongestPalindromeSubstring.java
├── AnagramCheck.java
└── PatternMatchingBasics.java
- Compile and run any algorithm
- Explore, learn, and modify the algorithms as you go!
Contributions are welcome! If you want to add more algorithms or improve explanations:
- Follow the same format and style
- Include detailed comments
- Add a demo in the main method
- Follow consistent Java naming conventions
- Comment your logic clearly
- Include time and space complexity
If you find this project helpful, please ⭐ star the repo!
This repository is open-source. You are free to use it for learning, teaching, and personal projects.