Quick sort implementation