Complete Data Structures & Algorithms guide in Java — with strategies, not just code.
This repo assumes you already know Java basics.
If you're starting from zero, complete this repo first:
👉 Java Zero to Hero
(Variables, OOP, arrays, methods, loops — everything you need before DSA)
Once you're comfortable with Java, come back here. ✅
Most DSA repos just show you what the code is.
This repo teaches you how to think — the strategies, patterns, and approaches
that actually help you solve problems in Java.
Every topic includes:
- ✅ Clean, heavily commented Java code
- ✅ Strategy files explaining when and why to use each technique
- ✅ Complexity analysis (time + space)
- ✅ A README in every folder explaining what you'll learn
Step 1 → java-zero-to-hero ← Java basics (do this first)
Step 2 → DSA-Java-Notes ← You are here ✅
Step 3 → Java-LeetCode-Solutions ← Coming soon
| # | Folder | What You'll Learn |
|---|---|---|
| 00 | Prerequisites & Setup | How to use this repo, BigO intro |
| 01 | Arrays & Strings | Two pointer, sliding window, prefix sum |
| 02 | Linked Lists | Singly, doubly, fast/slow pointer |
| 03 | Stacks & Queues | Stack, Queue, Deque, monotonic stack |
| 04 | Recursion & Backtracking | Recursion thinking, backtracking template |
| 05 | Searching | Linear, binary search, binary search on answer |
| 06 | Sorting | Bubble to quicksort + Java's built-in sort |
| 07 | Trees | BFS, DFS, BST, Heap, PriorityQueue |
| 08 | Graphs | BFS, DFS, Dijkstra, Topological Sort, Union Find |
| 09 | Hashing | HashMap, HashSet, frequency map strategy |
| 10 | Dynamic Programming | Memoization, tabulation, knapsack, LCS |
| 11 | Greedy | When to use greedy vs DP |
| 12 | Java DSA Toolkit | Cheatsheets for collections, patterns, complexity |
javac FileName.java
java FileNameOr open in IntelliJ IDEA / VS Code with Java extension.
- Follow the numbered folders in order (00 → 01 → 02 → ...)
- Read the
README.mdin each folder first - Open the
.javafiles — all notes are in comment form - Uncomment and run the code to see it in action
- Modify the code and experiment — that's how you actually learn
Piyush Kumar
📍 CSE – Data Science Student | 🇮🇳 India
Building this for anyone who wants to learn DSA in Java the right way.
⭐ If this helped you, give it a star — it helps others find it too!