completed quick sort