It is an algorithm that is to find maximum subarray problems. It is based on dynamic programming.
Kadane's algorithm:-In this algorithm we have to find the maximum subarray in the given array.it is based on dynamic programming and greedy.
for eg in the given array[-2,3,2,-1]. the sum is 5. It is always used brute force method but its time complexity goes n^2 but if we use dynamic programming the time complexity is n. It converts a two-dimensional array to a one-dimensional array which has the largest sum. It neglects negative numbers but is also used for negative numbers.
Submitted by Priyanshu Prakash (Priyanshu8488)
Download packets of source code on Coders Packet
Comments