Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLease answer A bakery sells donuts in boxes of two different quantities, X and 22. Additionally, each box requires work wi, wa to assemble. You
PLease answer
A bakery sells donuts in boxes of two different quantities, X and 22. Additionally, each box requires work wi, wa to assemble. You are given an integer n and must return the minimum work set of boxes to get exactly n donuts, if n is possible; or o if it is impossible. For example if x1 = 6, C2 = 9, wj = 1, W2 = 3 and n = 18, then you should return: 3 boxes of size x1 = 6, for total work of 3. However, if n = 11, you should return 0. A coworker suggests the following greedy algorithm for this problem. Always use the box requiring minimum work. Give an example with li, W; and n values, showing this greedy algorithm failsStep 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