DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Data Structures in Real Life!
Tushar Gupta
Tushar Gupta

Posted on

Data Structures in Real Life!

What is Data Structure?

Data structure is a methodical strategy to arrange data so that it can be used effectively. Data structures include things like arrays, Linked Lists, Stacks, Queues, etc. Data structures are helpful in every area of computer science, including artificial intelligence, graphics, operating systems, compiler design, and everything else. Algorithms are related to data structures, which enables programmers to manage data effectively and improve application performance.

Array :

  • The majority of image processing uses 2D arrays (matrices).
  • the RGB image uses a 3D matrix.
  • 2D arrays are utilized in games like Sudoku and chess.
  • The Leader Board of game or coding contest.

Stack :

  • Used in backtracking, check valid parenthesis in an expression.
  • Evaluating Infix and Postfix expressions.
  • Used in Recursive function calls to store function calls and their results.
  • Undo and Redo operations in word processors like MS-Word, and Notepad.
  • Browsing history of visited websites.
  • Call history/log in mobile phones.
  • Java Virtual Machine uses a stack to store immediate calculation results.

Queue :

  • Windows operating system uses a circular queue to switch between different applications.
  • Used in First Come First Serve job/CPU scheduling algorithm which follows FIFO order.
  • All the requests are queued for the server to respond.

Priority Queue :

  • A priority queue is used in priority scheduling algorithm and interrupt handling in OS.
  • Used in Huffman Coding in compression algorithms.

Linked List :

  • Previous and Next Page in Web Browser.
  • Songs in the music player are linked to the previous and next songs using doubly linked list.
  • Next and previous images in a phone gallery.
  • Multiple Applications running on a PC uses circular linked list.
  • Used for the implementation of stacks, queues, trees, and graphs.

Backtracking

  • Sudoku solver
  • 2048 game
  • Computer networking.
  • To solve problem of the N Queen.
  • To solve the problem of the Maze.
  • To find the Hamiltonian Path present in a graph.
  • To solve the problem of Knight’s Tour Problem.

Graph :

  • In Facebook, LinkedIn and other social networking sites, users are considered to be the vertices and the edge between them indicates that they are connected.
  • Facebook’s Graph API and Google’s Knowledge API are the best examples of graph.
  • Google Maps, Yahoo Maps, Apple Maps uses graph to show the shortest path using Breadth First Search (BFS).
  • Used in HTML DOM and React Virtual DOM.

Tree :

  • Representation structure in File Explorer. (Folders and Subfolders) uses N-ary Tree.
  • Auto-suggestions when you google something using Trie.
  • Used in decision-based machine learning algorithms.
  • Used in Backtracking to maintain the state-space tree.
  • A binary tree is used in database indexing to store and retrieve data in an efficient manner.
  • To implement Heap data structure.

Binary Search Trees (BST) can be used in sorting algorithms.

i) Dijkstra Algorithm :
This algorithm is used to find the shortest path between two vertices in a graph in such a way that the sum of weights between the edges is minimum.

ii) Prims Algorithm :
It is a greedy algorithm to obtain a minimum spanning tree.

HAPPY READING! πŸŽ‰

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.