分治法策略解决最大子数组问题

问题描述Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4]the contiguous subarray [4,−1,2,1] has the largest sum = 6.问题来自于Leetcode:Maximum Subarra解决方式利用分治策略来解决最大子数组问题时间复杂度O(nlgn程序范例[code lang="cpp"#include <iostr#include <cstdusing namespace std;int find_max_crossing_subarray(int* a, int... Read More