赞
踩
具体的实现过程如下:
typedef struct List { int num; struct List * next; }Node; Node * CombinationNode(Node* head1, Node* head2) { if(!head1) { return head2; } if(!head2) { return head1; } Node* p1 = head1->next; Node* p2 = head2->next; Node* p = head1; while(p1 && p2) { if(p1->num <=p2->num) { p->next = p1; p = p1; p1 = p1->next; } else { p->next = p2; p = p2; p2 = p2->next; } } if(p1 != NULL) { p->next = p1; } if(p2 != NULL) { p->next = p2; } return head1; }