Which sorting algorithm is considered a comparison-based sort?

Which sorting algorithm is considered a comparison-based sort?

a) Radix Sort
b) Counting Sort
c) Quick Sort
d) Bucket Sort

Answer:

c) Quick Sort

Explanation:

Quick Sort is a comparison-based sorting algorithm, meaning it sorts elements by comparing them to one another. The efficiency of Quick Sort is based on how well the pivot element is chosen and how the partitioning step divides the list.

In contrast, non-comparison-based algorithms like Radix Sort and Counting Sort use other properties of the elements (such as their digit values or frequencies) rather than comparisons to sort them.

Comparison-based algorithms have a lower bound of O(n log n) for time complexity, which applies to sorting algorithms like Quick Sort, Merge Sort, and Heap Sort.

Reference:

DSA (Data Structures and Algorithms) MCQ Questions and Answers

Scroll to Top