+ 1
How to write a simple code on bubble sort in Python.
3 Respostas
+ 6
check this out
https://www.sololearn.com/learn/649/?ref=app
+ 3
def bubble_sort(nlist):
for passnum in range(len(nlist)-1,0,-1):
for j in range(passnum):
if nlist[j]>nlist[j+1]:
nlist[j], nlist[j+1] = nlist[j+1], nlist[j]
nlist = [14,46,43,27,57,41,45,21,70]
bubble_sort(nlist)
print(nlist)
0
have a look at Bogo sort
https://code.sololearn.com/c503FUYUO9jF/?ref=app