Linked List

Linear collection of elements where each element points to the next.

A linked list doesn’t have the same limitations as an array.

Node

A linked list is sometimes called a node based data structure. This is because an element in a linked list is called a node. A node has two parts. The first is the data and the second is the memory address of the next node.

The second part of the last node (also called tail node) is null because there are no more nodes in the linked list.

The first node in the list is called the head.

Operations

OperationTime complexity
Inserting a elementO(1)
Deleting a elementO(1)
Traversing a linked listO(n)
Accessing an elementO(n)

Deleting and inserting element at the middle of a liked list requires two operations, the traversal and the deletion or insertion itself. The running time will be O(n).

Types of linked lists