Introduction to Linked List || Applications of Linked List || Types of Linked List


Linked list is a data structure that allows us to store data in a linear fashion.
Introduction to Linked List || Applications of Linked List || Types of Linked List



The analogies to visualize linked list can be train, chain or children holding hands in a line.
Introduction to Linked List || Applications of Linked List || Types of Linked List


Introduction to Linked List || Applications of Linked List || Types of Linked List


Introduction to Linked List || Applications of Linked List || Types of Linked List


The above images are analogies but this is how a real linked list looks in the world of data structures and programing
Introduction to Linked List || Applications of Linked List || Types of Linked List


In this image every rectangular box that you see is called "node", so hence forth we will refer these boxes simply as nodes

1st node is called a "head"
The arrows () that you see are represent linkes by which every node is connected or "linked" to other nodes. 

We refer to people with names and residential address, a company keeps track of it's employees by an employe id or unique id, similarly we keep track of our data in programing using "memory address".

Now, why did I suddenly mentioed about names , ids, and addresses ? This is because in Liked list "nodes" get memories allocated in a discontinued (say discreet or irregular) manner. So to keep track of every them one node is linked to it's next i by the memory address of the next node. The analogy was to say that as we refer employees by ids similarly we refer to nodes by their addresses(with the help of pointers - will see in detail in the next post)

The last node is always pointed to NULL, as there is no other node or memory address further. 

Enough of theories...
Coming to APPLICATIONS of Linked List :


1. To implement "STACK", "QUEUE". (Will learn about them in later posts)

2. To create an image vierwe (where we hold the address of previos and next image and store image file in nodes )

3. Similar to image viewer we can create music, and video player. These are implemented by doubly or circular linked list.

4. You must have seen websites where the images slide automaticly. This can also be created by linked list.

5. We can create "undo" and "redo" functionality by it.

6. We can keep track of multiple files and applications running in an operating system and switch among them using the "doubly-circular linked list"

And there can be many more applications of linked list where we want to keep track of objects one before and one after the current object...

Now we will discuss the types of linked list and explain them in short. (Detailed
explanation will be in the respective post of that type)

Types of Linked List :

1.  Simple linked list :
The most common type of linked list where we can access the element in only one direction i.e., from head to last node. Thus we can call it a unidirectional linked list also

Introduction to Linked List || Applications of Linked List || Types of Linked List


2. Circular linked list :
We can have traversal from head to the last node and because of it's circular nature and the last node takes us back to the first node. This way the cycle goes.

Introduction to Linked List || Applications of Linked List || Types of Linked List



3. Doubly linked list:
We can have traversal in both directions to and fro but not in cyclic/circular fashion. We can go forward and backward because we keep the address of previous node also.(except for head node where we cannot go backward and for last node where we cannot go any further obviously. The previous address of head and the next address of last node is NULL).

Introduction to Linked List || Applications of Linked List || Types of Linked List

4. Doubly Circular linked list :
As the name says we have here the properties of both doubly and circular linked list. We can have traversal in both directions i.e., We can go forward and backward. The last node will take us next to head node. If we go backwards from head node we will end up at the last node again. Seeing the image will make it clearer



In the next series of posts we will take up each type of linked list, discuss and implement it in detail one by one.

Let's meet in next post with simple linked list till then

#KeepLearningKeepGrowing




Post a Comment

1 Comments

  1. Very nice and informative... i will eagerly wait for the next post :)

    ReplyDelete
Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)