Starting from:
$35

$29

Homework Assignment 4 Solution

Write a program that takes a file name as a command line argument. The file contains a list of points, one per line, in the format

(123, 45)

(67, 89)

There are at most 500 points in the file. The first point is the start point, the second the target point. Your program is to compute a bottleneck path from the start to the target point. You then print the points of the path with their coordinates, one per line, and last, on a separate line, the bottleneck distance.

A bottleneck path is a path whose longest edge is as short as possible. To find the bottleneck distance, you perform binary search on the set of all distances between all pairs of points. For a candidate distance, you construct the graph of all point pairs with at most that distance, and check by BFS or DFS whether in that graph, start and target point are still connected.

More products