标签:for 排序 pre and div log int shel logs
1.python
1 def shellsort(l): 2 n = len(l) 3 h=1 4 while h<n/3: 5 h=3*h+1 6 while h>=1: 7 for i in range(h,n): 8 j = i 9 temp = l[j] 10 while j>=h and l[j-h]>temp: 11 l[j]=l[j-h] 12 j=j-h 13 l[j] = temp 14 print l 15 h=(h-1)/3 16
标签:for 排序 pre and div log int shel logs
原文地址:http://www.cnblogs.com/lowseasonwind/p/7072060.html