实验2链表的操作实验内容:1)基础题:编写链表基本操作函数,链表带有头结点(1)CreatList_h()//用头插法建立链表(2)CreateList_t()//用尾插法建立链表(3)InsertList()向链表的指定位置插入元素(4)DeleteList()删除链表中指定元素值(5)FindList()查找链表中的元素(6)OutputList()输出链表中元素2)提高题:(1)将一个头节点指针为heada的单链表A分解成两个单链表A和B,其头结点指针分别为heada和headb,使得A表中含有原单链表A中序号为奇数的元素,B表中含有原链表A中序号为偶数的元素,且保持原来的相对顺序。(2)将一个单链表就地逆置。即原表(a1,a2,。。。。。。an),逆置后新表(an,an-1,。。。。。。。a1)/*程序功能:单链表基本功能操作编程者:杨天啸日期:2016-04-14版本号:3.0*/#include#includetypedefstructList{intdata;structList*next;}List;voidCreatList_h(List*L)//头插法{inti=0;intn=0;intgoal;List*p;printf("请输入数据的个数:\n");scanf("%d",&n);L->next=NULL;for(i=0;idata=goal;p->next=L->next;//将L指向的地址赋值给p;L->next=p;}}voidCreateList_t(List*L)//尾插法{inti;intn;intgoal;List*p;List*q=L;printf("请输入数据的个数:\n");scanf("%d",&n);for(i=0;idata=goal;q->next=p;q=p;}q->next=NULL;}voidInsList(List*L,inti,inte)//插入{List*s;List*p=L;intj=0;while(p&&jnext;++j;}s=(structList*)malloc(sizeof(structList));s->data=e;//插入L中s->next=p->next;p->next=s;return;}voidDeleteList(List*L,inte)//删除{List*q;List*p=L;while(p->next&&p->next->data!=e){p=p->next;}if(!(p->next)){printf("不存在该元素!\n");exit(0);}q=p->next;p->next=q->next;e=q->data;free(q);return;}voidFindList(List*L,inte)//查找元素{intj=1;List*p=L->next;while(p&&p->data!=e){p=p->next;++j;}if(!p){printf("不存在该元素!\n");exit(0);}printf("您查找的元素位置为:%d\n",j);return;}voidDisPlay(List*L)//输出链表{List*p=L->next;printf("您输入的数据为:\n");while(p!=NULL){printf("%d",p->data);p=p->next;}printf("\n");}voidInverse(List*L)//单链表就地逆置{List*q;List*p=L->next;L->next=NULL;while(p!=NULL){q=p->next;//q指针保留原链表当前处理节点的下一个节点p->next=L->next;//将当前处理节点p插入到逆置L的表头L->next=p;p=q;//p指向下一个待插入的节点}}voidDisCreat(List*L)//链表拆分{inti=0;//i记录表A中结点的序号List*p;List*B=(structList*)malloc(sizeof(structList));//创建B表表头B->next=NULL;//B表初始化List*ra=L,*rb=B;//ra和rb将分别指向将创建的A表和B表的尾结点p=L->next;//p指向待处理的结点L->next=NULL;//置空新的A表while(p!=NULL){i++;//序号加1if(i%2==0){//处理序号为偶数的链表结点rb->next=p;//若B表尾描入新结点rb=p;//rb指向新的尾结点}else{//处理原序号为奇数的结点ra->next=p;//在A表尾插入新结点ra=p;}p=p->next;//将p指向新的待处理结点}ra->next=NULL;rb->next=NULL;p=L->next;printf("奇数位数据为:\n");//输出奇数位数据while(p!=NULL){printf("%d",p->data);p=p->next;}printf("\n");List*q=B->next;printf("偶数位数据为:\n");//输出偶数位数据while(q!=NULL){printf("%d",q->data);q=q->next;}printf("\n");return;}intmain(){intn;inti;inte;intNo;List*L=(structList*)malloc(sizeof(structList));List*B=(structList*)malloc(sizeof(structList));charyes_no='y';while(yes_no=='y'||yes_no=='Y')//循坏开始{system("cls");printf("\t\t\t|---------------------------------|\n");//交互式界面printf("\t\t\t|单链表基本操作|\n");printf("\t\t\t|---------------------------------|\n");pr...