Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. void quick(int *temp, int i, int j)
  2. {
  3. int c, x, t=0;
  4. m=i; k=j;
  5. c=temp[(m+k) / 2];
  6. do{
  7. while (temp[m] < c) m++;
  8. while (temp[k] > c) k--;
  9.  
  10. if (m <= k)
  11. {
  12. if(m!=k) NazQuick++;
  13.  
  14. x=temp[m];
  15. temp[m]=temp[k];
  16. temp[k]=x;
  17. m++;
  18. k--;
  19. }
  20. t++;
  21. } while (m < k);
  22.  
  23. if (i<k) quick(temp, i, k);
  24. if (m<j) quick(temp, m, j);
  25. }
  26.  
  27. while (temp[m] < c) m++;
  28. while (temp[k] > c) k--;
  29.  
  30. x=temp[m];
  31. temp[m]=temp[k];
  32. temp[k]=x;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement