GATE | GATE CS 2013 | Question 6
Which one of the following is the tightest upper bound that represents the number of swaps required to sort n numbers using selection sort?
(A) O(log n)
(B) O(n)
(C) O(nLogn)
(D) O(n^2)
Answer: (B)
Explanation: To sort elements in increasing order, selection sort always picks the maximum element from remaining unsorted array and swaps it with the last element in the remaining array. So the number of swaps, it makes in n-1 which is O(n)
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 2013 | Question 32
- GATE | GATE CS 2013 | Question 11
- GATE | GATE CS 2013 | Question 12
- GATE | GATE CS 2013 | Question 13
- GATE | GATE CS 2013 | Question 31
- GATE | GATE CS 2013 | Question 14
- GATE | GATE CS 2013 | Question 19
- GATE | GATE CS 2013 | Question 3
- GATE | GATE CS 2013 | Question 4
- GATE | GATE CS 2013 | Question 43
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 7
- GATE | GATE CS 2013 | Question 8
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 65


