Advertisement
SkyHawk

Bubble Sort

Jul 6th, 2011
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. void bubleSort(int* p,int l)
  2. {
  3.     int temp;
  4.     for(int i = 0;i<l;++i)
  5.         for(int q = l-1;q>i;--q)
  6.             if(p[q]<p[q-1])
  7.                 {temp = p[q]; p[q] = p[q-1]; p[q-1] = temp;}
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement