千锋教育Python数据分析教程_700集零基础Python入门到精通教程(py
for循环优化算法,第一次循环后如果时间如果时间复杂度为n(0) 直接返回
def bubble_sort(pop_list):
count = 0
for j in range(len(pop_list) - 1, 0, -1):
for i in range(0, j):
if pop_list[i] > pop_list[i + 1]:
pop_list[i], pop_list[i + 1] = pop_list[i + 1], pop_list[i]
count += 1
print('进入循环')
if count == 0:
return pop_list

