Answered step by step
Verified Expert Solution
Link Copied!

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 answerimage text in transcribed

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 fails

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

consider your role and influences as a researcher;

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago