Data structures and algorithms provide a set of approaches for handling data efficiently. So, a programmer must know DSA fundamentals to write efficient and correct code. Let’s understand the importance of DSA from two different points of view:
Coding interview point of view: Data structures and algorithms help an interviewer evaluate a candidate's problem-solving, coding and analytical skills.
Application point of view: Data structures are at the heart of several real-life applications. If we observe closely, application programming interfaces (API) hide implementation details, which uses the concept of DSA. So, a good programmer should know the use cases and applications of various data structures and algorithms to make the correct decisions.
I had never used computers before going to college. Even I failed in programming course during the 1st year. I had started talking to seniors about this failure but did not get a clear direction. Somehow I managed to persuade myself to leave the idea of a career in computer science. But as Steve Jobs said: "We can’t connect dots looking forward; we can only connect them looking backwards."
When I was in 3rd year, one of my friends explained recursive algorithm to find the nth Fibonacci number. He told me: "This is a bad code because a computer would take several years to produce the output for a large value of n" I said: “Really. How?”
He said: “Time complexity of this algorithm is an exponential function of n”. He immediately explained the idea of time complexity and gave proof. I was amazed and asked: “Why did most students write this code during the 1st-year examination?”.
He smiled and said: "Because they memorized it and never thought about its performance”. Further, he explained a linear time solution using the bottom-up approach of DP. He further optimized it to a single-loop solution with constant extra space.
This was the first incident when I came very close to understanding the importance of algorithms, which helped me change my mind. I understood one thing clearly: Programming is not just about syntaxes and writing correct code, but much more about designing efficient algorithms. I started going through several coding problems and comparing efficiency of their solutions. Even curiosity was so high that I studied the book CLRS twice!
Good knowledge of programming languages is necessary but not sufficient. The real joy comes from having a good command of problem-solving strategies in DSA. So consistent practice and exploring real-life applications can change the way we think about the importance of algorithms. After five years of teaching experience with students and professionals, sharing four good reasons to learn data structure and algorithms.
The system performance depends on choosing efficient algorithms as much as on choosing fast hardware. Even applications that do not require algorithms directly at the application level…relies heavily upon algorithms. For examples:
Overall, algorithms are at the core of most real-life applications. Just as rapid innovations are being made in other computer technologies, they are also being made in algorithms.
Learning algorithms and data structures might seem unnecessary in an age where we are using library functions for writing software codes. But why should we bother to learn implementation details when implementation is hidden behind an abstraction? In such a situation, we must learn data structures and algorithms to understand the logic behind the behaviour of these abstractions. If we don’t, we might apply them in the wrong way.
Why do tech companies test the knowledge of DSA during the interview process? The answer would be obvious: These companies encounter complex and large-scale data-intensive problems and would like to hire a smart programmer who can solve those problems efficiently in terms of time and memory. So the knowledge of data Structures and algorithms is a clear indicator of a programmer’s ability to solve those problems smartly.
Algorithmic logic is part of beautiful natural patterns and real-life activities. Sometimes, they are compact and straightforward pieces of logic work perfectly to perform a single task. Here is one of the best quotes by Donald Knuth: "People who analyze algorithms have double happiness. First of all, they experience the sheer beauty of elegant mathematical patterns that surround elegant computational procedures. Then they receive a practical payoff when their theories make it possible to get other jobs done more quickly and economically."
Enjoy learning, Enjoy coding, Enjoy algorithms!
Subscribe to get weekly content on data structure and algorithms, machine learning, system design and oops.