Linear Data Structures
Build the fundamental linear data structures from scratch in Python: nodes and the links between them, linked lists, stacks and queues. Learn how each one manages its data, where it shines, and solve classic problems with them, from bracket checking to the Towers of Hanoi and a queue simulation.
- Beginner level
- 4 modules
- 13 lessons
- 49 tasks and questions
Syllabus
01NodesThe building block of linked structures: what nodes and links are, how chains of nodes live in memory, what orphaned nodes are, and how to create, walk, insert and remove nodes in Python.2 lessons
02Linked listsHow linked lists work and what their operations cost compared with Python lists, a LinkedList class with iteration, and the classic search, insert, remove and in-place reverse operations.3 lessons
03StacksLast in, first out: push, pop and peek, underflow and overflow, lists as stacks and a bracket checker, a node-based Stack class with a size limit, and a Towers of Hanoi project with a playable game, a recursive solver and an iterative solver built on a stack.4 lessons
04QueuesFirst in, first out: enqueue, dequeue and peek, collections.deque and bounded buffers, a node-based Queue class with head and tail references, a car-wash queue simulation, and a guide to choosing between linear structures.4 lessons