Partition and Quick Sort
Sort a list with quick sort, using the Lomuto partition around the last value.
The problem
Implement quick_sort(values). Return a new list with the same values in ascending order, and leave values itself unchanged. values may be empty and may contain repeated or negative numbers. Do not call sorted or list.sort: write quick sort yourself.
Starter code
def quick_sort(values):
passPublic examples
values = [4, 1, 4, 2]gives[1, 2, 4, 4]values = [5, 3, 1]gives[1, 3, 5]
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
