1 / 5

Understanding Queues: The FIFO Data Structure

This introduction to queues explains the First In First Out (FIFO) principle, illustrating how queues operate in real-life and technology settings. Learn how to enqueue (add) and dequeue (remove) items from a queue, as well as check if a queue is empty. Discover practical examples of queue implementation, including static and dynamic sizing, and the necessary information to manage a queue effectively. This guide provides a foundational understanding of queue operations and their applications, ensuring a strong grasp of this essential data structure.

erelah
Télécharger la présentation

Understanding Queues: The FIFO Data Structure

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. Data Structures - Queues

  2. Introducing the Queue • FIFO ~ First In First Out • How does a queue (line) work? • First person gets in line • Second person gets in line after first person • etc. • The first person to get out of the line is the first person in line • enqueue – data is added to the end (tail) of the queue • dequeue – data is removed from the beginning (head) of the queue • isEmpty – returns True if queue is empty

  3. Queue Example ENQUEUE D ENQUEUE E ENQUEUE A #What is at the head of the line? and the tail? DEQUEUE DEQUEUE #What is at the head of the line? and the tail?

  4. Why do we use queues? • Used to ensure the first-come-first-serve concept • The first things added are the first things to be removed • Where do we see queues in real life? • Where do you think we see queues in technology?

  5. Queue Implementation • How do we implement a queue? • class • Static size vs. Dynamic size • Let’s draw a queue... • Try out some queue operations (enqueue, dequeue, etc.) • What pieces of information do we need to track?

More Related