daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 54 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. void
  2. bubblesort(int *values,
  3.   int length)
  4. {
  5.   short done = 1;
  6.   int i, temp, n = length;
  7.  
  8.   do
  9.     {
  10.       done--;
  11.       n--;
  12.  
  13.       for(i = 0; i <= n - 1; i++)
  14.         {
  15.           if(values[i] > values[i + 1])
  16.             {
  17.               temp          = values[i];
  18.               values[i]     = values[i + 1];
  19.               values[i + 1] = temp;
  20.               done++;
  21.             }
  22.         }
  23.     }
  24.   while(done);
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top