Linked List In C Programming Language

Linked List:- 

Linked List is a linear data structure. It is a collection of records, and all the records are connected by a variable which holds a memory address.
When you create a list, you write items one after the other. Similarly, a linked item is also added after a data item in the linked list.It is a collection of records, and all the records are connected by a variable which holds a memory address. Each record in a linked list has a field that is a pointer pointing to next record in the list.
Read Also:
  1. FlowChart
  2. Operators
  3. Conditions Statements
Pointer variable is used to point to the first record in the list. You can think of a linked list as a tree. All the branches of a tree are connected among themselves. You can move from one branch to another. All the data items are connected to a linked list like tree.
Linked list
It is a complex data structure, especially useful in systems or applications programming. It is comprised of a series of nodes, each node containing a data element, and a pointer to the next node, as like below pic.
It is the self-referential structure. It allows us to have a chain of structure with related data.
The flowchart of a linked list is showing below:
Linked list flowchart
It is not necessary to know the number of elements and allocate memory for them beforehand. Memory can be allocated as and when necessary. In case the size of the structure and the data in the structure are constantly changing then the array is not a useful structure and hence linked list is used. In a linked list, insertions and deletions can be handled efficiently without having to restructure the list.

Types of linked list:- 

There are various types of linked lists which are following:

1. Singly linked list:

In singly linked list, each node contains single link which attaches it to the next node in the list. Consider the following singly linked list representation:
Single linked list

2. Double linked list: 

In double linked list, each node contains two links, one for previous node and one for next node. Singly connected lists cannot be traversed in backward manner, with the same ease as forward traversal. However, double linked list can be traversed forward and backward with ease as below pic:
Dual linked list

3. Circular linked list: 

In a circular linked list, the last node does not contain the NULL pointer, Instead it contains the pointer of the fire node as showing in the pic:
Circular linked list

Post a Comment

0 Comments