Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 ( A ) : Write a Recurrence 3 ( C ) : Recover the Solution Now write code that will also return the minimum

3(A): Write a Recurrence 3(C): Recover the Solution
Now write code that will also return the minimum number of drops along with the list of fertilizers (in order) that will achieve this minimum numberreturn 100,[11,5,4,11,1,4,11,4,5]
[19]: # test code do not edit
print(minDropsWithBudget_Solution(25,10)) # must be 2,[4,5]
print(minDropsWithBudget_Solution(25,6)) # must be 1,[5]
print(minDropsWithBudget_Solution(25,30)) # must be 5,[4,5,4,5,11]
print(minDropsWithBudget_Solution(16,30)) # must be 7,[4,5,4,4,4,4,4]
print(minDropsWithBudget_Solution(18,31)) # must be 7,[4,5,4,4,4,4,5]
print(minDropsWithBudget_Solution(22,38)) # must be 7,[4,5,4,4,4,5,11]
print(minDropsWithBudget_Solution(32,55)) # must be 11,[4,5,4,4,4,4,5,4,4,11,5]
print(minDropsWithBudget_Solution(35,60)) # must be 12,[4,5,4,4,4,4,5,4,4,11,5,5](100,[11,5,4,11,1,4,11,4,5])
(100,[11,5,4,11,1,4,11,4,5])
(100,[11,5,4,11,1,4,11,4,5])
(100,[11,5,4,11,1,4,11,4,5])
(100,[11,5,4,11,1,4,11,4,5])
(100,11,5,4,11,1,4,11,4,5)
(100,11,5,4,11,1,4,11,4,5)
(100,[11,5,4,11,1,4,11,4,5]
]:
[]:
*[17]: def minDropsWithBudget(j, D, n):
18 :
# test code do not edit
print(minDropsWithBudget(1,25,10)) # must be 2
print(minDropsWithBudget(1,25,6 # must be 1
print(minDropsWithBudget (1,25,30) # must be 5
print(minDropsWithBudget (1,16,30) # must be 7
print(minDropsWithBudget (1,18,31) # must be 7
print(minDropsWithBudget (1,22,38) # must be 7
print(minDropsWithBudget (1,32,55) # must be 11
print(minDropsWithBudget(1,35,60) # must be 12
3(B): Memoize the Recurrence
Write a memo table to memoize the recurrence. Your memo table must be of the form T[j][d] for j ranging from 1 to n and d ranging from 0 to D. You will have to handle the base cases carefully.return 121
[17]: # test code do not edit
print(minDropsWithBudget_Memoize(25,10)) # must be 2
print(minDropsWithBudget_Memoize(25,6)) # must be 1
print(minDropsWithBudget_Memoize(25,30)) # must be 5
print(minDropsWithBudget_Memoize(16,30)) # must be J
image text in transcribed

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

Step: 3

blur-text-image

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

BPR always involves automation. Group of answer choices True False

Answered: 1 week ago