How to Start DSA

Every company is having Competitive Programming-based OA rounds and is asking DSA in tech rounds these days. If you're not doing DSA, the number of companies you can apply to gets drastically reduced. So here's a guide on how you can get started with DSA to ace those OAs and interviews.

Pick a Language

The most popular languages for doing DSA are C++, Java, and Python (in decreasing order). You can do DSA in any language you desire; however, picking one of the popular options is better since you will have access to many more resources and help online. If you have no language bias, I would recommend C++.

When doing competitive programming, it's generally preferred to use C++ or Java over Python since you're working with a time limit, and Python, being an interpreted language, is a bit slower than the other two options.

Get Started

Syllabus

Here is a rough syllabus of topics that you'll need to cover:

  • Programming Basics
    • Data types
    • I/O
    • etc.
  • Time Complexity and Space Complexity
  • Searching
    • Linear Search
    • Binary Search
  • Sorting
    • Selection Sort
    • Bubble Sort
    • Merge Sort
    • Quick Sort
  • Data Structures
    • Sets
    • Maps
    • Stacks
    • Queues
    • Linked Lists
  • Number Theory
  • Bit Manipulation
  • Recursion
  • Greedy Algorithms
  • Graph Theory
    • DFS
    • BFS
    • Dijkstra
    • Binary Search Trees
  • Dynamic Programming
  • Other Specific Algorithms:
    • Hashing
    • Sliding Window
    • Divide and Conquer

Learning Resources

Okay, I know the syllabus, where do I learn from?

Books

If you prefer the book learning approach, you are covered:

Video Lectures

If you prefer the video lecture approach:

  • Luv CP/DSA Playlist - Not to be confused with Luv Babbar, this is a different guy. The playlist is great, and he's a great teacher. The playlist is C++-focused, but the explanation of concepts will be language agnostic. Warning: This playlist is in Hinglish.
  • Aditya Verma - Very popular for his Dynamic Programming playlist but also has playlists on other concepts like Binary Search, Recursion, Stacks, Sliding Window, etc.
  • Striver - Very popular for his problem set but has nice playlists explaining some topics like Recursion, DP, Greedy Algos, Binary Search, Trees
  • LuvBabbar - Not a big fan of the guy personally, but this is a well-compiled playlist to study all the topics.

Roadmaps

If you want to follow a laid-out roadmap:

Other Helpful Websites

To quickly brush up on any algorithm:

  • CP-Algorithms - An absolutely brilliant resource website. You can look up any algorithm, and this website will give you a great theory explanation along with pseudocode, if not full C++ code. It also provides relevant questions from CP websites. No BS, to-the-point website.

Questions

I know the syllabus, I have understood the concepts, where and which questions do I solve?

If you're starting off with the absolute basics, before jumping onto the problem sets, consider doing some practice on the easy questions. For that, you can jump onto Leetcode Easy and keep solving until you feel comfortable solving any Easy question insight. Then you can move on to the problem sets and start solving topic-wise questions.

Compiled Problem Sets

Here are some compiled problem sets that are considered enough to conquer any interview you want:

  • InterviewBit Question Set - Topic-wise questions that are asked many times by top companies, ranging from easy to hard. Personally, I used this site during my placement season. Major recommendation.
  • 450 DSA Cracker - Luv Babbar's 450 question list. Very popular list among students.
  • Blind 75 LC - Popular list of 75 questions that, if you can solve, you can confidently crack any interview.

For OA Practice

A big factor in interviews for DSA questions as well as in OA Rounds is time. You have to be able to solve the questions within a certain time limit. Thus, it's good to give a few contests on CP websites so that you can get used to constraints. Here are some beginner-friendly ones:

  • Codeforces Contests - To start off, give only the Division 3 contests and solve the A and B questions, and slowly aim to solve C. You can start to give Div 2 contests as well once you feel comfortable.
  • LeetCode Contests - To start off, aim to solve at least 2 questions in all the weekly and biweekly contests.
  • Atcoder Contests - To start off, just give the 'Beginner Contests'.
  • Codechef Contests - Codechef has fallen off the throne for a while because of its degrading quality and user base, but it's still a decent site for beginners. To start off, I wouldn't recommend the Long contests because it has unnecessary brute force questions. Instead, just do the timed contests like Cook-off, Lunchtime, and Starters.

Other Practice Platforms

NameLink
HackerRankhackerrank.com
CodeSignalcodesignal.com
TopCodertopcoder.com
InterviewBitinterviewbit.com
Codewarscodewars.com
Project Eulerprojecteuler.net
Spojspoj.com
GeeksforGeeksgeeksforgeeks.org

This wiki was originally written by u/sggts04.

Later revisions done by: