hawk

导航

python 实现的 直接插入排序法

  1. str=input('plz input some numbers for sorting without any separate')
  2. doit=list(str)
  3. for a in range(1,len(doit)):
  4.     for b in range(a):
  5.         if doit[a] > doit[b]:
  6.             continue
  7.         else:
  8.             substitute=doit[a]
  9.             del doit[a]
  10.             doit.insert(b,substitute)
  11.             break
  12. print(doit)

自己写的直接插入排序法,正在不断学习python中。。。

posted on 2011-11-16 16:17  hawkgogo  阅读(200)  评论(0编辑  收藏  举报