diff --git a/Tp09/merge_sort.py b/Tp09/merge_sort.py index 91b5736c021d32db3c3193cb60b0c419c0689ca7..a78637a74dece3234ee2383bab791e5fefe96199 100755 --- a/Tp09/merge_sort.py +++ b/Tp09/merge_sort.py @@ -161,7 +161,19 @@ def split(l: ApLst) -> tuple[ApLst, ApLst]: $$$ all(k in l for k in l3) True """ - ... + l1 = ApLst() + l2 = ApLst() + compteur = 0 + while not l.is_empty(): + if compteur % 2 == 0: + l1 = ApLst(l.head(), l1) + else: + l2 = ApLst(l.head(), l2) + l = l.tail() + compteur += 1 + return (l1, l2) + + def merge(l1: ApLst, l2: ApLst,