Circular Queue
Circular Queue
Circular queue
Introduction:
Circular queue is a linear data structure. It follows FIFO principle. In circular queue the last
node is connected back to the first node to make a circle. Elements are added at the rear end
and the elements are deleted at front end of the queue.
Double Ended Queue is also a Queue data structure in which the insertion and deletion
operations are performed at both the ends (front and rear). That means, we can insert at
both front and rear positions and can delete from both front and rear positions.
Definition
In a normal Queue Data Structure, we can insert elements until queue becomes full. But
once if queue becomes full, we cannot insert the next element until all the elements are
deleted from the queue.
For example consider the queue below...
After inserting all the elements into the queue.
Now consider the following situation after deleting three elements from the queue...
This situation also says that Queue is Full and we cannot insert the new element because,
'rear' is still at last position. In above situation, even though we have empty positions in the
queue we cannot make use of them to insert new element. This is the major problem in
normal queue data structure. To overcome this problem we use circular queue data
structure.
1
2nd stage 2019-2020 Data Structure
Lecturer :Amaal K.Dawood Circular Queue
2
2nd stage 2019-2020 Data Structure
Lecturer :Amaal K.Dawood Circular Queue
3
2nd stage 2019-2020 Data Structure
Lecturer :Amaal K.Dawood Circular Queue
4
2nd stage 2019-2020 Data Structure
Lecturer :Amaal K.Dawood Circular Queue
5
2nd stage 2019-2020 Data Structure
Lecturer :Amaal K.Dawood Circular Queue
Home works