Skip to content
Snippets Groups Projects
Commit 75cdce03 authored by Louis Chmielewski's avatar Louis Chmielewski
Browse files

merge_sort split

parent 31c6e633
Branches
No related tags found
No related merge requests found
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment