Advertisement
SkyHawk

Insertion Sort

Jul 6th, 2011
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.16 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement