摘要:
def selection_sort(alist): n = len(alist) # 需要进行n-1次选择操作 a = 0 for i in range(n-1): # 记录最小位置 min_index = i exit = i # 从i+1位置到末尾选择出最小数据 for j in range( 阅读全文
摘要:
# Start with a list of numbers that ain't sorted numbers=[0,5,1,4,2,8] # Keep track of whether any swaps were made on the previous i teration # If no 阅读全文
摘要:
冒泡排序分析详细节情版 import random def bubble(li): for i in range(len(li)-1): exchange = False for j in range(len(li)-i-1):`` if li[j] > li[j+1]: print('%s-%s哈 阅读全文