what is queue
what is queue?
It is a linear data structure which works in FIFO order. in this queue insertion and deletion are perform from both direction end. One is called FRONT and second is called REAR. Insertion and Deletion operation are performed from REAR and FRONT respectively. Its main objective to implement CPU scheduling algorithm in operating system.
eg:- ticket booking at cinema hall etc.
Types of Queue.
1. linear queue
2.circular queue.
3 priority queue.
4. Deque/Dequeue
linear queue.
In this queue we can not insert/ store new element on deleted position, so in this case memory is westage but it can be avoided with the help of circular queue.
circular queue.
We know that major drawback of linear queue is that we can not insert element on deleted position but in case of circular queue new element can be inserted on the deleted position. In this case rear goes back zero if rear is equivalent to size-1.
Priority queue
In this queue insertion is performed according to priority value but deletion operation is performed in FIFO order.In this case higher priority element must be inserted before lower priority element.
Dequeue.
In this queue insertion and deletion can take place from both direction end front and rear.
Next topic-
linear queue using Array
linear queue using Array
i hope it is helpful for you....
and if you any doubt plzzz follow me on insta and ask me question....
Comments
Post a Comment