Original post link: https://algo-one.blogspot.com/2021/05/the-importance-of-dsa.html

For most of us, DSA is introduced as an important subject that can get us through IT placements or get us placed at firms like Google, Microsoft, Apple, and the list goes on. Based on the way the subject is introduced to us, most of us jump right into it, hoping that we will be working at our dream company one day.

While we are in the process of preparing ourselves for these dream jobs, it is common to hear that DSA is like a boat that takes us to the island where our dream companies exist but once you are on that island, the boat that took you there is no more relevant.

While there is some truth in both of the above statements, these statements can’t be generalized. I am also an exception to these statements and I feel there is much more to DSA than just being a powerful tool for cracking IT placements.

In this post, I will try to lay down some truth behind these common statements that we get to hear. But, in order to do that it’s important that we understand what DSA is?

DSA stands for Data Structure and Algorithms. So, like the name suggests the keyword DSA constitutes of two topics:

  • Data Structures
  • Algorithms


Algorithms are the very core set of rules on which a computer runs. To understand the importance of an algorithm, let’s have a look at a very simple example:

Let us say that we have a list of integers, [9, 1, 8, 3, 5] and the task is to sort these integers in increasing order. For a human, this is a very fundamental task and the answer to this problem is [1, 3, 5, 8, 9].

But, how can a computer reach the end result? In order to reach that end result, the computer has to follow a fixed set of rules that are defined by us.

One possible set of operations that a computer can follow to reach the end result is :

Array : [9, 1, 8, 3, 8]

Step 1a: Find the minimum of all the numbers from the 1st to the 5th number. 2nd number is minimum with the value 1.

Step 1b: Swap 1st and 2nd numbers.

Updated Array: [1, 9, 8, 3, 5]

Step 2a: Find the minimum of all the numbers from the 2nd to the 5th number. 4th number is minimum with value 3.

Step 2b: Swap 2nd and 4th numbers.

Updated Array : [1, 3, 8, 9, 5]

Step 2a: Find the minimum of all the numbers from the 3rd to the 5th number. 5th number is minimum with a value of 5.

Step 2b: Swap 3rd and 5th numbers.

Updated Array : [1, 3, 5, 9, 8]

Step 2a: Find the minimum of all the numbers from 4th to 5th number. 5th number is minimum with a value of 8.

Step 2b: Swap 4th and 5th numbers, the updated array is

Updated Array : [1, 3, 5, 8, 9]

Formally speaking, for an array of length 5, the algorithm constitutes 4 steps. In Step k, the correct value for the kth element in the sorted array is determined with help of the min-array(finding the minimum of kth to the last element of the array) and filled with the help of swapping(swapping the kth element with the minimum found element) operations.

This is just one of the many algorithms out there that can be used to sort an integer array.

So, why are we even getting so technical?

The main idea was not to state a sorting algorithm but to help you understand the fact that computers don’t just work magically. A well-defined set of rules has to be laid down with the help of programming languages in order to get our computers to work.

Data Structures:

When we google the term data structures, countless numbers of terms like arrays, linked list, tree, graphs, segment tree, wavelet tree, and many more show up on the internet. These are nothing but some common data structures out there. As the name suggests, the data structures exist to structure our data correctly to complement the operations inside our algorithm and improve our overall run time complexity.

For example, the range minimum operation that we are performing in the above sorting algorithm can be performed in linear time using the array data structure but with some other data structures like, segment trees or min-heap, these operations can be optimized to logarithmic time.

Together, the correct set of rules(algorithm) implemented with the correct set of complementary data structures is the way to solve a problem. There are multiple algorithms out there ranging from basic sorting algorithms like insertion sort, merge sort, quick sort, etc to shortest path algorithms like Dijkstra’s shortest path algorithm, Bellman-Ford, Floyd-Warshall, etc that use a range of data structures from simple 1 and 2-dimensional arrays to the binary and Fibonacci heaps.

Now, that we have understood what DSA is, let us jump to why DSA?

Importance of DSA in IT placements:

The importance of DSA in IT placements is a fact. From all the IT placement ranging from internship to full-time jobs, even for data science profile, DSA is asked in the interview. So, why are companies so focused on asking DSA? Now, people have a lot of explanations about this. From my experience, I have learned two things:

  • Problem-solving skills: For some companies, DSA is a genuine metric to test your problem-solving skills and evaluate your algorithmic IQ. As we have discussed that computers run on algorithms and to code something for a computer, one needs to think like a computer. In order to do so, one has to think in terms of algorithms. And those who are actually able to develop this algorithmic thinking become naturally good at real-life problem solving as well. The reason being, the applications of DSA problems require breaking a problem down into multiple subproblems, choosing the correct algorithm and data structure for each sub-problem, and integrating the end results to get the final solution. Such a person learns the art of breaking down a big problem into multiple subproblems and integrating them together to reach the end result which is the very thing that is expected from a problem statement presented in a firm. Being good at DSA, also helps us identify the limitations of a computer today.
    Now, this problem-solving skill is expected from a candidate when they interview for a tech job. When the subject DSA is taken seriously, it changes the entire perception of how you look at a problem. Its been around 3 years since I have started with DSA and I have solved over 2000 problems on the same. When I look back, I never really learned DSA for placements. I learned DSA as a tool to help me with sports programming. I just wanted to solve a lot of problems for fun. I liked to compete with others around me. And in the process, the way I think changed so much. At times, I started to relate these algorithms to the things that happen around me in real life. Although there is a lot of randomness in real life but if one truly gets into it, one can notice the application of DSA in a lot of real-life problems. When I started doing that, it made me really happy.
  • Mimicking: Now, coming back to the context, as idealistic as it sounds, it’s not completely correct that companies ask DSA solely for problem-solving skills. For a lot of firms, DSA is a trend. Same questions from problem banks are repeated at times. And it is expected as well as it is not easy to keep coming up with new problems. So, what is the issue with the approach? As soon as the range of questions is limited, this encourages the creation of standard question banks. Companies, pick up random questions for interviews from the same question bank students are studying from. Now, let us consider the case of 2 students A and B who are sitting for a firm XYZ. If A has seen a particular question before which B hasn’t, A will be able to answer that immediately while B might have to struggle a bit to reach the end solution. If there is just one opening, who will get into the firm? Now, to tackle this problem, some companies have multiple rounds of interviews and look at the combined results of multiple rounds to decrease the factor of luck. This also leads to students memorizing the algorithms instead of actually developing algorithmic thinking. I have encountered a lot of students, who can solve a standard DSA problem in an instant, but struggle when the problem is slightly modified. So, this system of mimicking even though it doesn’t intend to sometimes end up rewarding people who memorize things rather can people who understand things. And truth to be told, as long as DSA is used as a metric, the repetition of problems will grow with time. One can also argue that maybe these companies were never looking for the problem-solving skills to being with. Maybe, these companies are looking for those who can get results? Maybe some companies are just asking DSA because they do not expect freshers to have much technical experience?

This pretty much sums up the importance of DSA in IT placements. And I would definitely end this discussion with the best advice that I have. Learn DSA for the problem-solving skills it has to offer. Start early if possible. Give some time for this algorithmic thinking to sink in. And 2–3 months before placements, start solving standard problems so that you do not have to struggle when you encounter these problems in actual interviews.

Importance of DSA after IT placements:

Well, this topic is highly subjective. So, instead of laying down everything inside my head, I will just share my internship experience at a start-up as a Data Scientist. When, I started the internship, during my 1st project DSA didn’t hold much importance. But the element of problem-solving in terms of designing an architecture was there. From my second project onwards, I have been engaged with core applications of DSA and implementing these algorithms.

During my internship, I learned a very important thing. Problem-solving skill is not just about solving a problem that is presented before you. It is also about identifying new problems i.e. before the solution comes identification. And to be honest, I wasn’t really presented with a DSA problem. I identified the problem and created an algorithm around it. Maybe I was luckier than most, but I am glad I was able to see DSA in action where I worked!

In my honest opinion, for most people, DSA will not be directly relevant once in the job but the element of problem-solving and algorithmic thinking will always be there too makes things easier.
Hope this content was helpful for everyone. This is just my perception of things. I may not be completely correct in the matter.

PS: I have started a channel on DSA to help others around me. I have tried my best to deliver some really good content.