随笔 - 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 玻璃星 阅读(30) 评论(0) 推荐(0) 编辑

摘要:<?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 玻璃星 阅读(66) 评论(0) 推荐(0) 编辑

摘要:<?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 玻璃星 阅读(54) 评论(0) 推荐(0) 编辑

摘要:<?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 玻璃星 阅读(55) 评论(0) 推荐(0) 编辑

摘要:1.冒泡排序 2.选择排序 3.插入排序 4.希尔排序 5.归并排序 6.快速排序 阅读全文

posted @ 2020-11-09 10:39 玻璃星 阅读(103) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示