Advertisement
Merkava

Untitled

May 22nd, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. int StraightInsertionSort( int *m, int n )
  2. {
  3. int i, j, temp, col1=0;
  4. for (i = 1; i < n; i++)
  5. {
  6. temp = m[i];
  7. col1+=1;
  8. for (j = i - 1; j >= 0; j--)
  9. {
  10.  
  11. if (m[j] < temp)
  12. break;
  13.  
  14. m[j + 1] = m[j];
  15. col1+=1;
  16. }
  17. m[j] = temp;
  18. col1+=1;
  19. }
  20. return col1;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement