Question: If ray is storing 1 0 elements, what is the maximum number of swaps funSort ( ) could make in order to put the elements

If ray is storing 10 elements, what is the maximum number of swaps funSort() could make in order to put the elements in order?
public static void funSort( int[] ray )
{
for(int i=0; i< ray.length-1; i++)
{
int max = i;
for(int j = i+1; j < ray.length; j++)
{
if( ray[j]> ray[max])
max = j;
}
if( max != i){
int temp = ray[max];
ray[max]= ray[i];
ray[i]= temp;
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!