def subdivide(x_1, x_2, n):
    """Performs the n-th cantor subdivision of the interval (x_1, x_2), a subset [0, 1]"""
    if n == 0:
        return []

    new_x_1 = 2 * (x_1 / 3) + x_2 / 3
    new_x_2 = x_1 / 3 + 2 * (x_2 / 3)
    return (
        subdivide(x_1, new_x_1, n - 1)
        + [new_x_1, new_x_2]
        + subdivide(new_x_2, x_2, n - 1)
    )