标签:
实现源码
def bubble(array): flag = len(array)-1 while flag >0: iter = 0 for i in range(flag): if array[i] > array[i+1]: array[i], array[i+1]= array[i+1],array[i] iter=i flag = iter array = [5,3,18,99,8,2,8] if __name__ == "__main__": bubble(array) print array
标签:
原文地址:http://www.cnblogs.com/lifeinsmile/p/5245761.html