Question: Problem 1 . We are given 2 n equally - spaced points on a line. Half the points are black, and half are white. The
Problem We are given equallyspaced points on a line. Half the points are black, and
half are white. The goal is to connect every black point to a distinct white point with a wire
so as to minimize the total wire length.
Below are two suggestions for greedy algorithms, which may or may not solve the problem
correctly. For each suggested algorithm, if it is correct, prove its correctness. If it is incorrect,
prove that by providing an input on which the algorithm does not find an optimal solution.
Each of the suggested algorithms performs iterations. In every iteration, it selects a
single pair of points to connect and then deletes these two points from the line. In order to
define each algorithm, it is now enough to specify the greedy rule for selecting the pair of
points to connect.
Greedy Rule : find any pair of points, where is black and is white, and no
other point lies between the two. Connect to and delete both points from the line.
Greedy Rule : Let be the leftmost black point and let be the leftmost white point.
Connect to and delete both points from the line.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
