A data structure is a method of arranging data in a computer that allows it to be used effectively. Let's see the different types of data structures used in real-life.
Applications of Arrays
- The contact applications in our phone which we use in our daily life has a lot of contacts. These contacts are stored in the form of an arrays. When we add or delete a contact it is similar to inserting/deleting an array.
- Songs playlist in our music player.
- These are also used in the online ticket booking system if a user wants to book a seat in S-9, the array becomes seat[S].
Applications of Hash Table
- They can be used to implement caches mainly used to that are used to speed up the access to data.
- Hash is a not just used in data structure, but also widely used in security, cryptography, graphics, audio.
- The hash functions are used in various algorithms to make their updating and storing computing faster.
Single Linked List
Collection of element called nodes that are stored haphazardly in the memory. Node has two parts. One which store data at a specific address and the other is a pointer that contains the address of the next node. The last node contains the pointer to NULL.
Applications of Single Linked List
- UNDO, REDO or DELETE operations
- Viewing photos continuously one after the other in a photo viewer.
- Skip to the next track option in a music player.
Double Linked List
It is a type of linked list in which a node contains a pointer to the previous and the next node in a sequence.
Applications of Double Linked List
- It is usually used in card games to represent the deck of cards.
- Implementing backward and forward navigation in the web browsers.
- UNDO and REDO functions in notepad or some other applications.
A Stack is defined as a linear list in which insertions and deletions take place at the same end based on the Last-In-First-Out(LIFO) strategy. This end is called the top of the stack and the other end is called the bottom of the stack.
Applications of Stack
- To check for left and right parenthesis match in an expression.
- To evaluate a post fix expression.
- Store the return address in a function call-return structure of a compiler.
Applications of Queues
- Priority queues are used in browser while downloading multiple files.
- Used by printer software.
- CPU for task scheduling.
Applications of Trees
- Implementation of navigation in website or applications.
- Trees structures are also used in Domain Name Server(DNS).
- In various games which come across decision-making steps.
Applications of Graphs
- The shortest path between two points can be found using graphs.
- Used in various e-commerce websites for user preferences.
- Used by Network-based platforms for interconnections.
- Performing the same operations multiple times with different inputs
- In every step, we try smaller inputs to make the problem smaller
- Base condition is needed to stop the recursion otherwise infinite loop will occur
- Space complexity
- Speed for better time complexity