当前位置:网站首页>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)
边栏推荐
- Q_04_06 把它放在一起:传送
- 蓝桥历届真题-跑步锻炼
- 群组行动控制--自动队列化实现策略
- NC7 买卖股票的最好时机(一)
- ARM board adds routing function
- Professor Chen Qiang's "Machine Learning and R Application" course Chapter 15 Homework
- 面试攻略系列(二)-- 秒杀系统
- 正则表达式-re模块
- Anta and Huawei Sports Health jointly verify the champion running shoes and lead Chinese sports with innovation
- WPF 实现带蒙版的 MessageBox 消息提示框
猜你喜欢
随机推荐
蓝桥历届真题-门牌制作
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 13 Assignment
render解析
Explanation of RTSP protocol
WPF 实现带蒙版的 MessageBox 消息提示框
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面(循环不变量)
Clock frequency and baud rate count for serial communication in FPGA
Time series analysis course lab report
面试攻略系列(二)-- 秒杀系统
FFmpeg multimedia file processing (FFMPEG logging system)
Anta and Huawei Sports Health jointly verify the champion running shoes and lead Chinese sports with innovation
javscript基础易错点集合
GIN文件上传与返回
Process/Thread Related in Sandbox - 2
Q_06_04 语句和其他构造
[MRCTF2020]套娃-1
How to solve the 0x80070005 error when the computer is reinstalled and the system is restored
FFmpeg av_interleaved_write_frame错误
关于做2D游戏时,Canvas边界显示在Game窗口的问题
群组行动控制--自动队列化实现策略
![行程和用户[阅读理解法]](/img/4b/77bba3c488b5410fdec5c3894c7421.png)








