function quick($array){
if(count($array)<=1){
return $array;
}
$key=$array[0];
$right=array();
$left=array();
for($i=1;$i<count($array);$i++){
if($array[$i]>=$key){
$right[]=$array[$i];
}else{
$left[]=$array[$i];
}
}
$left=quick($left);
$right=quick($right);
return array_merge($left,array($key),$right);
}
$array=array(1,22,3,34,54,56,7,89989,1123,55,88);
print_r(quick($array));
转载于:https://www.cnblogs.com/wxc1/p/6114425.html