Consider a hallway in a building, with N equally sized rooms, numbered 1,..., N. Several meetings are planned, which require different numbers of adjacent rooms. You are given a list of meeting requests with the number of rooms need for each. The requests are represented by the array r[1, ..., k]. For example, meeting j requires r[j] adjacent rooms. You are offered a programmatic tool, which requires n steps to partition a set of n rooms, to accommodate two meeting requests of sizes s1 and s2, where s1+s2 = N. Describe an algorithm that receives a set of meeting requests s1, s2, ..., etc., and calculates the rooms allocations in the least number of steps. Formally prove that the algorithm is correct and that the solution it provides requires the lowest cost (in computational steps). Explain your solution with a concrete example. There was a similar question, but I did not understand the answer the expert gave. It had almost no details, and I could not follow it.
Consider a hallway in a building, with N equally sized rooms, numbered 1,..., N. Several meetings are planned, which require different numbers of adjacent rooms. You are given a list of meeting requests with the number of rooms need for each. The requests are represented by the array r[1, ..., k]. For example, meeting j requires r[j] adjacent rooms. You are offered a programmatic tool, which requires n steps to partition a set of n rooms, to accommodate two meeting requests of sizes s1 and s2, where s1+s2 = N.
Describe an
Formally prove that the algorithm is correct and that the solution it provides requires the lowest cost (in computational steps).
Explain your solution with a concrete example.
There was a similar question, but I did not understand the answer the expert gave. It had almost no details, and I could not follow it.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps