from typing import Sequence
from typing import List


def selection_sort_rec(seq: Sequence) -> List:
    """
    Sort a sequence with the recursive selection sort algorithm.

    Parameters
    ----------
    seq : Sequence

    Returns
    -------
    List

    """

    def rselectsort(seq: List, length: int):
        """Recursive selection sort algorithm."""
        if length in (0, 1):
            return
        last: int = length - 1
        key: int = last
        for j in range(last - 1, -1, -1):
            if seq[j] > seq[key]:
                key = j
        seq[last], seq[key] = seq[key], seq[last]
        rselectsort(seq, last)

    lst: List = list(seq)
    rselectsort(lst, len(lst))
    return lst