Consider the following code which sort all elements of an array ‘A’ in descending order.
Which of the following will represents correct value of X, Y, Z in above code for selection sort?
a. i > 0, K > 0, a[K] > a[max]
b. i > 0, K < 0, a[K] < a[max]
c. i < 0, K > 0, a[K] > a[max]
d. i > 0, K > 0, a[K] < a[max]
Answer is a
I think answer should be d. As it is given in the question that this algorithm will sort all the element of the array in the descending order but by using option a it is aranging in ascending order.
And option D is doing what question is saying.