Advertisements
Advertisements
Question
Explain a linked list with suitable example having six nodes with properly labeled diagram.
Code Writing
Diagram
Explain
Advertisements
Solution
A linked list is a linear data structure in which elements are not stored in contiguous memory locations. Each element, called a node, contains two parts:
- Data – stores the value
- Next (Link/Pointer) – stores the address of the next node
The last node points to NULL, indicating the end of the list.
struct Node
{
int data;
Node* next;
};
Example: Linked List with Six Nodes
Let us create a linked list containing six values:
10, 20, 30, 40, 50, 60
Properly Labelled Diagram

Explanation of the Diagram:
- HEAD stores the address of the first node.
- Each node has two fields:
- Left part → Data
- Right part → Next pointer
- Each node points to the next node in sequence.
- The last node points to NULL, showing the end of the list.
shaalaa.com
Is there an error in this question or solution?
2024-2025 (July) Official Board Paper
