{ for(i=front;i 1. i.e., the insertion and deletions are performed likewise. printf("\n 2.Delete"); printf("\n\t Queue is Overflow"); break; That means, an element which is inserted first will be deleted or accessed first. Types of Queues in Data Structure Simple Queue. It has a front and rear. scanf("%d",&t); It has a front and rear. printf("\n\t %d",queue[i]); The difference between stacks and … void insert(void); front=0; insert(); Simple Queue 2. { display(); Using a VPN Service – How to Hide Yourself Online, How to Protect Your Small Business from a Hacker Attack. while(ch!=4) Circular Queue 3. There are four different types of queue in data structure. The first node has no pointer pointing towards it whereas the last node has no pointer pointing out from it. printf("\n\t Exit"); int i; { Once a new element is inserted into the Queue, all the elements inserted before the new element in the queue must be removed, to remove the new element. Queues are an important concept of the data structures and understanding their types is very necessary for working appropriately with them. delet(); } While the deletion is performed in accordance to priority number (the data item with highest priority is removed first), insertion is performed only in the order. { scanf("%d",&t); Hence, the last node and the first node also gets connected making a circular link overall. The order is First In First Out (FIFO). { { queue[rear]=t; Your email address will not be published. void delet(void) //Delete Function As is clear from the name itself, simple queue lets us perform the operations simply. int ch=0; Queue is an abstract data type which can be implemented as a linear or circular list. Few more functions are required to make the above-mentioned queue operation efficient. void main() } } These are − 1. peek()− Gets the element at the front of the queue without removing it. Queue is an important structure for storing and retrieving data and hence is used extensively among all the data structures. case 3: printf("\n\t %d gets deleted.........",queue[front]); case 5: rear=front+1; }. Here we shall try to understand the basic operations associated with queues − 1. enqueue()− add (store) an item to the queue. int t; front++; } void display(void); { rear++; Queue is an abstract data type which can be implemented as a linear or circular list. Regardless of how many elements are already contained, a new element can always be added. i.e., the insertion and deletions are performed likewise. Queue operations may involve initializing or defining the queue, utilizing it, and then completely erasing it from the memory. switch(ch) } scanf("\n %d",&ch); They above information are very useful in my studies, Your email address will not be published. case 1: } Unlike the simple queues, in a circular queue each node is connected to the next node in sequence but the last node’s pointer is also connected to the first node’s address. if(rear