Explore the concept of a queue so that you know when to use it in your programs. Learn the common operations we use with queues so that you can integrate them into your programs.
- Like stacks and lists,…queues represent a series of ordered objects,…but the way we access, add and remove items…is slightly different.…If you think of a queue at an amusement park…or a line of people at a store,…a queue has a front and a back,…and it works the exact same way in code.…It is designed to have elements inserted…at the end of the queue and elements removed…from the beginning of the queue.…When people stand in a line,…the first person that gets in the line…is the first person out of the line,…and the last person that gets in the line…is the last person out of the line.…
We say queues follow a FIFO…or first in, first out policy for this reason.…Some important terminology to keep in mind…is engueue and dequeue.…When we add an item to the queue,…we say we engueue the item,…and when we remove an item from the queue,…we say we dequeue the item.…Similar to stacks, we can peek…or see the first item in the queue,…also known as the next item to be dequeued,…without the removing it from the data structure.…Just like stacks, we implement queues with a list…
- Data types: Booleans, numbers, strings, and more
- Multidimensional arrays
- Jagged arrays
- Search and sort arrays
- Linked lists
- Stacks and queues
- Hash functions and hash tables
- Trees and graphs
Skill Level Intermediate
Understand data structures1m 25s
1. Introduction to Data Structures
4. Stacks and Queues
5. Hash-Based Data Structures
6. Trees and Graphs
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.