next up previous
Next: Partition Up: l3 Previous: Pseudocode

Partitioning the Array

  1. Pick A[p] as the pivot
  2. Move from right to left looking for an element $\leq$ pivot
  3. Move from left to right looking for an element $\geq$ pivot
  4. Swap the two elements
  5. Repeat until pointers cross


next up previous
Next: Partition Up: l3 Previous: Pseudocode