4.3 Stacks and Queues
IN THIS SECTION, WE introduce two closely related data types for manipulating arbitrarily large collections of objects: the stack and the queue. Stacks and queues are special cases of the idea of a collection. We refer to the objects in a collection as items. A collection is characterized by four operations: create the collection, insert an item, remove an item, and test whether the collection is empty.
4.3.1 Stack of strings (array)
4.3.2 Stack of strings (linked list)
4.3.3 Stack of strings (resizing array)
4.3.6 Generic FIFO queue (linked list)
4.3.8 Load balancing simulation
Programs in this section
When we insert an item into a collection, ...
Get Computer Science: An Interdisciplinary Approach 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.