space-efficient quick sort