請問這個程式要怎麼改? |
尚未結案
|
bluemoon1311
一般會員 發表:3 回覆:0 積分:0 註冊:2004-10-21 發送簡訊給我 |
/** * Linear-time maximum contigous subsequence sum algorithm. */ public static int maxSubSum4( int [ ] a ) { /* 1*/ int maxSum = 0, thisSum = 0; /* 2*/ for( int j = 0; j < a.length; j ) { /* 3*/ thisSum = a[ j ]; /* 4*/ if( thisSum > maxSum ) /* 5*/ maxSum = thisSum; /* 6*/ else if( thisSum < 0 ) /* 7*/ thisSum = 0; } /* 8*/ return maxSum; }請問要怎麼把以上的程式改成能print最大值是什麼?以及它的範圍又是如何? 以及如何將infix轉換成postifix |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |