标签:pop order ret boolean min stat public false mic
public static mark dynway( ) //put or pop the books into the basket,mark the highest recorder
{
int Sum,Max;
int lom = -1;
int him = -1;
boolean star = true;
Sum = Max =0;
for(int j = 0;j < array.length;j++)
{
Sum += array[j];
if(Sum > Max){
Max = Sum;
if(star == true){
lom = j;
him = j;
star = false;
}
else{
him = j;
}
}
else if(Sum < 0){
Sum = 0;
star = true;}
}
return new mark(lom,him,Max);
}
dynamic programming:find max subarray
标签:pop order ret boolean min stat public false mic
原文地址:http://www.cnblogs.com/wujunde/p/6934864.html