Horje
kadane algorithm with negative numbers included as sum Code Example
kadane algorithm with negative numbers included as sum
//Usually Kadene's algorithm is not considered for negative numbers.   
  int ms,cs;
	    ms=cs=a[0]; 
	    for(int i=1;i<n;i++)
	    {
	        cs=max(a[i],cs+a[i]);
	       ms=max(cs,ms);
	}
return ms;




Cpp

Related
even and odd in c++ Code Example even and odd in c++ Code Example
creating node in c++ Code Example creating node in c++ Code Example
how to modify 2d array in function c++ Code Example how to modify 2d array in function c++ Code Example
c++ last element of array Code Example c++ last element of array Code Example
for loop in cpp Code Example for loop in cpp Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9