SHARE
TWEET

Untitled

a guest Oct 10th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // @param i - index of last inserted item
  2. // @param arr - the array to be sorted (must be memset() before passed)
  3. // @return the sorted arra from <param>arr</param>
  4. void Sort(int i, int* arr)
  5. {
  6.     static int N = sizeo(arr)/ sizeof(arr[0]);
  7.     if (i == N)
  8.         return;
  9.     if (i < 1)
  10.         return;
  11.     if (arr[i - 1] > arr[i])
  12.     {
  13.         int t = arr[i - 1];
  14.         arr[i - 1] = arr[i];
  15.         arr[i] = t;
  16.     }
  17.     Sort(i - 1, arr);
  18. }
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