
The following example Simple Program ‘quick sort’. Its sequence is to convert data between the position to greater than x with the data between positions to smaller than x. This pivot j should be placed so that the data between positions to smaller than x, while to greater than x.

Ordering is based on the principle of recursion. Baca juga: Pengertian algoritma komputer Bagaimana quick sort bekerja. Ini akan terasa jika anda mengurutkan bilangan yang sangat banyak. log disini menggunakan basis 2, Dibandingkan dengan insertion sort, selection sort, dan bubble sort algoritma quick sort harusnya memiliki kecepatan yang lebih cepat. Apply quicksort algorithm recursively to the left and the right parts.Quick sort a sequencing techniques that are similar to merge sort, use “divide and conquer”. Quick sort memiliki kompleksitas O(n log n). Notice, that array may be divided in non-equal parts. Values equal to the pivot can stay in any part of the array. Rearrange elements in such a way, that all elements which are lesser than the pivot go to the left part of the array and all elements greater than the pivot, go to the right part of the array. We take the value of the middle element as pivot value, but it can be any value, which is in range of sorted values, even if it doesn't present in the array. AlgorithmThe divide-and-conquer strategy is used in quicksort. The idea of the algorithm is quite simple and once you realize it, you can write quicksort as fast as bubble sort.



On the average, it has O(n log n) complexity, making quicksort suitable for sorting big data volumes. Quicksort is a fast sorting algorithm, which is used not only for educational purposes, but widely applied in practice. Procedure quicksort(var A:larik aw,ak:integer) Writeln ( 'Hasil data yang telah diurutkan:') Writeln (' PENGURUTAN DENGAN METODE QUICK SORT')
