Quick sort algorithm as given in Cormen