Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. void quickSort(int arr[], int lo, int hi)
  2. {
  3. stack<int> a, b;
  4. a.push(lo); b.push(hi);
  5. while (!a.empty())
  6. {
  7. int l = a.top(), r = b.top();
  8. if (l < r)
  9. {
  10. int p = partition(arr, l, r);
  11. a.pop(); b.pop();
  12. a.push(p + 1); b.push(r);
  13. a.push(l); b.push(p - 1);
  14. }
  15. else
  16. {
  17. a.pop(); b.pop();
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement