in Algorithms
267 views
0 votes
0 votes
Given a sequence of n real numbers a1,a2,a3,a4…………...an then to find contiguous subsequence Ai,Ai+1,…...Aj.such that its sum is maximum.

How much time the above problem will take if you dynamic program?
in Algorithms
267 views

3 Comments

O(n^2)??
0
0

It can be done in O(n) time by using Kadane's algorithm.

https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/

0
0
O(n)
0
0

Please log in or register to answer this question.

Related questions