PadhaikoAll subjects

Past exam question: 2072 Ashwin (Regular), Q5

Data Structure and Algorithms · 5 marks

Open in the Padhaiko app

Topic: Linked List

Question

Define different types of linked list with suitable example.

Solution

Three Main Types of Linked List:

  1. Singly Linked List (SLL): Each node stores (data, next), linking strictly forward; the last node's next is NULL.
    • Example: head -> [10|*] -> [20|*] -> [30|NULL]
  2. Doubly Linked List (DLL): Each node stores (prev, data, next), enabling both forward and backward traversal; head->prev = NULL and tail->next = NULL.
    • Example: NULL <- [10] <-> [20] <-> [30] -> NULL
  3. Circular Linked List (CLL): The last node's next points back to head instead of NULL (can be singly or doubly circular), useful for round-robin CPU scheduling.
    • Example: head -> [10] -> [20] -> [30] --(back to 10)
Answer:

The three types of linked list are Singly Linked List (one-way next links ending in NULL), Doubly Linked List (two-way prev and next links), and Circular Linked List (tail links back to head).

All past exam questions for Data Structure and Algorithms