Consider the following list of element: 13, 8, 24, 1, 5, 30, 98, 7.
What will be the output of the third pass if the selection sort is applied?
(A) 1, 8, 13, 24, 5, 30, 98, 7
(B) 8, 13 ,24, 1, 5, 30, 98, 7
(C) 8, 1, 5, 13, 24, 30, 98, 7
(D) 1, 7, 8, 13, 5, 30, 98, 24


Answer: (D)

Explanation: Fourth pass of insertion sort: 1, 8, 13, 24, 5, 30, 98, 7
Third pass of insertion sort: 8, 13 ,24, 1, 5, 30, 98, 7
Third pass of bubble sort: 8, 1, 5, 13, 24, 30, 98, 7
Third pass of selection sort: 1, 7, 8, 13, 5, 30, 98, 24

So, option (D) is correct.

Quiz of this Question


  • Last Updated : 21 Dec, 2018

Share your thoughts in the comments