Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.

Sign in to watch this lesson
Algorithms - Graphs II · 4:17
When every edge costs 0 or 1, Dijkstra's heap only ever holds two distinct labels, so two plain vectors replace it and shortest paths take linear time. We solve an arrow-grid puzzle with two conveyor belts, see why marking cells visited on push gives wrong answers, compare the deque form, and extend the idea to weights 0..k with Dial's ring of k + 1 buckets, measured against a heap.