Question: In Problem 6 . 2 you wrote a recursive function for the numbers game. def numGame ( numList ) : ' ' ' takes a
In Problem you wrote a recursive function for the numbers game.
def numGamenumList:
takes a list of numbers called numList as input and returns the maximum score possible choosing numbers from this list but without choosing two adjacent numbers. The order of the numList is arbitrary you can't make any assumptions about the order.
Your task now is to memoize that function.
Your new function, called memoNumGamenumList memo will take as input both a tuple of numbers and a memo dictionary.
When you run this program, you'll pass it in a list of numbers and an initially empty dictionary as shown below:
memoNumGame
T
memoNumGameT
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
