00:00

Types of Linked List in Data Structures

A Linked List is a linear data structure that consists of a collection of elements; each element in a linked list is called a Node. The node contains two parts: the first part contains data, and the second part contains the address of the next node.

Linked List

Types of Linked Lists in Data Structures

There are mainly three types of linked lists in data structures as given below:

  1. Singly Linked List:

  2. Doubly Linked List:

  3. Circular Linked List:

1. Singly Linked List

A Singly Linked List is a linear (ordered) data structure that contains a collection of elements, and each element is connected to its next element in a sequence.

Each element in a singly linked list is called a Node. The node consists of two fields: a data field and the reference field (address of the next node).

There is a HEAD pointer, which points to the first node of the singly linked list, and if the list is empty, then it stores NULL and the last node is called the Tail, and it stores NULL in the reference field (next).

Linked List

A singly linked list can traverse only in the forward direction because each node contains the address of the next node.

2. Doubly Linked List

A doubly linked list is a linear data structure; it is another form of Linked List.

A doubly linked list is a collection of seqential nodes (elements); each node consists of three fields: two pointer fields (references to the previous and to the next node in the sequence of nodes) and one data field.

A double linked list can be traversed in forward and backward directions because each node has two pointers, previous and next.

Doubly Linked List

In the Doubly Linked List, each node consist of three parts:

Doubly Linked List Node Structure
  1. First Part: Pointer to point the previous node in the list.
  2. Second Part: The data (value) stored in the node.
  3. Third Part: Pointer to point the next node in the list.

Circular Linked List

A circular linked list is another type of linked list where the last node points to the first node of the list, creating a circular structure. Unlike a normal linked list, a circular linked list does not have a NULL pointer at the end.

Linked List

As with other linked lists, circular linked lists can also grow or shrink dynamically as elements are added or removed.