当前位置:网站首页>2个有序数组排序
2个有序数组排序
2022-08-09 13:07:00 【论一个测试的养成】
def yxsort(l1,l2):
while True:
try:
l1_f = l1[0]
except:
return l2
try:
l2_f = l2[0]
except:
return l1
l2_e = l2[-1]
l1_e = l1[-1]
if l1_e <= l2_f:
l1.extend(l2)
return l1
if l2_e <= l1_f:
l2.extend(l1)
return l2
if l1_e > l2_f:
sort(l2,l1,l1_e)
# for i,j in enumerate(l2):
# if l1_e <= j :
# l1.remove(l1_e)
# l2.insert(i,l1_e)
# break
if l2_e > l1_f:
sort(l1,l2,l2_e)
def sort(l1,l2,data):
for i,j in enumerate(l1):
if data <= j:
l2.remove(data)
l1.insert(i,data)
break
if __name__ == '__main__':
l2 = [1, 2, 3, 4, 5, 6]
l1 = [3, 4, 5, 6, 7, 8]
l3 = [1, 2, 3, 5, 7, 9]
l4 = [3, 4, 5, 6, 7, 8]
x = yxsort(l2,l1)
print(x)
边栏推荐
猜你喜欢
现在40系显卡都快出来了,为何1060型号的显卡还有这么多人用?
Final assignment of R language data analysis in a university
pytest 筛选用例
gin的中间件和路由分组
Uni - app - uview Swiper shuffling figure component, click on the links to jump (click to get the item after the row data, remove data operation)
RobotFramework 之 RF变量与标准库关键字使用
蓝桥杯线上模拟赛——Flex 经典骰子布局
Come and throw eggs.
群组行动控制--自动队列化实现策略
FFmpeg multimedia file processing (the basic concept of ffmpeg processing stream data)
随机推荐
RobotFramework 之 资源文件
javscript基础易错点集合
微服务+微信小程序实现社区服务
Rmarkdown Tutorial
为什么文字不贴合边
NFS pays special attention to the problem of permissions
NC61 两数之和
Sandbox中的进程/线程相关-2
Q_04_07 进一步探索
GIN file upload and return
Come and throw eggs.
NC53 删除链表的倒数第n个节点
剑指 Offer 43. 1~n 整数中 1 出现的次数(递归、数学)
GIN中GET POST PUT DELETE请求
offset、client、scroll、window.pageYOffset比较
蓝桥历届真题-门牌制作
RobotFramework 之 Setup和Teardown
Q_08 更多信息
GIN Bind模式获取参数和表单验证
IDEA Gradle 常遇问题(二)(持续更新)