Reference1
Reference2
Reference3
Reference4
Reference5
Reference6
Array, Linked List, Stack, Queues, Searching, Sorting, Tree, Graph…
Do you have questions that why should I study all the above-complicated stuff if it has absolutely no use in real life?? Why do companies ask questions related to data structures and algorithms if it’s not useful in a daily job??
A lot of beginners and experienced programmers avoid learning Data Structures and Algorithms because it’s complicated and they think that there is no use of all the above stuff in real life. So before we discuss the topic we are going to throw a simple problem at you and you need to find the solution for that.
If you need to search your roll number in 20000 pages of PDF document (roll numbers are arranged in increasing order) how would you do that?
- If you will try to search it randomly or in a sequential manner it will take too much time. You might get frustrated after some time.
- You can try another solution which is given below…
- Go to page no. 10000
- If your roll no. is not there, but all other roll no. in that page are lesser than your than
- Go to page no. 15000
- Still if your roll no. is not there. but this time all other roll no. is greater than your.
- Go to page no. 12500
Continue the same process and within 30-40 seconds you will find your roll number. Congratulations… you just have used the Binary Search algorithm unintentionally..
This was just a simple example and you might have understood a little bit that why you need to learn data structure and algorithms and its importance in real life. There are plenty of examples you can find in your daily life. So if you think that this skill is only important to crack the interviews of product-based companies then you are totally wrong.
From the above example, we can straightforward give two reasons to Learn Data Structure and Algorithms…
If you want to crack the interviews and get into the product based companies
If you love to solve real-world complex problems.
To Crack the Interviews of the Top Product Based Companies
Do you know that under the hood all your SQL and Linux commands are algorithms and data structures? You might not realize this, but that’s how the software works.
Data structures and algorithms play a major role in implementing software and in the hiring process as well. A lot of students and professionals have the question of why these companies’ interviews are focused on DSA instead of language/frameworks/tools specific questions? Let us explain why it happens…
When you ask someone to make a decision for something the good one will be able to tell you “I choose to do X because it’s better than A, B in these ways. I could have gone with C, but I felt this was a better choice because of this“. In our daily life, we always go with that person who can complete the task in a short amount of time with efficiency and using fewer resources. The same things happen with these companies. The problem faced by these companies is much harder and on a much larger scale. Software developers also have to make the right decisions when it comes to solving the problems of these companies.
Knowledge of DS and Algo like Hash Tables, Trees, Graphs, and various algorithms goes a long way in solving these problems efficiently and the interviewers are more interested in seeing how candidates use these tools to solve a problem. Just like a car mechanic needs the right tool to fix a car and make it run properly, a programmer needs the right tool (algorithm and data structure) to make the software run properly. So the interviewer wants to find a candidate who can apply the right set of tools to solve the given problem. . If you know the characteristics of one data structure in contrast to another you will be able to make the right decision in choosing the right data structure to solve a problem.
Engineers working in Google, Microsoft, Facebook, Amazon-like such companies are different than others and paid higher as compared to other companies…but why? In these companies coding is just the implementation and roughly takes 20-30% of the time allotted to a project. Most of the time goes into designing things with the best and optimum algorithms to save on the company’s resources (servers, computation power, etc). This is the main reason why interviews in these companies are focused on algorithms as they want people who can think out of the box to design algorithms that can save the company thousands of dollars. Youtube, Facebook, Twitter, Instagram, GoogleMaps all these sites have the highest number of users in the world. To handle more users on these sites it requires more optimization to be done and that’s the reason product-based companies only hire candidates who can optimize their software as per user demand.
Example: Suppose you are working in a Facebook company. You come up with an optimal solution of a problem (like sorting a list of users from India) with time complexity of O(nLogn) instead of O(n^2) and assume that n for the problem here for the company in real life scenario is 100 million (very fair assumption considering the number of users registered on Facebook exceeds 1 billion). nLogn would be 800 million, while n^2 would be 10^7 billion. In cost terms, you can see that the efficiency has been improved more than 10^7 times, which could be a huge saving in terms of server cost and time.
Now you might have got that companies want to hire a smart developer who can make the right decision and save company resources, time, and money. So before you give the solution to use a Hash table instead of List to solve a specific problem think about the big scale and all the case scenarios carefully. It can generate revenue for the company or the company can lose a huge amount of money.
To Solve Some Real-World Complex Problems
Have you ever been scolded by your parents when you were unable to find your book or clothes in your messed-up room? Definitely yes…your parents are right when they give the advice to keep everything in the right place so the next time you can get your stuff easily. Here you need to arrange and keep everything (data) in such a structure that whenever you need to search for something you get that easily and as soon as possible. This example gives a clear idea that how important it is to arrange or structure the data in real life.
Now take the example of a library. If you need to find a book on Set Theory from a library, you will go to the maths section first, then the Set Theory section. If these books are not organized in this manner and just distributed randomly then it will be frustrating to find a specific book. So data structures refer to the way we organize information on our computers. Computer scientists process and look for the best way we can organize the data we have, so it can be better processed based on the input provided.
A lot of newbie programmers have this question that where we use all the stuff of data structure and algorithms in our daily life and how it’s useful in solving the real-world complex problem. We need to mention that whether you are interested in getting into the top tech giant companies or not DSA concepts still help a lot in your day-to-day life. Don’t you believe us…Let’s consider some examples…
- Facebook (Yes… we are talking about your favourite application). Can you just imagine that your friends on Facebook, friends of friends, mutual friends they all can be represented easily by Graph? Relax….sit for a couple of moments and think again…you can apply a graph to represent friends’ connections on Facebook.
- If you need to keep a deck of cards and arrange it properly how would you do that? You will throw it randomly or you will arrange the cards one over another and from a proper deck. You can use Stack here to make a proper arrangement of cards one over another.
- If you need to search for a word in the dictionary, what would be your approach? Do you go page by page or do you open some page and if the word is not found you open a page prior to/later to one opened depending upon the order of words to the current page (Binary Search).
- The first two were a good example of choosing the right data structure for a real-world problem and the third one is a good example of choosing the right algorithm to solve a specific problem in less amount time.
All the above examples give you a clear understanding that how the organization of data is really important in our day-to-day life. Arranging data in a specific structure is really helpful in saving a lot of time and it becomes easier to manipulate or use them. The same goes for the algorithm…we all want to save our time, energy and resources. We all want to choose the best approach to solve the problems in our daily life. A lot of problems exist in the world that can take hours or days to be solved with the native solution, it also may take years ! can you imagine! watch this: Importance of Data Structure and Algorithms
We are surrounded by a lot of real-world complex problems for
which no one has the solution. Observe the problems in-depth and you can help this world by giving the solution that no one has given before.
Reasons to learn DSA
Many people consider DSA as just a mere subject in computer science. This is where they get it wrong. DSA is much more than that. It teaches you a way to be a better programmer and a way to think better. It is a skill that will help you all through your life and is not a skill to learn just to pass a subject. Let us dive deeper into various reasons why one should learn DSA –
- Role of DSA in Technical Hiring Process
The knowledge of DSA is tested significantly in the technical hiring process of many companies. This is because the problems that the companies encounter daily are quite huge and complex, and they want to hire smart people who will solve these tasks within minimal time and the least number of resources. Advanced knowledge of Data Structures and Algorithms is a clear indicator of the person’s capabilities in solving complex problems in minimal time.
Interviewers are not worried about the ultimate solution to the problem in the developer hiring process. They want to see the tools that the candidates use to reach that solution. Top companies across the world like Google and Facebook spend only 20-30% of their time in implementing the code. The rest of the time is spent on formulating the solution using algorithms to save millions of dollars spent on various resources like servers. That is the reason they are at the top of the table and also the reason why they value the knowledge of DSA so much in their interviews. The hiring managers of these top companies spend more time on programming contests and programming sites than job portals to hire the top talents because in these portals they can find techies who have suggested unique solutions to problems.
- Role of DSA in Solving Real-World Problems
You will be surprised to know that DSA has quite an important role to play even in solving real-world problems. Real-world problems that take months can be solved in minutes using the knowledge of DSA.
Let us say you want to find a set of people in the same age group within a large collection of data. Assuming this data is sorted, you can solve this issue easily with the binary search algorithm which works on the principle of DSA. The binary search algorithm is considered a logarithmically scalable algorithm, unlike traditional methods that are just linearly scalable. This means, if the number of data points in the database is squared, the time taken to do the same task in the binary search will only be doubled.
3.Role of DSA in Machine Learning
Can you imagine, a concept as advanced and futuristic as Machine Learning (ML) needs Engineers with knowledge of DSA? Apart from solving real-world problems, these engineers can design amazing products using the combination of their ML and DSA knowledge. The knowledge of DSA is the basic building block of algorithmic thinking, and logical capabilities in any field of computer science, and ML is no exception. An ML engineer spends a considerable part of his time collecting data which can lead to various complex challenges that can be solved easily using the knowledge of DSA. Let us assume you are creating an ML product that has a dataset with the address as one of its columns. Now suppose you want to retrieve a portion of this data, say the street name, then ML cannot work on the string directly. You would need the help of DSA by implementing an algorithm based on a string to retrieve the required data.
As today’s Students Consider Data Structures and Algorithms as a theoretical subject, which was the worst mistake done by them,
Practical knowledge is knowledge that is acquired by day-to-day hands-on experiences and Solving more complex problems.
Data structure and algorithms help in understanding the nature of the problem at a deeper level and thereby a better understanding of the world.
Top comments (0)