//递归算法
NodePtr merge_lists(NodePtr& one_head,NodePtr& two_head)
{
NodePtr p1;
p1=NULL;
if(one_head == NULL && two_head == NULL)
return p1;
else if(one_head == NULL && two_head != NULL)
return two_head;
else if(one_head != NULL && two_head == NULL)
return one_head;
else
{
if(one_head->data <= two_head->data)
{
p1=one_head;
p1->link = merge_lists(one_head->link,two_head);
}
else
{
p1=two_head;
p1->link = merge_lists(one_head,two_head->link);
}
return p1;
}
}
//迭代算法