Google Interview Question
Software Engineer / DevelopersThis is not TSP. Its a minimal spanning tree formation and kruskal's algorithm will provide the cheapest route for the weighted, directed graph.
read up both TSP and Minimal spanning tree on wikipedia or your favorite algorithms text book to know the difference.
Dijkstra and A*, both would give the cheapest path between the two nodes. The question though remains as to which one will do it in the least possible time.
- Anonymous August 13, 2009Given good heuristics, A* will consider the fewest nodes to find the shortest path and as a result take the "least possible time".