Ask Question
22 May, 08:56

Write a program that implement a bubble sort?

+3
Answers (1)
  1. 22 May, 12: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?
Find an answer to your question ✅ “Write a program that implement a bubble sort? ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers