Quicksort
Quicksort works by selecting a ‘pivot-value’. Once selected the array is divided into 2 subarrays, with one containing the values lower than the pivot-value, and the other containing those greater than the pivot value. The 2 subarrays are then recursively sorted using Quicksort (until you are dealing with arrays of size <2). Choosing an appropriate pivot-value is therefore essential – for your algorithm find the median of the first, middle and last elements of the array and use that as your pivot value.
การแปล กรุณารอสักครู่..
