Queues are very similar to lists except they have a specific way of adding and removing items. Learn how to build and implement a queue in any programming language using a struct, a few functions, and resizable array.
- [Instructor] Queues are great for storing the order…of things that need to happen.…As you know, we can create a queue…that represents a group of people standing in line.…One person would be first in line,…another would be second, and so forth.…Like stacks, many languages…do not give you queue functionality outright,…but you can use the tools given from the language.…This sometimes means using an interface…and deciding how the queue is implemented…from a set of given choices or even implementing your own.…
We'll talk more about what this means…when we get to how queues work in other languages,…but first we'll be going back to Swift…to implement our own queue from scratch.…This is going to look pretty similar…to how stacks were implemented…because queues are an ordered list with a specific way…of adding and removing items.…For queues, we can only add to the back…and remove from the front.…Let's take a look at our stack code from before in Swift.…Here, we created a class or container…that defined the blueprint for how we create stacks in code.…
- 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?
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.