Node* head=(Node*)malloc(sizeof(Node));
Node* q=head;
while(head1 && head2){
if(head1->data<=head2->data){
Node* p=(Node*)malloc(sizeof(Node));
p->data=head1->data;
p->next=NULL;
q->next=p;
q=q->next;
head1=head1->next;
}
else if(head1->data > head2->data){
Node* p=(Node*)malloc(sizeof(Node));
p->data=head2->data;
p->next=NULL;
q->next=p;
q=q->next;
head2=head2->next;
}
}
return head->next;
}