nakka soft world !

[Python] Bubble sort 본문

프로그래밍언어/Python

[Python] Bubble sort

nakka 2015. 7. 7. 22:12
728x90

a=int(input())
b=list(map(lambda x:int(x), input().split()))

for i in range(1, a):
    for j in range(a-i):
        if(b[j] > b[j+1]):
            temp = b[j]
            b[j] = b[j+1]
            b[j+1] = temp
       
print(b)

728x90
Comments