diff --git a/TP9/tri-fusion/merge_sort.py b/TP9/tri-fusion/merge_sort.py index 2c488bedc2bcfe0a0cc1f90a5a473bdd6347d9a2..7dbe602630e675e05b650994353fcaa4ef821ff0 100755 --- a/TP9/tri-fusion/merge_sort.py +++ b/TP9/tri-fusion/merge_sort.py @@ -123,8 +123,9 @@ def is_sorted(l: ApLst, comp: Callable[[T, T], int]=compare) -> bool: $$$ is_sorted(native_to_list([1, 2, 4, 3])) False """ - ... - + while length(l)>1 and comp(l.head(),(l.tail()).head())<1: + l=l.tail() + return length(l)==1 def split(l: ApLst) -> tuple[ApLst, ApLst]: """