correct quick sort for all three cases