- Queue is also a linear data structure.
- It has one end called the REAR(also called tail) which used to insert new item.
- To removal of existing element called FRONT(also called head).
- This makes queue as FIFO.
- FIFO stands for First In First Out.
- The process to add an element into queue is called Enqueue.
- The process of removal of an element from queue is called Dequeue
- In a Linear or Simple queue, once the queue is completely full, it's not possible to insert a new item.
- 1. Situation - A
- 2. Situation - B
- Circular Queue is also a linear data structure.
- It follows the principle of FIFO(First In First Out).
- In Circular Queue, instead of ending the queue at the last position, it again starts from the first position after the last elements.
- The shape like circle, So it is called a Circular Queue.
- Characteristics of Circular Queue
- Head will always point to the front of the queue.
- Tail will always point to the end of the queue.
- In Begining, the head and the tail will be pointing to the same location i.e. queue is empty.
- Once a new item inserted, Head and Tail will initialize with zero value.
- The head and the tail will get reinitialized to 0 every time they reach the end of the queue.
- Application of Circular Queue
- Computer-based Traffic Signal System.
- CPU scheduling for Processes.
- Implementation of Circular Queue
- Circular Queue can be implemented using...
- 1. an Array
- 2. a Linked List.
- The easy and simple way of implementing a queue is by using an Array.
- Algorithm for Circular EnQueue operation
- Algorithm for Circular DeQueue operation
Tags:
data structure