Queue using Linked List

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;

Application

  • Operating system job scheduling
  • Call waiting at the call centre
  • Multiprogramming 
Previous articleLinked List
Next articleAptitude

LEAVE A REPLY

Please enter your comment!
Please enter your name here