Chapter 3. Understanding Collections: Queues, Stacks, and Circular Buffers

After completing this chapter, you will be able to

  • Identify queues, stacks, and circular buffers.

  • Design and implement queues, stacks, and circular buffers.

  • Understand when and when not to use queues, stacks, and circular buffers.

Queue Overview

A queue is a First In, First Out (FIFO) collection. A FIFO is a collection that resembles people waiting in a straight line. The first person to enter the line is the first person to leave the line. When the first people leave the line, they have been dequeued, or popped off the front of the queue, and as additional people join the line, they are enqueued, or pushed onto the back of the queue.

Uses of Queues

Queues are normally used when ...

Get Developer’s Guide to Collections in Microsoft® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.