Suppose we have the following function, which uses selection sort to sort from the end of the list:
def selection_sort(ls): \'\'\'Assumes ls is a list of