4.7: Queues

The queue, like the stack, is a useful data abstraction for retaining information in a specific order. A queue is a data structure with restricted insertion and deletion operations. Information may be inserted on the queue, but only at the rear end, or bottom. Information may be removed from the queue, but only at the front end, or top.

The queue acts like the pile of Community Chest cards in Monopoly. The top card is the only one that can be removed, and insertions to the pile can be made only at the bottom. If we think of the information stored as representing postponed obligations, then the queue gives access to the obligations in the order in which they were incurred. A popular mnemonic for helping to remember this characteristic is FIFO?/FONT>first in, first out. Like LIFO, this is a common term in accounting and inventory control systems.

4.7.1 Array and Circular Array Implementation of the Queue

4.7.2 List Implementation of the Queue with an Array of Records

4.7.3 List Implementation of the Queue with Records in Dynamic Memory