Add Ex5.2 using quicksort

Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2024-09-28 17:57:24 +01:00
parent 30df314a2f
commit b5f38ad475
Signed by: TiagoRG
GPG Key ID: DFCD48E3F420DB42
1 changed files with 1 additions and 1 deletions

View File

@ -42,4 +42,4 @@ def menor_e_resto_ordem(lista, f):
# Exercicio 5.2 # Exercicio 5.2
def ordenar_seleccao(lista, ordem): def ordenar_seleccao(lista, ordem):
pass return lista if len(lista) <= 1 else ordenar_seleccao([x for x in lista[1:] if ordem(x, lista[0])], ordem) + [lista[0]] + ordenar_seleccao([x for x in lista[1:] if not ordem(x, lista[0])], ordem)