摘要:<?php function quick_sort($arr) { $count = count($arr); if ($count <= 1) { return $arr; } $left = []; $right = []; for($i=1;$i<$count;$i++){ if($arr[$
阅读全文
posted @ 2020-11-16 15:24
随笔 - 40, 文章 - 0, 评论 - 0, 阅读 -
3584
|
|
随笔分类 - 算法
摘要:<?php function quick_sort($arr) { $count = count($arr); if ($count <= 1) { return $arr; } $left = []; $right = []; for($i=1;$i<$count;$i++){ if($arr[$
阅读全文
posted @ 2020-11-16 15:24
摘要:<?php function insertion_sort(&$arr){ $count = count($arr); for($i=0;$i<$count-1;$i++){ for($j=$i+1;$j<$count;$j++){ if($arr[$j]<$arr[$i]){ $arr[$i] =
阅读全文
posted @ 2020-11-10 11:37
摘要:<?php function bubble_sort(&$arr){ $count = count($arr); for($i=0;$i<$count-1;$i++){ for($j=$i+1;$j<$count;$j++){ if($arr[$j]<$arr[$i]){ $arr[$i] = $a
阅读全文
posted @ 2020-11-09 19:58
摘要:<?php function selection_sort(&$arr){ $count = count($arr); for($i=0;$i<$count-1;$i++){ $temp = $i; for($j=$i+1;$j<$count;$j++){ if($arr[$j]<$arr[$tem
阅读全文
posted @ 2020-11-09 19:32
摘要:1.冒泡排序 2.选择排序 3.插入排序 4.希尔排序 5.归并排序 6.快速排序
阅读全文
posted @ 2020-11-09 10:39
|
|