Ultimate guide to start learning Data Structures & Algorithms for beginners

Know all the tips and tricks (from experience), things to avoid as well as methods to employ when you are just getting started with Data Structures and Algorithms.

Aug 15, 2020 6 min read

Data Structures and Algorithms are the most integral part of programming. They will seem to be quite dreadful in the beginning, but they are equally important nonetheless.

Which is the best book to learn Data Structures and Algorithms? What courses should I take? Or, What is the the best platform to practice it? If you are plagued with such questions, then guess what? You are not alone. So follow along this article to learn all the essential tricks, common mistakes to avoid as well as some (great) resources for beginning your DSA journey. Without further ado, let’s start!

Mistake: Don’t try to learn everything all at once!

There are multitude of free as well as paid resources available online. But if you try to learn everything all at once, you will soon find yourself drowning in content without having done anything substantial.

The Plan

So how do we start really? First, devise a basic plan.

Focus on the simpler things:

  • Arrays/Strings
  • Linked lists
  • Stacks and Queues
  • Binary Trees
  • Searching and Sorting
  • Binary Search Trees

Then move on to the harder topics:

  • Recursion
  • Dynamic Programming
  • Greedy Programming
  • Graphs
  • Heaps

This is the order that I went with and I strongly recommend you to follow this specific order as there are certain topics which are highly dependent on the other. For instance, in Stacks and Queues, you will learn about Breadth First Search and Depth First Search, which are quite instrumental in solving most of the Binary Tree problems.

Practice, Practice, Practice!

I cannot stress enough on the importance of practice. Just mugging things up will only get you so far. Instead implement what you learnt and make a habit of solving at least one problem each day.

Break it till you make it!

Let’s say you’re trying to teach people about how engines work. A more traditional approach would be saying, ‘We’re going to teach all about screwdrivers and wrenches’. This is a very difficult way to do it.

A much better way would be saying ‘Here’s the engine, now let’s take it apart. How are we going to take it apart? You need a screwdriver. That’s what the screwdriver is for’.

Elon Musk

We are quite accustomed to the bottom up approach of doing things. But a much better way would be to go top down, that is, to learn along the way as and when required. This will help you to understand the importance of the ‘Why’ of doing things and not just ‘How’.

Start with the basics of each topic and get going. For each topic that you learn, follow it along with easy and then medium level questions. And once you feel that you are fairly confident with it, move on to the next. Don’t wait up too long solving only the questions pertaining to a single topic, instead try to solve a diverse set of problems. Along the way, you’ll get to know about your strengths and weaknesses as well as areas that you need to focus more on.

There are multiple ways of solving one problem. Is your solution time and space efficient? If not, what can you do to make it so? These are the questions that you need to ask yourself while solving each and every problem.

Resources

The very first and most important thing before problem solving is to understand about Time & Space complexities. You can learn it from this book

Cracking the Coding Interview

Book by Gayle Laakmann McDowell

But do you need to start doing all other chapters as well? I’d say, No, an even better option would be to head over to Leetcode.

But isn’t this a coding platform, how can I start with the problems if I don’t know the theory? To answer that, I’d say, then that’s the best resource that you can learn from.

Use the Leetcode Explore cards available for each topic and then solve its related problems. Use the filter/tag feature to fine tune your search for the problems that you wanna practice. And let’s not forget the most useful feature of leetcode, that is, it’s Discuss forum.

After doing 100 or so problems, you will realize that you have already solved many similar problems from the Laakmann’s book while doing Leetcode.

What if I get stuck?

This is the one thing that is bound to happen one day or the other. Let’s call it the learner’s block, shall we? 😀

So what do we do now? Learn from others. As simple as that…

See this is the most important thing while coding. If you feel there’s no way forward then check out other people’s code, and scrutinize it thoroughly, observe what they did and more importantly, how they did it. Don’t learn it, instead understand it. Go line by line and pick up new techniques that will help you in improving your own knowledge and building optimized code.

But if you feel that lately you’ve been encountering too many learner’s block or coder’s block or whatever name you wanna give it, then it’s time to again Break it till you make it! Pick up a book. In my case, this was the time when I started with this awesome book –

Elements of Programming Interviews

Book by Adnan Aziz, Amit Prakash, and Tsung-Hsien Lee

Now this is a book that is worth reading/solving and it’s a cut above the Laakmann’s book, both in the level of difficulty as well as knowledge. It will surely help you to gain a new perspective on solving problems.

Never Give Up

Saved this best one for the last. This is the one thing that you should never forget while undertaking any endeavor. There will be both highs and lows in your journey, some days when you’ll feel quite invigorated and some days when you’ll be quite frustrated or bored. But keep in mind your end goal and just keep working your way towards it and never ever give up!

Okay now, enough talking! 🙂

Did this article solve some of your questions? What are the lessons you learnt in your DSA journey? Let me know in the comments below!

More from The Tech Jarvis

More from DSA

Binary Search Algorithm with Examples

Binary Search algorithm explained with examples and code in Python. Along with analysis on its time and space complexities.

Dec 13, 2022 5 min read

More from Editorial

Google Kickstart

Google Kickstart Round G 2022: Curling

Google Kickstart Round G 2022 Solution to Curling problem explained in detail in Python with Time and Space Complexities.

Nov 17, 2022 6 min read

More from Editorial

Google Kickstart

Google Kickstart Round G 2022: Walktober

Google Kickstart Round G 2022 Solution to Walktober problem explained in detail in Python with Time and Space Complexities.

Oct 29, 2022 3 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*