Question: 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
 3(A): Write a Recurrence 3(C): Recover the Solution Now write code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!