COMPARATIVE STUDY OF TWO DIVIDE AND CONQUER SORTING ALGORITHMS: QUICKSORT AND MERGESORT

Autor: Oladipupo Esau Taiwo, Akande Noah Oluwatobi, Adeniyi Jide kehinde, Abikoye Oluwakemi Christianah, Kayode Anthonia Aderonke
Rok vydání: 2020
Předmět:
Zdroj: Procedia Computer Science. 171:2532-2540
ISSN: 1877-0509
DOI: 10.1016/j.procs.2020.04.274
Popis: Divide and Conquer is a well-known technique for designing algorithms. Many of the existing algorithms are a product of this popular algorithm design technique. Such include Quick sort and Merge sort sorting algorithms. These two algorithms have been widely employed for sorting, however, determining the most efficient among the two has always been a contentious issue. Most of the existing literature have compared these algorithms using machine dependent factors such as computational complexity but few have employed machine independent factors such as internal/external sorting, algorithm complexity: best, average, and worst cases, memory usage, stability etc. This study intends to contribute to this discuss using both machine dependent and independent factors. The implementation was carried out in MATLAB programming environment and the internal system clock was set to keep track of the time required for sorting. Results obtained revealed that in terms of computational speed using array of small sizes, Quick sort algorithm is faster, though Merge sort algorithm is faster with array of large sizes. Also, both algorithms are of O(nlogn) best case and average case complexity while the worst case for quicksort is O(n2) and that of merge sort remains unchanged. In terms of stability, Quick sort is stable while Merge sort is not. Despite the excellent performance of Merge sort algorithm, the need for an auxiliary memory for sorting makes it less preferable than Quick sort algorithm for applications where a good cache locality is of paramount importance.
Databáze: OpenAIRE