Displaying posts tagged: quicksort

Quicksort.

No Comments
Here is a quick look at quick sort. // Pre: valid array // Post: returns an array sorted with the quick sort algorithm function quick_sort($values = array()) { if(count($values) $pivot) { $greater[] = $values[$j]; } else { $less[] = $values[$j]; } } return array_merge(quick_sort($less), array($pivot), quick_sort($greater)); }