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[], 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started