Shun C. answered 06/02/22
Experienced Retired CS Professor
This problem is known as the "knapsack" problem.
Ahmed Z.
asked 11/30/21A person is cutting a long board of wood into different length of pieces . Each cutting has fixed width 2 cm lengths. Given that each cutting with different length has a different price, Now, we are required to help this person to find the optimal cuts in order to increase his income. Consider following example showing different cut’s lengths and their equivalent prices.
Input: board length = 4
Length [ ] = [1, 2, 3, 4, 5, 6, 7, 8]
Price [ ] = [2, 6, 8, 10, 14, 17, 19, 20]
Output: Best cut is two pieces of length 2 each to gain revenue of 6 + 6 = 12
[Explanation: the possible cuts and profit of each is as follows:
As noted the best cut is two pieces of length 2 each to gain revenue of 6 + 6 = 12
To answer question 1, you need to do the following:
1. Write an algorithm to find the optimal cuts in order to increase the person income’s
2. Implement the algorithm using OUBuild script following the above steps.
3. Provide 2 screenshots for different output.
Shun C. answered 06/02/22
Experienced Retired CS Professor
This problem is known as the "knapsack" problem.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.