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
The overall maximum height stack will be
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 sizsjStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started