A queue is a first-in first-out (FIFO) data structure: items are taken off the queue in the order in which they arrive. A queue operate like people waiting to get on a bus. The queue has a head and a tail. A pointer to the head of the queue indicates which item is to be serviced next. The tail pointer is useful for adding items to the end of the queue. When the head pointer is null, the queue is empty. The operations on queues typically include adding an entry to the end of the list (enqueue), deleting an entry from the beginning of the list (dequeue), and checking to see whether the queue is empty. Exercises in this section involves the use of queues.

Available Exercises

Exercise 10.1. Write a program that uses an array to implement a queue.

Exercise 10.2. Write a program that uses a linked list to implement a queue.