Practical Application of Data Structures

Ashutosh Kumar
2 min readJul 12, 2021

--

Where Data Structures are used in the real world?

Let’s see it with some examples

1. Graphs

- Graphs are very interesting Data Structures and my personal favorite.

- You have seen the friend suggestions on Facebook. Haven’t you?

- So basically they are fetched using graphs based on the distance/degree from you.

- Similarly in LinkedIn you can see the 1st, 2nd, 3rd connections.
(All the depth levels — level order traversal)

- the one more interesting example is Dependency Injection Library/packages

- so a Graph is created for all the dependencies and each instance of classes created in a topological order during runtime.

- that is the classes with 0 degrees created first and then 1-degree classes and so on.

- for example, if you accidentally injected two classes depends indirectly/directly on each other (circular dependency) it will give an error.

- because in topological sort we first check if there is a cycle or not.

2. Trees

- So you have at least once in a life used HTML Dom object to add or remove tag into the HTML document.

- So basically it's a complex tree of nodes(tags).

- Similarly, ReactJs’s virtual DOM is implemented using Complex Tree Data Structures

3. Stacks

- So in an application when you click on a button to go to a different screen and then again to a different screen.

- So these previous screen’s references are stored in a stack so that when you click on the back button it pops out the current screen and switches back to the previous screen.
(Web Browser Navigation 🤡)

- Similarly in Browser when you move to a different page it stores the previous page in a stack so you can pop back to the previous page.

4. Doubly Linked List

- browser nowadays providing back and forward functionality which is implemented using Doublely Linked.

--

--

Ashutosh Kumar
Ashutosh Kumar

Written by Ashutosh Kumar

Backend Engineering | BIT Mesra | Building Microservices and Scalable Apps | Mentor

No responses yet