Ask Question
2 November, 17:13

Write a program that implement a bubble sort?

+3
Answers (1)
  1. 2 November, 17:29
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers