How to Start Learning DSA?
In the journey of programming, every programmer comes across a point where they want to solve a problem in a more efficient way. While finding a way out of this, they eventually come to know about the term DSA. Now before jumping on how to start learning DSA, let us first know what the term DSA actually means.
Table of Contents
- DSA Full Form
- What is Data Structure?
- What is Algorithm?
- Why should you learn Data Structure and Algorithm?
- 5 Steps to start learning DSA
- Key Points to keep in mind to Master DSA
- How long does it take to learn Data Structures and Algorithms?
- How to be good at Data Structure and Algorithms?
- What are the best resources?
- What are the best platforms?
DSA Full Form: The Full form of DSA is Data Structures and Algorithms. As the name itself suggests, it is a combination of two separate yet interrelated topics – Data Structure and Algorithms.
In this journey to acquire a good grasp of DSA and become efficient in it, every programmer faces a big challenge “How to start learning DSA?”. In this article, we will be focusing on everything about DSA and how to begin your journey of DSA from scratch.
What is Data Structure?
A data structure is a particular way of storing and organizing data in our devices to use the data efficiently and effectively. The main idea behind using data structures is to minimize the time and space complexities. An efficient data structure takes minimum memory space and requires minimum time to execute the data.
What is Algorithm?
Algorithm means a process or set of well-defined instructions that are typically used to solve a particular group of problems or perform a specific type of calculation. To explain in simpler terms, it is a set of operations performed in a step-by-step manner to execute a task.
To learn more about algorithms refer to our article about “Introduction to Algorithm“.
Why Should you learn Data Structure and Algorithm?
Before moving to the question of “How to start learning”, first, let us look at why should we learn data structures and algorithms.
Every basic, as well as advanced, software and internet service, even searching a topic on the internet, all use one or other data structure or algorithm to implement. So in order to understand how any automated software or service works, it is a must to learn about data structures and algorithms first.
For example, like in our daily life, in order to pour a glass of water from a bottle, we need to implement a series of steps, such as
- Place the glass in a vertical position with the mouth upwards
- Open the bottle cap
- Pick the bottle up
- Bend the bottle such that the mouth of the bottle is aligned with the mouth of the glass
- The water will start pouring.
- Once the glass is filled with water, straight up the bottle again.
- Keep the bottle down
- Close the lid of the bottle.
Although these steps seem very basic, they need to be implemented in the same manner every time to get the desired output. As per the definition above, we already know that any set of rules to do a specific task is known as an algorithm. Hence the above-mentioned steps can be distinguished as an algorithm, and the glass can be distinguished as a data structure to store water. Therefore, data structure and algorithms can be seen everywhere in our day-to-day life, and it is very necessary to understand them to perform our daily tasks in life.
To learn in detail about the need for DSA refer to the article on “Why data structures and algorithms are necessary“.
DSA is the heart of root programming, knowing just computer language is not enough! That is why, at GeeksforGeeks, we have designed this self-paced course from the experts having years of industry expertise, where you’ll get to learn the basics of DSA, practice coding questions & attempt the assessment tests from anywhere in the world! So, wait no more! Join the course now and get ready to ace any product-based organization of your choice.
5 Steps to start learning DSA
Let us now move to the most important question “How to start learning DSA?“
This procedure may vary from person to person. But here we are trying to provide a general solution to the problem. A beginner can follow the step-by-step process as given below to get started with DSA:
1. Getting to know the topics:
The most important step is to find out the topics and the best of the resources for those. Before starting to learn about DSA first get an idea of what are the things you need to learn and the available resources for them.
When divided into parts, namely data structure and algorithm; one may follow the below topics in-order while starting to learn DSA:
- Data Structure:
- Prefix sum
- Suffix Sum
- Tree and Graph traversals
- Dynamic Programming
- Advanced algorithms on tree and graph
2. Finding the best resources for learning DSA
Once you have known what you have to learn, it is now time to find out from where you have to learn. You can learn DSA from various text, video or hybrid types of resources such as:
- Textbooks on DSA like Introduction to Algorithms by T.H.Cormen, etc.
- Self Paced Courses on DSA like Data Structures and Algorithms – Self Paced
- Live Online Classes on DSA like DSA Live for Working Professionals
3. Learn the Fundamentals of DSA properly:
After gathering all the topics and resources, it’s time to start learning the DSA. To learn about any algorithm and data structure, the most crucial step is to learn the fundamentals first. Without learning the basics properly we cannot implement them properly and also cannot move to advanced applications.
Based on the chosen resources, make sure to spend a keen amount of time learning about the fundamentals of each data structure and the basics of algorithms. Make sure to practice at every step to help solidify your learnings. You can also use our Practice portal for this purpose.
4. Master data structures and algorithms one by one:
Once you have become well versed with the fundamentals of DSA, it is now time to learn about the DSA in depth, i.e., know about the various detailed applications of Data Structures, learn about various complex algorithms, and how to implement them in problems.
Here as well you need to keep practicing at every step, to make sure to solidify your DSA learnings. You can also try to attend various coding competitions and challenges to practice and test your learning so far. Here’s a list of Top 15 websites for coding competitions and challenges that you can try out.
5. Consistency is the key:
Every monument is built brick by brick by working on a daily basis consistently, and so is the case for DSA. You must try to learn at least 1 new topic every day and solve at least 1 new problem related to it every day. Making this a practice for each day every day will help you master DSA in the best possible manner.
Make sure to give coding challenges at regular intervals as well. You might face challenges in solving even 1 problem in the beginning, but at the end, it will be all worth it. You can try GeeksforGeeks POTD to solve one problem based on DSA every day and here you can also use the discussion forums to help you make sure you get the logic properly. To know more about the discussion portals read the article – Stuck in Programming: Get The Solution From These 10 Best Websites.
Key Points to keep in mind to master DSA
1. Spaced Repetition:
A most common question anyone faces is: “I solved a number of questions but still cannot solve them after 7 – 10 days. How can I remember them?“.
The first and foremost answer to this is Not to try to remember the codes. The solution lies in practice and spaced repetition.
Spaced repetition is a method to fully learn something by recalling and reviewing the concepts in particular time intervals until you learn the concepts completely.
As seen the best time intervals will be to solve the problem again in a couple of days, then in 7-10 days and then in a month. It will help you to develop the habit of revising any topic at a proper time interval.It is always noticed that if you are revising concepts on spaced repetition so that’s make your concepts more and more well built and clear.
2. Practice more and more:
By now you are equipped with basic data structures and algorithms. Now the most important thing is your speed and efficiency i.e. how quickly you can find out the optimal solution and minimize the error in your approach.
As with any other work, the only way for this is also to “practice, practice and practice”. You can practice them in several online platforms for practicing problems. Also, you can participate in real-time challenges held time-to-time.
Some of the coding challenges that can help you achieve this are:
- One problem each day of varying difficulty: Problem Of The Day (POTD).
- Choose a problem on your own for any particular topic: Practice Problems based on specific Data Structures or Algorithms
3. Solve a variety of problems:
Now it is time to increase the size of your arsenal. As you have mastered a handful of data structures and algorithms, let’s venture out to solve problems of varying difficulty and topics.
It will help you in two ways.
- As the problems are not bound by categories, it will increase the pool of your data structures and algorithms through exposure to unknown algorithms. This time you will not require to code all the problems as you have already solved and programmed so many other problems.
- This will also boost your thinking capacity and you will come to know about the applications of different algorithms.
You can also refer to below links to practice problems in its respective difficulties:
You can also try from our curated lists of problems from below articles:
4. Participate in Coding Challenges:
A good amount of time is dedicated by now and you have also learned a lot. But have you reached your goal of mastering DSA – the reason behind your learning data structures and algorithms?
The only way to get the answer is by checking yourself out against other enthusiasts and original masters of DSA. There is hardly any other solution to this that is better than participating in some competitive coding challenges to gauge your ability. It will increase your coding speed and widen your view of how a problem can have so many varieties of approaches and also it helps you to be familiar with the interview environment because in interview you have time bound so by giving contests repeatedly to your on the path of boost your problem solving skills.
Also upsolving the contest is very much essential help building your concepts more robust. So must remember always solve the problems that you don’t able to solve in the contest.
5. Try solving Interview questions:
Though you have done almost everything, there is always room for improvement. Let us assume you are a consistent performer in real-time coding challenges and showing great results in that. Still, it is possible that you are not always finding out the most optimal solution to a problem, because competitive coding does not always require the most efficient approach.
There solving interview questions can prove handy. It is a natural practice in interviews to seek the most optimal approach. Now, by exposing yourself to interview questions you will become efficient day by day and also get prepared for interviews.
You can also try to solve the most asked interview questions based on the list curated by us at:
- Must Do Coding Questions for Companies
- Top 50 Array Coding Problems for Interviews
- Top 50 String Coding Problems for Interviews
- Top 50 Tree Coding Problems for Interviews
- Top 50 Dynamic Programming Coding Problems for Interviews
How long does it take to learn Data Structure and Algorithms?
Let us first clarify a thing that learning is a never-ending process. You can learn new things even after programming for years. But a viable question is “How long will it take to learn the basics of DSA”. Though the answer to the question varies from person to person and their time and dedication, an average approximation can be provided for this question. It is fair to say that one can master the basics within 10-12 weeks if one dedicates 3-4 hours a day. Again this varies from person to person. One may master it in 1 month and for some, it may take 5-6 months or more than that. This approximation is based on the time offered for courses like the ones run by Swayam (a Government of India initiative), GeeksForGeeks and others.
How to be good at Data Structure and Algorithms?
Since you have learned how to start learning DSA, the next goal is obviously to be good at DSA. Let us first clarify one thing. There is no easy way to be good at programming. But there is an efficient way to do so. That depends on factors like:
- Prior knowledge
- Why you want to learn
- Available resources
- A perfect guide.
For more details, refer to the article “How can one become good at Data Structures and Algorithms“.
What are the best resources?
As mentioned earlier, now we will discuss about the best possible resources. We at GeeksForGeeks have a vast collection of tutorials and problems related to DSA covering all types of topics from basic to the most advanced ones. Anyone willing to learn about a topic can anytime find the topics in the Archive section of GeeksForGeeks. There are also several past, running and upcoming courses available in the GeeksForGeeks Courses.
What are the best platforms?
Now we have learned about resources. But there is one more crucial step – practicing the problem. We need some platform to practice and implement our knowledge. GeeksForGeeks has the perfect solution for that. We have built the GeeksForGeeks Practice Portal exclusively for that reason. There are numerous problems available in the practice section. Moreover, you have the facility to filter the problems based on the type of data structure or algorithm, or even difficulty.
From the above discussion, we can conclude that though the process of learning data structures and algorithms is a bit lengthy and tough,it requires consistent hard work and practice if you follow the right path, be methodical with your approach of collecting resources and revisions and practice problems you will surely be able to learn DSA if an efficient way.
You must remember one thing during your learning phase – Learning is a continuous process. So prime objective would be to remain consistent and dedicate at least a minimum amount of time of your day towards learning DSA. If you are inconsistent then it is highly likely that you will forget the previously learned topics and have to start afresh which will ruin your efforts made till now.
Also it is always seen that no one’s journey is perfect so must remember that practices makes a man perfect and there are many up’s and down’s so don’t afraid from all that keep learning and keep growing.
- How can one become good at Data structures and Algorithms easily?
- Why Data Structures and Algorithms Are Important to Learn?
- Top 15 Websites for Coding Challenges and competitions
Please Login to comment...