Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void quickSort(int arr[], int lo, int hi)
- {
- stack<int> a, b;
- a.push(lo); b.push(hi);
- while (!a.empty())
- {
- int l = a.top(), r = b.top();
- if (l < r)
- {
- int p = partition(arr, l, r);
- a.pop(); b.pop();
- a.push(p + 1); b.push(r);
- a.push(l); b.push(p - 1);
- }
- else
- {
- a.pop(); b.pop();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement