时间:2021-07-01 10:21:17 帮助过:17人阅读
?
?function bin_sch($array,$low,$heigh,$k){
??if($low <= $heigh){
???$mid = intval(($low + $heigh)/2);
???
???if($array[$mid] == $k){
????return true;
???}else if($k <$array[$mid]){
????return bin_sch($array, $low, $mid-1, $k);
???}else {
????return bin_sch($array, $mid+1, $heigh, $k);
???}
??}
?}
?>