时间:2021-07-01 10:21:17 帮助过:34人阅读
$_t&&$high>$low) --$high;
$arr[$low]=$arr[$high];
while($arr[$low]<$_t&&$low<$high) ++$low;
$arr[$high]=$arr[$low];
}
$arr[$low]=$_t;
return $low;
}
function Qsort(&$arr,$low,$high)
{
if($low<$high)
{
$mid=Partition($arr,$low,$high);
Qsort($arr,$low,$mid-1);
Qsort($arr,$mid+1,$high);
}
}
$a=array(9,8,7,10,11,4,3,2,1);
Qsort($a,0,8);
var_dump($a);
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了快速排序Qsort,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。