标签:head his write node bsp null val pre size
/*function ListNode(x){
this.val = x;
this.next = null;
}*/
function Merge(pHead1, pHead2)
{
// write code here
if(pHead1 == null && pHead2 == null){
return null;
}
if(pHead1 == null){
return pHead2;
}
if(pHead2 == null){
return pHead1;
}
var newHead = null;
if(pHead1.val <= pHead2.val){
newHead = pHead1;
newHead.next = Merge(pHead1.next,pHead2);
}
else{
newHead = pHead2;
newHead.next = Merge(pHead1,pHead2.next);
}
return newHead;
}
标签:head his write node bsp null val pre size
原文地址:https://www.cnblogs.com/3yleaves/p/9594938.html