If you are a student who wants to crack placements at a product-based company or prepare for coding interviews at FAANG, startups, or service companies moving into product roles, the path is clearer than most people realise — and more achievable than most people believe. This complete guide to Data Structures and Algorithms and this DSA roadmap tells you exactly what to learn, in what order, and why — so you can move from "I don't know where to start" to "I can solve most interview problems" in a structured, confidence-building progression. Data Structures and Algorithms is not the hardest thing you will ever learn. It is a skill set with a defined body of knowledge, a learnable set of patterns, and a clear set of tools. The students who struggle with DSA for placements are not those who lack ability — they are those who lack a map. This is that map. Whether you want to learn DSA from scratch in your second year, cramming in your pre-final semester, or refreshing before a job switch, this DSA study plan covers every phase from foundations through advanced problem-solving — with interview coding questions examples, pattern guides, and honest time estimates at every step.
Related Article:
Top BTech Colleges in India 2026
Table of Contents
- Why DSA Matters for Placements
- Phase 1 — Programming Foundations (Week 1–2)
- Phase 2 — Core Data Structures (Week 3–6)
- Phase 3 — Core Algorithms (Week 7–10)
- Phase 4 — Problem Patterns (Week 11–14)
- Phase 5 — Advanced Topics (Week 15–18)
- Phase 6 — Interview Readiness (Week 19–24)
- Best Resources for DSA Preparation
- Common Mistakes to Avoid
- Conclusion
Why DSA Matters for Placements
Every major product company — Google, Microsoft, Amazon, Flipkart, Uber, Atlassian, Goldman Sachs technology, Adobe — screens software engineers primarily through coding interview preparation. The format is consistent: you are given a problem, a blank editor, and 20 to 45 minutes to produce a working, optimised solution and explain your reasoning. The problems are not academic puzzles — they are filters designed to assess whether you can think algorithmically, identify the right data structure for the constraints, and implement a correct solution under pressure. You cannot bluff your way through a live coding interview with good communication skills or project experience. You either know the patterns or you don't.
The good news is that the universe of patterns tested in placement interviews is finite and learnable. Analysis of thousands of interview problems across top companies shows that approximately 80% of all placement interview coding questions fall into 15 to 20 recurring algorithmic patterns — Two Pointers, Sliding Window, Binary Search, BFS/DFS, Dynamic Programming, Backtracking, and so on. A student who deeply understands these patterns and has practised applying them across problem variations can solve most interview problems they have never seen before — because the problem is new but the pattern is familiar. This DSA roadmap is structured around building that pattern recognition — systematically, from the ground up.
What Companies Actually Test
- Tier 1 Product Companies (Google, Microsoft, Meta, Amazon): Medium to Hard LeetCode problems; emphasis on optimal time/space complexity; system design for senior roles
- Mid-tier Product Companies (Flipkart, Paytm, PhonePe, Swiggy, Zomato, Atlassian): Easy to Medium problems; clean code and communication as strong differentiators
- Service + Mass Recruiters (TCS, Infosys, Wipro, Cognizant): Aptitude + basic programming; basic array, string, and loop problems; less DSA-intensive but still requires foundations
- Startups: Highly variable; some match Tier 1 difficulty; many focus more on practical coding and take-home projects; DSA foundations still essential
Phase 1 — Programming Foundations (Week 1–2)
Before you write a single line of Data Structures and Algorithms code, you need to be fluent in the language you are solving problems in. The most commonly used languages for DSA for placements are Python, Java, and C++ — with Python being the most beginner-friendly and C++ offering the best performance. Choose one language and commit to it for the full DSA study plan. Do not switch languages mid-preparation.
What to Master in Phase 1
- Variables, data types, conditionals, loops — the basics you likely already know
- Functions — parameters, return values, scope, recursion (particularly important)
- Arrays and strings — the two most important built-in structures in any interview language
- Built-in data structures — List/ArrayList, Dictionary/HashMap, Set, Stack/Queue equivalents
- Time and space complexity basics — Big O notation, what O(n), O(n²), O(log n) mean
Time Complexity — The Most Important Mental Model in DSA
Every solution you write in an interview will be evaluated on correctness AND efficiency. Here is the order of complexity from best to worst — and what each means for an array of size n:
# Big O complexity ladder — memorise this
# O(1) — Constant: doesn't grow with input size
def get_first(arr):
return arr[0] # same time regardless of array size
# O(log n) — Logarithmic: halves the problem each step
# Binary search on n=1,000,000 → only ~20 steps
# O(n) — Linear: one pass through the input
def find_max(arr):
return max(arr) # touches each element once
# O(n log n) — Most efficient sorting algorithms
arr.sort() # Python's built-in sort is O(n log n)
# O(n²) — Quadratic: nested loops — avoid in interviews
for i in range(len(arr)):
for j in range(len(arr)): # n * n = n² operations
pass
# O(2^n) — Exponential: usually seen in brute-force recursion
# Never acceptable for n > 20 in interviews
Goal by end of Phase 1: You can write clean, correct code in your chosen language for any basic problem. You understand what Big O notation means and can estimate the complexity of simple solutions.
Phase 2 — Core Data Structures (Week 3–6)
This is the most important phase of the entire DSA roadmap. Data structures are the building blocks — choosing the right structure for a problem is often 80% of the solution. Learn each one from scratch: what it is, how it works internally, its time and space complexity for each operation, and the class of problems it is best suited for.
Data Structures to Master (in order)
1. Arrays and Strings
- Index-based access O(1), insertion/deletion O(n)
- Most placement problems start here — master array manipulation completely
- Key operations: two-pointer traversal, prefix sums, sliding window (previewed here, detailed in Phase 4)
# Prefix sum — one of the most useful array techniques
def range_sum(arr, l, r):
prefix = [0] * (len(arr) + 1)
for i in range(len(arr)):
prefix[i + 1] = prefix[i] + arr[i]
# Now any range sum [l, r] is O(1)
return prefix[r + 1] - prefix[l]
# Without prefix sum: O(n) per query
# With prefix sum: O(n) preprocess + O(1) per query
2. Linked Lists
- Singly and doubly linked lists — implement from scratch; understand node-pointer manipulation
- Key patterns: reversal, cycle detection (Floyd's algorithm), finding middle node
- Every linked list problem becomes easy once you internalize the pointer-manipulation mental model
3. Stacks and Queues
- Stack: LIFO — used for bracket matching, monotonic stack problems, undo operations
- Queue: FIFO — used for BFS, task scheduling, sliding window maximum
- Deque (double-ended queue): used for sliding window problems and BFS with back-tracking
4. Hash Maps and Hash Sets
- The most frequently used data structure in interview problem-solving
- O(1) average lookup, insertion, deletion — the structure that converts O(n²) solutions to O(n)
- Master: frequency counting, two-sum pattern, grouping, caching/memoization
# Two Sum — the archetypal HashMap problem
# "Find two numbers in array that add to target"
# Brute force: O(n²) — check every pair
def two_sum_slow(nums, target):
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return [i, j]
# HashMap solution: O(n) — the interview-expected answer
def two_sum_fast(nums, target):
seen = {} # value → index
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i # store AFTER checking
5. Trees
- Binary trees, Binary Search Trees (BST), and N-ary trees
- Master all traversals: Inorder, Preorder, Postorder (recursive AND iterative), Level-order (BFS)
- BST properties: left < root < right; efficient for search, insert, delete in O(log n) average
- Recursive tree problems are among the most common interview questions — invest heavily here
6. Heaps (Priority Queues)
- Min-heap and max-heap — O(log n) insert and extract, O(1) peek
- Used for: Top-K elements, K-closest points, merge K sorted lists, running median
- Python:
heapqmodule (min-heap by default; negate for max-heap)
Goal by end of Phase 2: You can implement every data structure from scratch and solve Easy–Medium problems involving each one. You understand which structure to reach for given the problem constraints.
Also Read:
Top MTech Colleges in India 2026
Phase 3 — Core Algorithms (Week 7–10)
Algorithms are the procedures — the strategies you apply to data structures to solve problems efficiently. This phase covers the fundamental algorithms that appear directly in interviews and that underpin the patterns you will learn in Phase 4.
Sorting Algorithms
- Know well: Bubble Sort, Selection Sort, Insertion Sort (for intuition — all O(n²))
- Know deeply: Merge Sort and Quick Sort — understand the divide-and-conquer logic, implement from scratch
- Know when to use custom sorting: Interviews often require sorting by a custom comparator — e.g. sort intervals by start time, sort strings by length then alphabetically
Searching Algorithms — Binary Search (Critical)
Binary Search is one of the most underestimated topics in DSA preparation. It is not just "find element in sorted array" — it is a general-purpose technique for any problem where you can identify a monotonic search space. Master the template completely:
# Binary Search — master this template
def binary_search(arr, target):
left, right = 0, len(arr) - 1
while left <= right:
mid = left + (right - left) // 2 # avoids overflow
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid + 1 # target in right half
else:
right = mid - 1 # target in left half
return -1 # not found
# Advanced: Binary search on ANSWER (not just sorted array)
# "What is the minimum possible value of X such that condition holds?"
# → Binary search on the range of possible answers
# Example problems: Koko Eating Bananas, Ship Packages in D Days
Recursion and the Call Stack
Recursion is not a topic to learn once and move past — it is the foundation for trees, graphs, dynamic programming, and backtracking. If recursion feels uncomfortable, invest time here before moving forward. The key insight: every recursive solution has three components — the base case, the recursive call that moves toward the base case, and the logic that combines results.
Graph Algorithms (BFS and DFS)
- BFS (Breadth-First Search): Level by level traversal using a queue — used for shortest path in unweighted graphs, level-order tree traversal, nearest neighbour problems
- DFS (Depth-First Search): Deep exploration using recursion or a stack — used for cycle detection, topological sort, connected components, path finding
- Both patterns apply to explicit graph problems AND to implicit graph problems (grids, word ladders, state space search)
# BFS template — works for almost all BFS problems
from collections import deque
def bfs(graph, start):
visited = {start}
queue = deque([start])
while queue:
node = queue.popleft()
# process node here
for neighbor in graph[node]:
if neighbor not in visited:
visited.add(neighbor)
queue.append(neighbor)
# DFS template (recursive) — works for tree and graph DFS
def dfs(graph, node, visited=None):
if visited is None:
visited = set()
visited.add(node)
# process node here
for neighbor in graph[node]:
if neighbor not in visited:
dfs(graph, neighbor, visited)
Goal by end of Phase 3: You can implement sorting from scratch, apply binary search to novel problems, write clean recursive solutions, and template BFS and DFS for any graph or tree problem.
Phase 4 — Problem Patterns (Week 11–14)
This is the phase where your coding interview preparation starts feeling like pattern recognition rather than problem-solving from scratch. The patterns below collectively cover the majority of Medium-level LeetCode problems — which is exactly the difficulty range that most placement interviews target.
Pattern 1: Two Pointers
When to use: Sorted arrays, string palindrome checks, container/area problems, removing duplicates. Two pointers moving toward each other or in the same direction — eliminates the nested loop and reduces O(n²) to O(n).
# Two Pointers: Check if array has pair summing to target (sorted array)
def has_pair_with_sum(arr, target):
left, right = 0, len(arr) - 1
while left < right:
curr_sum = arr[left] + arr[right]
if curr_sum == target:
return True
elif curr_sum < target:
left += 1 # need larger sum
else:
right -= 1 # need smaller sum
return False
Pattern 2: Sliding Window
When to use: Contiguous subarray or substring problems — maximum sum subarray, longest substring without repeating characters, minimum window substring. Maintains a window over the array and expands/contracts it based on conditions.
# Sliding Window: Maximum sum subarray of size k
def max_sum_subarray(arr, k):
window_sum = sum(arr[:k])
max_sum = window_sum
for i in range(k, len(arr)):
window_sum += arr[i] - arr[i - k] # slide: add new, remove old
max_sum = max(max_sum, window_sum)
return max_sum # O(n) vs O(nk) brute force
Pattern 3: Fast and Slow Pointers
When to use: Cycle detection in linked lists, finding middle of linked list, detecting cycle start. The fast pointer moves twice as fast as slow — if there is a cycle, they will meet.
Pattern 4: Merge Intervals
When to use: Any problem involving intervals — meeting rooms, overlapping ranges, insert interval. Sort by start time, then merge overlapping intervals in a single pass.
Pattern 5: Monotonic Stack
When to use: Next greater element, largest rectangle in histogram, daily temperatures. Maintains a stack of elements in increasing or decreasing order — when an element breaks the monotonicity, you process the elements it "dominated".
# Monotonic Stack: Daily Temperatures
# "For each day, how many days until a warmer day?"
def daily_temperatures(temps):
result = [0] * len(temps)
stack = [] # stores indices of days awaiting warmer day
for i, temp in enumerate(temps):
while stack and temps[stack[-1]] < temp:
prev_day = stack.pop()
result[prev_day] = i - prev_day
stack.append(i)
return result # O(n) — each element pushed and popped once
Goal by end of Phase 4: When you read a new problem, you immediately identify which pattern it belongs to and can sketch the solution structure before writing code. You can solve most LeetCode Medium problems within 25 to 30 minutes.
CHECK OUT:
Top Colleges in Ranchi 2026
Phase 5 — Advanced Topics (Week 15–18)
This phase covers the topics that separate candidates targeting Tier 1 companies from those preparing for mid-tier placements. These are harder to learn but appear frequently in the most competitive interviews.
Dynamic Programming (DP) — The Most Feared, Most Learnable Topic
DP is not magic — it is a technique for problems with overlapping subproblems and optimal substructure. Every DP solution follows a structure: define the state, write the recurrence, add memoization or bottom-up tabulation. Learn these DP patterns in order:
- 1D DP: Fibonacci, Climbing Stairs, House Robber, Coin Change
- 2D DP: Longest Common Subsequence, Edit Distance, Unique Paths
- Knapsack Variants: 0/1 Knapsack, Unbounded Knapsack, Subset Sum
- String DP: Palindromic Substrings, Word Break, Interleaving Strings
# DP Template: Top-down with memoization
def coin_change(coins, amount):
memo = {}
def dp(remaining):
if remaining == 0: return 0 # base case
if remaining < 0: return float('inf')
if remaining in memo: return memo[remaining]
min_coins = float('inf')
for coin in coins:
result = dp(remaining - coin)
min_coins = min(min_coins, result + 1)
memo[remaining] = min_coins
return min_coins
result = dp(amount)
return result if result != float('inf') else -1
Backtracking
When to use: Generating all possible combinations, permutations, subsets, or any problem requiring exhaustive search with pruning. Backtracking is DFS on a decision tree — you make a choice, recurse, and undo the choice. Master: Subsets, Permutations, Combination Sum, N-Queens, Sudoku Solver.
Advanced Graph Algorithms
- Topological Sort: Ordering tasks with prerequisites — course schedule problems
- Union Find (Disjoint Set Union): Connected components, cycle detection in undirected graphs, Kruskal's MST
- Dijkstra's Algorithm: Shortest path in weighted graphs — O((V + E) log V)
Tries (Prefix Trees)
Tries are specialised trees for string prefix operations — autocomplete, word search, longest common prefix. Implement a Trie from scratch and understand insert, search, and startsWith operations.
Goal by end of Phase 5: You can solve Hard problems involving DP and backtracking with moderate hints. You understand all major graph algorithms and can implement them from memory.
Stop Stressing. Start Applying.
Skip the chaos of filling endless forms. Apply to your dream colleges in one go through the College Nirnay Common Application Form — built for every student navigating India's competitive education landscape.
Fill the Common Application Form →✓ Free to apply · ✓ Takes under 5 minutes · ✓ Trusted by thousands of students
Phase 6 — Interview Readiness (Week 19–24)
Knowing DSA and performing in a live interview are two different skills. Phase 6 is about converting your knowledge into consistent interview performance — under time pressure, with an interviewer watching, and with the requirement to think out loud while coding.
The Interview Protocol — How to Approach Every Problem
- Clarify (2–3 minutes): Ask about edge cases, input constraints, expected output format. "Can the array be empty? Can there be duplicates? Is the input sorted?" This shows structured thinking and prevents wasted time on wrong assumptions
- Brute force first (3–5 minutes): State the naive solution and its complexity before optimising. This establishes a baseline and demonstrates that you can solve the problem — even if not optimally
- Optimise (5–10 minutes): Identify the bottleneck (usually the O(n²) nested loop) and consider which pattern or data structure eliminates it. State your approach before coding
- Code (10–15 minutes): Write clean, readable code. Name variables meaningfully. Comment key logic decisions
- Test and debug (3–5 minutes): Walk through your code with a simple example, then an edge case. Fix any bugs you find
Mock Interview Practice
- Solve at least 50 problems on LeetCode under timed conditions (25 to 30 minutes per problem)
- Practice with a partner — explaining your reasoning out loud to another person is dramatically different from solving silently
- Use Pramp, InterviewBit's mock interview feature, or peer practice sessions in your campus coding club
- Record yourself solving problems and review — the most revealing and most uncomfortable practice method, and the most effective
The LeetCode Problem List Strategy
- NeetCode 150: The best curated list for placement preparation — 150 problems organised by pattern, covering every topic that matters for interviews
- Company-tagged problems on LeetCode: If you know which companies you are targeting, solve their most-asked problems in the 30 days before the interview
- Quality over quantity: Deeply understanding 150 problems and their patterns is more valuable than shallowly attempting 400 problems
Goal by end of Phase 6: You can solve Easy problems in 10 minutes, Medium problems in 25 minutes, and Hard problems with 5 to 10 minutes of guidance. You communicate your thinking clearly while coding.
Best Resources for DSA Preparation
Free Resources
- LeetCode: The gold standard for problem practice — use the free tier; it is sufficient for placement preparation
- NeetCode.io: Video solutions for every NeetCode 150 problem — the best free explanation resource available
- Striver's DSA Sheet (TakeUForward): 180-problem sheet with video solutions — highly respected in Indian placement preparation community
- GeeksForGeeks: Reference for data structure implementations and algorithm explanations — use it as a reference, not a primary learning source
- CS50 and MIT OpenCourseWare (6.006): For algorithm theory — optional but extremely valuable for understanding the why behind algorithms
Paid Resources (Optional)
- AlgoExpert / Educative.io: Structured courses with explanations — useful if you prefer guided learning over self-paced problem solving
- LeetCode Premium: Access company-tagged problems and mock interviews — worth it in the final 2 months if targeting specific companies
Recommended Problem Count by Phase
| Phase | Problems | Difficulty |
|---|---|---|
| Phase 2 (Data Structures) | 30–40 problems | Easy–Medium |
| Phase 3 (Algorithms) | 20–30 problems | Easy–Medium |
| Phase 4 (Patterns) | 40–50 problems | Medium |
| Phase 5 (Advanced) | 30–40 problems | Medium–Hard |
| Phase 6 (Interview Prep) | 30–50 problems (mock-style) | Mixed |
| Total | ~150–200 problems | Full range |
Common Mistakes to Avoid
- Starting with LeetCode Hard problems before mastering Easy ones: This is the most common and most demoralising mistake. The DSA roadmap is sequential by design — skipping foundations produces gaps that collapse under interview pressure
- Watching solution videos without attempting the problem: Watching a solution feels like learning but is not. Attempt every problem for at least 20 minutes before consulting any hint or solution. Struggle produces learning; passive observation does not
- Switching languages mid-preparation: The syntax cost of switching is lower than the pattern-familiarity cost. Stay with your chosen language for the full DSA study plan
- Solving 400 problems shallowly instead of 150 problems deeply: Pattern recognition comes from understanding variations of the same problem type — not from skimming as many problems as possible
- Never practising out loud: Silent problem-solving and verbal explanation to an interviewer are completely different skills. Practice thinking out loud from Phase 4 onwards — not just in Phase 6
- Ignoring time complexity analysis: A correct but O(n²) solution when O(n) is expected will not pass a Tier 1 interview. Always analyse and state complexity before finalising a solution
- Not building a revision schedule: DSA patterns decay without regular revisitation. Solve at least 5 problems per week in areas you have already completed, in addition to new material
Explore More
Conclusion
The DSA roadmap and the path to learn DSA from scratch outlined here — six phases across 24 weeks — is the most reliable path from zero to placement-ready that exists. It is not the fastest path; it is the most thorough one. Students who rush through it without building genuine understanding at each phase will find themselves unable to adapt to problems they have not seen before — which is precisely what interviews test. Students who follow it with patience and consistent daily effort will find themselves, by the end, in the minority of candidates who can actually perform under interview conditions rather than just recite solutions they have memorised.
The software engineer preparation journey for placements — the most important software engineer preparation investment you can make — is one of the most learnable and most teachable skill-building processes in engineering education. Unlike exams that test recall, coding interview preparation rewards pattern recognition, systematic thinking, and the ability to decompose complex problems — skills that compound with practice. Every hour of focused problem-solving adds to a mental library of patterns that becomes faster and more reliable over time.
placement preparation tips distilled: Start today. Build one concept at a time. Follow these placement preparation tips — quality over quantity, patterns over problems, consistency over intensity. These are the placement preparation tips that actually differentiate successful candidates. Solve problems consistently. Talk through your reasoning every time you practice. The students who crack placements at top product companies are not smarter than the ones who don't — they are more consistent, more systematic, and started earlier. Your coding roadmap is in front of you. This coding roadmap has been built from the ground up. The rest is practice. This DSA for placements guide, this coding roadmap, and this software engineer preparation framework exist so that your effort is directed rather than scattered. Every interview coding questions session, every learn DSA from scratch hour — it all compounds.




