Write a quick sort algorithm.
Implement quick_sort(nums) to sort an array of integers in place and return the same array. The algorithm should recursively partition the array around a pivot until every partition is sorted.
Input: nums, a list of integers. Output: The sorted nums list.
def quick_sort(nums):