时间:2021-07-01 10:21:17 帮助过:27人阅读
冒泡
$arr = Array(23,34,12,56,43,98,89);
for($i=0;$i
for($j=0;$j
if($arr[$j]>$arr[$j+1]){
$tmp = $arr[$j];
$arr[$j] = $arr[$j+1];
$arr[$j+1] = $tmp;
}
}
}
?>
?
快速
$arr = Array(23,34,12,56,43,98,89);
for($i=0;$i
for($j=0;$j
if($arr[$j]>$arr[$j+1]){
$tmp = $arr[$j];
$arr[$j] = $arr[$j+1];
$arr[$j+1] = $tmp;
}
}
}
?>