def quick_sorted(items):
    """Return a list of all items, in non-decreasing order."""
    # Base case: the empty list is already sorted.
    if items == []:
        return []
    # Reduction step: take the first item (call it the pivot)
    # and put the remaining items in two partitions,
    # those smaller or equal than the pivot, and those greater.
    pivot = items[0]
    left_unsorted = []
    right_unsorted = []
    for index in range(1, len(items)):
        if items[index] <= pivot:
            left_unsorted.append(items[index])
        else:
            right_unsorted.append(items[index])
    # Recursive step: sort each of the partitions.
    left_sorted = quick_sorted(left_unsorted)
    right_sorted = quick_sorted(right_unsorted)
    # Inductive step: put the sorted partitions and the pivot
    # in the correct order.
    return left_sorted + [pivot] + right_sorted