Implemented the quick sort.