Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use any of the algorithms studied in class. You do not have to write full descri

ID: 3575615 • Letter: U

Question

Use any of the algorithms studied in class. You do not have to write full descriptions of the algorithms. Just indicate which algorithm you would use, and which changes you need to make to the algorithm to answer each question. Indicate also how to pre-process the input for the algorithm. For example, if the question is: given a road map with distances between cities, find a shortest way of driving from city A to city B; your answer might be: build a graph in which every node is a city and an edge represents a road. The length of an edge is the length of the corresponding road. Use Dijkstra's algorithm to find a shortest path from A to B. This is a shortest route to drive from A to B. There are n small islands in a lake and it Ls desired to build bridges to connect them so that each island can be reached from any other island via one or more bridges. The islands arc numbered from 0 to n - 1. The cost of constructing a bridge between islands i and j is c(i, j). Describe an algorithm that determines which bridges must be built so that the total construction cost is minimum. For example, for the set of islands shown below, an optimum solution is the set of bridges in bold and it has total cost 16.

Explanation / Answer

For constructing the bridge with the minimum spanning cost you can use the Dijkstra's algorithm.

this algorithm is mainly used to find the shortest distance between the nodes.

It can be used to present the road network as well.

It marks the distance of every node to infinity then you take the smallest cost and traverse it ,change the cost from infinity to the new cost in which the node can be reached.

keep continuing this proccess and update the cost after traversing each node.