Home DATA STRUCTURE Queue Data Structure: Types and Applications

Queue Data Structure: Types and Applications

960
0
Queue Data Structure

Queue Data Structure


A Queue is a data structure that stores the data elements in a sequential manner. It is also called FIFO( First In First Out) or LILO(Last In Last Out). In the queue, insertion happens at the end(rear) and deletion from the front. To better understand we can consider a queue at the reservation counter of a movie theatre. Here the person standing in the front will book the ticket first and then the next person and so on.

Queue ADT


Enqueue(int data): Insert an element at the end of the queue
int Dequeue(): Removes and returns the element at the front of the queue

Auxiliary Queue Operations


Front(): Prints the element at the front of the queue
int QueueSize(): Returns the count of element in the queue
int isEmpty(): Check whether the queue is empty or not

Declaration of Queue struct

struct QNode{
int data;
struct QNode* next;
};
struct QNode *rear,*front;

Types of Queues in Data Structure


  • Simple Queue: The insertion of an item is done at the front of the queue and deletion takes place at the end of the queue.
  • Circular Queue: A special case of a simple queue in which the last member is linked to the first, a circle-like structure is formed.
  • Priority Queue: The nodes will have some predefined priority in the priority queue. The node with the least priority will be the first to be removed from the queue.
  • Double-Ended Queue (Deque): Insertion and deletion can take place at both the front and rear ends of the queue.

Application


  • Operating system job scheduling
  • Call waiting at the call centre
  • Multiprogramming 
  • People on an escalator
  • Cashier line in a store
  • A car wash line
  • One way exits 
Previous articleCBSE_National Coding Challenge 2023
Next articleData Structure: What is Array?

LEAVE A REPLY

Please enter your comment!
Please enter your name here