⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 30s17 days 22 hours 19 minutes 30 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 19m 30s17 days 22 hours 19 minutes 30 seconds.

Sign in to watch this lesson
Algorithms - Graphs II · 5:23
To connect eight offices with the cheapest set of leased lines, we need a minimum spanning tree: no loops, exactly n - 1 lines. The cut property explains why the cheapest line across any split is safe, Kruskal's algorithm turns it into a procedure (sort by price, skip any line that closes a loop; total 31 on our graph), and a disjoint set union with union by size and path compression answers 'already connected?' in almost constant time, so the sort's O(m log m) dominates.