Recursive Selection Sort Multiple choice Questions and Answers (MCQs)
Click on any option to know the CORRECT ANSWERS
Which of the following sorting algorithm has best case time complexity of O(n2)?
Question 1 Explanation:
Selection sort is not an adaptive sorting algorithm. It finds the index of minimum element in each iteration even if the given array is already sorted. Thus its best case time complexity becomes O(n2).
Which of the following is the biggest advantage of selection sort?
its has low time complexity
it has low space complexity
it is easy to implement
it requires only n swaps under any condition
Question 2 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.
What will be the recurrence relation of the code of recursive selection sort?
T(n) = 2T(n/2) + n
T(n) = 2T(n/2) + c
T(n) = T(n-1) + n
T(n) = T(n-1) + c
Question 3 Explanation:
Function to find the minimum element index takes n time.The recursive call is made to one less element than in the previous call so the overall recurrence relation becomes T(n) = T(n-1) + n.
Which of the following sorting algorithm is NOT stable?
Question 4 Explanation:
Out of the given options selection sort is the only algorithm which is not stable. It is because the order of identical elements in sorted output may be different from input array.
What will be the best case time complexity of recursive selection sort?
O(n log n)
Question 5 Explanation:
Selection sort's algorithm is such that it finds the index of minimum element in each iteration even if the given array is already sorted. Thus its best case time complexity becomes O(n2).
There are 5 questions to complete.