Skip to content

Instantly share code, notes, and snippets.

@chingovan
Created June 30, 2015 03:09
Show Gist options
  • Save chingovan/11a25b6a1ebb069017f4 to your computer and use it in GitHub Desktop.
Save chingovan/11a25b6a1ebb069017f4 to your computer and use it in GitHub Desktop.
n = int(input("Nhap so phan tu: "))
a = []
for i in range(0, n):
t = int(input("a[" + str(i) + "]:"))
a.append(t)
print(a)
isStillChange = False
for j in range(0, n):
isStillChange = False
for i in range(n - 1, j, -1):
if a[i] < a[i - 1]:
t = a[i];
a[i] = a[i - 1]
a[i - 1] = t
isStillChange=True
if isStillChange ==False:
break;
print(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment