8886781233
17368915236
#include
#include
int main() {
int i, n, *data , p;
/* get the number of inputs from the user */
printf("Enter the number of inputs:");
scanf("%d", &n);
/* dynamically allocate memory to store i/p values */
data = (int *) malloc(sizeof(int) * n);
/* get the input data from the user */
for (i = 0; i < n; i++) {
printf("data[%d]: ", i);
scanf("%d", &data[i]);
}
/* sorts the given numbers */
bubbleSort(data, n ,p );
}
void bubbleSort(int *data, int n , int p) {
int i, temp, k = 1, l,j;
if (n > 0) {
for (i = n; i > 0; i--) {
if (data[i] > data[i - 1])
{
temp = data[i];
data[i] = data[i - 1];
data[i - 1] = temp;
}
if( p = = 0)
{
p++;
l = n;
for ( i = 0 ; i < n ; i++)
{
prinft ( %d, data[i])
}
bubbleSort(data, i - 2 , p );
}
else
{
for ( j = n - 1 ; j < l ; j++)
{
if (data[j] > data[j - 1])
{
temp = data[j];
data[j] = data[j - 1];
data[j - 1] = temp;
}
}
for ( j = 0 ; j < l ; j++)
{
prinft ( %d, data[j])
}
bubbleSort(data, i - 2,p);
}
}
}
return;
}
Solution
8886781233
17368915236
#include
#include
int main() {
int i, n, *data , p;
/* get the number of inputs from the user */
printf("Enter the number of inputs:");
scanf("%d", &n);
/* dynamically allocate memory to store i/p values */
data = (int *) malloc(sizeof(int) * n);
/* get the input data from the user */
for (i = 0; i < n; i++) {
printf("data[%d]: ", i);
scanf("%d", &data[i]);
}
/* sorts the given numbers */
bubbleSort(data, n ,p );
}
void bubbleSort(int *data, int n , int p) {
int i, temp, k = 1, l,j;
if (n > 0) {
for (i = n; i > 0; i--) {
if (data[i] > data[i - 1])
{
temp = data[i];
data[i] = data[i - 1];
data[i - 1] = temp;
}
if( p = = 0)
{
p++;
l = n;
for ( i = 0 ; i < n ; i++)
{
prinft ( %d, data[i])
}
bubbleSort(data, i - 2 , p );
}
else
{
for ( j = n - 1 ; j < l ; j++)
{
if (data[j] > data[j - 1])
{
temp = data[j];
data[j] = data[j - 1];
data[j - 1] = temp;
}
}
for ( j = 0 ; j < l ; j++)
{
prinft ( %d, data[j])
}
bubbleSort(data, i - 2,p);
}
}
}
return;
}

888678123317368915236 #include stdio.h #include stdlib.h.pdf

  • 1.
    8886781233 17368915236 #include #include int main() { inti, n, *data , p; /* get the number of inputs from the user */ printf("Enter the number of inputs:"); scanf("%d", &n); /* dynamically allocate memory to store i/p values */ data = (int *) malloc(sizeof(int) * n); /* get the input data from the user */ for (i = 0; i < n; i++) { printf("data[%d]: ", i); scanf("%d", &data[i]); } /* sorts the given numbers */ bubbleSort(data, n ,p ); } void bubbleSort(int *data, int n , int p) { int i, temp, k = 1, l,j; if (n > 0) { for (i = n; i > 0; i--) { if (data[i] > data[i - 1]) { temp = data[i]; data[i] = data[i - 1]; data[i - 1] = temp; } if( p = = 0) { p++;
  • 2.
    l = n; for( i = 0 ; i < n ; i++) { prinft ( %d, data[i]) } bubbleSort(data, i - 2 , p ); } else { for ( j = n - 1 ; j < l ; j++) { if (data[j] > data[j - 1]) { temp = data[j]; data[j] = data[j - 1]; data[j - 1] = temp; } } for ( j = 0 ; j < l ; j++) { prinft ( %d, data[j]) } bubbleSort(data, i - 2,p); } } } return; } Solution 8886781233
  • 3.
    17368915236 #include #include int main() { inti, n, *data , p; /* get the number of inputs from the user */ printf("Enter the number of inputs:"); scanf("%d", &n); /* dynamically allocate memory to store i/p values */ data = (int *) malloc(sizeof(int) * n); /* get the input data from the user */ for (i = 0; i < n; i++) { printf("data[%d]: ", i); scanf("%d", &data[i]); } /* sorts the given numbers */ bubbleSort(data, n ,p ); } void bubbleSort(int *data, int n , int p) { int i, temp, k = 1, l,j; if (n > 0) { for (i = n; i > 0; i--) { if (data[i] > data[i - 1]) { temp = data[i]; data[i] = data[i - 1]; data[i - 1] = temp; } if( p = = 0) { p++; l = n; for ( i = 0 ; i < n ; i++)
  • 4.
    { prinft ( %d,data[i]) } bubbleSort(data, i - 2 , p ); } else { for ( j = n - 1 ; j < l ; j++) { if (data[j] > data[j - 1]) { temp = data[j]; data[j] = data[j - 1]; data[j - 1] = temp; } } for ( j = 0 ; j < l ; j++) { prinft ( %d, data[j]) } bubbleSort(data, i - 2,p); } } } return; }