Queue Linked List Notes
Queue Linked List Notes
Objective: Understanding the concept of queues, circular queues, and linked lists.
This document will guide you through key concepts, operations, and common
implementations using arrays and linked lists.
1. What is a Queue?
- A queue is a linear data structure that follows the FIFO (First In, First Out) principle.
- Real-life Example: A line at a ticket counter.
- Operations:
- Enqueue: Insert an element into the queue.
- Dequeue: Remove an element from the queue.
- Peek/Front: Retrieve the front element without removing it.
- Size: Get the number of elements in the queue.
2. Types of Queues
- A linked list-based circular queue where the last node points back to the first node.
- Operations:
- Enqueue: Insert a node after the rear.
- Dequeue: Remove the front node and adjust pointers.
- Traverse: Loop through nodes until the rear points to the front.