diff --git a/Algorithm/ShuffleExp.php b/Algorithm/ShuffleExp.php index 9d5ef54f70b83b8cbec43343f8d3100ff9d53259..8ca94ffd0c5f129f14d68529a3c8acc250b83831 100644 --- a/Algorithm/ShuffleExp.php +++ b/Algorithm/ShuffleExp.php @@ -92,5 +92,3 @@ class ShuffleExpRun{ $shuff = new ShuffleExpRun(100000,10,5); $shuff->ShuffleExpRun(); - -?> \ No newline at end of file diff --git a/Algorithm/SortHelper/SortHelper.php b/Algorithm/SortHelper/SortHelper.php index 23e43311667bb17d35ffc3341b867ee821c2303b..9e1eeb6b7ba870d75808fcdd9caebff6fb24327c 100644 --- a/Algorithm/SortHelper/SortHelper.php +++ b/Algorithm/SortHelper/SortHelper.php @@ -32,4 +32,3 @@ class SortHelper{ $arr[$j] = $temp; } } -?> \ No newline at end of file diff --git a/Algorithm/insertSort.php b/Algorithm/insertSort.php index f4825888742f929c865f601ab621a863ac6214c7..4ef792e4846cbc1e596648d749ea24f58743d3e9 100644 --- a/Algorithm/insertSort.php +++ b/Algorithm/insertSort.php @@ -38,6 +38,4 @@ foreach ($sortarr as $value) { } echo $str; $endtime = intval(microtime(true) * 1000); -echo '排序耗时:'.($endtime - $start).'ms'."\n"; - -?> \ No newline at end of file +echo '排序耗时:'.($endtime - $start).'ms'."\n"; \ No newline at end of file diff --git a/Algorithm/mergeSort.php b/Algorithm/mergeSort.php index 88e0b50451d4f689a0000684e4e0b4e050b85c41..6c2e17ff566730547e9bc07ec8b8467469b111a3 100644 --- a/Algorithm/mergeSort.php +++ b/Algorithm/mergeSort.php @@ -82,42 +82,6 @@ function mergeData(&$arr, $l, $mid, $r){ for($i = $l; $i <= $r; $i++){ $arr[$i] = $temparr[$i]; } - - - /** - * 写法2: - */ - /** - * 每次开辟一个新数组($aux)存放待归并的数组,方便后面进行归并使用 - */ - // $aux = []; - // for ($i = $l; $i <= $r; $i++) { - // //解决偏移量的问题 - // $aux[$i - $l] = $arr[$i]; - // } - - - // 初始化,i指向左半部分的起始索引位置l;j指向右半部分起始索引位置mid+1 - // $i = $l; - // $j = $mid + 1; - // for ($k = $l; $k <= $r; $k++) { - - // if ($i > $mid) { // 如果左半部分元素已经全部处理完毕 - // $arr[$k] = $aux[$j - $l]; - // $j++; - // }elseif($j > $r) { // 如果右半部分元素已经全部处理完毕 - // $arr[$k] = $aux[$i - $l]; - // $i++; - // }elseif($aux[$i - $l] < $aux[$j - $l]) { // 左半部分所指元素 < 右半部分所指元素 - // $arr[$k] = $aux[$i - $l]; - // $i++; - // }else{ // 左半部分所指元素 >= 右半部分所指元素 - // $arr[$k] = $aux[$j - $l]; - // $j++; - // } - // } - // print_r($arr); - // exit; } $start = microtime(true); @@ -127,6 +91,4 @@ $endtime = microtime(true); echo '排序耗时:'.($endtime - $start) .'毫秒'."\n"; for ($i=0; $i < count($arr); $i++) { echo $arr[$i].', '; -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/Algorithm/quickSort.php b/Algorithm/quickSort.php index e89d2dd12268f396a197d516d4c000d6e8a0a6cd..c140436d6da3560f262e380c5fd5660f5b5ccdd3 100644 --- a/Algorithm/quickSort.php +++ b/Algorithm/quickSort.php @@ -67,5 +67,3 @@ quickSort($arr); for ($i=0; $i < count($arr); $i++) { echo $arr[$i].', '; } - -?> \ No newline at end of file diff --git a/Algorithm/quickSort2.php b/Algorithm/quickSort2.php index f48901e2240f0ebb063d4101de80206d6055ffaf..a1dd3f7ab26342aad6c29923e7c66583f65637bc 100644 --- a/Algorithm/quickSort2.php +++ b/Algorithm/quickSort2.php @@ -86,5 +86,3 @@ quickSort($arr); for ($i=0; $i < count($arr); $i++) { echo $arr[$i].', '; } - -?> \ No newline at end of file diff --git a/Algorithm/quickSort3.php b/Algorithm/quickSort3.php index cd9d81ad9f3cdd82344382297552b1f91a4b5263..71438d11ddb78396c3acd601fc854371c20ade9f 100644 --- a/Algorithm/quickSort3.php +++ b/Algorithm/quickSort3.php @@ -62,5 +62,3 @@ quickSort($arr); for ($i=0; $i < count($arr); $i++) { echo $arr[$i].', '; } - -?> \ No newline at end of file diff --git a/Algorithm/selectSort.php b/Algorithm/selectSort.php index 9ba51c7703ac9e03ddec41ca815cb78d3fc374d3..90c68f61ac6ed6cb5f83a0a49c9dd76b3a728504 100644 --- a/Algorithm/selectSort.php +++ b/Algorithm/selectSort.php @@ -34,5 +34,4 @@ $sortarr = [100,4,5,6,7,2,44,59,67,57,45,71,82,85,98,94]; $sort_arr = selectSort($sortarr); for ($i=0; $i < count($sort_arr); $i++) { echo $sort_arr[$i].', '; -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/ArrayInfo/ArrayBase.php b/ArrayInfo/ArrayBase.php index 4cbf349ec095a4191802f34af163bad7eee60196..dcc7283db8f1a5dcbcc1723d5695fb1f8cfb58f8 100644 --- a/ArrayInfo/ArrayBase.php +++ b/ArrayInfo/ArrayBase.php @@ -233,6 +233,3 @@ class ArrayBase return $str; } } - - -