Algorithm Designda67_f_travelling_tourist

Travelling Tourist

1a99d18c-c730-4f56-a839-ac7d1ba1fcd2.cppC++
1// Loading code...

Selected Submission

100 / 100
0.052s
4628 KB
Shortest PathBacktrack
Time Comp.
O(D^2 * E log V + D!) where D is the number of destinations, E is the number of edges, and V is the number of vertices. Dijkstra's is O(E log V) and is called D^2 times. The permutation part is O(D!).
Space Comp.
O(V^2 + D)
Readability
5/10

"The code calculates the shortest path between all pairs of destination nodes using Dijkstra's algorithm and then finds the minimum cost to visit all destinations in any order using permutations. Thus, it combines shortest path finding with a brute-force search through all possible orderings."

History

AttemptPoints Time
Try #331005/1/2025
Try #321005/1/2025
Try #311005/1/2025
Try #301004/22/2025
Try #291004/22/2025
Try #281004/22/2025
Try #2704/22/2025
Try #2604/22/2025
Try #251004/22/2025
Try #241004/22/2025
Try #2354/22/2025
Try #2204/14/2025
Try #2104/14/2025
Try #2004/14/2025
Try #191004/14/2025
Try #181004/14/2025
Try #171004/14/2025
Try #161004/14/2025
Try #151004/14/2025
Try #141004/14/2025
Try #131004/13/2025
Try #12454/13/2025
Try #11454/13/2025
Try #101004/13/2025
Try #91004/13/2025
Try #81004/13/2025
Try #71004/13/2025
Try #6454/13/2025
Try #5304/13/2025
Try #4904/13/2025
Try #31004/13/2025
Try #21004/13/2025
Try #11004/13/2025