add a partition function for quick sort.