Python Data Structures: Stacks, Queues, and Deques (2018)
1h 25mAdvanced2018-12-06
Authors

Erin Allard
Software Engineer at Numerator
Course details
Data structures like stacks and queues come up frequently in interviews for technical roles. Though many candidates may never encounter data structures in day-to-day programming, showing a mastery of these concepts can help you rock your next interview—and add to your coding toolkit. In this course, Erin Allard shows how to use Python to build the top three linear data structures: stacks, queues, and deques. She compares and contrasts the data structures and shows how to implement them in an object-oriented way in Python. Learn how to define each class and use Python's built-in methods to accomplish the necessary behaviors, such as push, pop, and peek; enqueue and dequeue; and add_front and remove_rear. Challenges in each chapter help practice your new skills and prepare for your next interview.
Learning objectives
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
Learning objectives
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
Skills covered
Data EngineeringAdvancedPythonProgramming LanguagesData ScienceOpen SourceSoftware Development
Concepts
0. Introduction
- 01 - Python data structures primer
- 02 - What you should know
1. Abstract Data Types and Data Structures
- 03 - Abstract data types
- 04 - Data structures
2. The Stack
- 05 - Stacks as a linear abstract data type
- 06 - Creating the stack class and its methods
- 07 - push()
- 08 - pop()
- 09 - peek()
- 10 - size()
- 11 - is empty()
- 12 - Challenge - Balanced symbols
- 13 - Balanced symbols solution approach
- 14 - Balanced symbols solution in code
3. The Queue
- 15 - Queues as a linear abstract data type
- 16 - Creating the queue class and its methods
- 17 - enqueue()
- 18 - dequeue()
- 19 - peek()
- 20 - size() and is empty()
- 21 - Challenge - Print queue
- 22 - Print queue solution approach
- 23 - Print queue solution in code
4. The Deque
- 24 - Dequeues as a linear abstract data type
- 25 - Creating the deque class and its methods
- 26 - add rear() and add front()
- 27 - remove rear() and remove front()
- 28 - peek rear() and peek front()
- 29 - size() and is empty()
- 30 - Challenge - Palindrome checker
- 31 - Palindrome checker solution approach
- 32 - Palindrome checker solution in code
Conclusion
- 33 - Next steps