Understanding DSA: A Beginner's Guide
Okay, I recently had an interview, and it was going well until the interviewer asked me some questions about DSA. I know what DSA is, but I never really practiced it or read about it, or you could say I never really cared about it. Why?
The answer is simple: there's no practical use for DSA in my daily tasks at work, so I've never really focused on it. However, when the interviewer asked me a question about a DSA topic, it seemed simple at first. I thought I knew how to solve it and tried to answer using basic logic, also known as the Brute Force method. But then the interviewer stopped me and asked if I could use a different approach to make the solution more efficient and optimized. I tried to think for a while, but I couldn't come up with any possible answers. He then asked if I knew DSA and mentioned some patterns and questions related to it. At that moment, I went blank because I had never studied DSA or practiced any related patterns. As the interviewer continued to ask about it, I couldn't answer any of his questions because I genuinely didn't know anything about DSA.
I tried to fake it for a while and pretended to think, but I wasn't really thinking. I was just waiting for the interviewer to end the interview, hoping that the uncomfortable moment would pass quickly. Finally, the interview ended, and I left feeling very guilty because I always thought I knew everything. However, that interview really gave me a reality check.
So, I actually had two options: the first was to feel sorry for myself, or the second was to start learning about DSA and this time truly understand what DSA is. Obviously, I chose the second option. I went on YouTube and searched for the best DSA tutorials. I tried watching them for a while, but I couldn't understand what they were saying in those videos. Everything was going over my head. Then I asked my good friend ChatGPT to teach me about DSA. I requested a roadmap to learn DSA through its patterns and some related questions. After that, I opened LeetCode and tried an easy question on a DSA pattern called Two Pointers. I watched a video and then attempted to apply what I learned to the LeetCode question. Finally, it started to make sense, and I understood the pattern, but only for that specific question. When I tried a second question, I went blank again. It was clear that I didn't really understand the pattern; I had just copied the answer from the video.
I finally decided that I would not only learn DSA but truly understand it. I came across a resource by Piyush Garg, where he teaches about DSA. I watched the first video and decided to follow this resource to the end. It's actually a video series where he explains DSA.
I decided to write about my experience so that anyone facing the same issue can learn from it too. I'll be sharing what I learn and understand from the videos with everyone.
The first video is titled "What is DSA?"
DSA consists of two main parts: Data Structures and Algorithms.
Data Structures - These are methods for organizing and storing data efficiently.
Algorithms - These are step-by-step procedures or logic used to solve problems or perform tasks.
We will first learn about Data Structures and then move on to Algorithms.
There are basically two kinds of Data Structures: Linear and Non-linear.
Linear - Data is stored in a sequence, like in arrays and linked lists.
Non-linear - Data is organized in a hierarchy or network, like in trees and graphs.
We will explore more about Data Structures in this series. I'll explain everything in a simple way, so stay tuned for the next article, coming very soon.