Data Structures · Singly Linked Lists
Advantages of Linked Lists over Arrays and the Head Pointer
Overview
A singly linked list is a dynamic data structure built from structures (in C), where each node is linked to the next via a pointer.
It is one of the two popular data structures used to store information (input or output), the other being arrays.
Unlike arrays, a linked list can grow and shrink while the program runs, and a head pointer keeps track of where the list starts.
Key concepts
- Singly linked list: a dynamic data structure built from structures (in C), where each node is linked to the next via a pointer.
- Two popular data structures used to store information (input or output): arrays and structures (linked structures).
- Head pointer: a pointer that points to the start of the linked list. It is declared as a pointer to the node structure, e.g.
struct node *head;. It is a pointer to a structure of type node, i.e., it points to the first node of the list. - Dynamic vs static: using structures, the data structure can be created dynamically; using arrays, the need/size has to be static.

How it works
- When storing information, you can choose between arrays and structures (linked structures).
- In C, a plain array's size is fixed once it is allocated (even if allocated at run time with malloc), so it cannot grow or shrink as elements are added or removed; a linked structure can.
So if you do not know your requirement well ahead of time, you must leave it to structures. - Using structures, the data structure can be created dynamically; using arrays, the need/size has to be static.
- On the go, if you feel you need one more element, you can create the element and add it into the link. On the go, if you find you do not need some of the nodes/links, you can free them up.
- The structure is used to create the node, and in general a pointer
headis created initially:struct node *head; - Every link has a pointer that points to where the linked list is starting from. Without this pointer you cannot keep track of everything.
headis a pointer to a structure of type node — i.e., it points to the first node of the list.
Formulas
struct node *head;— declaresheadas a pointer to a structure of typenode, pointing to the first node of the list.
Comparison
| Feature | Arrays | Linked list (structures) |
|---|---|---|
| Dynamic creation in C | Not possible (no dynamic array creation) | Possible — nodes created dynamically |
| Size requirement | Must be known/static ahead of time | Can grow/shrink on the go |
| Adding an element later | Not possible dynamically | Create a new element and add it into the link |
| Removing an element | — | Free up the unneeded nodes |
| Tracking the start | Base address of array | head pointer to the first node |
Revision summary
- Arrays cannot be created dynamically in C; linked structures can.
- If the requirement is not known in advance, use structures (linked list), not arrays.
- Nodes can be added on demand and freed when no longer needed.
- The
headpointer is essential: it points to the first node and lets you keep track of the whole list. headis declared asstruct node *head;— a pointer to a structure of typenode.
Previous-year exam insights
- Insertion/deletion at the front of a singly linked list is ; insertion/deletion at the end is unless a tail pointer is maintained, in which case appending is but deleting the last node still needs (to find the predecessor).
Asked inGATE 2025GATE 1997 - Concatenating two lists in requires access to the last node of the first list: a singly linked list with only a head pointer needs , whereas a list with a tail pointer (or a circular list with a tail pointer) does it in .
Asked inGATE 1997GATE 2025 - A singly linked list allows moving only forward (to the successor); accessing the predecessor (backward step) is , which is why operations like 'backup' or deleting a node given only a pointer to it are in a doubly linked list but not in a singly linked list.
Asked inUGC NET 2004 - Random access by index is for arrays but for linked lists; searching an unsorted list is in both, and a sorted array supports binary search while a linked list does not.
- A linked list uses extra memory per element for the pointer(s) (one per node in singly, two in doubly linked lists) and nodes are not contiguous, so it has poorer cache locality than an array.
- Meld/merge of two unsorted linked lists can be done in by linking the tail of one to the head of the other, whereas merging two heaps or balanced BSTs costs more (building a heap from n elements is , merging two BSTs is ).
Asked inGATE 2025