-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lecture "Dynamic programming algorithms", exercise 1 #31
Comments
|
|
The dynamic programming algorithm could be written as:
The output is |
|
|
|
|
|
|
Hi, just a few comments for you to check in your solutions:
|
This issue made me think of the tables that were at the last page of copybooks at the elementary school. So at a first sight, I tried to show the binar characteristic of the muktiplication function htat takes as input two integers and a dictionary. Indeed, the multiplication is commutative, this also means that it takes just a 0 to have the result equal to zero, for example. A first attempt was naming two different tuples, i.e. tuple_x and tuple_y, but at the end I wasn't able to have a satysfing result. So I tried in another way, having two tuples named in the same way, but in which the order of the two factors switches.
|
Using a dynamic programming approach, write an extension of the multiplication function introduced in the chapter "Recursion", i.e.
def multiplication(int_1, int_2, solution_dict)
. This new function takes in input two integers to multiply and a dictionary with multiplications between numbers. The function returns the result of the multiplication and, at the same time, modifies the solution dictionary adding additional solutions when found. Accompany the implementation of the function with the appropriate test cases.The text was updated successfully, but these errors were encountered: