Consider an array containing positive and negative integers.Define contigsum(i,j) as the sum of the contiguous elements a[i] through a[j] for all array indexes i<=j.Develop a recursive procedure that determines i and j such that contigsum(i,j) is maximized.The recursion should consider the two halves of the array a.
This could very easily (and more efficiently) be done with a single loop. Your instructor will probably show you that implementation later on. The recursive solution is also pretty straight forward. Remember that contigsum(i,i) is i.