Dynamic Programming

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What are the two properties need for a dynamic programming solution to be efficient?

Optimal substructure property Overlapping Sub-problems property

What are the 7 matrices defined in Strassens algorithm?

P1 = A11(B12 - B22) P2 = (A11 + A12)B22 P3 = (A21 + A22) B11 P4 = A22(B21 - B11) P5 = (A11 + A22)(B11 + B22) P6 = (A12 - A22)(B21 + B22) P7 = (A11 - A21)(B11 + B12)

What is dynamic programming?

Stores the solutions to smaller instances of a problem in an array or table so that they can be easily accessed when solving a bigger problem. Useful when the solution to a given problem uses the same sub-problems multiple times

What is tabulation?

A bottom-up strategy, start with the base-case then build our solution up step by step until we have calculated the main problem

What is memoization?

A top-down strategy, we start from the desired problem and recursively work backwards, filling in the smaller problems as needed

What is Strassen's algorithm?

A trick that allows a 4x4 matrix C, calculated by the product of two 4x4 matrices A and B, to be calculating using 7 matrix products instead of 8

What is Karatsuba multiplication?

Karatsuba reduces the cost of multiplication by converting it into sum of numbers. Karatsuba recursively breaks down two integers into 4 integers, bottom and upper. Then, karatsuba calls itself again for the product of the two upper and bottom integers, A and B. Karatsuba then calls itself for the product of (upper 1 + upper 2) + (bottom1 + bottom2), C. With the three products, we then add A

What is a sub-sequence of a string?

Let u and v be strings. The u is a sub-sequence of v if one can obtain u by deleting zero or more symbols from v while keeping the order of the remaining symbols the same

Which problems can dynamic programming be applied to?

To optimization problems, this strategy can succeed where greedy algorithms fail


Ensembles d'études connexes

OSHA 205 Final (29 CFR 1903. 1904, 1910)

View Set

Lipid Lower Agents - CH 47 PrepU

View Set

Chapter 3: Expansion and Diversity: The Rise of Colonial America

View Set

AP GOV Three Branches Chap 6,7,8,9

View Set

Project Development & Documentation 2

View Set

Deliver the Right Message With Text Ads: module 4

View Set