Skip to content
Home » Representation

Representation

✅ Representation of Linked List (Detailed – BCA Exam Answer)


✅ 1. Introduction

A Linked List is a linear dynamic data structure in which elements are stored in the form of nodes.
Each node is connected to the next node using a link/pointer.

✅ Unlike arrays, linked list elements are not stored in contiguous memory locations.


✅ 2. Node Representation of Linked List

Each node of a linked list has two main parts:

✅ 1. Data Part

Stores the actual value (like integer, character, record, etc.)

✅ 2. Link/Pointer Part

Stores the address of the next node.

📌 Node structure:

+--------+---------+
|  DATA  |  NEXT   |
+--------+---------+

✅ The pointer NEXT points to the next node.


✅ 3. Linked List Representation in Memory

A linked list is represented in memory using nodes stored at random locations, but connected logically using pointers.

📌 Example Linked List:

HEAD → [10|•] → [20|•] → [30|NULL]

✅ Explanation

  • HEAD is a pointer that stores address of first node.
  • First node contains data 10 and address of second node.
  • Second node contains data 20 and address of third node.
  • Third node contains data 30 and points to NULL (end of list).

NULL indicates the end of the linked list.


✅ 4. Representation with Memory Addresses (Example)

Suppose nodes are stored at these memory locations:

NodeDataNext Address
HEAD1000
1000102500
2500204200
420030NULL

📌 Linked Representation:

HEAD
 ↓
1000 → 2500 → 4200 → NULL
[10]   [20]   [30]

✅ Nodes are not stored in sequence, but pointers connect them.


✅ 5. Linked List Representation in C (Structure)

✅ Node Creation using Structure

struct node
{
    int data;
    struct node *next;
};

✅ Here:

  • data stores value
  • next stores address of next node

✅ 6. Types of Linked List Representation

Linked list can be represented in different forms:


✅ (A) Singly Linked List

Each node points only to the next node.

📌 Representation:

HEAD → [Data|Next] → [Data|Next] → NULL

✅ Example:

10 → 20 → 30 → NULL

✅ (B) Doubly Linked List

Each node has two pointers:

  • prev (address of previous node)
  • next (address of next node)

📌 Representation:

NULL ← [Prev|Data|Next] ↔ [Prev|Data|Next] → NULL

✅ Example:

NULL ← 10 ↔ 20 ↔ 30 → NULL

✅ (C) Circular Linked List

Last node points back to the first node (no NULL at end).

📌 Representation:

10 → 20 → 30
↑         ↓
←←←←←←←←←←

✅ It forms a circle.


✅ 7. Important Points about Representation

✅ Key points:

  1. Linked list uses dynamic memory allocation
  2. Nodes are connected using pointers
  3. HEAD stores address of first node
  4. Last node contains NULL (in singly list)
  5. Traversal starts from HEAD

✅ Conclusion

A linked list is represented using nodes that contain data and pointer. The nodes are stored in non-contiguous memory locations and linked through pointers. The starting node is pointed by HEAD, and the last node points to NULL (in singly linked list).