This blog is focused on building a data structures and algorithms roadmap for students and professionals who are keen to learn to program. Today we live in a world where data is possibly one of the most precious intangible resources out there. With such large amounts of data, it becomes imperative to derive efficient ways to organize it so that we save on time and memory.
Additionally, product-based businesses with a global user base like Facebook and Google have enormous amounts of data that must be handled in the best way possible. Programmers with a strong foundation in data structures and algorithms are needed for this effective data organizing.
Therefore masters of this topic are always sought by big product-based companies because it ensures good handling of their data and provides a good measure of a candidate’s problem-solving skills.
DSA Full Form: The Full form of DSA is Data Structures and Algorithms. As the name itself suggests, it is a combination of two separate yet interrelated topics – Data Structure and Algorithms.
In this journey to acquire a good grasp of DSA and become efficient in it, every programmer faces a big challenge “How to start learning DSA?”. In this article, we will be focusing on everything about DSA and how to begin your journey of DSA from scratch.
What is Data Structure?
A data structure is a particular way of storing and organizing data in our devices to use the data efficiently and effectively. The main idea behind using data structures is to minimize the time and space complexities. An efficient data structure takes minimum memory space and requires minimum time to execute the data.
What is Algorithm?
Algorithm means a process or set of well-defined instructions that are typically used to solve a particular group of problems or perform a specific type of calculation. To explain in simpler terms, it is a set of operations performed in a step-by-step manner to execute a task.
Why Learn DSA?
- Write optimized and scalable code – Once you have knowledge about different data structures and algorithms, you can determine which data structure and algorithm to choose in various conditions.
- Effective use of time and memory – Having knowledge about data structures and algorithms will help you write codes that run faster and require less storage.
- Better job opportunities – Data structures and algorithms questions are frequently asked in job interviews of various organizations including Google, Facebook, and so on.
Here in this article, we will try to make that task easy for you. We will be providing here with a complete roadmap for learning data structure and algorithms for anyone keen to learn DSA, from scratch.
6 Steps to learn DSA from scratch
Here are the steps of learning DSA:
1. Learn at least one Programming language
This should be your first step while starting to learn data structure and algorithms. We as human beings, before learning to write a sentence or an essay on a topic, first try to learn that language: the alphabet, letters, and punctuations in it, how and when to use them. The same goes for programming also.
Firstly, select a language of your choice, be it Java, C, C++, Python, or any other language of your choice. Before learning how to code in that language you should learn about the building pieces of the language: the basic syntax, the data types, variables, operators, conditional statements, loops, functions, etc. You may also learn the concept of OOP (Object Oriented Programming).
2. Learn about Complexities
So, before knowing the data structure, you should know about Time and Space complexity because of it you can analyze your algorithm that how fast and how efficient it is (It’s very important concept)!
What exactly is it, and why is it so important?
So, here Asymptotic Notation comes into picture…in this you will be learning about How can you make your algorithms more efficient or more optimized by reducing their time and space complexity.
Basically this concept is very, very important, or I can say it is a building block of your DSA.
In this, you would learn about…
- Big-O Notation (Ο) – Big O notation specifically describes worst case scenario.
- Omega Notation (Ω) – Omega(Ω) notation specifically describes best case scenario.
- Theta Notation (θ) – This notation represents the average complexity of an algorithm.
Then learn about
- O(log N)
- O(N log N)
3. Learn Data Structures and Algorithms
In day to day life most of you use Google Map right!
Have you ever thought that how easily google find your specified location and get back to you with some results within secs?
(Basically the Graph concept involves here)
Also involves lots of algorithms and logics behind on it.
Now you would have some idea that how important the DSA is!!
So, without any worry, let’s get started. Learn the basic Data Structure.
Like 1st know
Types of DS
It is of two Linear and Non-linear
- Linked list
- Hash Table etc…
- Heap etc…
You can learn these from here
Pick those DS one by one and start to learn those.
Now, you can explore or learn Collection frameworks or STL.
???? In mean time pick any one of these HackerRank, HackerEarth, Leetcode, Codechef platform for solving the problems and test your understanding on those topics. I will suggest you that just complete one topic in DSA and try to solve some questions(solve topic wise). In this way, you will get more productive results to grasp the concept!
4. Practice on paper
We recommend practicing on paper at some point in your prep. When you code without an IDE and Stack Overflow, it takes you away from your comfort zone.
Here are some benefits of practicing on paper:
- You’re forced to plan your code before writing. You can’t just go back and retype.
- You will start learning correct language syntax and data structure usage. With an IDE, code used to write itself.
- You can take a paper and pen anywhere with you to practice.
And more importantly, it is a realistic simulation of a whiteboard interview.
5. Compete and Become A Pro
It’s time to put your abilities and effectiveness to the test. The ideal strategy is to engage in rivalry. This will show you where you stand in comparison to others and offer you a clue as to where you fall short.
There are several online competitive platforms available where you can participate regularly. Also, some online challenges are held from time to time in a year which also provides lots of prizes and opportunities, such as:
- Monthly Job-a-thon: It is a contest for individual participants. Participants get the opportunity to get hired by a bunch of companies that shortlist for interviews as per their criteria.
- Bi-Wizard Coding: A coding competition exclusively for students. The top 100 students get chances of winning exciting rewards and also access to free courses.
- Interview Series: A weekly challenge that gives a great opportunity for aspirants to practice a lot of questions based on important data structure and algorithms concepts for the preparation of interviews.
- Problem of the Day: A new problem every day to strengthen the base of data structure and algorithm.
6. Now, it’s time for Breadth
Let’s say you’ve mastered your core problems. Using common data structures is second nature to you. You can now look beyond your core set. Because you’ve implemented so many techniques already, you don’t even have to code all the new questions.
Try to solve practical interview difficulties during this period. Once you get proficient, you may start concentrating on extremely challenging issues. If I can figure out these very challenging problems, interview questions will be easy, the thinking goes. Typically, that is not the case. Really difficult problem solving strategies frequently have little to do with difficulties found in interviews.
There are few best training institutes for DSA which I have mentioned below:
GeeksforGeeks: Well reputed platform with various courses for DSA. In this course you can learn the basics of DSA and various techniques for solving problems by algorithm. It is highly recommended for students and freshers, People who want to crack computer programming and want to build their career in it should look for this course.
Coursera: In this program, you will be able to learn at your pace whether you are a beginner or want to pursue an advanced level. You get options in the form of advanced electives and specialization to choose from various programs after completing advance level. You get real life industry projects in which you can learn DSA applications by solving real life problems.
Learnbay: It provides you well designed courses for DSA. You can choose live training or self paced training. Both are really structured & relevant if you are specifically looking for interview preparation. In this course you can start your journey from scratch and can become a master. It covers in-depth knowledge of DSA concepts along with practical application. In addition, you get experience on 15+ real time industry projects along with lifetime accessibility to recording sessions. Lastly, course is accessible for lifetime & academy also conducts complementary mock interviews for candidates once they are prepared for interviews.
Here’s the list What You Have to learn
- Introduction to Git
- Introduction to Programming
- Types of languages
- Flowcharts & Pseudocode
- Flow of the program
- Time & Space Complexity
- Basics of Java
- Memory management
- Input and Output
- ArrayList Introduction
- Insertion Sort
- Selection Sort
- Bubble Sort
- Count Sort
- Radix Sort
- Linear Search
- Binary Search
- Modified Binary Search
- Two Pointer
- Subarray Questions
- How Strings work
- Comparison of methods
- Operations in Strings
- StringBuilder in java
Maths for DSA
- Complete Bitwise Operators
- Prime numbers
- HCF / LCM
- Sieve of Eratosthenes
- Newton’s Square Root Method
- Number Theory
- Euclidean algorithm
- Advanced Concepts for CP (later in the course)
- Bitwise + DP
- Extended Euclidean algorithm
- Modulo Properties
- Modulo Multiplicative Inverse
- Linear Diophantine Equations
- Fermat’s Theorem
- Wilson’s Theorem
- Lucas Theorem
- Chinese Remainder Theorem
- Solving the above math problems in code
- Scoping in Java
- Variable Length Arguments
- Why recursion?
- Flow of recursive programs – stacks
- Convert recursion to iteration
- Tree building of function calls
- Tail recursion
- Merge Sort
- Quick Sort
- Cyclic Sort
- Sudoku Solver
- Maze problems
- Recursion String Problems
- Recursion Array Problems
- Recursion Pattern Problems
- Subset Questions
Space and Time Complexity Analysis
- Comparisons of various cases
- Solving Linear Recurrence Relations
- Solving Divide and Conquer Recurrence Relations
- Big-O, Big-Omega, Big-Theta Notations
- Get equation of any relation easily – best and easiest approach
- Complexity discussion of all the problems we do
- Space Complexity
- Memory Allocation of various languages
- NP-Completeness and Hardness
Object Oriented Programming
- Classes & its instances
- this keyword in Java
- Overloading & Overriding
- Static & Non-Static
- Access Control
- Abstract Classes
- Singleton Class
- final, finalize, finally
- Exception Handling
Stacks & Queues
- Interview problems
- Push efficient
- Pop efficient
- Queue using Stack and Vice versa
- Circular Queue
- Fast and slow pointer
- Cycle Detection
- Single and Doubly LinkedList
- Reversal of LinkedList
- Recursion + Recursion DP + Iteration + Iteration Space Optimized
- Complexity Analysis
- 0/1 Knapsack
- Subset Questions
- Unbounded Knapsack
- Subsequence questions
- String DP
- Binary Trees
- Binary Search Trees
- AVL Trees
- Segment Tree
- Fenwick Tree / Binary Indexed Tree
- Square Root Decomposition
- Priority Queue
- Two Heaps Method
- k-way merge
- top k elements
- interval problems
- Theory – how it works
- Comparisons of various forms
- Limitations and how to solve
- Map using LinkedList
- Map using Hash
- Working with graph components
- Minimum Spanning Trees
- Kruskal Algorithm
- Prims Algorithm
- Dijkstra’s shortest path algorithm
- Topological Sort
- Bellman ford
- A* pathfinding Algorithm
What basic data structures and algorithms should one learn before starting competitive programming?
- Basic data sturctures (arrays, queues, linked lists, etc.).
- Bit manipulation.
- Advanced data structures:
- Union-Find Disjoint Sets.
- Segment Tree.
- Binary Indexed Tree (a.k.a Fenwik Tree).
- Skip Lists.
- Some self balanced Binary Search trees (e.g. Red Black Trees).
- Brute force and it’s tricks and advanced techniques (such as, pruning, bitmasks, meet in the middle, iterative deepining etc.)
- Binary Search (not only the basic code).
- Dynamic programming and it’s tricks and optimisations (Knuth optimisation, convex hull optimisation, bitmasks, etc.).
- Graph algorithms:
- Traversal (DFS & BFS) algorithms and how to use them.
- Finding Connected Components.
- Flood Fill.
- Topological Sorting (the famous algorithm uses DFS but you should also know Kahn’s algorithm that uses BFS as it has much applications).
- Bipartite Check.
- Finding Strongly Connected Components.
- Kruskal’s and Prim’s algorithms for finding the Minimum Spanning Tree of a graph and the variants of the problem.
- Dijkstra’s algorithm for solving the Single Source Shortest Path (SSSP) Problem with out negaitive cycles.
- Bellman-Ford’s algorithm for solving the SSSP problem with negative sycles.
- Floyd-Warshall’s algorithm for solving the All Pairs Shortest Path (APSP) problem and it’s variants.
- Network Flow problem (all it’s algorithms, variants and the problems reducable to it). 9 Mathematics:
- You should be familiar with the BigInteger class in Java (maybe write your own if you are in love with C++).
- Some Combinatorics.
- Number Theory (all what you can learn about it).
- Probability Theory.
- Floyd-Cycle detection algorithm.
- Game Theory (especially impartial games and Sprague-Grundy Theorem).
- Basic Manipulation.
- Z-Algorithm for finding a pattern in a text.
- Knuth-Morris-Pratt Algorithm for finding a pattern in a text.
- Hashing and Rabin-Karp Algorithm for finding a pattern in a text.
- Trie data structure.
- Aho-Corasick Algorithm for finding multiple patterns in a text.
- Suffix Array data structure.
- Suffix Automaton data structure.
- Computational Geometry Algorithms.
- Codeforces Candidate Master RoadMap
- DSA Cracker Sheet
- Striver’s CP List
- Competitive Programming Algorithms
Frequently Asked Questions
- What is the fastest way to learn data structures and algorithms?
Data Structures is a topic that you must give time to in order to get good at it. Learning it quickly will produce no results and the purpose of you preparing it would thus be failed.
- How long does it take to complete data structures and algorithms?
Data Structures and Algorithms would require 3-4 months on an average but this being said, please note that this topic is something that you’ve got to spend time on to master. It varies from person to person how much time you’d need.
- Can I learn data structures and algorithms in three months?
It is important to spend time on this topic in order to master it. Thus, setting a standard time period after which any person can be a master of it, is not viable.
- Can I master data structures and algorithms in one month?
It is impossible to master data structures and algorithms in one month unless you have prior experience that will help you, as they are things that you can only master if you spend time with them.
In this article, we discussed the importance of Data structures and then laid down a data structures roadmap going topic-wise and listing down the most important concepts from each topic. Mastering these concepts will give a boost to your preparation for interviews in which data structures is one of the most important topics.