Queues

Queues is a kind of abstract data type where items are inserted one end (rear end) known as enqueue operation and deteted from the other end(front end) known as dequeue operation.
This makes the queue a First-In-First-Out (FIFO) data structure.
The queue performs the function of a buffer.



queues


Operation on Queues

Operation Description
initialize() Initializes a queue by adding the value of rear and font to -1.
enqueue() Insert an element at the rear end of the queue.
dequeue() Deletes the front element and return the same.
empty() It returns true(1) if the queue is empty and return false(0) if the queue is not empty.
full() It returns true(1) if the queue is full and return false(0) if the queue is not full.



Operation on queue

operartion in queue



Application of queues

Queues are mostly used in operating systems.
  • Waiting for a particular event to occur.
  • Scheduling of processes.