Question: My Previous Code: #include #include using namespace std; void displayArray(int arr[], int n) { int i; for (i=0 ; i { cout } cout }

 My Previous Code: #include #include using namespace std; void displayArray(int arr[],

My Previous Code:

#include

#include

using namespace std;

void displayArray(int arr[], int n)

{

int i;

for (i=0 ; i

{

cout

}

cout

}

void bubbleSort (int array[], int size)

{

int count, i, j;

for (i=1 ; i

{

count=0;

for (j=0; j

{

if (array[j] > array[j+1])

{

int temp = array[j];

array[j] = array[j+1];

array[j+1] = temp;

count=1;

}

}

cout

displayArray (array, size);

if (count==0)

break;

}

}

int main()

{

int size=10;

int array[]={2,6,4,8,10,12,89,68,45,37};

cout

displayArray(array, size);

cout

bubbleSort(array, size);

cout

displayArray(array, size);

return 0;

}

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!