Added maximum subarray algorithm