Consider the following recursive function: def r(xs: list[in…

Consider the following recursive function: def r(xs: list[int]) -> list[int]:    match xs:        case []:            return []        case [x]:            return [x]        case [first, second, *rest]:            return [first] + r(rest) + [second] What list will r([1, 2, 3, 4]) return?

Consider the following recursive function: def p(xs: list[in…

Consider the following recursive function: def p(xs: list[int]) -> list[int]:    match xs:        case []:            return []        case [x]:            return [x]        case [first, second, *rest]:            return p(rest) + [first, second] What list will p([1, 2, 3, 4, 5]) return?

Consider the following variation of the selection sort algor…

Consider the following variation of the selection sort algorithm: def sort(values: list[int]) -> None :   for i in range(len(values)) :      maxPos = i      for j in range(i + 1, len(values)) :         if values[j] > values[maxPos] :            maxPos = j   temp = values[maxPos]   values[maxPos] = values[i]   values[i] = values[maxPos] If this algorithm takes 5 seconds to sort 15,000 elements, how long would you expect it to take to sort 30,000 elements?

The function at_least returns True if at least two values in…

The function at_least returns True if at least two values in a list of booleans are True. Provide the Big‑O running time for the following function. def at_least( arr: list[bool] ) -> None:    count = 0    for i in range(0, len(arr)):        if arr[i] == True:            count += 1    return count >= 2