Q.

The following sorting algorithm is of divide- and-conquer type

A. Bubble sort
B. Insertion sort
C. Quick sort
D. None of the above
Answer» C. Quick sort
Explanation: Quick sort is a divide-and-conquer sorting algorithm that works by partitioning a list of items into two smaller lists and then sorting each of these lists recursively. It is an efficient and widely used algorithm, with an average case time complexity of O(n log n).

Bubble sort and insertion sort are both comparison-based sorting algorithms, but they do not use the divide-and-conquer approach. Bubble sort works by repeatedly swapping adjacent elements that are out of order, while insertion sort works by iteratively inserting each element into its correct position in the sorted list. Both of these algorithms have a time complexity of O(n^2) in the worst case.
2.2k
1
Do you find this helpful?
6

Discussion

T

Taha
3 years ago

Data structure
0