Millions of programmers are looking forward to pursuing a career in dream software companies. On average, a dedicated programmer spends hundreds of hours on learning data structure and algorithms for the coding interview. Unfortunately, some of them struggle to become good at it and crack the coding interview. There are several reasons, but one of the best among them would be - lack of motivation and long-term interest in data structure and algo.
So what are the key ideas to develop long-term term motivation? Why algorithms and data structure are essential for a programmer? How it helps us to become smart problem-solvers? Let's find out the answers to these fundamental questions. I would like to start with a story from personal experience!
I had never used computers before entering into the college. Even I got poor grades in the course of programming during the 1st year. I had started talking to seniors about this failure but still did not get a clear direction. Somehow I had managed to persuade myself to leave the idea of a career in computer science. But as Steve Jobs said — we can’t connect the dots looking forward; we can only connect them looking backward.
When I was in 3rd year, one of my friends explained the recursive algorithm to print the nth Fibonacci number. He told me that this is a bad code because the 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 the proof. I was amazed and said - “Why did most students write this code during the 1st-year examination?”. He smiled and said - “ Because they had memorized it and never thought about its performance!”. Further, he explained to me the better solution via the bottom-up approach of dynamic programming.
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: an algorithm is about performance, and a bad algorithm is always a failure even if you have good hardware. I started going through several basic problems and comparing the efficiency of their solutions. It gave me an amazing feeling! Even curiosity was so high that I studied the book CLRS twice. Now situation is totally opposite: learning algorithms and data structure is my passion.
Good knowledge of programming languages is necessary but not sufficient. The real joy comes when we have good command over DS algorithms and problem-solving. I believe that a good practice of problem solving can change the way we think about algorithms and help us grow to new heights of career. After four years of teaching experience with students and professionals, sharing here the 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 algorithm 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 will be using library functions for 90% of our coding. But, why should we bother to learn the implementation when the implementation is hidden behind an abstraction? In such a situation, we must learn data structures and algorithms to understand the logic behind the behavior of these abstractions. If we don’t then, we will eventually apply them in a way that will hurt you.
Why tech companies test the knowledge of DSA during the interview process? The answer would be obvious — these companies encounter problems daily that are complex and large on the scale of data, and they would like to hire an intelligent programmer who can solve those problems in minimal time, using the least number of resources. So the knowledge of Data Structures and Algorithms is a clear indicator of the programmer’s abilities in solving those problems efficiently.
Algorithmic logic is part of the beautiful natural patterns and real-life activities. There is immense satisfaction when we visualize working our way to an understanding of them. They are the compact and simple pieces of logic work perfectly to perform a single task. Here is the best quote from the "father of the analysis of algorithms" 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 Thinking, Enjoy Algorithms!
Get well-designed application and interview centirc content on ds-algorithms, machine learning, system design and oops. Content will be delivered weekly.