Write a C++/java program for the following algorithm design assignment: Design a
ID: 3679466 • Letter: W
Question
Write a C++/java program for the following algorithm design assignment:
Design an algorithm using the dynamic programming algorithm design paradigm that solves the following problem in O(n^2) time
Lets say we have n boxes,each box is a rectangular cube with different widths and lengths.the height of all cubes is 1 unit.we want to build a tower using these n boxes such that every box is bigger than all the boxes above it->meaning if the i'th box has a width of 10 and a length of 8 the (i+1)'th box must have a width of 10 or less and a height of 8 or less.
Note that we CANNOT rotate the boxes, so if a box has a width of 10 and a length of 8, we cannot rotate it so that it will have a length of 10 and width of 8 units
Write a program that calculates the maximum height the tower can possibly have.
The input format is as follows:
The first line is the number of inputs n
The next n lines are the width and heights of the n boxes
Input example 1:
output:
input example 2:
output:
input example 3:
output:
WARNING: must use the Dynamic Programming algorithm design paradigm or solution wont be accepted by professor
Thanks!
Explanation / Answer
IN java
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.