Complete Roadmap to Learn Data Structure and Algorithms πŸ±β€πŸπŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»

suchitra_13

Suchitra

Posted on July 4, 2021

Complete Roadmap to Learn Data Structure and Algorithms πŸ±β€πŸπŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»

The very 1st step you have to do is, choose a programming language, either Java or C++ (or it's up to you which language you want to learn).

🎯 Now, start learning the language 1st

Learn giphy

Like…
πŸ“Œ Basic Syntax
πŸ“Œ Data Types
πŸ“Œ Operators, Variables, functions
πŸ“Œ Conditional Statement, loops
πŸ“Œ And the most important OOP(Object-Oriented Programming)


Learn about Collection frameworks if you choose java or STL(Standard Template Library) in C++.
(Or you can skip this as of now).

Now, I can assume that you are a bit familiar with your preferred language.
Like if I say every language has their own unique features/ operations which make them different from others right?

So, my point is that learn the language in such a manner that you don't suffer later.


Suppose, as an example, I am taking Java language here.
So, in this you should know about java…

  • Whether it is a OOP or procedural language?
  • And if OOP, whether it is fully OOP or not?
  • Why java does not support pointers?
  • Why java is a platform independent language?
  • Some features of it!

I will encourage you when you start leaning in any language to ask these type of question and try to explore more.

🎯 Now, you learned the language, got familiar with syntax and OPP concepts. So, It's time to deep dive into DSA(Data Structure and Algorithm).

You may or may not be familiar with this term DSA so, I am just briefing you here or in the alternative, you can search into google baba:πŸ˜€

Let me explain

let me explain

Data Structure and Algorithms play a vital role in solving problems (industrial problem, real scenario problem, etc…)

Basically, DSA is a very crucial thing in a software field as even in real world scenario as well. In day to day life, you may or may not be notice these, or even we don't have any idea related to it…
Like...

Example 1:

In your phone contacts, you must be search some contacts by their name, right?
Here, have you thought that how fast your phone shows you the results?? Probably in secs or even less, right!

How it searches so fast even we have more than 200 or 500 contacts, but it gets back with results within secs
How??

How?

You would be thinking about that, which algorithm it uses or which data structure it uses…??

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…

Two type of Complexities:

  • Time
  • Space

Notations:

  • 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(1)
  • O(log N)
  • O(N log N)
  • O(N)
  • O(N^2)
  • O(2^N)
  • O(N!)

Graph

You can follow this book for learning these concept


Example : 2

In your phone suppose you opened multiple websites suppose 1, 2, 3, 4 then you tapped in back what you see means in which order the websites appear…
In this way, right!
4 3 2 1 (LIFO) it is the concept of Stack(Which you will be studying in DS)


Example : 3

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

Linear DS

  • Array
  • String
  • Linked list
  • Stack
  • Queue
  • Hash Table etc…

Non-linear

  • Tree
  • Graph
  • 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!


Now learn some basics Algorithms…

Sorting Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Count Sort etc…

πŸ‘©β€πŸ« Learn it here

Searching Algorithms

  • Linear Search O(N)
  • Binary Search O(log N)

πŸ‘©β€πŸ« Learn it from here

Recursion :

(Grasp the concept very clearly)
It is a technique in which the function call itself again and again until the base case occurs.

πŸ‘©β€πŸ« Learn it from here

Backtracking :

It is itself a recursion, but here it has some additional conditions which makes it more efficient.

Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point of time (by time, here, is referred to the time elapsed till reaching any level of the search tree).

Some standard problems

  • Sudoku Solver Problem
  • Rat In Maze
  • Combination sum, Combination Sum II, Combination Sum III
  • N Queen Problem

πŸ±β€πŸ You can visit here
πŸ‘©β€πŸ« Check it here

Greedy Approach :

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. So the problems where choosing locally optimal also leads to global solution are best fit for Greedy.
For example, consider the Fractional Knapsack Problem.
πŸ‘©β€πŸ« Check it here

Dynamic Programming:

DP = Recursion + some memory

It has two approach:

  • Memoization (Top down πŸ‘‡)
  • Tabulation (Bottom Up ☝)

You can follow these resources to learn the concept

Bit Manipulation / Bit Masking :

  • AND (&)
  • OR (|)
  • XOR (^)
  • NOT (~)
  • Left Shift (<<)
  • Right Shift(>>)

πŸ“Œ Learn from here!

πŸ‘‡ Here as well

πŸ“Œ Another one πŸ˜€


Some Advance Topics :

  • Segment Tree
  • Tries
  • Suffix Tree,
  • Suffix Array,
  • Advance Graph Theory

you are done

Now, it's time to solve problems as much as you can:)
(Practice Makes Man perfect)

Be consistent practicing, initially you will be facing difficulty to solve and even understand the logic by seeing the solution as well. These things are common, it happens to everyone. Just do and don't give up.
(You will be master if you practice 😊)

Participate in contest if you want to test yourself or also interested in CP(Competitive Programming), give it try.

Otherwise, you are good enough for interview if you practice by yourself without giving contest as well!


Some Tips :

  • While solving problems if you don't come up with solution with spending at most 1 hour, I will suggest you leave that question as for that time no need to spend more time on that!
  • Try that question another day or some days later. If still stuck, then you can refer to some editorials or hints.
  • One thing is very important is that suppose you successfully solved some questions πŸ˜€. Congratulations, but still I will suggest going to discussion and see other's solution as well. It will be more insightful, and you can get to know different approaches.
  • And suppose you are in that situation that you can't solve the problem or even seeing the solution, you are unable to think that logic which are used in the solution. So, don't be panic and don't depress. Just dry run the solution, it really helps(Personally it helps me a lot 😊).
  • If still you are thinking that the concept is not so much clear then try to write on paper what you understand the concept via dry running! (Also, you can refer to video lectures).

Some Free Resources

I hope it helps you 😊

Thanks for reading 🧑

image

πŸ’– πŸ’ͺ πŸ™… 🚩
suchitra_13
Suchitra

Posted on July 4, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related