If I understand this algorithm correctly it will sort an array (A) with p being a pointer to the first element, and r being a pointer to the last element in descending order.
1.Quicksort(A,p,r)
2. if p < r then
3. q = Partition(A,p,r)
4. Quicksort(A,p,q)
5. Quicksort(A,q+1,r)
6.Partition(A,p,r)
7.x = A[p]
8.i = p-1
9.j = r+1
10.while TRUE
11. do repeat j = j – 1
12. until A[j] >= x
13. repeat i = i + 1
14. until A <= x
15. if i < j then
16. exchange A with A[j]
17. else
18. return j
Will this work properly? I changed a generic version of quicksort by reversing the >= and the <= on lines 12,14.
1.Quicksort(A,p,r)
2. if p < r then
3. q = Partition(A,p,r)
4. Quicksort(A,p,q)
5. Quicksort(A,q+1,r)
6.Partition(A,p,r)
7.x = A[p]
8.i = p-1
9.j = r+1
10.while TRUE
11. do repeat j = j – 1
12. until A[j] >= x
13. repeat i = i + 1
14. until A <= x
15. if i < j then
16. exchange A with A[j]
17. else
18. return j
Will this work properly? I changed a generic version of quicksort by reversing the >= and the <= on lines 12,14.