How do I use algorithms and data structure in real life?
Did you ever search for the shortest path from your home to your college in google maps or stand in a line to collect your groceries? Well, you have done these things many times in your life but unaware of knowing that these are some real-life examples of data structures and algorithms. In this article, I explained some real-life examples of common data structures and algorithms. Hope they'll help you to understand.
- Arrays: It is the most used data structure. An array is simply a collection of objects or things. Simple examples can be a collection of books on your table, clothes in a wardrobe and pens in your pen stand.
In software programs, the array is used almost everywhere in the program to store any data.
- Queue: Queue works as first in first out manner. If you ever stand in line whether for getting into a bus or collecting movie tickets where the first one in the line processed first, then you experienced this common data structure.
It is used in Transport and operations research where various entities are stored and held to be processed later.
In operating systems, it is used for the waiting list in Applications and task scheduling.
- Stack: Look at the pile of dishes in your kitchen rack. It resembles the stack data structure where the object on the top is taken first.
It is used for undo/redo operation in word processors, mathematical expression evaluation, and syntax parsing in any software program.
- Graph: Think of your friends on facebook. They are connected to you and to others in the form of a graph. You'll also find the application of graph in google maps where the shortest distance from any location is calculated using graph algorithms.
In computers, it is used for routing, data organizations and in networks of communication.
- Tree: A tree data structure can be thought of like the hierarchy of employees in an office. You'll find trees used in many applications.
It is used in parsers, filesystems, IP routing table, data analysis and data mining applications.
- Hash Table:ÃâÃÂ Hash tables are commonly used for fast data lookup. It is also used in symbol trees for compilers, database indexing, caches and unique data representation.
- Sorting algorithms: You use sorting algorithms when you are playing cards with your friends or ordering things by their value.
As the name suggests sorting algorithms like bubble sort or quick sort are used to order data values or objects in computer programs.
- Greedy Algorithms: Every time you choose the best one from a collection of things whether it is food or clothes, you're driven by the greedy approach. In greedy algorithms, the highest value object or data value is taken.
There are a number of greedy algorithms. For example, Prim's and Kruskal's algorithms used for finding the minimum spanning trees. Dijkstra algorithm is used in applications like google map to find the shortest path in a graph.
- Searching Algorithms:ÃâÃÂ Whenever you search anything in google, it uses various searching algorithms to process your request. For retrieving data from its databases, every application uses searching algorithms to process the searching request. Binary search is used for searching a data value from a sorted list in quick time.
- Trie: You'll see the idea of trie when you look for any word in the dictionary. It is used in the applications for auto-completing the text and spells checking.
I tried to explain some of the common data structures and algorithms for you. There are more data structures and algorithms which have plenty of real-life uses. Well, you should check these books to know more about algorithms and data structures. Hope they'll help you to better understand these data structures and algorithms.