Kadane's algorithm uses which of the following techniques?
Divide and conquer
Dynamic programming
Recursion
Greedy algorithm
157 practice sets · Page 4 of 8
Kadane's algorithm uses which of the following techniques?
Divide and conquer
Dynamic programming
Recursion
Greedy algorithm
Kadane's algorithm is used to find ____________
Longest increasing subsequence
Longest palindrome subsequence
Maximum sub-array sum
Longest decreasing subsequence
Which technique is used by line 7 of the above code?
Greedy
Recursion
Memoization
Overlapping subproblems
Which property is shown by line 7 of the above code?
Optimal substructure
Overlapping subproblems
Both overlapping subproblems and optimal substructure
Greedy substructure
What is the space complexity of the recursive implementation used to find the nth fibonacci term?
O(1)
O(n)
O(n^{2})
O(n^{3})
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