All pastes #570376 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-16 17:36 UTC
rendered paste body
PARTITION(A,p,r)

1  x  A[p]

2  i  p - 1

3  j  r + 1

4  while TRUE

5      do repeat j  j - 1

6           until A[j]  x

7         repeat i  i + 1

8           until A[i]  x

9         if i < j

10            then exchange A[i]  A[j]

11            else return j