Open In App
Related Articles

Algorithms | Sorting | Question 6

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Consider a situation where swap operation is very costly. Which of the following sorting algorithms should be preferred so that the number of swap operations are minimized in general?

(A)

Heap Sort

(B)

Selection Sort

(C)

Insertion Sort

(D)

Merge Sort



Answer: (B)

Explanation:

Selection sort makes O(n) swaps which is the minimum among all sorting algorithms mentioned above.

Hence Option(B) is the correct answer.



Quiz of this Question
Please comment below if you find anything wrong in the above post

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads