How to Learn Data Structures and Algorithms [Storytime Saturdays]
How you can use learn difficult Datastructures to ace your exams, interviews, and jobs.
If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here.
To learn more about the newsletter, check our detailed About Page + FAQs
To help me understand you better, please fill out this anonymous, 2-min survey. If you liked this post, make sure you hit the heart icon in this email.
Recommend this publication to Substack over here
Take the next step by subscribing here
How can you study Data Structures and Algorithms?
This is a challenge that has struck every student, software developer, and manager from the dawn of time. Picking the right approach can make or break your company. Thus studying DSA effectively is a must for anyone who wants to make it in the more technical components of Tech. Which is a bummer, because there aren’t many good resources on how to study it. Most videos/resources out there focus on Data Structures and Algorithms for Leetcode-Style Coding Interviews. While that is important (until the interview system is improved), it is myopic and won’t help you develop your knowledge of DSA in-depth. This just shoots you in the foot.
In this article, I will give you a better approach to learning DSA. One that doesn’t involve 500+ Questions or watching 20 tutorials. And most importantly, this method of learning these DSA will deepen your appreciation for them, allowing you to fully utilize them when needed. What is this mystery method? Let’s get right into it.
The Action Plan for Learning DSA Better
Following are the steps that you should implement to truly learn and master data structures and algorithms. They are-
Understand the Story- Every DS/A was created for particular circumstances/challenges. Understanding why it exists, the history behind its creation, and how it slots into the current landscape are crucial components that are often overlooked. Don’t make this mistake.
Blackbox It- Now is the time to see how this idea is implemented. People make the mistake of trying to derive it (writing merge sort from scratch), but that is a mistake. That is for much later. Your second step should be to view the concept from a purely functional perspective. What is the point of this DS/A? What inputs does it take? What outputs can it produce? This will be much easier.
Read Lots of Engineering Blogs/Videos- Once you have a strong black box of this idea (you understand when this idea would be applied and for what outcomes), it’s time to read into how this idea has been applied in the real world. Watch the videos/read the blogs, to see how different teams applied this idea to solve problems. These blogs/videos are great for various reasons- they help you see how people are solving problems IRL, appreciate the tradeoffs you would have to make when designing systems, and see how this concept slots into larger systems. This is the step you can’t skip if you want to reach the expert level.
Try to Spot it in real life- Once you have a deep appreciation of the idea, now is the time to start trying to spot different implementations of this idea. Say you’ve just learned about Graphs and their relational nature. You know you can use them to visualize the components of your system. Now is when you think about how you could possibly use GNNs and their ability to help you spot fraud. Think about engineers at Facebook might use it to create more personalized ads. This step is crucial in translating technical challenges into business outcomes.
Peel back the Layers and Repeat- Finally, we come to the step that most people do first (and thus they struggle with learning). Once you have a very strong understanding of the utility of the concept, it is now time to start understanding the theoretical basis. What is the proof for certain bounds? How can you derive the important algorithms? This is the final step. This step will add a lot of solidity to your knowledge. And it will teach you the problem-solving techniques to invent ideas of your own.
This approach works because it mimics how knowledge is created. Most textbooks/lectures teach you ideas by first making you prove the properties and then talking about the utility. However, actual knowledge is created in the opposite way (even in fields like Math and AI). Researchers start with a challenge, try to figure out what kinds of solutions would help them solve it, do their research, and build their ideas by working backward from the end goal. Utilize this technique, and you will see the results skyrocket.
Necessity is the Mother of Invention. To try and study concepts without understanding why they were necessary is a serious waste of your time and energy.
For those of you that want to understand why this works in more detail, read on.
Why This Approach will help you learn
To first understand why this approach will help you, let’s first understand why most people struggle with self-studying.
So why do people struggle when they try to self-study Data Structures and Algorithms?
Simply put, it is because they fail to understand the context of what they are learning. Their focus will be on the Data Structure/Algorithms and their properties. They will study the proofs, try to code up the concept from scratch, and try to do some basic problems with it. But that’s it. Very rarely is the context of why these ideas were developed given any weightage. They will not look into how it slots into the larger tech landscape.
No matter how well the student did in their theoretical CS course, they don’t look at their code compiling and think of the Backus–Naur Form and the developers of the language might have used it.
-Personal Observation
The problem with this is that they are learning these ideas in isolation. Even if they are able to get through all the technical proofs and get to use the idea, they only really master the concepts in isolation. You may be able to build complex neural networks completely from scratch, but that means nothing if you lack the insight as to when neural networks should be applied to improve performance, and when it makes more sense to accept lower performance for other reasons.
This problem is prominent in not only Computer Science but other theoretical fields like Math. The next time you hear someone say, “Ideas like Trig, Calculus, and Linear Algebra are not useful” remember this post. It’s the exact same problem. People are learning facts and theories, instead of solutions to problems.
Here is why my suggested approach is different. Firstly, notice that the theoretical properties are deprioritized in favor of focusing on how this idea can be utilized fully. This approach will force you to consider the tradeoffs and see what properties of a particular idea/concept are more useful/show up more often. This will help you truly learn on a deeper level, as your mind is being forced to analyze and create its solutions. This deepens the connections between the neurons, making you more proficient at the task.
When you learn the history behind an idea, force yourself to evaluate the strengths and weaknesses, and try to think of how variants can be developed, you are engaging with the higher levels of learning. Even if you’re not successful (you probably won’t get the full scope), your learning will be on steroids.
For a practical example of how understanding the full nuance of a Data Structure can be key to mastering it, take a look at the post I did on spotting graphs in your interviews. The framework for spotting the graphs comes out of understanding why Graphs are powerful and how they help us encode relationships. Students have utilized it for great results. I’m sure you will too.
Loved the post? Hate it? Want to talk to me about your crypto portfolio? Get my predictions on the UCL or MMA PPVs? Want an in-depth analysis of the best chocolate milk brands? Reach out to me by replying to this email, in the comments, or using the links below.
Stay Woke,
Go kill all,
Devansh <3
Reach out to me on:
Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/
My content:
Read my articles: https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd