Node* MergeLists(Node *headA, Node* headB)
{
// This is a "method-only" submission.
// You only need to complete this method \
if(headA == NULL)
return headB;
if(headB == NULL)
return headA;
if(headA->data>headB->data)
return MergeLists(headB,headA);
else
headA->next=MergeLists(headA->next,headB);
return headA;
}
{
// This is a "method-only" submission.
// You only need to complete this method \
if(headA == NULL)
return headB;
if(headB == NULL)
return headA;
if(headA->data>headB->data)
return MergeLists(headB,headA);
else
headA->next=MergeLists(headA->next,headB);
return headA;
}
No comments:
Post a Comment