1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
likoan [24]
3 years ago
15

Andy is trying to put together a holiday gift knapsack (with W=8) for Sarah. He has n items to choose from, each with infinitely

many copies (aka. knapsack with repetitions). Item i has weight wi, and value vi. Andy wants to pick some items (possibility with duplicates) so their total weight is exactly W, while minimizing the total value of the items picked. If OPT(w) denotes the minimum total value needed to make a weight of w, for every 0 ≤ w ≤ W, (i) write the recursive formula for finding OPT(w) and (ii) compute the values of OPT(1) . . . OPT(8) for the following three items: (w1 = 1, v1 = 3), (w2 = 3, v2 = 2), (w3 = 4, v3 = 3).
Computers and Technology
1 answer:
Sever21 [200]3 years ago
3 0

Answer:

See explaination

Explanation:

Given 3 items: {w1 = 1, v1 = 3}, {w2 = 3, v2 = 2}, {w3 = 4, v3 = 3}

Hence OPT(1) = 3, OPT(3) = 2, OPT(4) = 3

Recursive formula for OPT(k) to minimize value is

OPT(k) = INFINITE if k <= 0

= min(3 + OPT(k-1), 2 + OPT(k-3), 3 + OPT(k-4))

Let us calculate OPT(1) to OPT(8)

OPT(1) = 3

OPT(2) = min ( 3 + OPT(1), 2 + OPT(-1), 3 + OPT(-2)) = 6

OPT(3) = 2

OPT(4) = 3

OPT(5) = min ( 3 + OPT(4), 2 + OPT(2), 3 + OPT(1)) = min(6, 8, 6) = 6

OPT(6) = min ( 3 + OPT(5), 2 + OPT(3), 3 + OPT(2)) = min(9, 4, 9) = 4

OPT(7) = min ( 3 + OPT(6), 2 + OPT(4), 3 + OPT(3)) = min(7, 5, 5) = 5

OPT(8) = min ( 3 + OPT(7), 2 + OPT(5), 3 + OPT(4)) = min(8, 8, 6) = 6

You might be interested in
A(n) ________ is a chart based on PivotTable data.
Mrrafil [7]
Well since it’s a chart based on a PivotTable prettyyyy sure it’s gonna be a PibltChart
7 0
2 years ago
Green Fields Landscaping Company sells evergreen trees which are priced by height. Customers have a choice of purchasing a tree
Tomtit [17]

Answer:

Answered below

Explanation:

//Program is written in Python programming //language.

number_of_trees = int(input ("Enter number of trees purchased: "))

height_of_trees = float(input("Enter height of trees: "))

delivery_status = input("Do you want trees delivered? enter yes or no ")

price_of_two_meters = 20

total_price = number_of_trees * price_of_two_meters

//Invoice

print (number_of_trees)

print(height_of_trees)

print (total_price)

print (delivery_status)

8 0
3 years ago
What is SEO?<br> Training Live Online Instructor-Led Learning, https://www.peoplentech.com.bd/<br> ,
evablogger [386]

Answer:Search engine optimization (SEO) is the process of optimizing your online content so that a search engine likes to show it as a top result for searches of a certain keyword. ... When it comes to SEO, there's you, the search engine, and the searcher.

Explanation:

4 0
2 years ago
Plz help!!!!!!!!!!!!!!!!111
Y_Kistochka [10]

This question stuns me. Not sure which answer it is, but my best choice right now is probably the one you have selected in the image. A line graph would show the rate of plant growth over the course of a certain amount of days, resulting in which had the highest rates within that period. Might be wrong, but I hope you do well.

4 0
2 years ago
How does 6ix9ine like it in jail with him rapping about soap slippy uh he finna d1c me uh b00ti3 feeling iffy uh? (&lt;~&gt;) /
Sindrei [870]
Um what the heckleberries
4 0
3 years ago
Read 2 more answers
Other questions:
  • My 2 in 1 laptop/tablet
    13·1 answer
  • When presentations are being shown to an audience of over fifty people, how they should be displayed?
    5·2 answers
  • You’re creating a table for one of your slides, and need to make some modifications to your table structure. Which of the follow
    6·2 answers
  • Write the definition of a method printDottedLine, which has no parameters and doesn't return anything. The method prints to stan
    12·1 answer
  • Which of these is an example of input?
    6·1 answer
  • The hostel in which you plan to spend the night tonight offers very interesting rates, as long as you do not arrive too late. Ho
    5·1 answer
  • Double clicking the top right corner of a document will
    12·1 answer
  • Mention and explain various alignment options​
    9·1 answer
  • B. WAP to check whether input number is palindrome number or not using SUB...... END SUB.​
    15·1 answer
  • The name for the instructions you write to a computer in a program
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!