Which one the following inplace sorting algorithms needs the minimum number of swaps?
A
Quicksort
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
Insertion sort
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Selection sort
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
Heap sort
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is C Selection sort In selection sort, minimum number of swaps taken compared to other sorting techniques.
Number of swaps = O(n)
Number of comparisons = O(n2)
In finds the minimum of the subarray and exchanges only once in every pass.