Implements Quick sort.