Recent questions tagged dynamic-programming

2 2 votes
1 1 answer
122
122 views
True or False:In every dynamic-programming solution, the asymptotic space requirement must be at least as large as the total number of distinct subproblems.True False
2 2 votes
1 1 answer
83
83 views
0 0 votes
1 1 answer
67
67 views
An instance of Subset Sum contains:$n$ positive integersa positive target value $m$What is the running time of the standard dynamic-programming solution?$\Theta(m+n)$ $\T...
1 1 vote
1 1 answer
79
79 views
There is an unlimited supply of three item types:$$\begin{array}{|c|cc|}\hline\text{Item} & \text{Size} & \text{Value} \\\hlineA & 1 & 2 \\B & 2 & 6 \\C & 3 & 9 \\\hline\...
0 0 votes
1 1 answer
79
79 views
The following function $\texttt{CalcEditDistance}$ computes the edit distance between two strings.For this problem:Inserting one character has cost $1$.Deleting one chara...
0 0 votes
1 1 answer
122
122 views
For an array, $a ,a ,\ldots,a[n]$ consider the proposed DP state:$LIS[i]=$ length of the longest increasing subsequence contained anywhere within $a[1\ldots i]$.Using onl...
2 2 votes
1 1 answer
150
150 views
A $15$ kg knapsack is given with the following items:$$\begin{array}{|c|cc|}\hline\text{Item} & \text{Weight} & \text{Value} \\\hlineA & 2 & 7 \\B & 3 & 10 \\C & 5 & 18 \...
1 1 vote
1 1 answer
88
88 views
Consider four matrices whose dimension array is:$p=[5,2,2,4,6]$Thus:$A_1:5\times2$$A_2:2\times2$$A_3:2\times4$$A_4:4\times6$Using optimal matrix-chain multiplication, wha...
2 2 votes
1 1 answer
70
70 views
Consider the following statements.Dynamic programming generally solves smaller subproblems, stores their solutions, and combines those stored results to solve progressive...
0 0 votes
1 1 answer
130
130 views
Match the LIST-I with LIST-IILIST-ILIST-IIA.Dynamic programmingI.Floyd Warshall Shortest pathB.GreedyII.Huffman codingC.Back trackingIII.Hamiltonian cycle problemD.Branch...
9 9 votes
2 2 answers
1.1k
1.1k views
Consider a table $T$, where the elements $T[i][j], 0 \leq i, j \leq n$, represent the cost of the optimal solutions of different subproblems of a problem that is being so...
1 1 vote
2 2 answers
498
498 views
The longest common subsequence of $\{1,2,3,2,4,1,2\}$ and $\{2,4,3,1,2,1\}$ is$2,1,2,3$$1,3,2,1$$2,3,2,1$$2,3,1,2,1$
0 0 votes
1 1 answer
625
625 views
When developing a dynamic programming algorithm, the sequence of steps followed is:Construct an optimal solution from computed information.Recursively define the value of...
0 0 votes
1 1 answer
465
465 views
Arrange the following steps in the correct order to solve the Knapsack problem using Dynamic Programming.Define the base case when the capacity is zero ($0$) or no items ...
1 1 vote
1 1 answer
189
189 views
Which of the following problems is solved using dynamic programming?Merge sortDepth-first searchBreadth-first searchFibonacci sequence calculation
0 0 votes
1 1 answer
294
294 views
A subsequence of an array $A$ is any sub-array of $A$, obtained by deleting zero or more elements of $A$ without changing the order of the remaining elements. The input t...
0 0 votes
0 0 answers
275
275 views
The input to the problem consists of (i) an array $A[1,2, \ldots, n]$ of $n$ positive integers and (ii) a positive integer $T$. We are given the guarantee that at least o...