耿国华课后习题答案

耿国华课后习题答案

ID:83467478

大小:6.55 MB

页数:45页

时间:2023-07-12

上传者:无敌小子
耿国华课后习题答案_第1页
耿国华课后习题答案_第2页
耿国华课后习题答案_第3页
耿国华课后习题答案_第4页
耿国华课后习题答案_第5页
耿国华课后习题答案_第6页
耿国华课后习题答案_第7页
耿国华课后习题答案_第8页
耿国华课后习题答案_第9页
耿国华课后习题答案_第10页
资源描述:

《耿国华课后习题答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

12.(1)X(2)X(3)V3.(1)A(2)C(3)C5.ᑡx=x+1Ḅ⚣for(i=1;i<=n;i++)for(j=1;j<=ij++)for(k=1;k<=j;k++)x=x+1;ூ௃X=x+1Ḅ⚣T(n)=1+(1+2)+(1+2+3)+…+(1+2++n)=n(n+1)(n+2)/66.ᑏᐗ⚗!p(x)=a+ax+ax2+....+axnḄ"Pn(xo),#$%&n012nḄ᡻()ᦪ+᦮-Ḅ./0ᩖ⌕./0ᩖ34567%859ᵨ;<ᦪ஺>?@⚪ḄBᐭ…n)ஹx+n,BEPn%)஺ḄBᐭ+BEFᵨᑡG(1)JKLᦪ⊤ḄLᦪN!O⌴(2)JKᐰRST◚!O⌴஺VWXGḄYZ[#ᙠ]^_`aḄXbcBᐭBE஺ூ௃(1)JKLᦪ⊤ḄLᦪN!O⌴Y[deᨵgᵨ<ᦪ.8ᓰᵨᑁjgᵨklmnLopqbLrᢝ<ᦪJᵨឋuvwឋu஺Z[nLxybLz{|}~"ᦪTᨵ▲஺(2)JKᐰRST◚!O⌴Y[bLynLḄ-ᦪᑁj/]O⌴ᦪ.Ḅ./ὑZ[<ᦪJᵨឋvឋ᝞JKᐰRST◚!O⌴LᦪPolyValue(){inti,n;floatx,a[],p;printf(u

1n=,>);scanf(u%r,&n);printf("

2x=")scanf("f”,&x);for(i=0;i

3s=afor(i=1;i<=n;i++){s=s+a[i]*p;/*᡻()ᦪ:n)*/P=P*x}return(p);)Ḅ./0ᩖT(n)=O(n)2ឋ⊤⚪1.(1)ᙠ⊤ᐭᡈᑤ◀-ᐗ◤⌕ᙳv•¡ᐗ,ᐹ¤vḄᐗ-ᦪyᐭᡈᑤ◀Ḅ¥wᨵᐵ஺(2)§ឋ⊤ᨵ+¨!WXj©k᪀஺ᙠ⊤§ឋ⊤Ḅ«ᙠᦪ¬%.®¯°$%±☟᝱´j,ᙠ¨!⊤᦮-¨⊤ᵫ“ᜮᢣ┐”ᩭ⊤¼ᓫ¨⊤Ḅ«±᝱´j஺(3)ᙠ⊤¾¿ÀÁÂḄᐗᐸᱥᳮ¥w%__________ÁÂ஺ᙠᓫ¨⊤¾¿ÀÁÂḄᐗᐸᱥᳮ¥w8%ÁÂ஺(4)ᙠÇᜮk[ḄÈᓫ¨⊤ᜮk[Ḅj©¥wIᵫᜮᢣ┐ᢣ¼,✌ᐗk[Ḅj©¥wᵫᜮk[ᢣ¼,◀✌ᐗk[᜜ᐸËÌᐗk[Ḅj©¥wᵫᐸÍÎÏÐḄnextÑᢣ¼஺2.⌱Ó⚪(1)A(2)¯ÔL±Õ⊤ᜮk[Ḅᓫ¨⊤|Pk[Ö8±✌ᐗk[×8±Øᐗk[஺ᢥ⌕ᑡ⌱Óᔠ〉Ḅᑡ஺a.ᙠPk[mᐭSk[Ḅᑡ±EஹA஺b.ᙠPk[ÏᐭSk[Ḅᑡ±HஹLஹIஹEஹA஺c.ᙠ⊤✌ᐭSk[Ḅᑡ±FஹM஺d.ᙠ⊤ØᐭSk[Ḅᑡ±LஹJஹAஹG஺Ü⌱ÓḄᨵAP->next=S;BP->next=P->next->next;CP->next=S->next;DS->next=P->next;ES->next=L;FS->next=NULL;GQ=P;Hwhile(P->next!=Q)P=P->next;Iwhile(P->next!=NULL)P=P->next;JP=Q;KP=L;LL=S;

4u』p;zD(\3)/l4)Dx5)zD\6)zAly7Ýᑖß]8àḄj©k᪀bcᓫ§⊤Ḅ®ᙢ⌮wᓽᙠä⊤Ḅj©/å§ឋ⊤(a1,a2,…,aQ⌮w(an,ae,…,a஺஺ூ௃(1)ᵨrᦪ¬æj©k᪀voidinvert(SeqList*L,int*num)(intj;ElemTypetmp;for(j=0;j<=(*num-1)/2;j++){tmp=L0]L[j]=Lrnum-j-1];L[*num-j-1]=tmp;})(2)ᵨᓫ¨⊤æj©k᪀voidinvert(LinkListL)(Node*p,*q,*r;if(L->next==NULL)return;/*¨⊤*/p=L->next;q=p->next;p->next=NULL;/*᤺-k[èᡂêë⌮w⊤7while(q!=NULL)/*ì-k[íî)ᜮᐭdÏ⌮w⊤*/(r=q->next;q->next=L->next;L->next=q;q=r;))11å§ឋ⊤A=(a1,a2........am),B=(b1,b2,……bn)ᔠ#ᡂ§ឋ⊤C,C=(a1,b1,......am,bm,bm+1.........bn)dm<=n.ᡈC=(a1,b1,.......an,bn,an+1........am)dm>n.,§ឋ⊤AஹBஹC]ᓫ¨⊤æj©k᪀|C⊤ᑭᵨA⊤+B⊤Ḅk[/᪀ᡂ஺>?ᓫ¨⊤Ḅ«"m+nᙳðN!j©஺ூ௃᝞LinkListmerge(LinkListA,LinkListB,LinkListC){Node*pa,*qa,*pb,*qb,*p;pa=A->next;/*pa⊤¼AḄdÏk[*/pb=B->next;p=A;/*ᑭᵨpᩭᢣᔣòóÎḄ⊤Ḅ⊤Øêë"ᢣᔣ⊤AḄᜮk[*/while(pa!=NULL&&pb!=NULL)/*ᑭᵨØôõóÎömḄ¨⊤*/{qa=pa->next;qb=qb->next;p->next=pa;/*÷ø⌱Ó⊤A+⊤BḄk[óÎᑮò¨⊤7P=pap->next=pb;P=Pb

5pa=qa;pb=qb;)if(pa!=NULL)p->next=pa;/*AḄ«ᜧûBḄ«*/if(pb!=NULL)p->next=pb;/*BḄ«ᜧûAḄ«7C=A;Return(C);⚪üýþÿ⚪⚪Ḅ1,2,…,nḄnᢥ┐ᔣᙶᙌᢝᨵṹ(᦮ᦪ)஺%&'⌱)ᦪ*▲,m,-.%&┐/1%&0)ᦪ)ᑮm23)ᦪ஺)mḄ4ᑡ67Ḅṹ89Ḅm,-7ᙠ┐ᔣ*Ḅ;%&<9-1)ᦪ᝞>;?@AᡠᨵḄᐰD4ᑡ3஺EFGH0,J44ᑡ0஺ᑭᵨᓫᔣNOP⊤8RST᪀VW>XHᢥ᯿4ᑡ0ᡭᓺ4ᔜḄ஺]᝞mḄ^,20_n=7,7Ḅṹ`ab3,1,7,2,4,8,4,4ᑡ06,1,4,7,2,3,5஺ூde௃gh᝞;typedefstructNode(intpassword;intnum;structNode*next;}Node,*Linklist;voidJosephus()(LinklistL;Node*p,*r,*q;intm,n,C,j;L=(Node*)malloc(sizeof(Node));/*^&ᓄᓫᔣNOP⊤*/if(L==NULL){printfC^nP⊤ᵭmnᑮop!)return;}L->next=NULL;r=L;printf("msᐭᦪunḄ,(n>0):");scanf(n%d",&n);for(j=1;j<=n;j++)/*wxP⊤*/(p=(Node*)malloc(sizeof(Node));if(p!=NULL)(printf("msᐭ.ydḄṹ:"J);scanf("yd”,&C);p->password=C;p->num=j;r->next=p;r=p_)}r->next=L->next;

6printf("msᐭ.•)ᦪᓃ▲,m(m>0)});scanf("%d",&m);printf(M***************************************printf(ᕬᑡḄ0:

7“);q=L_p=L->next;while(n!=1)/*Gg4ᑡḄ0*/(j=1_while(jnext;j++_)printf("%d->",p->num);m=p->password;/*9ṹ*/n-_q->next=p->next;/*p4ᑡ7r=p_p=p->next;free(r);)printf("yd\rT,p->num);).3▲ឋឋ⊤-᪘ᑡ.eᫀ1ᢥ3.1(b)ᡠ⍝(⍝ᙳᓫᔣ⍝)e(1)᝞Ḅ0ᑡ123,ᑣ¡ᑮḄ40ᑡb¢£¤(2)᝞Ḅ0ᑡ123456,¡ᔲᑮ435612135426Ḅ40ᑡ¦§¨©ª(ᓽᑏ4“S”⊤᪘ஹ“X”⊤4᪘Ḅ᪘0ᑡ¯8)஺ூde௃(1)¡ᑮḄ40ᑡb123ஹ132ஹ213ஹ231ஹ321஺ফn¡ᑮ435612Ḅ40ᑡ஺ªᨵS(1)S(2)S(3)S(4)X(4)X(3)S(5)X(5)S(6)S(6),>ᢥ᯿“²ᐜ4”Ḅ©µij,4᪘Ḅ0¶·X(2)X(1)஺¡ᑮ135426Ḅ40ᑡ஺ªᨵS(1)X(1)S(2)S(3)X(3)S(4)S(5)X(5)X(4)X(2)X(1)஺3¸4᪘ḄRST᪀¹º»¼ᙠ½᪘ḄRST᪀¾᝞¿ᑨÁ᪘oÂ᪘äூde௃(1)0᪘(topᵨᩭRÅ᪘⚔ᐗÈḄ;᪗)ᑨÊ᪘So᝞ËS->top==-1⊤᪘o஺ᑨÊ᪘SÃ᝞ËS->top==Stack_Size-1⊤᪘Ã஺(2)P᪘(top᪘⚔ᢣ┐ᢣᔣ᪘⚔ᐗÈ☢ḄᜮT)ᑨÊ᪘o᝞Ëtop->next==NULL⊤᪘o஺ᑨÊ᪘ÃÏÐÑᨵᵨopᵭmnᑮopRÅ⌕᪘ḄᐗÈ>᪘Ã஺4᯿ÓᑣÔgÕஹÖஹ×ஹ◀ÙÔgḄÚᐜÛ]Ü4Ý;ᑡ⊤ÞºJ,¯8ᦪ᪘Ôgß᪘ḄàᓄXHA-B*C/D+EfF

8ூde௃OVSOPTROVSOPTR•/^OPTR'*'CáᡂB*CDBT(1)AÔgTËT(1)AOPTRo'+ᢈæçèOPTR_t'æçè#vOPTR?'áᡂEtFáᡂT(3)+T(4)ÔgTËT(4)ÔgTËT(5)T(5)5ᑏghᑨÊ`aêᐭḄ•@TìßḄíî0ᑡbᔲ¹᝞'0ᑡ1&0ᑡ2'Ḅíß0ᑡ஺0ᑡ10ᑡ2¾ïnð,ñ0ᑡ2b0ᑡ1Ḅ⌮0ᑡ஺]᝞'a+b&b+a'bóôõVºḄíß0ᑡö'1+3&3-1'ᑣnb஺ூde௃gh᝞;:intlsHuiWen()Stack*S;Charch,temp;lnitStack(&S);Printf("

9msᐭíß0ᑡ”);Ch=getchar();While(ch!=&)/*0ᑡ1ᐭ᪘*/{Push(&S,ch);ch=getchar();)do஻ᑨÊ0ᑡ2bᔲb0ᑡ1Ḅ⌮0ᑡ*/{ch=getchar();Pop(&S,&temp);if(ch!=temp)/*0ᑡ2nb0ᑡ1Ḅ⌮0ᑡ*/{return(FALSE);printf(M

10NOM);}}while(ch!=@&&!lsEmpty(&S))if(ch==@&&lsEmpty(&S)){return(TRUE);printf("

11YES");}/*0ᑡ2b0ᑡ1Ḅ⌮0ᑡ*/else{return(FALSE);printf("

12NO");}}/*lsHuiWen()78⌕JNOᑡnøᜫopᐰDï¡ᑮᑭᵨFú᪗ûtag,tag஺ᡈ1ᩭýᑖᜮÿᢣ┐Ḅᑡ᝱ḄᑏḄᐭ஺ூ௃ᐭintEnterQueue(SeqQueue*Q,QueueElementTypex){/*!ᐗ#xᐭ*/

13if(Q->front==Q->front&&tag==1)/**/return(FALSE);if(Q->front==Q->front&&tag==O)/*xᐭ$Xᐭ%&'()᪗+*/tag=1;Q->elememt[Q->rear]=x;Q->rear=(Q->rear+1)%MAXSIZE;/*(),ᢣ┐*/Return(TRUE);)intDeleteQueue(SeqQueue*Q,QueueElementType*x){/*ᑤ◀ᜮᐗ#ᵨx12ᐸ4*/if(Q->front==Q->rear&&tag==O)/**7return(FALSE);*x=Q->element[Q->front];Q->front=(Q->front+1)%MAXSIZE;/*&'()ᜮᢣ┐*/if(Q->front==Q->rear)tag=O;/*ᜮᐗ#%ᑡ5&'()᪗+6*/Return(TUUE);7489ᫀ1^s='lAMASTUDENT,t='GOOD',q='WORKER'஺:;ᑡ<=Ḅ>?ூ௃StrLength(s)=14;SubString(sub1,s,1,7)sub1='lAMA';SubString(sub2,s,7,1)sub2='';Strlndex(s,4,'A')=6;StrReplace(s,'STUDENT',q);s=lAMAWORKER,;StrCat(StrCat(sub1,t),StrCat(sub2,q))sub1='lAMAGOODWORKER'஺2ᑏ@A9ḄBC<=StrReplace(S,T,V)«ூ௃᝞;intstrReplace(SStringS,SStringT,SStringV){/*ᵨ9VEᣚSGḄᡠᨵJ9T7intpos,i;pos=strlndex(S,1,T);/*KSGJ9T7LMAḄN)*/if(pos==0)return(O);while(pos!=0)/*ᵨ9VEᣚSGḄᡠᨵJ9T*/(switch(T.len-V.len)(case0:/*9TḄPQRS9VḄPQ*/for(i=0;i<=V.len;i++)/*ᵨVEᣚT*/S->ch[pos+i]=V.ch[i];case>0:/*9TḄPQᜧS9VḄPQ7for(i=pos+t.ien;ilen;i-)/*!SGJ9T%ḄᡠᨵUVS->ch[i-t.len+v.len]=S->ch[i];$WT.len-V.lenXN)*/for(i=0;i<=V.len;i++)/*ᵨVEᣚT*/S->ch[pos+i]=V.ch[i];

14S->len=S->len-T.len+V.len;case<0:/*9TḄPQYS9VḄPQ*/if(S->len-T.len+V.len)<=MAXLEN/*Zᐭ%9PYSMAXLEN*/{/*!SGJ9T%ḄᡠᨵUV%WV.len-T.lenXN)*/for(i=S->len-T.len+V.len;i>=pos+T.len;i-)S->ch[i]=S->ch[i-T.len+V.len];for(i=0;i<=V.len;i++)/*ᵨVEᣚT7S->ch[pos+i]=V.ch[i];S->len=S->len-T.len+V.len;}else/*Eᣚ%9P,MAXLEN,\9V]^ᐰ`Eᣚ*/if(pos+V.len<=MAXLEN){for(i=MAXLEN-1;i>=pos+Taen;i-)S->ch[i]=s->ch[i-T.len+V.len]for(i=0;i<=V.len;i++)/*ᵨVEᣚT7S->ch[pos+i]=V.ch[i];S->len=MAXLEN;}else/*ᵭVḄ`ᑖUV⌕ef*/{for(i=0;ich[i+pos]=V.ch[i];S->len=MAXLEN;}}/*switch()7pos=Strlndex(S,pos+V.len,T);/*KSG;LXJ9TḄN)*/}/*while()7return(1);}/*StrReplace()7ᦪ⊤7g8ᫀ1.Ꮇ(ᨵ6j8ᑡḄklᦪnA,oXᐗ#ᓰᵨ6XU⁚rsᘤᢥU⁚ᙬ஺wxAḄBᙢᙬ51000,z(1)ᦪnAᐳᓰᵨ|}U⁚~(288)(2)ᦪnAḄᨬ%LXᐗ#Ḅᙢᙬ~(1282)(3)ᢥjrsᐗ#A36Ḅᙢᙬ~(1126)(4)ᢥᑡrsᐗ#A36Ḅᙢᙬ~(1192)4.(ᨵ▣An“n,!ᐸᩩḄᐗ#⌲jḄrSᦪnB[1..3n-2]GB[k]=a"K(1)ᵨi,j⊤kḄ;᪗ᣚ~(2)ᵨk⊤iஹjḄ;᪗ᣚ஺ூ௃(1)k=2(i-1)+j(2)i=[k/3]+1,j=[k/3]+k%3(□᦮)5.ᙠ▣Ḅ)5.2G!zposmon[col]Ḅᦋ¢£ᓰᵨLX¤¥ᔣ§¨஺ூ௃(L)FastTransposeTSMatrix(TSMartrixA,TSMatrix*B){/*©▣A)ᑮBᡠᢣᔣḄ▣G«▣ᵨᐗn⊤⊤*/intcol,t,p,q;intposition[MAXSIZE];B->len=A.len;B->n=A.m;B->m=A.n;

15if(B->len>0)(position[1]=1;for(t=1;t<=A.len;t++)position[A.data[t].col+1]++;/*position[col]r¬7col-1ᑡ®ᐗ#ḄXᦪ,ᓽᑭᵨpos[col]ᩭ²³7col-1ᑡG®ᐗ#ḄXᦪ*//*KcolᑡG7LX®ᐗ#ᙠB.data[]ḄN)r¬ᙠposition[col]G*/for(col=2;col<=A.n;col++)position[col]=position[col]+position[col-1];for(p=1;pdata[q].row=A.data[p].col;B->data[q].col=A.data[p].row;B->data[q].e=A.data[p].e;Position[col]++;)))(k)FastTransposeTSMatrix(TSMartrixA,TSMatrix*B)(intcol,t,p,q~intposition[MAXSIZE];B->len=A.len;B->n=A.m;B->m=A.n;if(B->len>0)(for(col=1;col<=A.n;cok+)position[col]=0;for(t=1;t<=A.len;t++)position[A.data[t].col]++;/*zoLᑡḄ®ᐗ#ḄXᦪ*//*´ᨬ%LᑡµKoLᑡG7LX®ᐗ#ᙠB.data□GḄN)r¬ᙠposition[col]^7for(col=A.n,t=A.len;col>0;col-){t=t-position[col];position[col]=t+1;)for(p=1;pdata[q].row=A.data[p].col;B->data[q].col=A.data[p].row;B->data[q].e=A.data[p].e;Position[col]++;)))8.¶;☢¸¹⊤Ḅº»rs>᪀½((((a),b)),(((),d),(e,f)))ூ௃

16᪀9.K;ᑡ¸¹⊤¾Ḅ>?:(1)HEAD[((a,b),(c,d))];(a,b)(2)TAIL[((a,b),(c,d))];(@d))(3)TAIL[HEAD[((a,b),(c,d))]];(b)(4)HEAD[TAIL[HEAD[((a,b),(c,d))]]];b(5)TAIL[HEAD[TAIL[((a,b),(c,d))]]];(d)/r/yஹ7À8ᫀ6.1ᑖÁ¶ᐹᨵ3X>ÃḄ᪛Å3X>ÃḄkÆ᪛ḄᡠᨵÇÈ᝱஺ூ௃

17ᐹᨵ3X>ÃḄ᪛ᐹᨵ3X>ÃḄkÆ᪛6.3wxLÉQ5kḄ᪛GᨵஹXQ51Ḅ>Ã⊈XQ52Ḅ>Ã......^XQ5kḄ>ÃᑣÌ᪛Gᨵ|}XÍJ>ÃÎூ௃(᪛G>ÃÏᦪ5n,ᑣn=n()+m+……+nk᪛GᑖÐᦪÑ5B,ᑣB=%+2n2+3n3+......+knkÒ5◀᪷>Ã᜜oX>ÃᙳLXÖᐭ×ḄᑖÐᡠ^ᨵn=B+1ᓽn()+%+........+rik=%+2n+3n+........+kn+123kᵫ]ÍJ>Ãᦪ5n=112+2113+......+(k-1)n+10k6.5wxkÆ᪛ᨵ50XÍJ>ÃᑣÌkÆ᪛ḄÏ>ÃᦪÙ}ᨵ|}XÎூ௃n°⊤ÍJ>ÃᦪḄ⊤Q52Ḅ>Ãᦪᑣno=n2+1ᡠ^n2=no-1=49,ÚkÆ᪛GÛᨵQ51Ḅ>ÃÏ>Ãᦪn=n°+n2=996.6ÜᑖÁÝÞ^;ᩩßḄᡠᨵkÆ᪛(1)$ààᑡGààᑡ~(2)Gààᑡ%ààᑡ~(3)$ààᑡ%ààᑡ஺ூ௃(1)$àGà᪛ᡈâãJ᪛ḄᓫÐ᪛~(2)Gà%à᪛ᡈâåJ᪛ḄᓫÐ᪛~(3)$à%à᪛ᡈ£ᨵ᪷>ÃḄkÆ᪛஺6.9Ꮇ(æçḄᵯᦻêᵫ8XUënᡂUëᙠᵯᦻGAḄ⚣᳛ᑖÁ50.07,0.19,0.02,0.06,0.32,0.03,0.21,0.105ï8XUë(zðñòṹ஺ூ௃᪀⌼ðñò᪛᝞;

180.320.190.210.28D.llD.17LiU50.061/I0.020.03ðñòṹ5iimuI11005l211110Iio6L:mob:01Ii:1101Isoo6.11¶᝞;½ᡠ᪛ḄkÆ᪛஺«)ூ௃

19AA(d)6.16ᑖÁᑏ@AᙠGàõkÆ᪛TGöÝ:÷>Ã*pᙠGààᑡGḄ$ø%ù஺ᙠᐜàõkÆ᪛TGöÝ:÷>Ã*pᙠᐜààᑡGḄ%ù஺ᙠ%àõkÆ᪛TGöÝ:÷>Ã*pᙠ%ààᑡGḄ$ø஺(1)Ý>ÃḄGà$ø>ÃBiTNode*lnPre(BiTNode*p)/*ᙠGàõkÆ᪛GöÝpḄGà$ø>Ãûᵨpreᢣ┐12>?*/{if(p->Ltag==1)pre=p->LChild;/*üýᑭᵨõ*/else{/*ᙠpḄãJ᪛GöÝ“ᨬå;ÿ”7for(q=p->LChild;q->Rtag==0;q=q->RChild);pre=q;)return(pre);)(2)ḄBiTNode*lnSucc(BiTNode*p)/*ᙠ᪛pḄᵨsuccᢣ┐*/{if(p->Rtag==1)succ=p->RChild;/*ᑭᵨ*/else{/*ᙠpḄ᪛“ᨬ#$%”*/for(q=p->RChild;q->Ltag==0;q=q->LChild);succ=q;

20)return(succ);)(3)ḄᐜBiTNode*PreSucc(BiTNode*p)/*ᙠᐜ᪛PḄᐜᵨSUCCᢣ┐*/{if(p->Ltag==0)succ=p->LChild;elsesucc=p->RChild;return(succ);)(4)Ḅ()BiTNode*SuccPre(BiTNode*p)/*ᙠ᪛pḄ()ᵨpreᢣ┐*/{if(p->Ltag==1)pre=p->LChild;elsepre=p->RChild;return(pre);)6.20+,᪛ᢥ᯿/⊤1234ᑭᵨ᪘Ḅ6789ᑏ;ᐜ<ᔊ>⌴@A2ḄBC஺ூ௃VoidPreOrder(BiTreeroot)/*ᐜ<ᔊ᪛Ḅ>⌴@BC*/(lnitStack(&S);p=root;while(p!=NULL||!lsEmpty(S)){if(p!=NULL)(Visit(p->data);push(&S,p);p=p->Lchild;)else(Pop(&S,&p);p=p->RChild;))}6.26E᪛ᢥ᯿/⊤1234FᑏBCG᪛#᪛HIJᣚ஺ூ௃BC(L)Voidexchange(BiTreeroot)(p=root;if(p->LChild!=NULL||p->RChild!=NULL)

21temp=p->LChild;p->LChild=p->RChild;p->RChild=temp;exchange(p->LChild);exchange(p->RChild);))BC()Voidexchange(BiTreeroot)(p=root;if(p->LChild!=NULL||p->RChild!=NULL)(exchange(p->LChild);exchange(p->RChild);temp=p->LChild;p->LChild=p->RChild;p->RChild=temp;})NOPᫀ8.1ூRS௃58.5ூRS௃

22Jan(2)᣸WXApr,Aug,Dec,Feb,Jan,July,June,Mar,May,Nov,Oct,SepᢚqASLcc=(l+2X2+3X4+4X5)/12=37/12SU8.12ூRS௃~⊤WX0123456789102241300153461367Bᦪপ(1)(2)(2)(1)(1)(2)(6)ASLsucc=(lX4+2X3+6)/8=2ASLUNSUCC=(2+1+8+7+6+5+4+3+2+1+1)/11=40/11f87NLPLஹS⚪1.ᦪ᪀2.67ᦪ᪀Ḅ஺3.BCḄᱯឋ஺4.BCḄ¡¢£ᩖ¥஺5.ᦪ¦Ḅᭆ¨஺6.ឋ᪀>ឋ᪀Ḅ©ª஺7.☢ᔣ®¯°±²Ḅᱯ஺8.ᙠ☢ᔣ®¯°Ḅ9ᵨ9.´ᦪµ⌴Ḅ¶⌕12¸ᱯ஺10.¹®ᦪ¦Ḅᭆ¨஺ஹᑨ»⚪¼ᙠᔜ⚪¾ᑏW”ᡈ“X”Á1.ឋ᪀ÂÃᵨÄ᪀ᩭ3Æ>ឋ᪀ÂÃᵨ>Ä᪀ᩭ3Æ஺¼Á

232.BCǯ஺()3.ᙠÈɱ²(᝞CᡈPASCAL)ᢣ┐¦Í¦஺()ÎஹB$ᑡ¯ÐX=X+1Ḅ±Ñ⚣¥fbr(i=l;i<=n;i++)for(j=l;j<=i;j++)for(k=l;k<=j;k++)x=x+l;ூ௃i=l¡X1=(l+l)xl/2=(l+12)/2i=2¡Xl+2=(l+2)x஻2=(2+22)/2i=3¡XI+2+3=(1+3)x3/2=(3+32)/2i=n¡X1+2+3+....+n=(l+n)xn/2=(n+n2)/2x=x+lḄ±Ñ⚣¥WXf(n)=[(1+2+3+....+n)+(12+22+32+.....+n2)]/2=[(l+n)xn/2+n(n+l)(2n+l)/6]/2=n(n+l)(n+2)/6=n3/6+n2/2+n/3Ýᑖ±Ñ⚣¥ßBC£ᩖ¥XO(f(n))=0(n3)ஹàFᑏBCáLᐗã⚗2Pn(x)=a0+alx+a2x2+a3x3+...anxnḄåPn(xO),æBCḄçL±ÑḄ᡻Iᦪß᦮êBCḄ¡¢£ᩖ¥⌕á¡¢£ᩖ¥ëìÃíîBCïÃðᵨáñòᦪ஺óô:7⚪Ḅöᐭai(i=O,l,…,n),xßn,ö;WPn(xO)஺ùúBCḄöᐭßö;ìûᵨ$ᑡüý12þLX(1)ùÿᦪ⊤Ḅᦪ⌴஺(2)ᐰ◚⌴஺Ḅᙠ"⚪$%&'()*Ḅ+,-.ᐭ0.1ூ௃(1)ᦪ⊤Ḅᦪ⌴345ᨵ7ᵨ9ᦪ:;ᓰᵨᑁ>7ᵨ?@ABCDE,Fᢝ9ᦪᵨឋIJKឋI஺3BLM,NOPQRSᦪᨵ▲஺(2)ᐰ◚⌴3UV,MBḄWᦪXYUVᑁ>Z[%\⌴ᦪ]:Ḅ:[^ὑ39ᦪᵨឋ`aJbឋc$᝞e3ᐰ◚⌴ᦪPolyValue(){inti,n;floatx,a[],p;printfC1

24n=),);scanf("F',&n);printfC'nx')scanf("%F',&x);for(i=0;i

25ᦪ⊤Ḅᦪ⌴floatPolyValue(floata[],floatx,intn)(floatp,s;inti;p=x;s=a[O];for(i=l;i<=n;i++){s=s+a|i|*p;/*᡻ᦪ:n*/p=p*x;}return(p);)$Ḅ:[ᩖ3T(n)=O(n)ឋ⊤2.1%eWᭆ¢Ḅ£¤3ᜮᢣ┐ᜮ?✌ᐗª?஺2.2«Z3(1)ᙠ¬⊤®ᐭᡈᑤ◀+Wᐗª◤⌕´ᙳJ¶++·+ᐗªᐹ¹J¶ḄᐗªWᦪM—®ᐭᡈᑤ◀Ḅ»K__ᨵᐵ஺(2)ᙠ¬⊤¾¿ÀÁÂḄᐗªᐸᱥᳮ»K____________ÁÂ஺ᙠᓫÇ⊤¾¿ÀÁÂḄᐗªᐸᱥᳮ»K____________ÁÂ஺(3)ᙠÉᜮ?ḄÊZᓫÇ⊤ᜮ?Ḅ>Ë»KᵫᢣÍ✌ᐗª?Ḅ>Ë»Kᵫ____________ᢣÍ◀✌ᐗª?᜜ᐸÏÐ+ᐗª?Ḅ>Ë»Kᵫ—ᐸÑÒÓÔḄnextÕ—ᢣÍ஺2.3Ö×LÙÚ⊤ᜮ?ḄᓫÇ⊤PP?Û;Ù✌ᐗª?Ü;ÙÝᐗª?஺ᢥ⌕ßXeᑡáâ⌱äᔠ〉Ḅáâᑡ஺a.ᙠP?A®ᐭS?ḄáâᑡÙ3_(4)ஹ(1)_ob.ᙠP?Ó®ᐭS?ḄáâᑡÙ3(7)ஹ(11)ஹ(8)ஹ(4)ஹ(Doc.ᙠ⊤✌®ᐭS?ḄáâᑡÙ3(5)ஹ(12)஺d.ᙠ⊤Ý®ᐭS?ḄáâᑡÙ3(11)ஹ(9)ஹ(1),(6)oò⌱äḄáâᨵ3(1)P->next=S;(2)P->next=P->next->next;(3)P->next=S->next;(4)S->next=P->next;(5)S->next=L;(6)S->next=NULL;(7)Q=P;(8)while(P->next!=Q)P=P->next;(9)while(P->next!=NULL)P=P->next;(10)P=Q;(11)P=L;(12)L=S;(13)L=P;2.4Ö×ឋ⊤L⌴ûᨵ஺ᑏ+$ýX®ᐭᑮLḄ〉ᢝឋ⊤LḄᨵឋ஺StatusInsert_SqList(SqList&va,intx)஻%x&ᐭ⌴)ᨵ⊤va*{if(va.length+1>va.listsize)returnERROR;va.length++;for(i=va.length-l;va.elem[i]>x&&i>=0;i—)va.elem[i+l]=va.elem[i];

26va.elem[i+l]=x;return103fOK;}//Insert_SqList2.5ᑏBCDEF⊤*ᑤ◀IJiKᐗMNOḄkKᐗM஺[PQ]:STUViWkḄᔠDឋ஺(YZ[\“^_”ஹ“b_”)ீdD1ுfghᐗMi᪗m(“b_k”)l*mnCogᐭ(“^_k”)pfor(m=i-1+k;m<=L->last;m++)L->elem[m—k]=L->elem[m];ீdD2>qrfghᐗMi᪗mWogᐭjl*mpீdD2ுogᐭjl*mnCfghᐗMi᪗p2.6stឋ⊤*ḄᐗM(᦮ᦪ)w⌴)ᨵ᣸ᑡzᓫ|⊤}~᪀஺ᑏBᦔCDᑤ◀⊤*ᡠᨵᜧminkmaxkḄᐗM(⊤*~ᙠ᪵ḄᐗM)ᑖ᪆ḄCDḄrᩖ(STpminkWmaxkḄKḄwlTḄ᦮ᦪ)஺StatusDelete_Between(Linklist&L,intmink,intmaxk)஻◀ᐗM⌴)᣸ᑡḄ|⊤L*wᜧmink.maxkḄᡠᨵᐗM(p=L;while(p->next->data<=mink)p=p->next;//pᨬ¢BK£ᜧminkḄᐗMif(p->next)஻᝞¥¦ᨵ§mink¨ᜧḄᐗM(q=p->next;while(q->datanext;஻qJBK£maxkḄᐗMp->next=q;)}//Delete_Between2.7ᑖ©£qḄ~᪀ª«ឋ⊤Ḅ¬ᙢ⌮CDᓽᙠ°⊤Ḅ~±²ឋ⊤(al,a2...,an)⌮l(an,al)o(1)B³ᦪ´}~᪀µឋ⊤~a(l:arrsize)Ḅ¶elenumKᑖ*஺(2)ᓫ|⊤}~᪀஺[dD1]:ᙠ°ᜮ¸¢¹^ᜮ&Bº[dD2]:»µ¼Kq½ghḄᢣ┐p,q,r,²qḄ¢Àrᦋlp2.8ᎷµKᢥᐗMw⌴)ᨵ᣸ᑡḄឋ⊤AWB,ᙳᓫ|⊤}l~᪀ÅÆᑏCD²A⊤WB⊤ÇzᡂBKᢥᐗMw⌴ÉᨵḄ᣸ᑡḄឋ⊤C,z⌕Ëᑭᵨ°⊤(ᓽA⊤WB⊤Ḅ)¸±~Î⊤C.[PQ]:P.28Ï2-1voidmerge(LinkListA;LinkListB;LinkList*C)pa=A—>next;pb=B—>next;*C=A;(*C)->next=NULL;while(pa!=NULL&&pb;=NULL){if(pa—>data<=pb—>data){smaller=pa;pa=pa—>next;smaller—>next=(*C)—>next;/*ᜮ&D*/

27(*C)—>next=smaller;else{smaller=pb;pb=pb—>next;smaller—>next=(*C)—>next;(*C)—>next=smaller;)while(pa!=NULL){smaller=pa;pa=pa—>next;smaller—>next=(*C)—>next;(*C)—>next=smaller;)while(pb!=NULL){smaller=pb;pb=pb—>next;smaller—>next=(*C)->next;(*C)—>next=smaller;)LinkListmerge(LinkListA;LinkListB){……LinkListCÔpa=A->next;pb=B—>next;C=A;C—>next=NULL;returnC;while(pallpb)(if(pa->datadatall!pb)(pc=pa;q=pa->next;pa->next=pre;pa=q;//^AḄᐗM&ᐭ^⊤)else(pc=pb;q=pb->next;pb->next=pre;pb=q;//^BḄᐗM&ᐭ^⊤)pre=pc;)C=A;A->next=pc;஻᪀⌼^⊤ᜮ}//reverse_mergeᑖ᪆:Ö×DḄØÙᢥEᑮᜧḄFÛÜ%AWBḄᐗM&ᐭ^⊤ḄᜮÝpcᜐ,ᨬ¢ᜐᳮAᡈBḄᒕâᐗM.2.9ᎷµᨵBKãä|⊤Ḅåᜧ1,⊤*æçᜮ¸èçᜮᢣ┐஺stslᢣᔣ|⊤êK¸Ḅᢣ┐ÆᑏCDᙠ|⊤*ᑤ◀ᢣ┐sᡠᢣ¸Ḅ¶ë¸஺ìPQí:µᢣ┐PᢣᔣS¸Ḅ¶ëḄ¶ëᑣPïSᨵðᐵòóStatusDelete_Pre(CiLNode*s)஻ᑤ◀ᓫãä|⊤*¸sḄôõ¶ö(P=sÔwhile(p->next->next!=s)p=p->next;஻÷ᑮsḄ¶öḄ¶öpp->next=s;

28returnOK;}//Delete_Pre2.10stᨵᓫ|⊤⊤QḄឋ⊤*øᨵ¼ùúûḄᦪüᐗM(᝞úýúûஹᦪúúûWᐸúû)ÆᑏCDᩭ᪀⌼⊤⊤Ḅឋ⊤⊤Ḅ,ᑭᵨ⊤Ḅ!"#⊤Ḅᜮ%&'஺StatusLinkList_Divide(LinkList&L,CiList&A,CiList&B,CiList&C)஻*ᓫ⊤LḄᐗ.ᢥ0ᑖ"2⊤.CiList"3ᜮḄᓫ⊤0.(s=L->next;A=(CiList*)malloc(sizeof(CiLNode));p=A;B=(CiList*)malloc(sizeof(CiLNode));q=B;C=(CiList*)malloc(sizeof(CiLNode));r=C;஻56ᜮwhile(s)(if(isalphabet(s->data))(p->next=s;p=s;)elseif(isdigit(s->data))(q->next=s;q=s;)else{r->next=s;r=s;)}//whilep->next=A;q->next=B;r->next=C;}//LinkList_Divide2.117ឋ⊤A=(al,B=(bl,b2,...,bn),8ᑏᢥ:ᑡ<ᑣᔠ?AஹB"ឋ⊤CḄABCDC=(al,bl,...,am,bm,bm+1,...,bn)EmnF஺ឋ⊤AஹBஹCᙳᓫ⊤!"KLM103fN᫱P⊤ᑭᵨA⊤QB⊤Ḅ᪀ᡂ஺STDᓫ⊤ḄUVWmQnᙳXYZKL஺[\]:voidmerge(LinkListA;LinkListB;LinkList*C)ᡈDLinkListmerge(LinkListA;LinkListB)voidmerge1(LinkList&A,LinkList&B,LinkList&C)஻*⊤AQBᔠ?"C,AQBḄᐗ.◞᣸ᑡᵨKL(p=A->next;q=B->next;C=A;while(p&&q)(s=p->next;p->next=q;//^BḄᐗ.aᐭif(s){t=q->next;q->next=s;///illAcdAḄᐗ.aᐭp=s;q=t;

29}//while}//merge12.12dᵨ⊤⊤Ḅefg⚗Zᑖiᡂjg⚗Z#jg⚗Zᔜlm᜻o⚗ᡈᏔo⚗?⌕rᑭᵨ⊤Ḅᩭ᪀ᡂ#j⊤஺[\]:Stᵨᜮᢣ┐wxyᢣ┐஺voidDivide_LinkedPoly(LinkedPoly&L,&A,&B)஻*⊤KLḄefg⚗ZLzᡂ᜻o⚗ḄAQᏔo⚗ḄB(p=L->next;A=(PolyNode*)malloc(sizeof(PolyNode));B=(PolyNode*)malloc(sizeof(PolyNode));pa=A;pb=B;while(p!=L)(if(p->data.exp!=2*(p->data.exp/2))(pa->next=p;pa=p;}else(pb->next=p;pb=p;}p=p->next;}//whilepa->next=A;pb->next=B;}//Divide_LinkedPoly2.13563ᜮḄឋ⊤ᵨK{|ᐭḄ}~ᑴᦪ⊤ḄdataK{•}~ᑴ஺?ᙠ⊤}~ᑴᦪ1ḄA஺[\]:%d{ᙠ☢஺2.147g⚗ZP(x)ᵨᡠBKL஺ᑏABḄxWrP(x)ḄW஺[\]:floatPolyValue(Polylistp;floatx){........}᪘Qᑡ1.ᢥ3.1(b)ᡠ⍝(j⍝ᙳ"ᓫᔣ¢£⍝)~¢¥¦§V¨©Dপ᝞~¬Ḅ¥¦ᑡ"123,ᑣ%®CᑮḄ°¬¥¦ᑡx±²Mফ᝞~¬Ḅ¥¦ᑡ"123456,®ᔲCᑮ435612Q135426Ḅ°¬ᑡ,?µt¶.(ᓽᑏ°“S”⊤~᪘ஹ“X”⊤°᪘Ḅ᪘¸!ᑡ)஺ூi©௃(1)%®CᑮḄ°¬¥¦ᑡxD123ஹ132ஹ213ஹ231ஹ321,ফ»®Cᑮ435612Ḅ°¬ᑡ஺¶"ᨵSপSফSবS(4)X(4)XবSমX(5)S(6)SযFᢥ᯿“Â~ᐜ°”Ḅᑣ°᪘ḄÅÆÇ"XফXপ஺®Cᑮ135426Ḅ°¬ᑡ஺¶"ᨵS(1)X(1)S(2)S(3)X(3)S(4)S(5)X(5)X(4)X(2)X(1)஺2.7ᑡᨵAஹBஹCஹDஹE#5ᐗ.ᐸ✌ᐗ."A஺᝞Ê#ᑡËÌ᡻¢:ᑡ4θ!D(1)|°✌ᐗ.G(2)*✌ᐗ.WaᐭᑮyG(3)ᑤ◀✌ᐗ.G(4)Ñoᑤ◀✌ᐗ.஺Òᑮᑡᡂ"ᑡ"Óᑣxᔲ%®Cᑮ|°ᑡD

30(1)AஹCஹEஹCஹC(2)AஹCஹE(3)AஹCஹEஹCஹCஹC(4)AஹCஹEஹC[\Ô]DAஹBஹCஹDஹE(|°✌ᐗ.A)AஹBஹCஹDஹEஹA(*✌ᐗ.Aaᐭᑮy)BஹCஹDஹEஹA(ᑤ◀✌ᐗ.A)CஹDஹEஹA(Ñoᑤ◀✌ᐗ.B)CஹDஹEஹA(|°✌ᐗ.C)CஹDஹEஹAஹC(*✌ᐗ.Caᐭᑮy)DஹEஹAஹC(ᑤ◀✌ᐗ.C)EஹAஹC(Ñoᑤ◀✌ᐗ.D)3.°᪘ḄjÕKL᪀ÖZ×Øᙠ#jÕ᪘ḄKL᪀᝞ÙᑨÛ᪘Ü᪘ÝM4.ᢥ᯿ÞᑣAஹßஹàஹ◀Q'âA(T)ãᐜᐵåḄæçè°:ᑡAé⊤êZrWF¸!ᦪ᪘QA᪘ḄëᓄíîDA-B*C/D+EfFூ௃5.8ᑏABᑨïðoñᐭḄ@"óḄôᑡxᔲ"Ö᝞ᑡ1&ᑡ2,õZḄᑡ஺ᐸᑡ1Qᑡ2ö»&÷ᑡ2xᑡ1Ḅ⌮ᑡ஺ç᝞'a+b&b+axùúõZḄᑡû1+3&3—1ᑣ»x஺ü]D(1)ýñýᐭ᪘Òᑮ&(2)ýñý°᪘ýÿᑮ……intlsReverse()஻ᑨᐭḄ&&ᑖᔲ⌮ᑣ1,ᔲᑣ0(InitStack(s);while((e=getchar())!='&')push(s,e);while((e=getchar())!='@'){if(StackEmpty(s))return0;pop(s.c);if(e!=c)return0;)if(IStackEmpty(s))return0;return1;)//IsReverse6.Ꮇ⊤!"ᵫᓫ%&'()*ᑣ+,,᪀ᡂ஺0ᑏ23,4523678ᑏ9"(:);8ᑏ<=Ḅ⊤!">ᣚ⌮@ᐲ"(:)஺voidNiBoLan(char*str,char*new)஻B:⊤!"str>ᣚᡂ⌮@ᐲ"new{p=str;q=new;஻EFGHstrḄIJKLMNOᐜQᨬSḄᱯUVInitStack(s);஻s+,᪘while(*p)(if(*p%))*q++=*p;஻XYelsec=gettop(s);

31if(*pOᐜQZc[)push(s,*p);else(while(gettop(s)OᐜQ\Z*pS)(pop(s,c);*(q++)=c;}//whilepush(s,*p);஻+,ᙠ᪘ᑁ⍳ab103f⏗d^ᶂghờjᾯb}//else}//elseP++l}//while}//NiBoLan஻mHnopᳮᦟᩞ7.ᎷtuᜮwxḄayz⊤⊤{|ᑡ~23ᢣ┐ᢣᔣ|ᐗwx(\ᜮᢣ┐)0nᑏḄ|ᑡᓄஹᐭ|ᑡY|ᑡḄ,4஺voidInitCiQueue(CiQueue&Q)஻ᓄayz⊤⊤{Ḅ|ᑡQ(Q=(CiLNode*)malloc(sizeof(CiLNode));Q->next=Q;}//InitCiQueuevoidEnCiQueue(CiQueue&Q,intx)஻Bᐗxᐭayz⊤⊤{Ḅ|ᑡQ,Qᢣᔣ|ᐗ,Q->nextᢣᔣᜮwx,Q->next->nextᢣᔣ|ᜮᐗ(p=(CiLNode*)malloc(sizeof(CiLNode));p->data=x;p>next=Q->next;஻XBpLᙠQḄ☢Q->next=p;Q=pl஻ᦋᢣ┐)StatusDeCiQueue(CiQueue&Q,intx)஻ayz⊤⊤{Ḅ|ᑡQᜮᑤ◀ᐗx(if(Q==Q->next)returnINFEASIBLE;஻|ᑡp=Q->next->next;x=p->data;Q->next->next=p->next;free(p);returnOK;}//DeCiQueue8.⌕ay|ᑡ\ᜫ23ᐰKᑮᑭᵨ£•3᪗¦§tag,ttag0ᡈ1ᩭªᑖᜮᢣ┐«¬Ḅ|ᑡ᝱Ḅ¯°±nᑏ²³w᪀Ḅᐭ|²Y|,4஺´µ\¶:᝱¸front=0,rear==0,tag==O|ᩩº¸front=rear,tag==O|°ᩩº¸front=rear,tag==1ᐸ¼᝱¸front!=rear,tag==O(ᡈ1ஹ2)ᐭ|½¾¸...(ᐭ|)if(front==rear)tag=ll(ᡈXtag=l)

32Y|½¾:…(Y|)tag=Ol[Á⚪]:᝞ÅÆ=ªᑖ|ஹ|°ஹÇÇ°ÈÉÊËb9.ÌÍtÎ,4ḄÏ(ᐸ᪘|ᑡḄᐗÐÑᙳint)¸(1)voidproc_l(StackS){inti,n,A[255];n=0;while(!EmptyStack(S)){n++;Pop(&S,&A[n]);}for(i=l;i<=n;i++)Push(&S,A[i]);)5᪘s⌮Ó஺(2)voidproc_2(StackS,inte){StackT;intd;InitStack(&T);while(!EmptyStack(S)){Pop(&S,&d);if(d!=e)Push(&T,d);)while(!EmptyStack(T)){Pop(&T,&d);Push(&S,d);ᑤ◀᪘SᡠᨵÖ×eḄᐗ஺(3)voidproc_3(Queue*Q){StackS;intd;InitStack(&S);while(!EmptyQueue(*Q))(DeleteQueue(Q,&d);Push(&S,d);)while(!EmptyStack(S)){Pop(&S,&d);EnterQueue(Q,d)5|ᑡQ⌮Ó஺Ø*Ù1.s='IAMASTUDENT\t='GOODq=?WORKERSÚYÎᑡ½¾ḄwÛ:StrLength(s);SubString(subl,s,l,7);SubString(sub2,s,7,1);StrIndex(slA;4);StrReplace(s/STUDENT\q);StrCat(StrCat(subl,t),StrCat(sub2,q));[mὃÝᫀ]StrLength(s)=14;SubString(subl,s,1,7)subl='IAMASubString(sub2,s,7,l)sub2='StrIndex(s,4,A,)=6;StrReplace(slSTUDENT\q);s='IAMAWORKER';

33StrCat(StrCat(subl,t),StrCat(sub2,q))subl=?IAMAGOODWORKER'஺2.nᑏ,4ßàḄáâ½¾StrReplace(S,T,V)஺StrCat(S,T)lSubString(Sub,S,posJen)ointString_Replace(Stringtype&S,StringtypeT,StringtypeV);஻5SᡠᨵãTäᣚV,~£ᣚåᦪ(for(n=0,i=lli<=S[0]-T[0]+1;i++)(for(j=i,k=l;T[k]&&S|jl==T[k];j++,k++);if(k>T[O])஻çᑮN²TᓛéḄã:ᑖÈÉÊËᜐᳮ(if(T[0]==V[0])for(l=l;l<=T[0];l++)஻ëãìí²p㫬:XäᣚS[i+M]=V[l];elseif(T[O]vVî)஻ëãìíᜧ×pã¬ð5ᨵñ(for(l=S[0];l>=i+T[0];l-)S[l+V[0]-T[0]]=S[l];for(l=l;l<=V[0];l++)S[i+l-l]=V[l];)else//ëãìíò×pã¬:ᐜ5óñ(for(l=i+V[0];l<=S[0]+V[0]-T[0];l++)S[l]=SD-V[0]+T[0]];for(l=l;l<=V[0];l++)S[i+l-l]=V[l];)S[0]=S[0]-T[0]+V[0];i+=V[0];n++;}//if}//forreturnn;}//String_Replace3.Ꮇtᙽzw᪀⊤{ᙽḄᜧò1,▬ᜮwx஺0nᑏ,4ßàḄÎᑡáâ½¾¸StrAsign(S,chars)lStrCopy(S,T)lStrCompare(S,T)lStrLength(S)lStrCat(S,T)lSubString(Sub,S,pos,len)஺[öÆ]:ᵨᓫz⊤ßà஺StrAsign(S,chars)lStrCopy(S,T)¸StrCompare(S,T)lStrLength(S)ltypedefstruct{charch;LStrNode*next;}LStrNode,*LString;஻zw᪀voidStringAssign(LString&s,LStringt)஻Bt÷øÚs(s=malloc(sizeof(LStrNode));fbr(q=s,p=t->next;p;p=p->next)(r=(LStrNode*)mallo103fc(sizeof(LStrNode));r->ch=p->ch;

34q->next=r;q=r;)q->next=NULL;}//StringAssignvoidStringCopy(LString&s,LStringt)஻Btùᑴs.²23ûÓḄªüᙠ×sýþᙠ.(for(p=s->next,q=t->next;p&&q;p=p->next,q=q->next)(p->ch=q->ch;pre=p;)while(q)(p=(LStrNode*)malloc(sizeof(LStrNode));p->ch=q->ch;pre->next=p;pre=p;)p->next=NULL;}//StringCopycharStringCompare(LStrings,LStringt)஻ḄZ,s>t¬<ᦪ,s=t¬O,snext,q=t->next;p&&q&&p->ch==q->ch;p=p->next,q=q->next);if(!p&&!q)return0;elseif(!p)return-(q->ch);elseif(!q)returnp->ch;elsereturnp->ch-q->ch;}//StringCompareintStringLen(LStrings)஻sḄ(ᐗᦪ)(fbr(i=O,p=s->next;p;p=p->next,i++);returni;}//StringLenLString*Concat(LStrings,LStringt)஻stᡂᢣ┐(p=malloc(sizeof(LStrNode));for(q=p,r=s->next;r;r=r->next)(q->next=(LStrNode*)malloc(sizeof(LStrNode));q=q->next;q->ch=r->ch;}஻for஻ᑴsfbr(r=t->next;r;r=r->next)(q->next=(LStrNode*)malloc(sizeof(LStrNode));q=q->next;q->ch=r->ch;}஻for஻ᑴtq->next=NULL;returnp;}//ConcatLString*Sub_String(LStrings,intstart,intlen)஻ᐸsstart!"#$lenḄ%{p=malloc(sizeof(LStrNode));q=p;for(r=s;start;start-,r=r->next);஻&ᑮstartᡠ)*Ḅ+,ᢣ┐rfbr(i=1;i<=len;i++,r=r->next)

35q->next=(LStrNode*)malloc(sizeof(LStrNode));q=q->next;q->ch=r->ch;}஻ᑴtq->next=NULL;returnp;}//Sub_String4../012)34Ḅ567889:;<=<:>%:;<Ḅ?@;<Ḅ஺charStrCompare(Stringtypes,Stringtypet)஻ḄBC,s>tEFᦪ,s=tEO,svtEGᦪ(for(i=1;i<=s[O]&&i<=t[O]&&s[i]=t[i];i++);if(i>s[O]&&i>t[O])return0;elseif(i>s[0])return-t[i];elseif(i>t|0])returns[i];elsereturns[i]-t[i];}//StrCompare5.HI7S="(xyz)*",T="(x+z)*y"஺Jᑭᵨὶஹ%"ᣚPQRSSᣚ$T.intHString_Replace(HString&S,HStringT,HStringV)஻ᚮ+᪀VḄ"ᣚPQ,"ᣚWᦪ(for(n=0,i=0;i<=S.length-T.length;i++)(forG=i,k=0;k=i+T.length;l—)S.ch[l+V.length-T.length]=S.ch[l];for(l=0;l

36[Ḅ%⌮"஺7.Sqᵨ+,ᜧo$4Ḅᓫs⊤uvḄᑖ6ᑏz{ᙠk@kᐭT,k@ᑤ◀len@஺01z{ᵨ78.ᑏ1ᑡz{7(1)Rr|ᡠᨵ$chiḄ@ᣚᡂch2Ḅ@஺(2)Rr|ᡠᨵ@ᢥ᯿eḄWuᙠr|஺(3)r|ᑤ◀ᐸchḄᡠᨵ@஺(4)rl|index@#✌WYr2efḄ%Ḅ#!"஺(5)r|ᑤ◀ᡠᨵYrlefḄ%஺9.ᑏᦪRsi|Ḅi@ᑮj@Ḅ@ᵨs2hᣚ஺7(1)ᵨ☟᝱(2)ᐜn!kᑴ10.ᑏz{Ḅ¡PQStrCompare(s,t)஺11.ᑏz{Ḅ¡PQSlrReplace(&s,t,v)஺:(1)¢hᣚ%!(e£9⚪|i)(2)¢hᣚ%k☢Ḅ@pnᡈmn($hᣚ%§ᜓ©)(3)hᣚ%ᐭª(ᑴ)(4)«V/gᑮ……⚪1.ஹHIST,J001w_®¯ᑏz{°ᡠᨵᒹ²ᙠS|³´ᒹ²ᙠT|Ḅ@᪀ᡂḄR0R|2@ᙠS|WḄ!"஺(1)ᑭᵨCONCATஹLE103fNஹSUBEQUALµ_¡¶zᩭ஺(2)0Q$uv+᪀ᩭ஺voidString_Subtract(Stringtypes,Stringtypet,Stringtype&r)஻ᡠᨵᒹ²ᙠs|³t|¸ᨵḄ@᪀ᡂḄr{StrAssign(r,");for(i=1;i<=Strlen(s);i++)(StrAssign(c,SubString(s,i,1)):for(j=l;jStrlen(t))StrAssign(r,Concat(r,c));}}//for}//String_Subtract½¾ᦪ¿ÀÁ⊤1.Ꮇxᨵ6Ã8ᑡḄÄÅᦪ¿A,2ᐗᓰᵨ6@⁚uvᘤᢥ@⁚ᙬ஺HIAḄᙢᙬ$1000,yz7(1)ᦪ¿AᐳᓰᵨÌÍ@⁚:(288)(2)ᦪ¿AḄᨬkᐗḄᙢᙬ:(1282)(3)ᢥÃuvEᐗA36Ḅᙢᙬ:(1126)(4)ᢥᑡuvEᐗA36Ḅᙢᙬ:(1192)

37[ÐÑ]:¡¾ÓÁᦪ¿Ḅ1᪗1Õ஺2.xᨵ^)Ö×▣(aij)nxn,Rᐸ^ᩩ)ÖÚVḄᐗ⌲Ãᙢuᦪ¿B(l:3n-2)|Ü°B[k]=aij,7(1)ᵨi,j⊤kḄ1᪗;ᣚݯ:(2)ᵨk⊤i,jḄ1᪗;ᣚݯ஺i=k/3+1,j=k%3+i-1=k%3+k/3i=k/3+1,j=k-2x(k/3)3.ᎷxÞß×▣ABᙳ0^ᐗ¿⊤Q$uv+᪀஺Jᑏ×▣eáḄz{âx^ᐗ¿⊤Cu+ã×▣஺voidTSMatrix_Add(TSMatrixA,TSMatrixB.TSMatrix&C)஻^ᐗ¿⊤ḄÞß×▣á{(C.mu=A.mu;C.nu=A.nu;C.tu=O;pa=l;pb=l;pc=l;for(x=l;xv=A.mu;x++)஻)×▣Ḅ2-ÃåÃá{(while(A.data[pa].iB.data[pb].j)(C.data|pc].i=x;C.data[pc].j=B.data[pb].j;C.data[pc].e=B.data[pb].e;pb++;pc++;)else(C.data[pc].i=x;C.data[pc].j=A.data[pa].j;C.data[pc].e=A.data[pa].epa++;pc++;)}//whilewhile(A.data[pa]==x)//ᐭA|ᒕèḄᐗ(xÃ)(C.data[pc].i=x;C.data[pc].j=A.data[pa].j;C.data[pc].e=A.data[pa].epa++;pc++;while(B.data[pb]==x)//JffiAB|ᒕèḄᐗ(xÃ)

38C.data[pc|.i=x;C.data[pc].j=B.data[pbl.j;C.data[pc].e=B.data[pb].e;pb++;pc++;}}//forC.tu=pc;}//TSMatrix_Add4.ᙠÞß×▣ḄéêS"z{5.2|Ryzposition[col]Ḅ®{ëáᦋíÜz{îᓰᵨïðᔣ<8஺5.ᑏ-ᙠᓝ@s⊤|ᑤ◀óôᐗaijḄz{஺[]:“ᑤ◀”wW÷W஺6.ø1☢ÀÁ⊤Ḅw_uv+᪀ù7((((a),b)),(((),d),(e,f)))7.1ᑡÀÁ⊤¶zḄ+ã7(1)HEAD[((a,b),(c,d))];(2)TAIL[((a.b),(c,d))];(3)TAIL[HEAD[((a,b),(c,d))]];(4)HEAD[TAIL[HEAD[((a,b),(c,d))]]];b(5)TAIL[HEAD[TAIL[((a,b),(c,d))]]];(d)⚪ú×▣Amxn|ḄûᐗaijqiÃ|ḄᨬofEüqjᑡ|Ḅᨬᜧᑣþÿᐗ▣Ḅ஺Ꮇᦪ▣ᑏ▣Ḅᡠᨵ஺voidGet_Saddle(intA[m|[n])஻▣AḄ(for(i=0;i

39A[%d|[%d]=%d",i,j,A|i||j])0)}//for}//Get_Saddle123ᦪ45᪛1.ᑖ89ᐹᨵ3;Ḅ᪛43;Ḅ5᪛Ḅᡠᨵ<=>᝱஺2.@⚪1ᡠBᔜD>᝱Ḅ5᪛ᑖ8ᑏEFஹF4HFIᔊḄFᑡ஺3.LMNOkḄ᪛ᨵnlO1Ḅ;n2O2Ḅ;……nkOkḄ;ᑣ᪛ᨵRSTU;VWXYZ:\ὃP.H6ឋ_3n=nO+nl+.........+nkB=n1+2n2+3n3+.........+knkn=B+1:.nO+nl+.........+nk=nl+2n2+3n3+.........+knk+1

40nO=n2+2n3+.......+(k-l)nk+14.ᎷN5᪛ḄᐜFFᑡEBADCFHGIKJ,FFV103f>bBCDEFGHIJK,c95᪛஺WXYZ:\ὃP.1486.LM5᪛ᨵ50TU;ᑣ5᪛Ḅd;ᦪeSfᨵRSVWXYZ:TU;d;ᦪeRᨵRSVghi•O;஺7.klmnᑡᩩpḄᡠᨵ5᪛qa)EF4Fr=b)F4HFr=c)EF4HFr=WXYZ:st=஺a)DLRuLDRḄr=qDR,᝞wxL,ᑣyᐰr=᝞wxLR,…஺b)LDRuLRDḄr=qLD,᝞wxR,ᑣyᐰr=஺c)DLRuLRDḄr=qD,᝞wxLR,ᑣyᐰr=஺(᝞wsD,ᑣ{᪛)7.n;ḄK5᪛|ᵨᐹᨵkchild~Ḅ;᪛Ḅ;ᑣ{ḄChild~ᨵRSVWXYZ:\ὃP.H98.9unᑡLMFᑡ@fḄ᪛Tq᪛Ḅᐜ᪷FFᑡGFKDAIEBCHJ0᪛ḄH᪷FFᑡDIAEKFCJHBG,WXYZ:(1)ᐜ9@fḄ5᪛(2)᪛ḄH᪷Fᑡu@f5᪛ḄFFᑡr=9.ᎷᵨḄᵯᦻᵫ8ᡂᙠᵯᦻḄ⚣᳛ᑖ8q0.07,0.19,0.02,0.06,0.32,0.03,0.21,0.10(1)c*8ṹ(2)ᙳṹO஺10.LM5᪛ᵨ5⊤⌕5᪛TḄHFFᑡḄ1;Ḅᢣ┐.ᔲg<ᵨ⌴¤¥<ᵨ᪘ᩭyᡂ?c©ª«¬.WXYZ:xUḄ“¯n°”11.94nᑡ᪛@fḄ5᪛q12.LM5᪛ᢥ᯿5⊤´µᑏ5᪛TU;Ḅᦪ¶஺13.ᑏ⌴¤q@5᪛·ᐗ'xḄ;ᑤs¹᪷ḄU᪛º»rfḄ{¼஺WXYZ:W´1q(1)ᢥᐜF½¾0(2)¿E½ÀU;(3)ᢥHF»0voidDelSubTree(BiTree*bt,DataTypex)(if(*bt!=NULL&&(*bt)->data==x){FreeTree(*bt);*bt=NULL;)elseDelTree(*bt,x)voidDelTree(BiTreebt,DataTypex){if(bt)

41{if(bt->LChild&&bt->LChild->data==x){FreeTree(bt->LChild);bt->LChild=NULL;if(bt->RChiId&&bt->RChild->data==x){FreeTree(bt->RChild);bt->RChild=NULL;DelTreebt->LChild,x;DelTreebt->RChild,x;}W´2q1ᐜF½¾0Á2ÂýÀÄE᪷;Á3ᵨᢣ┐\ᦪ0W´3q1ᐜF½¾0Á2ÂýÀÄE᪷;Á3ÅÆᦪ'ᑤ◀H;w0Á\YÈÉFÊ14.ᑖ8ᑏÆᦪyᡂqᙠᐜFËÌ5᪛T½¾kÍ;*pᙠᐜFFᑡḄHÏ஺ᙠHFËÌ5᪛T½¾kÍ;*pᙠHFFᑡḄEÐ஺WXYZ:Á1ᐜ½ÀËÌxËÌÑᵨn☢ÓÔqÁ2;*pᙠᐜFFᑡḄHÏᐸ¯UᡈU03;*pᙠHFFᑡḄEÐ×.ᐸ¯UᡈU஺15.ᑖ8ᑏØᙠFËÌ5᪛½¾kÍ;*pᙠFFᑡḄEÐuHÏ஺Á\È⚪Ê16.ᑏ@NÙU-ᐘÜ⊤⊤YḄ᪛ÝᐸTUḄᦪ஺WXYZ:Á1ÊgÞÙU-ᐘÜ⊤ᑜᑖ᪷ஹ✌U᪛ஹᐘÜ᪛⌴¤ᜐᳮ஺Á2gᑭᵨ'ᡈᐰäåæ஺17.@ÙU-ᐘÜ⊤⊤YḄ᪛ᑏ᪛ḄçOḄ஺18.LM5᪛ᢥ᯿5⊤´µ,ᑭᵨ᪘ḄéêëìᑏHFIᔊí⌴¤Ḅ஺Á\îêÊ19.5᪛ᢥ5⊤ᑏᑨ8N5᪛.ᔲ.Nïᑣ5᪛஺ïᑣ5᪛.ᢣqᙠ5᪛<ᙠU᪛ᦪ1Ḅ;஺WXYZ:gᑭᵨðñ⌴¤ஹí⌴¤Iᔊ஺20.5᪛ᨬᜧóOḄ஺5᪛ḄᨬᜧóO.ᢣq5᪛ᡠᨵô;ᦪḄᨬᜧ'஺WXYZ:W´Z:1ᑭᵨõᑡö'᪷Á2õºÞ¯ஹUᐭõÂᑮõ{3ùú·ôᨬH;ᙠõḄûüÁ41iôᨬH;ḄUý.1i+1ôḄᨬH;511ôᨬH--;ᙠõḄûü0W´Z:ᑭᵨôþ4ᐰäᦪðÿᔊஹ21.᪛ᢥ᯿⊤ᑭᵨ᪘Ḅᑏᐜᔊ!⌴#$Ḅ%&஺

4222.()*+,-.᪛Ḅ/ᑡ12ᑡ34-5,6.᪛.7+,-.᪛Ḅ8ᑡ12ᑡ34-5,6.᪛723.᪛ᢥ᯿⊤9ᑏ%&:᪛;<=᪛>?@ᣚ஺BCDE7.1᝞EᡠHḄᨵᔣEK+LEḄ*(1)OP⚔RḄᐭTஹT7(2)UVW▣7(3)UV⊤7(4)⌮UV⊤7(5)ᓝ[⊤7(6)\]^ᑖ`஺7.2᝞EᡠHḄaᔣEK+LEḄ*(1)UVbc⊤7(⌕eOPfgR2B-P⚔RhijBP⚔RhkOP⚔RḄᔜUVfḄVmnoᡠUVᑮḄ⚔RhᵫiᑮᜧḄm஺)(2)s⚔R1tuvTwᐜᔊLEᡠx⚔RᑡyfḄᑡ7(+vTwᐜz{᪛)(3)s⚔R1tu|TwᐜᔊLEᡠx⚔RᑡyfḄᑡ஺(+|Twᐜz{᪛)7.3᝞E7.31ᡠHḄAOE-}~e*(1)OPḄᨬyᨬ7(2)OP103fḄᨬtuyᨬtu7(3)+ᐵ஺7.4᝞E7.30ᡠHḄᨵᔣ}~ᑭᵨDijkstra%&e⚔R1ᑮᐸ⚔RḄᨬ+%&᡻?2ᔜḄ᝱஺7.59ᑏ%&ᵫᐭḄ⚔RᦪஹḄᦪஹᔜ⚔RḄyᔜᩩḄ¡¢ᨵᔣEḄUV⊤஺StatusBuild_AdjList(ALGraph&G)஻ᐭᨵᔣEḄ⚔Rᦪfᦪ⚔RyfḄ¡¢UV⊤{InitALGraph(G);scanf(,,%d',,&v);if(v<0)returnERROR;஻⚔Rᦪ¤¥n¦Gvexnum=v;scanf(,,%d,,,&a);if(a<0)returnERROR;஻fᦪ¤¥n¦Garcnum=a;fbr(m=0;m

43for(q=Gvertices[i].firstarc;q->nextarc;q=q->nextarc);q->nextarc=p;)p->adjvex=j;p->nextarc=NULL;)//whilereturnOK;}//Build_A(ljList7.6~ᙠUVW▣g᪀²³´EḄ*InsertVertex(Gv);InsertArc(G,v,w);DeleteVertex(Gv)yDeleteArc(Gv,w)஺஻⚪2ḄEGᙳnᨵᔣaᩗEᐸ¸¹º᧕ᵫ¼ᑏStatusInsert_Vex(MGraph&Gcharv)//ᙠUVW▣⊤HḄEG²½ᐭ⚔Rv(if(Gvexnum+l)>MAX_VERTEX_NUMreturnINFEASIBLE;Gvexs[++Gvexnum]=v;returnOK;}//Insert_VexStatusInsert_Arc(MGraph&Qcharv,charw)஻ᙠUVW▣⊤HḄEG²½ᐭf(v,w)(if((i=LocateVex(Qv))<0)returnERROR;if((j=LocateVex(Gw))<0)returnERROR;if(i==j)returnERROR;if(!Garcs[i][j].adj)(Garcs[i][j].adj=l;Garcnum++;)returnOK;}//Insert_ArcStatusDelete_Vex(MGraph&Gcharv)஻ᙠUVW▣⊤HḄEG²ᑤ◀⚔Rv(n=Gvexnum;if((m=LocateVex(G,v))<0)returnERROR;Gvexs[m]<->Gvexs[n];஻:Àᑤ◀⚔R@ᣚᑮᨬ8-P⚔Rfbr(i=O;i

44returnOK;}//Delete_Arc7.7~×UV⊤g᪀cØ⚪6஺஻n⁚ḕÛÜ⚪Ý+Insert_Arc%&,ᐸ%&KÞ”ᑏ.StatusInsert_Arc(ALGraph&Qcharv,charw)஻ᙠUV⊤⊤HḄEG²½ᐭf(v,w)(if((i=LocateVex(Qv))<0)returnERROR;if((j=LocateVex(Qw))<0)returnERROR;p=(ArcNode*)malloc(sizeof(ArcNode));p->adjvex=j;p->nextarc=NULL;if(!Gvertices[i].firstarc)Gvertices[i].firstarc=p;else(for(q=G.vertices[i].firstarc;q->q->nextarc;q=q->nextarc)if(q->adjvex==j)returnERROR;஻fàᙠq->nextarc=p;}Garcnum++;returnOK;}//lnsert_Arc7.8~jEḄvTwᐜz{áᶍᑏ-%&ᑨäåUV⊤ḄᨵᔣE2æᔲᙠᵫ⚔Rviᑮ⚔RvjḄ(Ḅ)஺èé*%&2êëḄEḄìíᙠ¼g᪀²³´஺intvisited[MAXSIZE];஻ᢣH⚔Ræᔲᙠï/²intexist_path_DFS(ALGraphGinti,intj)஻vTwᐜᑨðᨵᔣEG2⚔Riᑮ⚔Rjæᔲᨵæᑣòó1,ᔲᑣòó0(if(i==j)return1;஻iôæjelse(visited[i]=l;for(p=Gvertices[i].firstarc;p;p=p->nextarc){k=p->adjvex;if(!visited|k]&&exist_path(k,j))returnl;//iõöḄ⚔Rᑮjᨵ}//for}//else}//exist_path_DFS7.9÷²⚪⌕e஺~jEḄ|Twᐜz{áᶍᑏ-%&஺intexist_path_BFS(ALGraphdinti,intj)஻|TwᐜᑨðᨵᔣEG2⚔Riᑮ⚔Rjæᔲᨵ,æᑣòó1,ᔲᑣòó0(intvisited[MAXSIZE];InitQueue(Q);EnQueue(Q,i)7while(!QueueEmpty(Q))(DeQueue(Q,u);visited[u]=l;

45for(p=Gvertices[i].firstarc;p;p=p->nextarc)(k=p->adjvex;if(k==j)return1;if(!visited(k])EnQueue(Q,k);}//for}//whilereturn0;}//exist_path_BFS7.10~ᑭᵨ᪘Ḅø103f☟úûᗨýþÿᡮᶂᕑᕒ᫅᥏7.ᚳ5K∍13.ᓽ᫱raph!ᡂ#$%&'ᦪ)*+஺voidSTraverse_Nonrecursive(GraphG)஻.⌴01ᔊ3456G{intvisited[MAXSIZE];InitStack(S);Push(S,GetVex(S7));஻:;$<⚔>ᐭ᪘visit(l);visited=l;while(JStackEmpty(S))(while(Gettop(S,i)&&i)(j=FirstAdjVex(Qi);if(j&&!visited[j])(visitQ);visited[j]=l;Push(S,j);஻ᔣCDᑮFᜮ)}//whileif(!StackEmpty(S))(Pop(S,j);Gettop(Sj);k=NextAdjVex(Cii,j);஻ᔣHD$Iif(k&&!visited[k])(visit(k);visited[k]=1;Push(S,k);)}//if}//while}//Straverse_Nonrecursiveᑖ᪆:MNᙠḄQMRSTUV᪛ḄᐜY1ᔊ.⌴0NZ[\]^_ὃ6.37.ᵫb#3456,ᡠef;hi$jklmᑮᡠᨵg>.7.11oᵨqr⊤tug᪀]wᑏ$<ᑨz{ᔣ6|}~jḄ<⚔>#ᔲtᙠ$ᩩkḄᓫ(ᢣ⚔>Yᑡ|ᨵḄ⚔>)ḄNZ஺[]:ᑭᵨ]$<_ᦪ]kᑣ¡¢g>Ḅ஺intvisited|MAXSIZE|;

46intexist_path_len(ALGraphGinti,intj,intk)஻ᑨ£qr⊤¤¥tuḄᨵᔣ6GḄ⚔>iᑮj#ᔲtᙠkḄᓫ(if(i==j&&k==O)return1;஻¦ᑮ§$ᩩ]¨©ᔠ⌕¬elseif(k>0)(visited[i]=l;for(p=Gvertices[i].firstarc;p;p=p->nextarc){,l=p->adjvex;if(!visited[l])if(exist_path_len(G,l,j,k-l))return1;//ᒕ®¯$}//forvisited[i]=0;஻M⚪ᐕ²³´µmḄg>hᙠ¶$ᩩ|}//elsereturn0;஻·¦ᑮ}//exist_path_len7.12¸6#¹ᩗḄᨵᔣ6GḄqr⊤⊤Z஺fg>VIhi]1ᔊ6Gᡠ»g>Yᑡ(A),¼1ᔊ6Gᡠ»g>Yᑡ(B)½GḄ$<¾ᡫYᑡ#(C)½᣾>VIᑮg>V8ḄᨬÂ(D)½fg>VIᑮg>V8ḄᐵÄ(E),ᐸ|AஹBஹCḄ⌱ÈᨵÉজV1,V2,V3,V4,V5,V6,V7,V8ঝV1,V2,V4,V6,V5,V3,V7,V8(3)V1,V2,V4,V6,V3,V5,V7,V8টV1,V2,V4,V6,V7,V3,V5,V8ঠV1,V2,V3,V8,V4,V5,V6,V7ডV1,V2,V3,V8,V4,V5,V7,V6ঢV1,V2,V3,V8,V5,V7,V4,V6DஹEḄ⌱ÈᨵÉজV1,V2,V4,V5,V3,V8ঝV1,V6,V5,V3,V8(3)V1,V6,V7,V8V1,V2,V5,V7,V8ট7.13ÊË$ÌeUVÍ⊤Îtug᪀ḄUV᪛]ÏwᑏᢥÑÒÓY(\$ÑÔCÕH)1ᔊUV᪛ḄNZ஺voidLayerOrder(BitreeT)஻ÑY1ᔊUV᪛(InitQueue(Q);஻Ö×ØÎÙᑡEnQueue(Q,T);while(!QueueEmpty(Q))

47DeQueue(Q,p);visit(p);if(p->lchild)EnQueue(Q,p->lchild);if(p->rchild)EnQueue(Q,p->rchild);)}//LayerOrder;ÚÛܦ8.1Ý¡ᜧßᙳnḄᨵYḄÓY⊤á{YḄÓY⊤ᑖzâãܦ]Ïᙠ¸ᑡä%åæ¸ᑖzçèὅᙠêᭆ᳛íḄîᙳܦ#ᔲ[\ï(1)ܦᡂð]ᓽ⊤|·ᨵᐵÄñêbjòKḄóô஺(2)ܦᡂð]¨⊤|õᨵ$<ᐵÄñêbjòKḄóô஺(3)ܦᡂð]¨⊤|ᨵÝö<ᐵÄñêbjòKḄóô]$Òܦ⌕¬¦hᡠᨵóô஺÷ø:ᙳᵨÓYܦZ஺8.2ùh¡10ḄᨵY⊤âãᢚûܦḄᑨj᪛]ü¬ᐸêᭆ᳛íܦᡂðḄîᙳܦ஺÷ø:᪷)P.191ASLjþÿᙳ஺8.312Ḅ⊝᪛Ḅᨬᜧ᪵Ḅ᪛஺!":$ᨬ%ᑖ'()*+,ᐸ.ἔᐜḄ1ᑖ'2%ᑖ'3)᝞53)ᑣᐜ(1ᑖ')7(1ᑖ'Ḅ*+,ᐸ.ἔᐜḄ%ᑖ'21ᑖ'3)᝞53)ᑣᐜ(%ᑖ')᝞89:ὃ⇋)⌲>()?ᑮ12஺8.4AB᪛CD)ᢥFGHIᔣ2-3᪛)ᓽ3▤B-᪛MNᐭᐵQṹḄS᪛TU,20,30,50,52,60,68,70஺᝞V8Wᑤ◀50Z68,[>᡻]W2-3᪛Ḅ^᝱஺8.5⌱abcdᦪH(k)=(3k)%ll,ᵨgឋijkᦣᑡnᜐᳮqr஺ᙠ஺t10ḄᦣᑡᙢᙬBwM)xᐵQyIᑡ(22,41,53,46,30,13,01,67)᪀⌼bc⊤)}3ᭆ᳛Gᡂ25ᡂḄᙳ஺!":ᙳὃP.225஺012345678910224130015346136711221126ASLsucc=(1x4+2x3+6)/8=2ASLunsucc=(2+14-8+7+6+5+4+3+2+1+1)/11=40/Il8.6GᑡᐵQyS•50.75Ḅbc⊤)ᡠ᪀⌼Ḅbc⊤Ḅᙳ஺(ZHAO,QIAN,SUN,LI,ZHOU,WU,ZHENG,WANG,CHANG,CHAO,YANG,JIN)!",(1)ᵫ}⊤)(2)ᑭᵨ103fᩡ,(3)¡qrḄ¢n஺8.7£ᑏᑭᵨᢚ¦§¨ᡠᙠᙽḄᑖᙽn஺8.8ᑏᑨ«¬᪛+ᔲ᣸I᪛Ḅn஺¯8᪛F°⊤±²³᪀)´᪛MḄᐵQyᙳ5µ஺!":¶·MI¸ᔊIᑡ+ᔲ⌴»ᨵI¢n1,ᵨ½⌴¾MI¸ᔊn)¯¿ᢣ┐pre,pÂpre->data>p->dataᑣÃÄᎷ

48¢n2,ᵨ⌴¾MI¸ᔊn)¯ᐰÇᢣ┐pre,(MIgÈᓄn)Âpre->data>p->dataᑣÃÄᎷ¢n3,ᵨ⌴¾(MIᡈWI)n(1)B᪛+(2)ᓫ᪷᪛+(3)%⌴¾Î(4)1⌴¾Î(5)%᪛Ḅ1Ï᪷(6)1᪛Ḅ%Ïᜧ᪷intlast=O,flag=l;intIs_BSTree(BitreeT)஻ᑨÑ᪛T+ᔲ᣸I᪛)+ᑣÃÄ1,ᔲᑣÃÄ0(if(T->lchild&&flag)Is_BSTree(T->lchild);if(T->datadata;if(T->rchild&&flag)Is_BSTree(T->rchild);returnflag;}//Is_BSTree8.9£ᑏn)}ᢣᙠ¬Ḅ᣸I᪛MᡠᙠḄ×ᦪ஺8.10£ᑏn)ᙠ¬Ḅ᣸I᪛Ø.ÙÚ5µḄᨬÛÜᐳἔᐜ(ÞᙠÚAஹBM)A+BḄἔᐜ)ᑣàA+AஹBḄᨬÛÜᐳἔᐜ)஺!":(1)Ꮇ¯A<=B,(2)A᪷CD)%áᡈ1á)?ᑮAᙠ%(ᡈ᪷))Bᙠ1(ᡈ᪷)஺8.11£ᑏdᦪ)ᑭᵨᑖnᙠᨵI⊤MNᐭᐗãx,äᢝ⊤ḄᨵIឋ஺!":(1)⊤Mæçᨵx,(2)⊤MèᨵxP.2318.12éê12Ḅ⊤,(Jan,Feb,Mar,Apr,May,June,July,Aug,Sep,Oct,Nov,Dec)»(1)ᢥ⊤MᐗãḄëIìHNᐭ--îDBḄ᣸I᪛)NᐭïᡂWḄ᣸I᪛}ᐸ3ᭆ᳛ḄGᡂḄᙳ஺(2)Þx⊤Mᐗãᐜð]᣸I᪀ᡂᨵI⊤,}ᙠ3ᭆ᳛ḄGx8ᨵI⊤ð]ᢚ¦ᡂḄᙳ஺(3)ᢥ⊤MᐗãḄëIìH᪀⌼⊝᣸I᪛)}ᐸ3ᭆ᳛ḄGᡂḄᙳ஺!":ᑨ᪛ᡈ᣸I᪛)᪷òP.191ASLóᙳ஺8.13ᨵ9ôḄ3▤B-᪛Mõöᨵ÷ö½ôᨵ10ôḄ3▤B-᪛Mõöᨵ÷ö½ô!":ôxøBᢣ┐஺8.14ᑏwùᩖO(log2n+m)Ḅn)ᑤ◀᣸I᪛MᡠᨵᐵQy5xḄ)ûüBw஺ᐸMn᪛MḄᦪ)mýᑤ◀Ḅᦪ஺!"(1)p=root(2)᝞Vp->keyᜧஹ3x,ᑣᑤ◀p->rchildZp,(3)%á>)þ(2)(4)᝞Vp->keyx,ᑣÿ(5)(2)(6)ljp==NULLvoidDelete_NET(BiTree&T,intx)஻ᑤ◀᣸᪛Tᡠᨵxᐗ

49if(T->rchild)Delete_NET(T->rchild,x)if(T->datalchild;free(q);஻᝞-᪛᪷x,ᑣᑤ◀᪛᪷012᪛Ḅ᪷345Ḅ᪛᪷if(T)Delete_NLT(T,x)஻67ᙠ12᪛᡻+:;}//Delete_NLT8.15ᙠ<⊝᣸᪛Ḅ>?@AB?IsizeCᐸE4FḄ12᪛ḄᦪA1஺Hᑏ&ᩖK4O(logn)Ḅ:;LM᪛Nk?ḄOP஺[RS]:ᐜWXYZ[஺(1)sum=0,(2)]"^᪷_`a1bcsum+lsize<=kḄᨬᜧa,(3)aaḄb[sum=sum+Isize,ᑮb,sum+lsize(b)>=kf(2)^(3),ᑮsum=klypedefstruct{intdata;intbf;intIsize;//IsizeC⊤ShḄ12᪛ḄiᦪA1BIcNode*lchild,*rchild;}BIcNode,*BlcTree;஻jIsizeCḄ<⊝᣸᪛klBTNode*Locate_BlcTree(BlcTreeT,intk)஻ᙠjIsizeCḄ<⊝᣸᪛TLMNkḄᢣ┐(if(!T)returnNULL;//k1ᡈᜧ᪛iᦪif(T->lsize==k)returnT;஻pqr?elseif(T->lsize>k)returnLocate_BlcTree(T->lchild,k);//ᙠ12᪛scelsereturnLocate_BlcTree(T->rchild,k-T->lsize);//ᙠ2᪛sctu⌕wᦋkḄE}//Locate_BlcTreeNyzᑁ|᣸9.10ᐵ~ṹᑡ(503,087,512,061,908,170,897,275,653,426)4YZ᡻+0᣸:;ᑏ(^)>B᣸)&Ḅᐵ~ṹ᝱(1)ᐭ᣸(2)᣸(@d[l]=5)(3)᣸(4)ᚮ᣸(5)᣸(6)ᦪ᣸஺9.2ᐵ~ṹ40,27,28,12,15,50,7,ᵨ᣸ᡈᚮ᣸ᑏ>᣸-஺9.3K4nḄᑡ+᣸&ᡠ◤+Ḅ¢£¤ᦪ¥¦rn?ᐗḄ§`᣸ᑡ஺n=7&ᙠᨬ¨©ª◤+«¬¤¢£®¯°ᳮᵫ஺n=7³B?ᨬ¨©ªḄ§`᣸ᑡ´103fO(µ¶>?·¸q)9.4Ꮇºᑡᵫn?ᐵ~»Ḅ᪀ᡂ⌕[¾᣸¿]⌱ᐵ~]ᜧᑮÁḄ^k(k«n)?஺ÂÃ᝞Ä+ÅÆÇᡠ3Ḅᐵ~¢£¤ᦪÈᑮᨬ(Éᓫ⌱ËஹᑈÎ᣸ஹᚮ᣸ᙳᨵÐÆ)9.5ᐭ᣸cᐭOPḄÑ3Ð0ÒÓᑖÕcḄÖ;ᩭ´Ø஺ÂÙÚᑏB?ᦋÛḄᐭ᣸:;஺

509.6HᑏB?ÜᔣÞÎḄ᣸:;ᓽßàáâᔣßãÖᔣÞÎ஺[RS](1)ä᣸(2)“æç“æ☢”ß⍗&)஺voidBubble_Sort2(inta[],intn)஻ßàáqãÖᔣÞÎḄᑈÎ᣸:;(low=0;high=nl;஻ᑈÎḄêëchange=1;while(lowa[i+l])(a[i]<->a[i+l];change=l;)high--;//wᦋêëfor(i=high;i>low;i—)஻]ᔣêÞÎif(a[i]a[i-l];change=1;)]ow++;஻wᦋë}//while}//Bubble_Sort29.7Hᑏ:;n?ᐵ~ì᦮ᦪEḄᑡ+᦮ᳮ0Çᡠᨵᐵ~4îEḄ᣸ᙠᐵ~4ïîEḄð^⌕[ìÁñò᪀«ÇᵨB?Ḅóôñò:;Ḅ&ᩖK0(n)õö:;Ḅᨬᜧ÷ø¤ᦪ஺[RS]:r[0]=r[l]0஺4ᑖëEä᣸ᑜᑖÓúû⌕[ᐗ᣸஺voidDivide(inta[],intn)஻üᦪaᡠᨵE4îḄýᑮïîḄð^(low=0;high=n-l;while(low=0)high--;஻0034þÿḄa[low]<->a[high];while(lowa[high];)1//Divide9.8ᓫ⊤᪀ᓫ⌱᣸ḄvoidLinkedList_Select_Sort(LinkedList&L)஻ᓫ⊤Ḅᓫ⌱᣸(for(p=L;p->next->next;p=p->next)(q=p->next;x=q->data;for(uq,s=q;r->next;r=r->next)஻ᙠq☢ᐗ!"ᨬ$Ḅ%if(r->next->datanext->data;

51s=r;if(s!=q)஻ᑮ'"(q->data)$Ḅᨬ$%s->next(p->next=s->next;s->next=q;t=q->next;q->next=p->next->next;p->next->next=t;)஻,ᣚq.s->next/0%}//for}//LinkedList__Select_Sort9.9Ꮇ23n0Ḅᑡ56ᐸᡠᨵᐵ;<"=>v.w?@Ḅ᦮ᦪ6Cᐸ5DEᐵ;<Ḅ"FGHḄ஺ᑣKᢥ᝞NO᣸PQ2ᦪRnumber[v…w]CSnumber[i]TUᐵ;8C5=floor(sqrt(n)).ᑏ06ᵨO(n)@.Oপ▬@ᡂ/0ᨵᑡḄ\஺voidSL_Merge(inta,int11,int12)஻iᑖ11,12C112<(11+12)Ḅ/0ᨵᑡ\ᨵᑡ(startl=0;start2=ll;஻ᑖ⊤ᑡ1.ᑡ2Ḅᒕ¡¢\£ᑖḄ¤mnfor(i=0;i

52j=start+i;l=start-i-(i+k)%len;temp=a[j];while(l!=start+i)(a[j]=temp;temp=a[l];a[l]=a[j];j=l;l=start+(j-start+k)%len;஻º»ᔣª)a[start+i]=temp;}//for}//RSh9.11Ꮤ,ᣚ᣸᝞Nᡠ[Pw•¾bᡠᨵ᜻ᦪi,¯a[i].a[i+l]gh(ÀÁw§¾bᡠᨵᏔᦪi,¯a[i].a[i+l]gh(À,Âa[i]>a[i+l],ᑣ¯/ὅ,ᣚ;w¾bᡠÅb73⊍ÇÈ6w§¾bᡠᨵᏔᦪi,…,º»ÉÊË᦮0ᑡᨵÌ஺(1)Í᣸OḄÎᩩÐFÑÒÅ(2)ᑖ᪆ÓÔ¤ᑡÕᡈ⌮/ÍØÙN6᜻Ꮤ,ᣚ᣸ÚÛ5ᡠ◤ghḄᐵ;<(ÀḄ»ᦪ஺(3)ᑏÝ᜻Ꮤ,ᣚ᣸Ḅ஺voidLinkedList_Select_Sort(LinkedList&L)஻ᓫ⊤.Ḅᓫ⌱᣸(for(p=L;p->next->next;p=p->next){q=p->next;x=q->data;forgq,s=qÁr->nextÁE->next)஻ᙠq☢ᐗ!"ᨬ$Ḅ%if(r->next->datanext->data;s=r;)if(s!=q)஻ᑮ'"(q->data)$Ḅᨬ$%s->next(p->next=s->next;s->next=q;t=q->next;q->next=p->next->next;p->next->next=t;}஻,ᣚq.s->next/0%}//for}//LinkedList_Select_Sort9.122U0ᵨ⊤⊤ḄÊà⌱᣸஺(á9.8W)9.13¥ᐭ᣸5¥ᐭmnḄâKãÚ§ᑖäḄOᩭ஺æ_ᑏ0ᦋgḄ¥ᐭ᣸஺(á9.5Wç)9.140èឋ⊤5Ḅᐗ!Õ᦮ᦪᡈê᦮ᦪ஺2U06¯Õ᦮ᦪ.ê᦮ᦪᑖë6ìèឋ⊤Ḅíîê᦮ᦪ6îÕ᦮ᦪ஺ï⌕¶bᐗ!᣸6ð⌕ñòó,ᣚ»ᦪ஺(á9.7)9.15ÑÒãôìᵨõᦪRᚮḄ÷øùÅ9.16(kl,k2,…,kn)Fᚮ,ᑏ0¯(kl,k2,…,kn,kn+1)ú᦮ᚮ஺ᢥ_

53ᑏ0ûᚮë¤0•0üᐭᐗ!Ḅýᚮ஺voidBuild_Heap(Heap&H,intn)஻ûþN᪗ᑮ᪗⌲ᐭᚮḄ(for(i=2;iH.r[k].key)H.r[j]<->H.r[k];j=k;)}//for}஻Build_Heap9.17ᐭ᣸"ஹ$ᓫ⌱'᣸"ஹ()᣸"ஹᚮ᣸"ஹ*+᣸"ஹ,-᣸"./ᦪ᣸"Ḅ1ឋ3ஹ45ឋ.〉ᵨ89஺9.18ᙠ<⌱'Ḅ=ᫀ?@ᐭAB=ᫀC1)ஹ᣸"(ᑖE)ḄFᨵHIJC_A®_K᣸""ᑡ?MNOPᐗRST᣸""ᑡ(UVW1)?ḄᐗRXSYᐸ[ᐭ᣸"ᑡḄAB\]^_Bজ—Ὄ᣸""ᑡ?ᢧ⌱ᐗRS+YᐸMN[ᐭ᣸""(UVW1)Ḅbcdᣚ᣸"f"ᑡ?ᐗRghbiᑡḄSjkḄlᐗR⌮"ghdᣚ஺_C_ট_._Dঝ—/rsEFḄlJ᣸"FSt_D__C_ᦔ᳛wḄFSᑭᵨyJS᪷{ᐗRḄᐵ}~P᣸"\]ḄF_E_ঢ<⌱'=ᫀ®⌱⃭᣸"ঝ()᣸"ঞᐭ᣸"টᑈ᣸"ঠ*+᣸"ডᑖ᣸"ঢ,᣸"ণ/ᦪ᣸"2)ஹbḄᐵ}W(46,79,56,38,40,84),ᑭᵨ()᣸"ḄFSbW/ᑮḄbNᑜᑖWCAஹ38,40,46,56,79,84Bஹ40,38,46,79,56,84Cஹ40,38,46,56,79,84Dஹ40,38,46,84,56,793)ஹᑡ᣸"?SC3P☢89CUVᦪ{ᨵ"StᨬI஺Aஹᚮ᣸"Bஹᑈ᣸"Cஹ()᣸"DஹSHELL᣸"9.19ᑨA¡C()ᙠbᜧᚮ?Sᨬ¢ᐗR£b5ᙠᨬ¤஺(X)fn¥ᵨ()᣸"Fgh᣸"Sᨬ¦89ᡠ◤஺(nlog2n)஺(X)ᙠ᡻hy᣸"ª«?SP¬᣸"ṹ®ḼTᨬ°᣸""ᑡ±Fᔣ³´Ḅµ,ᑣ¸¹£45Ḅ஺0

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
关闭