Quiz 3 - Dynamic Programming Flashcards

1
Q

What are the major required aspects in a problem in order to apply Dynamic Programming Technique?

  • Whether a problem can be divided or not
  • Be able to solve using top down and bottom up approach
  • Optimal Substructure and Overlapping subproblems
  • Base case to stop recurrence
A
  • Optimal Substructure and Overlapping subproblems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In which of the following approaches we start with the base case and proceed to solve the bigger subproblems?

A

Bottom-Up Approach

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In dynamic programming, the technique of storing the previously calculated values is called what?

A

Memoization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The difference between Divide and Conquer Approach and Dynamic Programming is?

  • Use of recurrence formula
  • The base case
  • The way we divide the sub-problems
  • Whether the sub-problems overlap or not
A
  • Whether the sub-problems overlap or not
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A binary search algorithm searches for a target value within a sorted array. Binary search compares the target value to the middle element of the array; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until the target value is found or until a search can no longer be performed. This problem can be solved using which of the techniques?

  • Dynamic Programming
  • None of the options
  • Any of the two techniques
  • Divide and Conquer
A
  • Divide and Conquer

there are repeatable subproblems, but not Dynamic Programming because there are no overlapping sub-problems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In the Longest Common Subsequence problem assume we are comparing two strings of lengths m and n. In the bottom-up approach the solution we build a 2-Dimensional array called Cache[m][n]. The final solution was obtained by accessing which element of the cache?

give the location of the element in the 2d array.

A

The element in the bottom right corner of the cache[m][n]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In
[ Select ]
we start with the base case and build the solution starting from base case. In
[ Select ]
we start solving the the bigger problem proceed towards the base case.

A

bottom-up

top-down

How well did you know this?
1
Not at all
2
3
4
5
Perfectly