Advertisement
Guest User

kek

a guest
Oct 23rd, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. void qSort(char* v[], int left, int right) {
  2. int last = 0;
  3. int counter = 0;
  4.  
  5. if (left >= right)
  6. return ;
  7.  
  8. swap(v, left, (left + right) / 2);
  9.  
  10. last = left;
  11.  
  12. for (counter = left + 1; counter <= right; counter++) {
  13. if (strcmp(v[counter], v[left]) < 0) {
  14. swap(v, counter, ++last);
  15. }
  16. }
  17.  
  18. swap(v, left, last);
  19.  
  20. qSort(v, left, last - 1);
  21. qSort(v, last + 1, right);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement