דילוג לתוכן הראשי
0

השיעור הזה זמין כרגע באנגלית.

The cheapest way, not the shortest

BFS finds the route with the fewest roads. But roads differ: one takes a minute, another twenty. To find the cheapest route when every step has its own cost, you need Dijkstra's algorithm, and it uses the heap you just met.