




































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





































Queues
Lecture 6
Introduction to Queues
Introduction to Queues
Common Operations on Queues
- FRONT (Q ): Returns the first element on Queue Q. - ENQUEUE( x , Q ): Inserts element x at the end of Queue Q. - DEQUEUE( Q ): Deletes the first element of Q. - ISEMPTY( Q ): Returns true if and only if Q is an empty queue. - ISFULL(Q): Returns true if and only if Q is full.
Introduction to Queues (Uses)
Queue is most often used in a scenario where there is a shared resource that has to serve multiple requests but resource can handle only one request at a time
Queues Implementations
Array Implementation of Queues
Array Implementation of Queues
How can we avoid to waste unused memory?
Circular Array?
Array Implementation of Queues
Linked List Implementation of
Queues
Linked List Implementation of
Queues
Use a pointer to store address of tail and call it rear
Linked List Implementation of
Queues
Static Implementation of Queues
pointers.
Rear