implement quick sort