Applications of Linked Lists

Applications of Linked Lists

Written by Richa Kiran on Jun 18th, 2021 Views Report Post

In this article, I'm gonna be talking about Applications of linked lists. Now that we've come so far and learned all the basics of a singly linked list, it's only natural to wonder what could be the use of a linked list in the real world. Let's start off with this gif - tenor.gif Does it remind you of something?

The minions have formed something called a Conga Line. A linked list is sort of like a conga line. Each person holds the person in front of them just like how each node of a linked list are connected to the node adjacent to them. Here's another picture of a Conga Line - tenor (2)-min.gif Doesn't it remind you of the good old COVID-Free days? Anyway, we can even consider a train to be a good example of a linked list. You might be thinking, that these are all metaphorical sort of examples of a linked list. This was only to give you a bit of idea about what it might look like. Let's first explore what makes Linked Lists advantageous over other linear data structures like arrays.

What makes Linked Lists better than other linear data structures?

->A linked list has dynamic size, which means you can increase and decrease the size of a linked list at run-time. Whereas a data structure like arrays have fixed size due to which sometimes the memory gets wasted if we don't make use of the full size of an array.

->Insertion and deletion operations are easier in linked lists and take constant time. Whereas in arrays deletion and insertion require continuous shifting of elements from one position to another which makes the process much more difficult. The complexity is comes out to be linear in this case.

->We can easily make use of linked list to implement other linear data structures like Queues and Stacks.

But, even though linked lists utilize less memory due to its dynamic size, it can waste memory too. Only one value is assigned in each cell of an array, but, there are at least two components that are stored in a node of a linked list(one being the assigned value and the other pointer to the next node).

Now, let's see some real world applications of a linked list.

Your playlist

Yup, you heard it right! Your playlist is one of the most relatable examples of a linked list. More specifically, it is an example of a doubly linked list.

If your playlist is a linked list, each song would represent a node. When one song is over, the pointer automatically shifts to the next song in the playlist(or we can say next node of the linked list). If you want to add a new song, it gets added to the end of the list. It is very easy to play a song once again or skip a song as a doubly linked list can be traversed both ways.

Graph data structure

Imagine Multiple linked lists inter-connected to one another. That's vaguely how Graphs look like. 1431391699Fotolia_64334859_Subscription_Monthly_M.webp Linked lists are used in implementation Graph Data Structure. Graphs have many real world applications like World Wide Web, Google Maps, GPS, Social Media platforms like Facebook,the product recommendations you get on e-commerce websites, even the Operating System you use works on it.

Implementation of other Data Structures

Just like graphs, linked lists can be used in implementation of other data structures as well, like Stacks and Queues. Stacks can be used in Undo/Redo operations, in text editors like MS Word. Queues can be used in graph traversals.

Image Viewer

Just like playlist of song, linked list is used in image viewer in which each image represents a node.

Switching web pages back and forth in the web browser

We can navigate from one page to the next page or switch back to the previous page in web browser, another example of linked list irl. In a bigger picture it can actually be represented by a graph.

I hope you enjoyed this article and got to learn new things from it. To learn basic operations on linked list you can check out my other posts here. Happy learning!

Comments (0)