Interview Preparationbeginner

How to Learn DSA from Scratch for Placements

The order to learn data structures and algorithms in, what each topic needs, and a 16-week plan with practice targets for placement tests.

Published
TL;DR – Quick Answer

To learn DSA from scratch, first get comfortable with one language and Big O basics. Then learn topics in this order: arrays and strings, hashing, sorting and binary search, two pointers and sliding window, recursion, stacks and queues, linked lists, trees, heaps, graphs, and finally dynamic programming. Spend one to two weeks per topic, solve 10 to 20 problems in each, and keep a log of mistakes to re-solve. Most fresher placement tests focus on the first half of this list.

On This Page

To learn DSA from scratch, get comfortable with one language, learn Big O basics, then study topics in a fixed order from arrays to dynamic programming. Spend one to two weeks per topic and solve problems in each before moving on. Most fresher placement tests focus on the first half of the list, so you can start applying before you finish everything.

This guide gives the topic order, what to master in each topic, a 16-week plan and links to practice on our site.

Before you start DSA

You are ready to begin DSA when you can do these in your chosen language without searching:

  • Write loops, conditions and functions
  • Work with arrays and strings: read, update, loop through
  • Write a simple class with fields and methods
  • Read input and print output in the format a test asks for

If not, spend two to four weeks on the basics first. Number and string problems such as reverse a number without using strings and count the vowels and consonants in a string are good warm-ups.

Pick one language and stay with it. Java, C++ and Python all work. Know its built-in structures: lists or arrays, maps, sets, and a stack or queue.

Learn Big O first, briefly

Big O tells you how running time grows as input grows. You need it to judge whether a solution will pass a test's time limit.

Big O Name Example
O(1) Constant Reading an array element by index
O(log n) Logarithmic Binary search on a sorted array
O(n) Linear One loop through an array
O(n log n) Linearithmic Efficient sorting such as merge sort
O(n²) Quadratic Two nested loops over the same array

You do not need formal proofs. You need to look at your code and say roughly how it grows. Our DSA guide explains this with examples.

The DSA topic order

Learn in this order. Each topic uses ideas from the ones before it.

# Topic What to master Placement weight
1 Arrays Traversal, prefix sums, in-place changes Very high
2 Strings Character counts, reversing, palindromes, substrings Very high
3 Hashing (maps and sets) Frequency counts, fast lookups, duplicates Very high
4 Sorting and binary search Bubble, selection, insertion, then merge and quick sort; binary search and its variants High
5 Two pointers and sliding window Pairs in sorted arrays, longest or shortest subarray High
6 Recursion and backtracking Base case, recursive case, subsets, permutations Medium to high
7 Stacks and queues Brackets, next greater element, queue using stacks High
8 Linked lists Reverse, find middle, detect a cycle, merge Medium to high
9 Trees and binary search trees Traversals, height, BST insert and search Medium
10 Heaps (priority queues) Top k elements, merging sorted lists Medium
11 Graphs Representation, BFS, DFS, connected parts Medium, higher for product companies
12 Dynamic programming Breaking into overlapping subproblems; 1D, then 2D Mostly product companies

"Placement weight" is a rough guide to how often a topic shows up in fresher coding tests and interviews. Services company tests lean on topics 1 to 7. Product company interviews often go through all twelve.

Pro tip: For each topic, first learn how it works and the cost of its main operations, then solve 3 easy problems, then medium ones. Do not jump to hard problems before easy ones feel routine.

How to study one topic

Use the same cycle for every topic:

  1. Learn the idea (day 1). Read or watch one explanation. Draw it on paper.
  2. Implement it yourself (day 1 to 2). For example, write binary search or reverse a linked list without copying.
  3. Solve easy problems (days 2 to 5). Five to eight problems.
  4. Solve medium problems (days 5 to 10). Five to ten problems. Struggle 20 to 30 minutes before a hint.
  5. Review (last day). Re-solve the problems you could not do alone. Write a short note on the patterns you saw.

For the method to read and break down each problem, see how to improve problem-solving skills for coding.

Practice problems on our site, by topic

Browse the full Problems section for more in each topic.

The 16-week DSA study plan

This plan assumes one to two hours on college days and a little more on free days.

Weeks Topic Target by the end
1 Language check and Big O 10 basic programs; explain the Big O of each
2 to 3 Arrays 20 problems; prefix sums used at least twice
4 Strings 15 problems
5 Hashing 15 problems using a map or set
6 to 7 Sorting and binary search Write merge sort and binary search from memory; 15 problems
8 Two pointers and sliding window 12 problems
9 Recursion and backtracking 10 problems; draw the call tree for 3
10 Stacks and queues 12 problems
11 Linked lists 10 problems; reverse a list from memory
12 to 13 Trees and BST 15 problems; all four traversals from memory
14 Heaps and graphs (BFS, DFS) 10 problems
15 Dynamic programming basics 8 classic 1D problems
16 Mixed timed practice Two timed sets of 2 problems in 60 minutes

If you are targeting services companies soon, you can start taking their tests after week 10 and continue the rest alongside. If you are in third year, see how to prepare for placements in third year for how DSA fits with projects and internships.

Common mistake: Restarting DSA from arrays every time you take a break. Keep a progress sheet. When you return, re-solve five old problems to warm up, then continue from where you stopped.

Keep a mistake log

The fastest way to improve is to study your own mistakes. Keep a sheet with these columns:

Problem Topic What went wrong Fix or pattern Re-solve date

Before every mock test, read this log instead of new material.

Preparing for the interview side

Coding tests check whether your code passes. Interviews also check whether you can explain it. For each topic, be ready to answer:

  • How does this structure work, and what is the time of insert, search and delete?
  • When would you use it instead of another one? For example, array vs linked list or stack vs queue.
  • What is the time and space of your solution, and can you improve it?

Our DSA interview questions page covers the common theory questions.

Where this fits in placement preparation

DSA is one part of placement preparation, next to aptitude, projects, CS fundamentals and communication. For a final-year schedule that combines them, see the placement preparation roadmap for 2027. Start DSA today with one topic and one problem. Progress comes from showing up daily, not from finding the perfect list.

Picking a language for DSA? Read Python vs C++ for placements before you start.

Frequently Asked Questions

How long does it take to learn DSA from scratch?
With one to two hours a day, most students cover the core topics for placement tests in about four months. Product company interviews with harder problems may need more time. Steady daily practice matters more than total hours.
Which language is best for learning DSA?
Use the language you know best. Java, C++ and Python are all accepted in most placement coding tests. Switching languages to learn DSA usually wastes time.
How many DSA problems should I solve for placements?
There is no magic number. Around 150 to 250 well-understood problems spread across the core topics prepares most students for fresher tests. Understanding patterns matters more than count.
Do service companies ask DSA questions?
Many service company tests include coding problems, usually easy to medium level on arrays, strings and basic logic. Product companies tend to ask harder problems on trees, graphs and dynamic programming.
Should I learn the theory or just solve problems?
Both. Learn how a structure works and the time of its main operations first, then solve problems. Theory without practice fails in tests; practice without theory fails in interviews when you are asked why.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 4 December 2026 LinkedIn
Chat with us