Queues allow you to store data in an ordered way, where the most recent item that was added to the stack is the last item that can be removed. This is called First In, First Out, or FIFO. Learn the other key characteristics of the queue's abstract data type in this video.
- [Instructor] Let's talk about what makes…the queue class unique especially in comparison to stacks.…Here's a high level definition of what a queue is.…Queues hold a collection of items…in the order in which they were added.…Items are added to the back of a queue…and removed from the front of the queue.…If you think of a queue as a line of costumers,…a customer adds themselves to the end of the line…and eventually leaves from the front of the line.…This is called first-in first-out or FIFO.…
Note that this is subtly different from stacks…which are last-in first-out.…Queues also preserve order so when you think…about people joining a line,…the order is preserved there as well.…Just as we did for the stack class,…we can see if there is a built-in data type we could use…to implement the queue behind the scenes.…Again, we can use a list because a list…is an ordered collection of items that we can modify.…When we code our queue class,…we're going to use the right side…or end of a list to represent the front of the queue.…
- Abstract types and data structures
- Stacks as a linear abstract data type
- Creating the Stack class and its methods
- Adding items to the top and bottom of a stack
- Creating the Queue class and its methods
- Manipulating items in a queue
- Creating the Dequeue class and its methods
- Adding and removing items from a dequeue
Skill Level Advanced
Learning the Python 3 Standard Librarywith Kathryn Hodge2h 10m Intermediate
What you should know1m 26s
1. Abstract Data Types and Data Structures
2. The Stack
3. The Queue
4. The Deque
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.