There is a map of cities - like a real world country's map. Some cities have roads between them, and it takes a known time to traverse each road.I'm in city A and have a list of my favorite cities [F1..Fn]. Give an efficient algoritha to decide which of my favorite cities I can get to the fastest.
Solved it using dijktra's with priority queue
Problem was finding time complexcity. The algorithm I wrote with with min heap was traversing the same node again and again. So had to make it more efficient. But inspite of doing that the time complexcity was coming out to be (V+E)logE and not (V+E)logV which I'd learnt. Turns out E = V*(V-1), hence (V+E)2log(V). So got a bit confused.
The interviewer was too good in time complexcity analysis.