PHP simple implementation of fast sorting method, PHP implementation sort
In this paper, we describe the simple implementation of PHP fast sorting method. Share to everyone for your reference. The implementation method is as follows:
function Quicksort ($SEQ) {if (!count ($SEQ)) return $seq; $k = $seq [0]; $x = $y = Array (); for ($i =count ($SEQ);--$i;) { if ($seq [$i] <= $k) { $x [] = $seq [$i]; } else { $y [] = $seq [$i]; }} return Array_merge (Quicksort ($x), Array ($k), quicksort ($y));}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/979037.html www.bkjia.com true http://www.bkjia.com/PHPjc/979037.html techarticle PHP Simple implementation of a quick sorting method, PHP implementation of the Order of this article describes the simple implementation of PHP fast sorting method. Share to everyone for your reference. The concrete implementation method is as follows: Func ...