1.

Which of the following is the biggest advantage of selection sort?(a) its has low time complexity(b) it has low space complexity(c) it is easy to implement(d) it requires only n swaps under any conditionThis question was posed to me in an online quiz.This key question is from Recursion topic in chapter Recursion of Data Structures & Algorithms II

Answer»

The correct option is (d) it requires only n swaps under any condition

For explanation: Selection SORT WORKS by obtaining least value ELEMENT in each iteration and then swapping it with the current index. So it will take n swaps under any condition which will be USEFUL when memory write operation is expensive.



Discussion

No Comment Found

Related InterviewSolutions