最大子树问题(The maximum-subarray problem) Introduction to Algorithms Chapter4.1
通俗的说就是在一堆有正有负的数中找出连续的一组数字,使它们的和最大。
The maximum-subarray problem is interesting only when the array contains some negative numbers. If all the array entries were nonnegative, then the maximum-subarray problem would present no challenge, since the entire array would give the greatest sum.
这是最大子树问题 Θ(nlgn) 的C语言实现代码
#include<stdio.h>
typedef struct
{
int maxLeft;
int maxRight;
int sum;
}Cross;
Cross find_max_crossing_subarray(int a[],int low,int mid,int