Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago