Complete the code below, replacing the 'X' and 'Y' with the necessary commands to perform a selection sort algorithm on a given list:
X: while li...
Complete the code below, replacing the 'X' and 'Y' with the necessary commands to perform a selection sort algorithm on a given list:
X: while lista[j] < menor]: Y: index_menor =j X: if lista[j] < lista[index_menor]: Y: index_menor =j X: for i in range(len(lista)): Y: for j in range(i+1, len(lista)):
X: while i < len(lista):
Y: index_menor = i
X: for j in range(i+1, len(lista)):
Y: if lista[j] < lista[index_menor]:
Y: index_menor = j
X: if index_menor != i:
Y: lista[i], lista[index_menor] = lista[index_menor], lista[i]
0
0
Faça como milhares de estudantes: teste grátis o Passei Direto
Compartilhar