php代码
<?php $i = 100;
while($i > 0){
if($i > 30){
$test[] = mt_rand($i - 30, $i--);
}else{
$test[] = mt_rand(1, $i--);
}
}
//shuffle($test);
echo count($test), "\n";
//sort($test);
echo implode(", ", $test), "\n\n";
$t1 = microtime(true);
quicksort($test);
echo implode(", ", $test), "\n\n";
echo microtime(true) - $t1, "<br>\n";
function quicksort(array &$sort){
$end = count($sort);
if(--$end $o){
while($i $beg){
$end = $i; // 继续左边
}elseif($stack){
// 返回继续右边
$end = array_pop($stack);
$beg = array_pop($stack);
}else{
break;
}
}
}
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










