SkyHawk

Insertion Sort

Jul 6th, 2011
394
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void inSort(int* p,int l)
  2. {
  3.     int t;
  4.     int q;
  5.     for(int i = 1;i<l;++i)
  6.     {
  7.         t = p[i];
  8.         for(q = i-1;p[q]>t && q>=0;--q)
  9.             p[q+1] = p[q];
  10.         p[q+1] = t;
  11.     }
  12. }
RAW Paste Data