Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 09 · DSA · Four patterns the ladders lean on · about 19 min to read

Play it as a journeyTutor comes with a plan

Three colours, two teams, Prim and all pairs

Graphs
Graphs · Open board

: dots and the lines between them. This lesson asks four more questions of that same picture: is there a loop in the arrows, can the dots be split into two teams, what is the cheapest way to join them all, and how far is every dot from every other.

Lesson 88 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • A build that never ends
  • Three colours: white, grey and black
  • Two teams: a graph you can split by colour
  • Prim: grow one tree, always taking the cheapest line out
  • All pairs: one table, and one middle stop at a time
  • Directed cycle detection, with the loop printed
  • LC 785, Is Graph Bipartite?
  • Prim on the six offices, and LC 1584
  • Floyd-Warshall, and LC 1334
  • Measured cost of the three loops
  • Edges and limits

Terms it explains: White, grey, Black, bipartite, Prim's algorithm, minimum spanning tree, Floyd-Warshall, Common mistakes, A*, adjacency list, adjacency matrix, Bellman-Ford, BFS, DAG, DFS, Dijkstra, directed vs undirected, in-degree, MST, relax an edge, sparse vs dense, topological sort, union-find, vertex/edge, weighted.

Lab

Every find walks a chain of houses up to the root. In the worst order, how long can that chain get, and what keeps it short?

Drag Cables joined to the end, then switch The habits and watch Tallest chain fall from 31 to 5.

Open The short chains

Review DSA