题目如图:
def BubbleSort_1(x):
i = len(x) - 1
while i > 0 :
flag = False
j = 0
while j < i:
if x[j] > x[j + 1]:
swap(x,j,j+1)
flag = True
j += 1
if not flag:
return x
i -= 1
return x