Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- lista10000=[]
- for i in range (1, 10000001):
- lista10000.append(i)
- def bubbleSort(lista):
- inicio = time.clock()
- ordenado = False
- while ordenado==False:
- print(lista)
- ordenado = True
- for i in range (1, len(lista)):
- if (lista[i]<lista[i-1]):
- temp = lista[i]
- lista[i] = lista[i-1]
- lista[i-1] = temp
- ordenado=False
- print("Bubble sort levou ",format(time.clock()-inicio, ".2f"), "segundos para 10.000 elementos.")
- bubbleSort(lista10000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement