Java DSA Roadmap (Beginner to Advanced)
Phase 1: Java Basics (1-2 Weeks)
- Variables, Data Types, Operators
- Control Statements (if-else, loops)
- Functions & Recursion
- OOP (Classes, Objects, Inheritance, Polymorphism)
- Arrays & Strings
Resources:
- Java Basics - GeeksforGeeks: https://www.geeksforgeeks.org/java/
- Java Basics - W3Schools: https://www.w3schools.com/java/
Phase 2: Core Data Structures (4-6 Weeks)
1. Arrays & Strings (Week 1)
- Topics: One-dimensional & Two-dimensional Arrays, Prefix Sum, Sliding Window
- Problems: Two Sum, Maximum Subarray (Kadane's Algorithm), Longest Substring Without Repeating Characters,
Reverse String
- LeetCode: https://leetcode.com/tag/array/
2. Hashing (Week 2)
- Topics: HashMap, HashSet, Frequency Counting
- Problems: Two Sum (Using HashMap), Group Anagrams, Longest Consecutive Sequence
- LeetCode: https://leetcode.com/tag/hash-table/
3. Recursion & Backtracking (Week 3)
- Topics: Base Case, Recursion Tree, Backtracking, Subset Problems
- Problems: Factorial, Fibonacci, Subsets, Combination Sum, N-Queens
- LeetCode: https://leetcode.com/tag/recursion/
4. Linked List (Week 4)
- Topics: Single & Doubly Linked List, Fast & Slow Pointers
- Problems: Reverse Linked List, Merge Two Sorted Lists, Detect Cycle in Linked List
- LeetCode: https://leetcode.com/tag/linked-list/
Phase 3: Advanced Data Structures (4-6 Weeks)
5. Stack & Queue (Week 5)
- Topics: Stack, Queue, Monotonic Stack
- Problems: Valid Parentheses, Min Stack, Sliding Window Maximum
- LeetCode: https://leetcode.com/tag/stack/
6. Trees & BST (Week 6)
- Topics: Binary Tree, DFS, BFS, BST Operations
- Problems: Inorder, Preorder, Postorder Traversal, Lowest Common Ancestor, Validate BST
- LeetCode: https://leetcode.com/tag/tree/
7. Graphs (Week 7-8)
- Topics: BFS, DFS, Dijkstra's Algorithm, Union-Find
- Problems: Number of Islands, Shortest Path in a Grid, Detect Cycle in Graph
- LeetCode: https://leetcode.com/tag/graph/
8. Dynamic Programming (Week 9-10)
- Topics: Memoization, Tabulation, Knapsack, LCS
- Problems: Fibonacci (DP Approach), Coin Change, Longest Increasing Subsequence
- LeetCode: https://leetcode.com/tag/dynamic-programming/
Phase 4: Advanced Topics (Optional)
- Greedy Algorithms (Activity Selection, Huffman Encoding)
- Segment Trees & Binary Indexed Trees (Range Queries)
- Tries (Prefix Tree for String Problems)
How to Practice?
- Easy: 50 Problems
- Medium: 100 Problems
- Hard: 30 Problems
Solve 3-5 problems per day on LeetCode & GeeksforGeeks
Use Java Collections Framework (JCF) for practice
Final Goal:
After 3-4 months, you should be able to solve medium-hard problems in coding interviews.