算法/寻找最大值/jscript 3
外观
< 算法 | Find maximum
<script language="jscript">
function findMax(i_intAryTab,i_start,i_end) { if ( (i_end - i_start) == 1 ) { if ( i_intAryTab[i_end] > i_intAryTab[i_start] ) { return i_intAryTab[i_end]; } else { return i_intAryTab[i_start]; } // end if } // end if var intJ = (((i_end - i_start)+1)/2) - 1; var oMaxN = findMax(i_intAryTab,i_start,i_start+intJ); var oMaxM = findMax(i_intAryTab,i_start+intJ+1,i_end); if ( oMaxN > oMaxM ) { return oMaxN; } else { return oMaxM; } // end if } // end method function findMaxHandler(i_intAry) { return findMax(i_intAry,0,i_intAry.length - 1); } // end method var cc= new Array(3,6,1,9,1,1,1,12); var ii = findMaxHandler(cc); document.write(ii); </script>