Skip to content
Tactiverge

Learning Rooms/○ Level 3 · Innovator/Computing and algorithms

Data Structures: Crash Course Computer Science #14

CrashCourse · Length: see YouTube · captions on YouTube · nothing loads until you press play

By the end you can…

  • Choose between list, tuple, set and dict for a task and justify the choice.
  • Explain why membership tests and lookups by key are fast in sets and dicts but slow in lists.
  • Use tuples for fixed records such as grid cells and as dictionary keys.
?Predict▶Watch✓Practise⚙Build

Watch it all: no segment has been checked by hand for this video yet.

1.Predict before you press play

A route planner must check 'have I already visited this cell?' thousands of times. Which container should hold the visited cells?

Pick one before you press play. A wrong guess is fine: it is what makes the video stick.

2.See the idea first

Play with this diagram for a minute. It gives you something to hang the video on.

Loading the interactive…

Can't use the diagram? Read a description instead

The dict mode shows an inventory of six parts. Looking up 'servo SG90' returns 6 directly; as a list of pairs a scan would compare 4 names. Looking up an unstocked 'M4 bolt' raises KeyError with square brackets but returns 0 with .get(key, 0); a list scan would check all 6 names.

3.Watch, actively

A fast tour of arrays, strings, stacks, queues, trees and graphs, and how each is laid out in memory.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

Watch for…

  • → Watch for how an array, a linked list and a hash table are laid out, and which questions each answers quickly.

Pause whenever you like. Rewatching a hard minute is a good habit, not a failure.

Can't stream it? Read the idea instead

A data structure is a way of laying out data so certain jobs are fast. Arrays give instant access by position, queues and stacks control which item comes out next, and trees and graphs record how items connect. The best choice depends on what you will do most often.

What the video covers (our own note, written when we verified it): A fast tour of arrays, strings, stacks, queues, trees and graphs, and how each is laid out in memory.

Written by Tactiverge in our own words, not a transcript. The full lesson below explains the idea without the video.

Read it instead

Jot down one thing that surprised you and one question you still have.

Private: saved only on this device, never sent to Tactiverge.

4.Practise what you just saw

These come from the lesson that use this video and are checked on the server. Wrong answers get a hint and another try.

Practice 1

A list holds 50,000 part numbers in random order. Checking a part that is NOT in the list: how many comparisons does 'p in parts' make?

comparisons

Practice 2

A planned path must keep its waypoints in order and may visit the same waypoint twice. Which container?

Practice 3

stock = {'M3-BOLT': 120}. What does stock.get('M4-BOLT', 0) return?

Practice 4

You need the stock quantity for any part number, looked up thousands of times. Which container?

5.Try it yourself

No simulation models this idea yet. The lesson below has an interactive diagram instead.

6.Where engineers use it

Path planners keep the visited set as a hash set of cell tuples and the best-known cost per cell as a dict; switching a visited list to a set is often the single biggest speed-up in a student planner.

From the applied view in the lesson List, tuple, set or dict? Pick the right container. Checked by automated tests only.

7.Build something with it

Follow-up project

Rewrite a planner's visited list as a set and its distance list as a dict keyed by cell tuples. On a 100 × 100 open grid, count how many membership comparisons the list version would make in total (sum the list length at each check) and compare with one lookup per check for the set.

Where this video lives

In the course catalogue: CSE-310 Structured programs and data

The video is by CrashCourse, embedded from YouTube with privacy-enhanced mode and never autoplayed. The room around it (prompts, notes, practice, projects) is Tactiverge's, written with AI assistance and checked by automated tests only.