Skip to content
Snippets Groups Projects
Commit d221847a authored by Dariya Kinadinova's avatar Dariya Kinadinova
Browse files

mergesort

parent 594b9c96
No related branches found
No related tags found
No related merge requests found
...@@ -214,7 +214,17 @@ def mergesort(l: ApLst, comp: Callable[[T, T], int]=compare) -> ApLst: ...@@ -214,7 +214,17 @@ def mergesort(l: ApLst, comp: Callable[[T, T], int]=compare) -> ApLst:
$$$ is_sorted(l1) $$$ is_sorted(l1)
True True
""" """
pass if not l.is_empty():
l1, l2 = split(l)
for i in range(length(l)):
a = l1.head()
l1 = l1.tail()
b = l1.head()
for k in range(length(l)-1):
if compare(a, b) != -1:
l1 = l1.tail()
l1 = ApLst(b, ApLst(a, l1))
l1 = l1.tail()
if (__name__ == '__main__'): if (__name__ == '__main__'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment