Find the maximum sub-array sum for the following array: {3, 6, 7, 9, 3, 8}
33
36
23
26
8 practice sets · Page 1 of 1
Find the maximum sub-array sum for the following array: {3, 6, 7, 9, 3, 8}
33
36
23
26
Which method is used by line 4 of the above code snippet?
Divide and conquer
Recursion
Both memoization and divide and conquer
Memoization
What is the space complexity of the divide and conquer algorithm used to find the maximum sub-array sum?
O(n)
O(1)
O(n!)
O(n^{2})
What is the time complexity of the divide and conquer algorithm used to find the maximum sub-array sum?
O(n)
O(logn)
O(nlogn)
O(n^{2})
Which line should be inserted to complete the above code?
(tmp_max = cur_max)
break
continue
(cur_max = tmp_max)
Find the maximum sub-array sum for the given elements. {-2, -1, -3, -4, -1, -2, -1, -5, -4}
-3
5
3
-1
Find the maximum sub-array sum for the given elements. {2, -1, 3, -4, 1, -2, -1, 5, -4}
3
5
8
6
Given a one-dimensional array of integers, you have to find a sub-array with maximum sum. This is the maximum sub-array sum problem. Which of these methods can be used to solve the problem?
Dynamic programming
Two for loops (naive method)
Divide and conquer
Dynamic programming, naïve method and Divide and conquer methods