Introduction to Linked Lists

A linked list is a linear data structure consisting of a group of nodes where each node point to the next node through a pointer. Each node is composed of data and a reference (in other words, a link) to the next node in the sequence.


Linked List


Linked lists are among the simplest and most common data structures. The principal benefits of a linked list over a conventional array are:

On the other hand, simple linked lists by themselves do not allow random access to the data or any form of efficient indexing. Thus, many basic operations – such as obtaining the last node of the list, finding a node containing a given data, or locating the place where a new node should be inserted – may require sequential scanning of most or all of the list elements.

Common Types of Linked Lists

1. Singly Linked List

Singly linked lists contain nodes with a data field and a next field, which points to the next node in a line of nodes. The operations that can be performed on singly linked lists include insertion, deletion, and traversal.

Singly Linked List

2. Doubly Linked List

In a doubly-linked list, each node contains, besides the next-node link, a second link field pointing to the prev node in the sequence.

Doubly Linked List

An XOR-linking technique allows a doubly-linked list to be implemented using a single link field in each node.

3. Circular Linked list

In the last node of a list, the link field often contains a null reference, a special value is used to indicate the lack of further nodes. In a circular doubly linked list, the “tail” is linked back to the “head”. The major advantage of circularly linked lists is their ability to traverse the full list beginning at any given node.

Circular Linked List

Applications of Linked Lists

Linked lists are a dynamic data structure, which can grow and be pruned, allocating, and deallocating memory while the program is running.

Note: Unless explicitly mentioned, a singly linked list will be referred to by a list or linked list throughout our website.


Also See: