4 Linked Lists

Data Structures and Algorithms · Unit 4

Linked Lists

Exam-focused notes for Linked Lists (Data Structures and Algorithms, BIT201): what the TU syllabus asks and how it has actually been tested, with 5 solved past questions from this unit.

What this unit covers

  • Singly linked list definition and traversal
  • Doubly linked list definition and comparison
  • Circular linked list definition and traversal
  • Doubly circular linked list operations
  • Insertion at front position algorithm
  • Deletion of last node algorithm
  • Advantages and disadvantages of linked list over array

Doubly circular linked list operations

20825 marks

Explain the insertion and deletion of a node at first and last position of doubly circular linked list. [5]

Each node has three fields: PREV (pointer to previous node), DATA, and NEXT (pointer to next node). In a doubly circular linked list: - The last node's NEXT points to the first node - The first node's PREV points to the last node --- Steps: 1. Create a new ...

Full solved answer →
20805 marks

Write short notes on a.) Doubly circular linked list Write short notes on b.) Breadth first Search [2.5+2.5]

A Doubly Circular Linked List is a type of linked list that combines the properties of both a doubly linked list and a circular linked list. Each node contains three fields: - PREV: Pointer to the previous node - DATA: The actual data stored - NEXT: Pointer...

Full solved answer →

Singly linked list definition and traversal

20795 marks

Explain singly linked list with example. Compare singly linked list with doubly linked list. [5]

A singly linked list is a linear data structure in which elements (called nodes) are stored in non-contiguous memory locations. Each node contains two parts: 1. Data field - stores the actual data/value 2. Next pointer - stores the address (reference) of th...

Full solved answer →

Advantages and disadvantages of linked list over array

010 marks

What are the advantages and disadvantages of linked list over an array? Discuss algorithms for inserting a node at front position of the linked list and deleting its last item in singly linked list.[10]

--- Advantage Explanation --------------------------- 1 Dynamic Size Linked list can grow or shrink at runtime. No need to declare size in advance, unlike arrays which have a fixed size. 2 Efficient Insertion/Deletion Inserting or deleting a node (especiall...

Full solved answer →

Circular linked list definition and traversal

05 marks

What is a circular linked list? How can you traverse all nodes in a singly linked list? [5]

--- A circular linked list is a linked list in which the last node does not contain a NULL pointer. Instead, the last node points back to the first (head) node, forming a circle or loop. There are two types: - Singly Circular Linked List: Each node has one ...

Full solved answer →