User:Pdigo/sandbox

function partition(list, left, right, pivotIndex) pivotValue := list[pivotIndex] repeat while(left < right and  list[left] < pivotValue) increment left if (left == right) return left while(left < right and  pivotValue < list[right]) decrement right if (left == right) return left swap list[left] and list[right]