????????(????)????
????
1.16 void print_descending(int x,int y,int z)//???????????{
scanf(“%d,%d,%d”,&x,&y,&z);
if(xy; //???????????,??if(yz;
if(xy; //???printf(“%d %d %d”,x,y,z);
}//print_descending 1.17 Status fib(int k,int m,int &f)//?k?????????m???f
{
int tempd;
if(knext,k++);
return k;
}//Length
2.15
void ListConcat(LinkList ha,LinkList hb,LinkList &hc)//???hb??ha??????hc
{
hc=ha;p=ha;
while(p->next) p=p->next;
p->next=hb;
}//ListConcat
2.16
?????.
2.17
Status Insert(LinkList &L,int i,int b)//???????L??i?????????b
{
p=L;q=(LinkList*)malloc(sizeof(LNode));
q.data=b;
if(i==1)
{
q.next=p;L=q; //??????}
else
{
while(–i>1) p=p->next;
q->next=p->next;p->next=q; //????i?????}
}//Insert
2.18
Status Delete(LinkList &L,int i)//???????L????i??{
if(i==1) L=L->next; //??????else
{
p=L;
while(–i>1) p=p->next;
p->next=p->next->next; //???i??}
}//Delete
2.19
Status Delete_Between(Linklist &L,int mink,int maxk)//???????????L????mink???maxk????{
p=L;
while(p->next->datanext; //p????????mink??if(p->next) //?????mink????{
q=p->next;
while(q->datanext; //q???????maxk??p->next=q;
}
}//Delete_Between
2.20
Status Delete_Equal(Linklist &L)//???????????L????????{
p=L->next;q=p->next; //p,q??????while(p->next)
{
if(p->data!=q->data)
{
p=p->next;q=p->next; //??????????,p,q?????}
else
{
while(q->data==p->data)
{
free(q);
q=q->next;
}
p->next=q;p=q;q=p->next; //?????????????}//else
}//while
}//Delete_Equal
2.21
void reverse(SqList &A)//???????{
for(i=1,j=A.length;iA.elem[i]A.elem[j];
}//reverse
2.22
void LinkList_reverse(Linklist &L)//???????;?????,??????2
{
p=L->next;q=p->next;s=q->next;p->next=NULL;
while(s->next)
{
q->next=p;p=q;
q=s;s=s->next; //?L??????????}
q->next=p;s->next=q;L->next=s;
}//LinkList_reverse
??:???????,????L?????q????????,p?????.
2.23
void merge1(LinkList &A,LinkList &B,LinkList…

Categories: Papers