1.

List obtained in third pass of selection sort for list 3, 5, 4, 1, 2 is ___________(a) 1, 2, 4, 3, 5(b) 1, 2, 3, 4, 5(c) 1, 5, 4, 3, 2(d) 3, 5, 4, 1, 2This question was posed to me in an internship interview.Asked question is from Algorithms topic in division Algorithms of Discrete Mathematics

Answer»

Correct CHOICE is (B) 1, 2, 3, 4, 5

To explain: The selection sort BEGINS with finding the least element in the list. This element is moved to FRONT and then the least element among the remaining elements. Is found and put into the second position and so on.



Discussion

No Comment Found

Related InterviewSolutions