8,051 views
3 3 votes

Maximum Subarray Sum problem is to find the subarray with maximum sum. For example, given an array {12, -13, -5, 25, -20, 30, 10}, the maximum subarray sum is 45. The naive solution for this problem is to calculate sum of all subarrays starting with every element and return the maximum of all. We can solve this using Divide and Conquer, what will be the worst case time complexity using Divide and Conquer.

A

O(n)

B

O(nLogn)

C

O(Logn)

D O(n2)

Correct answer is B. O(nLogn) How? 

Please log in or register to answer this question.

Position:
Show:

Related questions

4 4 votes
1 1 answer
184
184 views
GO Classes asked Aug 24
184 views
Consider three recursive algorithms.Algorithm $\mathbf{1}$Divides a problem of size $N$ into two subproblems of size $N/2$ and performs constant additional work.$T_1(N)=2...
5 5 votes
1 1 answer
357
357 views
GO Classes asked Aug 6
357 views
Randomized quicksort is applied to $n$ distinct keys, where $n$ is divisible by $16$.A pivot is chosen uniformly at random.What is the probability that both recursive sub...
3 3 votes
1 1 answer
206
206 views
GO Classes asked Aug 6
206 views
Consider an array of $2n$ elements of the form:$1,2n-1,2,2n-2,3,2n-3,4,2n-4,\ldots,n,n$For example, when $n=8$:$1,15,2,14,3,13,4,12,5,11,6,10,7,9,8,8$What is the number o...
3 3 votes
1 1 answer
197
197 views
GO Classes asked Aug 6
197 views
Consider the problem of sorting an array of $n$ comparable elements in which there are only four distinct keys.It is possible to design an algorithm that makes at most $4...