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

冒泡排序(LOW)

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

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

# _*_coding:utf-8_*_

import random

def bubble_sort(li):
    for i in range(len(li)-1):
        exchange = False
        for j in range(len(li)-i-1):
            if li[j] > li[j+1]:
                li[j], li[j+1] = li[j+1], li[j]
                exchange = True
        if not exchange:
            return


li = list(range(100))
random.shuffle(li)
print(li)
bubble_sort(li)
print(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)
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们