■ Detailed Java DSA Roadmap
■ Phase 0 – Foundation Zero: Java Basics & Programming Math
• Java Basics: Data types, Variables, Operators, Control Structures, Arrays, Strings.
• Expressions & Operators: Arithmetic (+,-,*,/,%), Unary (++/--), Logical (&&,||,!), Bitwise
(&,|,^,<<,>>).
• Precedence and Associativity of operators, Integer vs Floating division, Overflow and
Underflow.
• Number Systems: Binary, Decimal, Hexadecimal conversions, parseInt and toString(radix).
• Mathematics for DSA: Prime Numbers (Sieve of Eratosthenes), GCD & LCM (Euclidean
algorithm), Modular arithmetic, Fast exponentiation.
• Bit Manipulation: Power of 2 checks, Count set bits, XOR properties, Masks and Shifts.
• BigInteger and BigDecimal usage for large numbers.
■ Phase 1 – Arrays, Strings & Searching/Sorting
• Arrays: Static and Dynamic arrays, Memory model, Resizing, Complexity.
• Strings: String vs StringBuilder, Character arrays, Palindrome, Anagram problems.
• Two-pointer and Sliding Window techniques.
• Prefix Sum, Suffix Sum, Difference Array, Kadane’s Algorithm.
• Searching: Linear Search, Binary Search (first/last occurrence, search insertion point).
• Sorting: Bubble, Insertion, Selection, Merge Sort, Quick Sort (Lomuto/Hoare), Heap Sort,
Counting/Radix Sort.
• Binary Search on Answer problems.
■ Phase 2 – Linked Lists, Stacks, Queues, Hashing
• Linked Lists: Singly, Doubly, Circular, Implementation from scratch.
• Linked List Problems: Reverse, Find middle, Detect cycle (Floyd’s Algorithm), Merge sorted
lists.
• Stacks: LIFO principle, Min Stack, Next Greater Element, Infix-Postfix conversion, Evaluate
expressions.
• Queues: FIFO principle, Normal Queue, Circular Queue, Deque, PriorityQueue.
• Queue Problems: Sliding Window Maximum, Rotten Oranges.
• Hashing: HashMap, HashSet, Frequency counting, Subarray problems with given sum.
• equals() and hashCode() contract in Java.
■ Phase 3 – Recursion & Backtracking
• Recursion Basics: Factorial, Fibonacci, Sum of digits, Power function.
• Recursion Trees and Complexity.
• Backtracking: N-Queens, Rat in a Maze, Sudoku Solver, Word Search.
• Subsets, Subsequences, String permutations, Combinations.
■ Phase 4 – Trees
• Binary Trees: Node structure, Traversals (Inorder, Preorder, Postorder, Level-order).
• Tree Problems: Height, Diameter, Balanced Tree check.
• Views: Left, Right, Top, Bottom views.
• Lowest Common Ancestor (LCA).
• Binary Search Tree (BST): Insert, Search, Delete, Validate BST.
• Heaps: Min/Max Heap, Heapify, Heap Sort, k-largest/smallest elements.
• PriorityQueue usage in Java.
• Tries: Prefix Tree, Word Search, Autocomplete problems.
■ Phase 5 – Graphs
• Graph Representations: Adjacency List, Adjacency Matrix.
• Traversals: BFS, DFS (recursive and iterative).
• Cycle Detection: Directed and Undirected graphs, Bipartite check.
• Shortest Path Algorithms: Dijkstra, Bellman-Ford, Floyd-Warshall, 0-1 BFS.
• Minimum Spanning Tree (MST): Kruskal’s Algorithm (DSU), Prim’s Algorithm.
• Topological Sort: DFS and Kahn’s Algorithm.
• Strongly Connected Components (SCC): Kosaraju’s Algorithm, Tarjan’s Algorithm.
• Disjoint Set Union (Union-Find with path compression and rank).
■ Phase 6 – Dynamic Programming & Greedy
• DP Basics: Memoization vs Tabulation, State definition, Recursion to DP.
• 1D DP: Fibonacci, Climbing Stairs, Minimum Cost problems.
• 2D DP: Grid-based DP, Unique Paths, Minimum Path Sum.
• Knapsack Problems: 0/1 Knapsack, Unbounded Knapsack, Subset Sum.
• LCS Variants: Longest Common Subsequence, Longest Increasing Subsequence, Edit
Distance.
• Matrix Chain Multiplication, Egg Dropping problem.
• Advanced DP: DP on Trees, Digit DP, Bitmask DP.
• Greedy Algorithms: Activity Selection, Interval Scheduling, Huffman Coding.
• Divide & Conquer: Binary Search on Answer, Matrix exponentiation.
■ Phase 7 – Advanced Data Structures & Algorithms
• Segment Tree: Range sum/min/max queries, Lazy Propagation.
• Fenwick Tree (Binary Indexed Tree).
• Disjoint Set Union (Advanced problems).
• String Algorithms: KMP, Rabin-Karp, Z Algorithm, Manacher’s Algorithm (palindromes).
• Number Theory: Modular arithmetic, Modular inverse, Chinese Remainder Theorem.
• Combinatorics: nCr mod p, Pascal’s Triangle.
• Geometry (Optional): Convex Hull (Graham’s Scan, Monotone Chain), Line sweep problems.
• Network Flow (Optional): Edmonds-Karp, Dinic’s Algorithm.
■ Phase 8 – Problem Solving & Competitive Programming
• LeetCode Top Interview 150 problems.
• GeeksforGeeks Must-Do DSA problems.
• Codeforces Div3, AtCoder Beginner contests for speed.
• Solve 500+ problems across topics for mastery.
• Practice analyzing time/space complexity of every solution.
■ Suggested Timeline (6 Months Plan)
• Month 1 → Java Basics, Math, Arrays, Strings.
• Month 2 → Linked Lists, Stacks, Queues, Hashing.
• Month 3 → Recursion, Trees.
• Month 4 → Graphs.
• Month 5 → Dynamic Programming, Greedy, Divide & Conquer.
• Month 6 → Advanced DS, String Algorithms, Problem Solving.
■ Final Tips
• Code everything from scratch before using libraries.
• Be consistent: Solve 2–3 problems daily.
• Maintain a GitHub repo with your solutions.
• Focus on understanding WHY a solution works.
• Use LeetCode (interview prep), Codeforces (speed), GeeksforGeeks (concepts).
• Revise and re-solve problems after a gap for mastery.