#include <stdio.h>#include <stdlib.h>#define new (struct node *)malloc(sizeof(struct node))struct node {int value;struct node *next;};struct node *creat(int a[],int n){struct node *head,*q;for (head=NULL;n;n--){q=(struct node *) malloc(sizeof(struct node));q->value=*a++;q->next=head;head=q;}return head;}struct node *copy(struct node *h){struct node *head,*p,*q,*u,*v;head=NULL;p=h;while (p){q=(struct node *) malloc(sizeof(struct node));q->value=p->value;v=head;while (v->value<q->value && v!=NULL){u=v;v=v->next;}if (v==head)head=q;else u->next=q;q->next=v;p=p->next;}return head;}int d[]={1,7,3,5};int b[]={2,4,8,0};struct node *connect(struct node *h1,struct node *h2){struct node *k;k=(struct node *) malloc(sizeof(struct node));k=h1->next;h1->next=(h2->next)->next;free(h2->next);h2->next=k;return(h2);}main(){struct node *h1,*h2,*p,*t,*l;h1=creat(d,sizeof d/sizeof d[0]);p=copy(h1);while(p){printf("%5d",p->value);p=p->next;}printf("\n");h2=creat(b,sizeof b/sizeof b[0]);t=copy(h2);while(t){printf("%5d",t->value);t=t->next;}printf("\n");l=connect(p,t);while(l){print("%5d,l->value);l=l->next;}printf("\n");}