# Python Program to Select the ith Largest Element from a List in Expected Linear Time def select(alist, start, end, i):    """Find ith largest element in alist[start... end-1]."""    if end - start <= 1:        return alist[start]    pivot = partition(alist, start, end)     # number of elements in alist[pivot... end - 1]    k = end - pivot     if i < k:        return select(alist, pivot + 1, end, i)    elif i > k:        return select(alist, start, pivot, i - k)     return alist[pivot] def partition(alist, start, end):    pivot = alist[start]    i = start + 1    j = end - 1     while True:        while (i <= j and alist[i] <= pivot):            i = i + 1        while (i <= j and alist[j] >= pivot):            j = j - 1         if i <= j:            alist[i], alist[j] = alist[j], alist[i]        else:            alist[start], alist[j] = alist[j], alist[start]            return j  alist = input('Enter the list of numbers: ')alist = alist.split()alist = [int(x) for x in alist]i = int(input('The ith smallest element will be found. Enter i: ')) ith_smallest_item = select(alist, 0, len(alist), i)print('Result: {}.'.format(ith_smallest_item))