Question: Let x 1 < x 2 < . . . < xn be real numbers representing coordinates of n villages located along a straight road.

Let x1< x2<...< xn be real numbers representing coordinates of n villages
located along a straight road. A post ofce needs to be built in one of these
villages.
a. Design an efcient algorithm to nd the post-ofce location minimizing
the average distance between the villages and the post ofce.
b. Design an efcient algorithm to nd the post-ofce location minimizing
the maximum distance from a village to the post ofce.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!