Chapter 13.5 Dynamic Programming

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

What does sharing of subproblems mean in the context of dynamic programming?

A bottleneck that prevents one from dividing the problem into completely independent subproblems (as one would need to do to apply the divide-and-conquer technique)

Define Subproblem Optimality

A condition wherein it is possible to characterize an optimal solution to a particular subproblem in terms of optimal solutions to its subproblems. An optimal solution to the global problem must be a composition of optimal subproblem solutions.

Define what is meant by simple subproblems in the context of dynamic programming

A way to parameterize subproblems with just a few indices, like i, j, k, and so on.

Cij = *Encyclopedia Definition*

Cij = ai1b1j + ai2b2j + ... + ainbnj = 𝝨aikbkj from k = 1 to n

What does the Matrix-Chain Product problem determine?

Determines the optimal paranthesization of the expression defining the product A that minimizes the total number of scalar multiplications performed.

Define Longest Common Subsequence (LCS) problem

In this problem, we are given two character strings, X = x0 x1 x2 · · · xn−1 and Y = y 0 y1 y2 · · · ym−1 , over some alphabet (such as the alphabet {A,C, G, T } common in computational genomics) and are asked to find a longest string S that is a subsequence of both X and Y .

What is the role of optimization in dynamic programming?

It is its goal

What is one way to solve the LCS problem?

One way to solve the longest common subsequence problem is to enumerate all subsequences of X and take the largest one that is also a subsequence of Y . Since each character of X is either in or not in a subsequence, there are potentially 2n different subsequences of X , each of which requires O(m) time to determine whether it is a subsequence of Y . Thus, this brute-force approach yields an exponential-time algorithm that runs in O(2n m) time, which is very inefficient.

Define what is meant by subproblem overlap in the context of dynamic programming

Optimal solutions to unrelated subproblems can contain subproblems in common.

True or False: Dynamic Programming can be used to produce polynomial-time algorithms to solve problems that seem to require exponential time.

True

True or False: Matrix multiplication is associative

True. B * (C * D) = (B * C) * D

There are __________ number of ways to parenthesize an associative arithmetic expression.

an exponential number of ways

Given a string X = x0 x1 x2 · · · xn−1 , a subsequence of X is:

any string that is of the form xi1 xi 2 · · · xik , where i j < i j+1 ; that is, it is a sequence of characters that are not necessarily contiguous but are nevertheless taken in order from X . For example, the string AAAG is a subsequence of the string CGAT AAT T GAGA.

Suppose we are given a collection of n two-dimensional matrices for which we wish to compute the mathematical product A = A0 · A1 · A2 · · · An−1 , where A i is a di × di+1 matrix, for i = 0, 1, 2, . . . , n − 1. the original matrix chain-product problem can be characterized as that of computing the value of ______. *Textbook question*

as that of computing the value of N0,n−1 (N sub 0, sub n - 1)

For matrix multiplication, the number of _______ in the first matrix must be equal to the number of _______ in the second matrix.

columns in the first matrix equal to the number of rows in the second matrix

We can apply the dynamic programming technique to problems that have the following properties:

1. Simple subproblems 2. Subproblem optimization 3. Subproblem overlap

If A is an m × n matrix and B is an n × p matrix, the matrix product C = AB (denoted without multiplication signs or dots) is defined to be the ____ × ___ matrix *Encyclopedia Definition*

is defined to be the m × p matrix

Let B be a 2 × 10-matrix, let C be a 10 × 50-matrix, and let D be a 50 × 20-matrix. Computing B · (C · D) requires ________ multiplications. Conversely, computing B * (C * D) requires __________ multiplications.

requires 2 * 10 * 20 + 10 * 50 * 20 = 10,400 multiplications. requires 2 * 10 * 50 + 2 * 50 * 20 = 3,000 multiplications


Ensembles d'études connexes

NCO DLC SET 2 Leadership and Management

View Set

Microsoft Exam 70-480 (HTML5, CSS3, Javascript)

View Set

English Pt. 2 Literary Terms or Rhetorical Devices

View Set