ISRO Computer Science (CSE) 2008 - Question 77

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2008

How many comparisons are needed to sort an array of length 5 if a straight selection sort is used and array is already in the opposite order?

  • A. 1
  • B. 10
  • C. 15
  • D. 20

Answer: B. 10

Explanation: Selection sort comparisons are n(n-1)/2 regardless of order. 5*4/2 = 10.

| | All questions of ISRO Computer Science (CSE) 2008