标签:color div image class random shu .com gap lis
shell_sort
def insert_sort_gap(li,gap): for i in range(gap,len(li)): tem = li[i] # 要插入的数 j = i-gap # j指的是手里的牌的下标 while li[j] > tem and j>=0: li[j+gap] = li[j] j -= gap li[j+gap] = tem def shell_sort(li): d = len(li)//2 while d>=1: insert_sort_gap(li,d) d//=2 import random li = list(range(1000)) random.shuffle(li) shell_sort(li) print(li,‘最后结果‘)
标签:color div image class random shu .com gap lis
原文地址:https://www.cnblogs.com/foremostxl/p/10249114.html