What is the best way to start with Data Structures?
Tags: codenewbie, programming, algorithms, 100daysofcode
Published: 2021-01-03 16:38:40

Data Structure & Algorithms are considered to be one of the most complex topics to understand in computer science and I believe it is true. So how do I get started?

It is important to understand the Data Structure well because most companies judge you by your understanding of the data structures and Algorithms.

I am not an expert in DS but telling you the strategy which I followed. Coming from a non-cs background I struggled a lot to choose the right resources and what amount to learn and what topics to learn in DS. 

First, we need to clarify the basics very well. There are a lot of resources and most of them are very good so you cannot go with all of them pick anyone and focus on it. If you preferred to watch videos over any other preferred material of study then you can start with these tutorials: https://www.youtube.com/watch?v=92S4zgXN17o&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P
These are awesome and will help you clarify your basics.

The next thing is practice, you have to practice daily. For that, I would highly recommend everyone to start the 100daysofCode challenge in which you will have to do coding daily for at least 1 hour. It will work for you but you have to do it consistently.

After watching these tutorials the next step I took is to start doing questions by myself. GeeksforGeeks, Leetcode, Interviewbit, Hackerrank all are very good platforms to practice coding. I pick two platforms GeeksforGeeks (https://practice.geeksforgeeks.org/explore/?page=1) and Interviewbit(https://www.interviewbit.com/courses/programming/). I start by doing 3-4 questions in 1 hour in which I cover 1-2 easy questions and 1-2 medium level questions and try to complete all 5 questions in 1 hour. After every 15 days when I feel comfortable & started to solve problems, I increase one question in my list. One more point I used to write the URL of the problem which I solve and with some details in the form of an excel file. 
 
What to do when you get stuck? What is the right way to approach a problem?

Yeah, we'll get stuck and it is completely normal. Pick a question read the question then solve the question on paper by brute force approach first. Give yourself a time of around 10-15 min to think about the approach. If you solved it by brute force you got 5 points next is to find the solution in an optimal way. In the start, it is not easy to find the optimal solution by yourself and it is completely ok if you have to look for the solutions. Think this way if you feed some solutions in your mind then only you will come to know how to solve the problem. So it's ok if you have to look at the solutions in start to reach the optimal solution. But next time when you solve a similar kind of problem try to solve it without looking solution.

If you weren't able to solve it by brute force as well in the early stage then you can start by looking at the hints/solution. Do not memorize the solution but instead try to understand how it is working. In the start, I struggled a lot I was not able to solve problems even with the brute force approach I used to read a lot of solutions. So in this way, I am feeding myself what is the way to solve the problem.

After around a month try solving around 5-6 questions in an hour and follow the same approach pick 2-3 easy problems first then move to harder ones. 

I continued this process for around 6 months then I got comfortable with DS.

Few Tips:
1. Do not try to memorize every solution.
2. You have to be patient to see the results.
3. Practice coding daily for at least 1 hour/day.
4. Turn off mobile data while practicing or keep your phone in another room.
5. If you feel stuck then don't quit but take a small break and invest some time in any other side project for a change.
6. You can share your progress on Twitter/Linkedin it will help to keep motivated and do much more.
7. Keep challenging yourself to do more or you can take help from your friend who can challenge you to do more.
8. Keep track of your progress.
9. Never hesitate to ask for help if you are getting any issues.

Remember you should never quit. Just be patient and trust the process. Thanks for reading :)