Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. void insertion(int array[], int N, int *cambios, int* comparaciones)
  2. {
  3.  
  4. for (int i = 1; i < N; i++) {
  5. for (int x = i - 1; x >= 0; x--) {
  6. (*comparaciones)++;
  7. if (array[x + 1] < array[x]) {
  8. swap(array[x + 1], array[x]);
  9. (*cambios)++;
  10. }
  11. else {
  12. break;
  13. }
  14. }
  15. }
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement