Which property is shown by the above function calls?
Memoization
Optimal substructure
Overlapping subproblems
Greedy
Browse topic-based Data Structure And Algorithm practice sets.
302 practice sets · Page 9 of 16
Which property is shown by the above function calls?
Memoization
Optimal substructure
Overlapping subproblems
Greedy
What is the time complexity of the recursive implementation used to find the nth fibonacci term?
O(1)
O(n^{2})
O(n!)
Exponential
Which line would make the implementation complete?
fibo(n) + fibo(n)
fibo(n) + fibo(n - 1)
fibo(n - 1) + fibo(n + 1)
fibo(n - 1) + fibo(n - 2)
The following sequence is a fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21,..... Which technique can be used to get the nth fibonacci term?
Recursion
Dynamic programming
A single for loop
Recursion, Dynamic Programming, For loops
Which of the following lines should be added to complete the above code?
arr[i-1][j] = min
arr[i][j-1] = min
arr[i-1][j-1] = min
arr[i][j] = min
Consider the two strings ""(empty string) and "abcd". What is the edit distance between the two strings?
0
4
2
3
Consider the strings "monday" and "tuesday". What is the edit distance between the two strings?
3
4
5
6
Suppose each edit (insert, delete, replace) has a cost of one. Then, the maximum edit distance cost between the two strings is equal to the length of the larger string.
True
False
In which of the following cases will the edit distance between two strings be zero?
When one string is a substring of another
When the lengths of the two strings are equal
When the two strings are equal
The edit distance can never be zero
Which of the following is an application of the edit distance problem?
Approximate string matching
Spelling correction
Similarity of DNA
Approximate string matching, Spelling Correction and Similarity of DNA
The edit distance satisfies the axioms of a metric when the costs are non-negative.
True
False
Which of the following methods can be used to solve the edit distance problem?
Recursion
Dynamic programming
Both dynamic programming and recursion
Greedy Algorithm
Which of the following problems should be solved using dynamic programming?
Mergesort
Binary search
Longest common subsequence
Quicksort
Which of the following problems is NOT solved using dynamic programming?
0/1 knapsack problem
Matrix chain multiplication problem
Edit distance problem
Fractional knapsack problem
When a top-down approach of dynamic programming is applied to a problem, it usually _____________
Decreases both, the time complexity and the space complexity
Decreases the time complexity and increases the space complexity
Increases the time complexity and decreases the space complexity
Increases both, the time complexity and the space complexity
In dynamic programming, the technique of storing the previously calculated values is called ___________
Saving value property
Storing value property
Memoization
Mapping
A greedy algorithm can be used to solve all the dynamic programming problems.
True
False
When dynamic programming is applied to a problem, it takes far less time as compared to other methods that don't take advantage of overlapping subproblems.
True
False
If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called _____________
Dynamic programming
Greedy
Divide and conquer
Recursion
If a problem can be broken into subproblems which are reused several times, the problem possesses ____________ property.
Overlapping subproblems
Optimal substructure
Memoization
Greedy