Sorting is one of the basic algorithm that executed frequently in a program. The most popular sorting algorithm is Quick Sort because it is faster in most scenarios than other algorithms. However, pivot selection on Quick Sort algorithm is very important to avoid the worst case scenario. This study aims to test commonly used pivot selection methods (first, middle, last) and pivot selection based on central tendency of data (mean, median, mode). The data that is tested are random data (repeated), random data (permutation), sorted, reverse-sorted, and almost sorted. The size of data that is tested are 1.000, 10.000, 100.000, dan 1.000.000. The best result is achieved by selecting middle element as pivot based on the execution time of each scenario.
Copyrights © 2023