微信搜索“毛凌志岗前心得”小程序
归并排序 - 维基百科,自由的百科全书
Python[编辑]def merge(l1,l2): final=[] #对l1,l2进行排序 l1 = sorted(l1) l2 = sorted(l2) while l1 and l2: if l1[0]<=l2[0]: final.append(l1.pop(0)) else: final.append(l2.pop(0)) return final+l1+l2
def merge(l1,l2): final=[] #对l1,l2进行排序 l1 = sorted(l1) l2 = sorted(l2) while l1 and l2: if l1[0]<=l2[0]: final.append(l1.pop(0)) else: final.append(l2.pop(0)) return final+l1+l2
Copyright @ 2024 lexus Powered by .NET 9.0 on Kubernetes Powered by: .Text and ASP.NET Theme by: .NET Monster