CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Courses / Code

Data Structures You Can See

Stacks, queues, hash tables and trees you can poke, then pick the right one for the job.

Intermediate · 10 lessons · Free, no account needed

Best after: Build with Python, Algorithms in Motion

Start the course

Lessons

  1. Stacks: Last In, First Out (5 min): A stack keeps things in a pile: you add to the top and take from the top.
  2. Queues: First In, First Out (7 min): A queue is a line: items join at the back and leave from the front.
  3. Linked Lists: Chains of Arrows (7 min): Putting an item at the front of a Python list shifts every other item: n moves for n items.
  4. Hash Tables: How Dictionaries Find Things (7 min): A hash function turns a key into a number. The number % the table size picks a locker.
  5. Sets: Is It In There? (7 min): A set holds each item once, in no particular order. It's a hash table with keys and no values.
  6. Trees: Folders Inside Folders (7 min): A tree has one root; every other node has one parent and any number of children. Nodes with no children are leaves.
  7. Binary Search Trees (7 min): A binary search tree keeps one rule at every node: smaller values in the left branch, bigger in the right.
  8. Heaps and Priority Queues (7 min): A priority queue hands out the most urgent item first, not the oldest.
  9. Choosing the Right Structure (7 min): No structure is best at everything. Each is fast at some jobs and slow at others: a trade-off.
  10. Undo Button and Leaderboard (7 min): Undo and Redo run on two stacks: Undo moves the newest action from done to undone, Redo moves it back.

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab