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
When are numbered lists generally used?
laiz [17]
<span>C. when listing items that have an order of priority </span>
4 0
3 years ago
Read 2 more answers
Can you list one property of each of the following?<br> Excel<br> Word<br> Powerpoint
Rudiy27
Exel is used for graphing, Word for any type of essay or paper, and Powerpoint for presentations.
Hope this helps!
4 0
3 years ago
Read 2 more answers
How do I cancel my membership or Subscription on here
timurjin [86]

Answer:

You don't

Explanation:

7 0
3 years ago
All of the language commands that the CPU understand make up the CPU's
disa [49]
I think assembly level command mov ,push ,call
5 0
3 years ago
How do you enter the command prompt on Chromebook
Step2247 [10]

1) Go through the standard Chrome OS login screen (you'll need to setup a network, etc) and get to the web browser. It's OK if you login as guest.

2) Press [ Ctrl ] [ Alt ] [ T ] to get the crosh shell.

3) Use the shell command to get the shell prompt.

3 0
3 years ago
Other questions:
  • What is your understanding of the difference between a stream cipher and a block cipher?
    14·1 answer
  • To move from layout view to form view, tap or click the _____ button on the access status bar.
    15·1 answer
  • Discuss anomaly detection.
    5·1 answer
  • A Windows user has been successfully saving documents to the file server all morning. However, the latest attempt resulted in th
    9·2 answers
  • Microsoft's
    8·1 answer
  • Graphic software task​
    7·1 answer
  • Questions Presscomion
    9·1 answer
  • How does a Cloud-first strategy approach a client's migration to the Cloud?
    11·1 answer
  • Part of metacognition involves making a plan to address <br> .
    9·2 answers
  • Write a program that estimates how many years, months, weeks, days, and hours have gone by since Jan 1 1970 by calculations with
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!