Track 16 · Lesson 7 of 12
Stacks and queues
Use a list as a stack and collections.deque as a queue to match brackets, undo edits, serve jobs in order and explore step by step.
You will be able to
- Explain last-in-first-out (stack) and first-in-first-out (queue) order
- Use a list as a stack with append and pop
- Use collections.deque as a queue, and explain why list.pop(0) is slow
- Solve bracket matching and undo history with a stack, and job scheduling with a queue
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.