1 / 16

Create an empty queue. Determine whether a queue is empty. Add a new item to the queue.

Create an empty queue. Determine whether a queue is empty. Add a new item to the queue. Remove from the queue the item that was added earliest. Remove all the items from the queue. Retrieve from the queue the item that was added earliest. ADT Queue Operations. Figure 7.1

walkowiak
Download Presentation

Create an empty queue. Determine whether a queue is empty. Add a new item to the queue.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Create an empty queue. Determine whether a queue is empty. Add a new item to the queue. Remove from the queue the item that was added earliest. Remove all the items from the queue. Retrieve from the queue the item that was added earliest. ADT Queue Operations

  2. Figure 7.1 Some queue operations

  3. Figure 7.2 The results of inserting a string into both a queue and a stack

  4. Array-based Implementation Reference-based Implementation Comparing Implementations Implementations of the ADT Queue

  5. Figure 7.3a A reference-based implementation of a queue: a) a linear linked list with two external references; b) a circular linear linked list with one external reference

  6. Figure 7.3b A reference-based implementation of a queue: a) a linear linked list with two external references; b) a circular linear linked list with one external reference

  7. Figure 7.4 Inserting an item into a nonempty queue

  8. Figure 7.5 Inserting an item into an empty queue: a) before insertion; b) after insertion

  9. Figure 7.6 Deleting an item from a queue of more than one item

  10. Figure 7.7 a) A naive array-based implementation of a queue; b) rightward drift can cause the queue to appear full

  11. Figure 7.8 A circular implementation of a queue

  12. Figure 7.9 The effect of some operations of the queue in Figure 7-8

  13. Figure 7.10a a) front passes back when the queue becomes empty

  14. Figure 7.10b b) back catches up to front when the queue becomes full

  15. Figure 7.11 A more efficient circular implementation: a) a full queue; b) an empty queue

More Related