Solução - bubblesort
método bubblesort de ordenação
Size 1 kB - File type text/python-sourceFile contents
def bubble(vetor):
troca=True
fim=len(vetor)-1
pos=1
while(troca==True):
troca=False
for i in range(0,fim):
if(vetor[i]>vetor[i+1]):
chave=vetor[i]
vetor[i]=vetor[i+1]
vetor[i+1]=chave
pos=i
troca=True
fim=pos
return (vetor)
vetor=[]
vetor=[28,26,30,24,25]
print (bubble(vetor))
Click here to get the file