JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

插入排序(LOW)

发布时间 2023-08-11 20:56:50作者: zylyehuo

博客地址:https://www.cnblogs.com/zylyehuo/

# _*_coding:utf-8_*_

def insert_sort(li):
    for i in range(1, len(li)):  # i 表示摸到的牌的下标
        tmp = li[i]
        j = i - 1  # j指的是手里的牌的下标
        while j >= 0 and li[j] > tmp:
            li[j + 1] = li[j]
            j -= 1
        li[j + 1] = tmp
        print(li)


li = [3, 2, 4, 1, 5, 7, 9, 6, 8]
print(li)
insert_sort(li)

    本栏目推荐文章
  • The IDE is running low on memory
  • wsl 开发环境中完美解决 vm.max_map_count [65530] is too low
  • low-frequency array (LOFAR)技术分析
  • sonarqube启动报错:You must address the points described in the following [2] lines before starting Elasticsearch.bootstrap check XXXmax numberXXXfor user[sonar] is too low .XXX check the logs at XXX/.log
  • 低水平特征(low-level)高水平特征(high-level),傅里叶光谱高频低频
  • 2023ICCV_Retinexformer: One-stage Retinex-based Transformer for Low-light Image Enhancement
  • Why does Windows claim to be low on memory when I have swap space available?
  • 【流行前沿】Text + Sketch Image Compression at Ultra Low Rates
  • 插入排序(LOW)
  • 选择排序(LOW)
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们