线性表归并程序方法1、2.docVIP

  • 4
  • 0
  • 约1.73千字
  • 约 3页
  • 2018-03-07 发布于河南
  • 举报
线性表归并程序方法1、2

#include stdio.h #include malloc.h struct node {int xh; struct node *next; }; typedef struct node NODE; NODE *gb2(NODE *heada,NODE *headb) { NODE *p,*q,*t,*head; head=(NODE *)malloc(sizeof(NODE)); head-next=NULL; p=heada-next; q=headb-next; t=head; while(p!=NULLq!=NULL) if(p-xhq-xh) { t-next=p; heada=p; p=p-next; t=t-next; } else { t-next=q; ?headb=q; ?q=q-next; t=t-next; } if(p==NULL) t-next=q; else t-next=p; return(head); } NODE *gb(NODE *heada,NODE *headb) {NODE *p,*q,*head; head=(NODE *)malloc(sizeof(NODE)); head-next=NULL; p=heada-next; q=headb-next; while(p!=NULLq!=NULL) if(p-xhq-xh) {he

文档评论(0)

1亿VIP精品文档

相关文档