Question: 2 / 2 100% + Problem 2. In the city of Sidhapur, there is a very long straight street on which n people live in
2 / 2 100% + Problem 2. In the city of Sidhapur, there is a very long straight street on which n people live in houses built next to each other (not necessarily at the same gap) - house i is identified by a coordinate xi. The citizens currently need to get their bread from the neighboring town of Roti- Garh, which they find annoying. Hence the local councillor decides to open k bakeries on the long street. The residents are happy to lease out one floor of their houses for opening a bakery. Your task would be to pick k out of the n houses. Remember that each citizen needs to travel everyday to their closest bakery. Hence, you better come up with a solution such that the total distance travelled by all citizens each day is as small as possible. Design a polynomial (in n and k) time algorithm to pick the k spots
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
