Ask Question
25 December, 14:50

Write a program that implement a bubble sort?

+1
Answers (1)
  1. 25 December, 18:10
    0
    A program that implement a bubble sort:

    #include

    #include

    int main ()

    {

    int ar[50], no, i, j, temp;

    cout<<"Enter array size ";

    cin>>no;

    cout<<"Enter array elements ";

    for (i=0; i
    cin>>ar[i];

    for (i=1; i
    {

    for (j=0; j< (no-i); ++j)

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

    {

    temp=ar[j];

    ar[j]=ar[j+1];

    ar[j+1]=temp;

    }

    }

    cout<<"Bubble Sort array";

    for (i=0; i
    cout<<" "<
    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program that implement a bubble sort? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers