0% found this document useful (0 votes)
7 views1 page

Queue Complete Notes

A queue is a linear data structure that operates on a FIFO basis, where the first element added is the first to be removed. Key operations include enqueueing and dequeueing elements, with various types such as simple, circular, priority, and deque. Queues have applications in CPU scheduling, printer queues, call center systems, data buffering, and breadth-first search algorithms.

Uploaded by

shiza098764
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Queue Complete Notes

A queue is a linear data structure that operates on a FIFO basis, where the first element added is the first to be removed. Key operations include enqueueing and dequeueing elements, with various types such as simple, circular, priority, and deque. Queues have applications in CPU scheduling, printer queues, call center systems, data buffering, and breadth-first search algorithms.

Uploaded by

shiza098764
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Queue (Complete Exam Notes)

1. Definition (FIFO)
A queue is a linear data structure that follows FIFO (First In First Out). The element inserted first is removed
first. It works like a real-life line of people — first person in line leaves first.

2. Basic Operations
Enqueue: Insert element at rear.
Dequeue: Remove element from front.
Front: Shows first element.
Rear: Shows last element.

3. Algorithms
Enqueue Algorithm:
1. Check if queue is full
2. If full → overflow
3. Else insert element at rear
4. Move rear pointer forward
Dequeue Algorithm:
1. Check if queue is empty
2. If empty → underflow
3. Remove element from front
4. Move front pointer forward

4. Diagram
Front → 10 20 30 ← Rear

5. Types of Queue (With Explanation)


Simple Queue: Normal queue where insertion is from rear and deletion is from front.
Circular Queue: Last position connects back to first. Saves space and avoids shifting.
Priority Queue: Each element has priority. Higher priority elements are removed first.
Deque (Double Ended Queue): Insertion and deletion allowed from both front and rear.

6. Applications
• CPU scheduling
• Printer queue
• Call center waiting system
• Data buffering
• Breadth First Search (BFS)

You might also like