Deques, which resemble double-ended queues, allow you to store data in a semi-ordered way. Unlike queues, which can only take in new items at one end and have items removed from the other end, items in a deque can be added to and removed from both sides. Learn the other key characteristics of the deque's abstract data type in this video.
- [Instructor] Let's talk through…what makes the deque class unique…in comparison to other linear data structures.…And also touch on the basic functionality…we need a deque to have.…First of all, deque stands for double-ended queue…where we take the D, the E,…and the first three letters of queue…and put them all together…to create this new word called deque.…High level definition of a deque…is that it's an abstract data type…that resembles both a stack and a queue.…Deques can hold a collection of items…and order is sort of preserved in a deque.…
You'll see soon why I use the phrase sort of.…In a deque, you can add items both to the front…and to the back and you can remove items…from the front and back as well.…When it comes to implementing a deque,…our first consideration is whether or not…Python has a built-in data type…that we could use behind the scenes.…Just like for the stack and queue data structures,…we can use a list to implement a deque…because a list is an ordered collection of items…that we can modify.…
- 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 9m 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.