There are n different sizes of boxes, from 1 to n. There is an unlimited supply of boxes of each size t, each with a val

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

There are n different sizes of boxes, from 1 to n. There is an unlimited supply of boxes of each size t, each with a val

Post by answerhappygod »

There are n different sizes of boxes, from 1 to n. There is an
unlimited supply of boxes of each size t, each with a value
vt .
A box of size t can hold several smaller boxes of sizes
a1, a2, . . . , ak as long as the
sum of sizes a1 + a2 + . . . + ak
is strictly less than t.
Each of these boxes may be filled with yet more boxes, and so
on.
Design an algorithm which runs in O(n 2 )
time and finds the maximum value that can be attained by taking one
box, potentially with smaller boxes nested inside it.
Clarifications:
• What input is given in an instance of the problem? The integer
n, and n integers v1, . . . , vn.
• What are the sizes of the boxes? The sizes are 1, 2, . . . ,
n.
• Are there any constraints on the values of the boxes? You can
assume that all vt are positive.
Hint: To fill the interior of a box of size t, you either use
only one box (in which case the optimal packing is straightforward)
or you use two or more smaller boxes.
Do not write the code, give steps and methods. Explain
the steps of algorithm, and the logic behind these steps in plain
English and give Diagrams and time complexity
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply