From 5ded8920b3451709e1deac2478405cbb5a8a82a8 Mon Sep 17 00:00:00 2001
From: Belkacemi Melissa <melissa.belkacemi.etu@118p29.fil.univ-lille.fr>
Date: Wed, 10 Apr 2024 10:51:40 +0200
Subject: [PATCH] is_sorted

---
 TP9/tri-fusion/merge_sort.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/TP9/tri-fusion/merge_sort.py b/TP9/tri-fusion/merge_sort.py
index 2c488be..7dbe602 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]:
     """
-- 
GitLab