AlexandruT

Bubble Sort

Sep 25th, 2015
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. do
  2. {
  3.     sortat = 1;
  4.     for(i = 1; i < n; i++)
  5.     {
  6.         if(a[i] > a[i + 1])
  7.         {
  8.             aux = a[i];
  9.             a[i] = a[i + 1];
  10.             a[i + 1] = aux;
  11.             sortat = 0;
  12.         }
  13.     }
  14. }
  15. while(sortat == 0);
Advertisement
Add Comment
Please, Sign In to add comment