Skip to content
Snippets Groups Projects
Commit 5ded8920 authored by Belkacemi Melissa's avatar Belkacemi Melissa
Browse files

is_sorted

parent d3a609f6
No related branches found
No related tags found
No related merge requests found
...@@ -123,8 +123,9 @@ def is_sorted(l: ApLst, comp: Callable[[T, T], int]=compare) -> bool: ...@@ -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])) $$$ is_sorted(native_to_list([1, 2, 4, 3]))
False 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]: def split(l: ApLst) -> tuple[ApLst, ApLst]:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment