The way that the array will looks like after the first swap of a bubble sort in ascending order is {5,32,41, 8,7,50,11}.
<h3>Who do you Write sort code in JAVA?</h3>
It will be:
class SSort
{
void sort(int array[])
{
int n = array.length;
for (int i = 0; i < 2; i++)
{
int minimum_index = i;
for (int j = i+1; j < n; j++)
if (array[j] < array[minimum_index])
minimum_index = j;
int temp = array[minimum_index];
array[minimum_index] = array[i];
array[i] = temp;
}
}
void printArray(int array[])
{
int n = array.length;
for (int i=0; i<n; ++i)
System.out.print(array[i]+" ");
System.out.println();
}
public static void main(String args[])
{
SSort s = new SSort();
int array[] = {41, 32, 5, 8, 7, 50, 11};
s.sort(array);
System.out.println("After first two iteration of Selection sort:");
s.printArray(array);
}
}
Therefore, The way that the array will looks like after the first swap of a bubble sort in ascending order is {5,32,41, 8,7,50,11}.
Learn more about array from
brainly.com/question/26104158
#SPJ1