INTRODUCTION ON QUEUE Queue is a Linear Data Structure that works on First-in-First-Out (FIFO) principle. • It has two pointers, ‘Front’ that points to the beginning of the queue and ‘Rear’ that points to the end of the queue. • The ‘Front’ and ‘Rear’ pointers are manipulated constantly to always point to the beginning and end of queue. • It can be implemented using Arrays and Linked Lists (Recursive and Non-recursive) methods both. 3 3/7/2017
QUEUE 4 3/7/2017
TYPES OF QUEUE 1.Simple or linear queue: Linked lists are among the simplest and most common data structures. They can be used to implement several other common abstract data types, including lists(the abstract data type ), stacks, queues, associative arrays, and S-expressions, though it is not uncommon to implement the other data structures directly without using a list as the basis of implementation. 5 3/7/2017
SIMPLE QUEUE 6 3/7/2017
TYPES OF QUEUE CONT. 2.Circular queue: Circular queue is a linear data structure . It follows FIFO principle. In circular queue, the last node is connected back to the first node to make a circle. Circular linked list follow the First In First Out principle. Elements are added at the rear end and the elements are deleted at front end of the queue . 7 3/7/2017
CIRCULAR QUEUE 8 3/7/2017
TYPES OF QUEUE CONT. 3.Priority queue: Priority queue is an abstract data type such as queues,stacks and dictionaries. While removing an element from a priority queue, the data item with the highest priority is removed first. In a priority queue, insertion is performed in the order of arrival and deletion is performed based on the priority. 9 3/7/2017
PRIORITY QUEUE 10 3/7/2017
TYPES OF QUEUE CONT. 4.Dequeue: A double-ended queue ( dequeue ) is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front (head) or back (tail). It is also often called a head-tail linked list, though properly this refers to a specific data structure implementation. 11 3/7/2017
ENQUEUE AND DEQUEUE OPERATION 12 3/7/2017
OPERATIONS OF QUEUE enqueue () − add (store) an item to the queue. dequeue () − remove (access) an item from the queue. Few more functions are required to make the above-mentioned queue operation efficient. These are − peek() − Gets the element at the front of the queue without removing it. isfull () − Checks if the queue is full. isempty () − Checks if the queue is empty. 13 3/7/2017