Question: You have n boxes with square bases, the i -th box has height h i , each side of the base has length s i,

You have n boxes with square bases, the i-th box has height hi, each side of the base has length si, and the weight of the box is wi. You can stack box j on top of box k if sj sk and wj wk. So you can only stack a box on top of another if its both no heavier and has a base no bigger.

Let H(i) be the tallest stack of boxes you can build. The tallest stack of boxes that you can build with box j on the top is

You have n boxes with square bases, the i-th box has height

The overall maximum height stack will be

hi, each side of the base has length si, and the weight

A. Write pseudocode that implements a brute-force recursive solution to this problem.

B. Analyze the running time of the brute-force recursive solution.

H(j) = max(H (i)) + h KJ wi2WJ sizsj

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 Databases Questions!