博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
八大排序算法
阅读量:4222 次
发布时间:2019-05-26

本文共 1198 字,大约阅读时间需要 3 分钟。

理了一下八大排序(to do list好多年终于填掉了)
人是真的要锤大锤打才能成长起来哇~

舍友过生日,先撤了~

# - * - coding:utf8 - * - -'''@Author : Tinkle G@Creation Time: 2018/03/16'''class Solution(object):    ########################    # 插入排序    ########################    # 直接插入排序    def StraightInsertionSort(self,nums):        idx,size = 0,len(nums)        while(idx
=0): if tmp
=1): for i in range(k,n): j = i-k tmp = nums[i] while(j>=0 and tmp
nums[j+1]: nums[j+1],nums[j] = nums[j],nums[j+1] def BubbleSort1(self,nums): i = len(nums)-1 while(i>0): pos = 0 for j in range(i): if nums[j]>nums[j+1]: pos = j nums[j],nums[j+1]=nums[j+1],nums[j] i = pos def BubbleSort2(self,nums): start,end = 0,len(nums)-1 while(start
nums[j+1]: nums[j],nums[j+1] = nums[j+1],nums[j] end -=1 for j in range(end,start,-1): if nums[j]
=key): high-=1 nums[low],nums[high]=nums[high],nums[low] while(low

转载地址:http://rfqmi.baihongyu.com/

你可能感兴趣的文章
aclocal安装依赖的库
查看>>
String和常量池值的变化
查看>>
FastDFS 安装及使用详解
查看>>
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)解决方案
查看>>
Host 'XXX' is not allowed to connect to this MySQL server解决方案
查看>>
corosync pacemaker 配置高可用集群(一)
查看>>
5种IO模型、阻塞IO和非阻塞IO、同步IO和异步IO
查看>>
nginx(一) nginx详解
查看>>
nginx(二) nginx编译安装 及 配置WEB服务
查看>>
nginx(三) nginx配置:反向代理 负载均衡 后端健康检查 缓存
查看>>
nginx(四) nginx+keepalived 实现主备+双主热备模型的高可用负载均衡代理服务
查看>>
jQuery核心--多库共存
查看>>
QTP Tutorial #23 – QTP Smart Object Identification, Sync Point, and Test Result Analysis
查看>>
第一章漫话自动化测试
查看>>
第二章:Selenium IDE应用实践
查看>>
第三章:Python基础
查看>>
正则表达式
查看>>
第五章 自动化测试模型
查看>>
Linux命令行与shell编程第3章基本的shell
查看>>
Linux命令行与shell编程第4章 更多的bash shell命令
查看>>