## Exercice 1





## Exercice 2
# 1.

def compare_naif(L, M):
    N = M.copy()
    for x in L:
        j = 0
        trouve = False
        while j < len(N) and not trouve:
            if N[j] == x:
                trouve = True
                N.pop(j)
            else:
                j = j + 1
        if not trouve:
            return False
    return len(N) == 0


L1 = list(range(6)) + [2, 5]
L2 = [1, 3, 0, 2, 5, 5, 2, 4]
L3 = list(range(6))
print(compare_naif(L1, L2), compare_naif(L1, L3))


## 2.

def inter(G, D):
    res = []
    i, j = 0, 0
    while i < len(G) and j < len(D):
        if G[i] < D[j]:
            res.append(G[i])
            i = i + 1
        else:
            res.append(D[j])
            j = j + 1
    if i == len(G):
        res.extend(D[j:])
    else:
        res.extend(G[i:])
    return res


def tri(L):
    n = len(L)
    if n < 2:
        return L
    else:
        G = tri(L[:n//2])
        D = tri(L[n//2:])
        return inter(G, D)


# print(tri(L2))

## 3.






## Exercice 3

ex1 = 'veridique ! dominique pique nique en tunique.'
ex2 = "babaababa"
ex3 = "veridique !"
