1 Star 0 Fork 0

Adachi/2021Besti信安

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
StraightInsertSort.py 426 Bytes
一键复制 编辑 原始数据 按行查看 历史
Adachi 提交于 2021-11-02 18:48 +08:00 . 直接插入排序
#coding=utf-8
#简单直接插入排序
def insertsort(list):
for i in range(1, len(list)):
for j in range(i, 0, -1):
if list[j] < list[j - 1]:
list[j], list[j - 1] = list[j - 1], list[j]
#print('please enter the length of the array\n')
print('please enter the elements of the array\n')
b = input()
a = list(b.split())
a = [int(i) for i in a]
insertsort(a)
print(a)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chen-xialin/cxl20211413.git
git@gitee.com:chen-xialin/cxl20211413.git
chen-xialin
cxl20211413
2021Besti信安
master

搜索帮助