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

Sign in to watch this lesson
Algorithms - Graphs II · 4:42
On a sparse graph the O(n^2) scan for the closest vertex wastes almost all its work, so we hand that job to a container. We run Dijkstra with a std::set (erase the old pair, insert the new one) and with a lazy std::priority_queue that pushes duplicates and skips stale entries, then measure both and show what forgetting the one-line stale check costs.