Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. Dijkstra's Algorithm (20 pts;6+6+4+4) Dijkstra's single source shortest paths algorithm finds shortest paths from a (source) vertex to all other vertices. Once the algorithm
4. Dijkstra's Algorithm (20 pts;6+6+4+4) Dijkstra's single source shortest paths algorithm finds shortest paths from a (source) vertex to all other vertices. Once the algorithm is executed on a source, say x, the distances to all vertices from this source can be stored in a file. Subsequently, to determine the shortest distance from x to any vertex, the algorithm need not be executed again; instead, the distance is simply read off the file. Consider an application that works on a directed graph that has 1,024 vertices and 10,240 edges, and positive edge weights. (Remember, log2(1,024) 10) In any single run, the application gets the shortest distance from x to y in the graph, where x and y are input vertex numbers It maintains a single file into which it can dump shortest distances from any vertex (so at any time this file can contain sets of shortest distances from numerous vertices) It takes exactly (nte) log(n) time to execute Dijkstra's algorithm for a given source vertex (This is not a big-oh order, it is an exact number) It takes exactly 100*log(n) time to find whether the shortest distance from x to y is in the distance file, and if so, the actual distance. Let's call this process "file lookup". It takes exactly 100"log(n) time to store in the file the shortest distances from any source z - call this process "file store" a) What would your strategy be to determine the shortest distance from x to y, for any single run of the application with x and y as parameters? Write your strategy in the form of an algorithm, i.e. a sequence of steps. Do not write any Java code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started