freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結構的c語言算法-wenkub.com

2025-06-14 06:58 本頁面
   

【正文】 preorder(bright)。 printree(bright)。/*0表示是左子樹*/ } } }}void printree(BTree *b)/*以嵌套括號表示法輸出一棵二叉樹*/{ if(b!=NULL) { printf(%d,bdata)。 }/*表示是右子樹*/ if(pleft!=NULL) { top++。 if(pright!=NULL) {/*將右子樹根節(jié)點入棧*/ top++。i=MaxWidth。i=n。/*右節(jié)點之前輸出(1)*/ case 2:type=39。break。/*2表示是根*/ while(top0) { p=stack[top]。 if(b!=NULL) {top=1。ch=str[j]。break。 pdata=ch。,39。)39。stack[top]=p。\039。/*top為棧指針,k指定是在左還是右孩子,j為str指針*/char ch。}BTree。 printf(\n)。 printf(從g1中刪除39。 printf(\n)。 } }}}void main(){ gnode *g1,*g2。/*刪除表尾中的x得到t*/ q=(gnode *)malloc(sizeof(gnode))。/*將t作為新表表頭*/ if(plink!=NULL)/*若還有后繼元素,刪除x后作為新表表尾*/ { delall(plink,x,t)。/*從表尾的表頭產(chǎn)生t*/ q=(gnode *)malloc(sizeof(gnode))。 } else q=NULL。 else { if(ptag==0)/*為原子節(jié)點的情況*/ { if(p!=x) { q=(gnode *)malloc(sizeof(gnode))。 printf(\n)。 reverse(g1,g2)。 g1=create(((a,b),c,(d,e)))。/*創(chuàng)建表頭節(jié)點q*/ q=tag=1。r=t。/*給表頭加上一個子表節(jié)點*/ btag=1。 q=s。 else { if(ptag==0)/*為原子的情況*/ { s=(gnode *)malloc(sizeof(gnode))。 printf((same(g1,g3)==0)?不同: 相同)。 printf(g1與g2:)。 printf(\n)。 disp(g1)。 g1=create((a,(b,c,d),e,((f))))。amp。 } else { if(p==NULLamp。amp。q!=NULL) { if(ptag==0amp。 printf(\n)。 disp(p)。 printf(輸入廣義表表達式: )。/*原子節(jié)點直接復制*/ else { gcopy(p,q)。 q=NULL。 if(find) return(1)。 if(p!=NULL) { if(!ptagamp。 h=q。 break。 q=qlink。pamp。 if(h) do { p=h。 qlink=NULL。 if(len0) { p=(gnode *)malloc(sizeof(gnode))。/*將subs分為表頭和表尾*/ r=create(hstr)。*/ strncpy(subs,s,len2)。 p=gh。/*構造原子節(jié)點*/ gh=*s。 len=strlen(s)。 strcpy(s,rstr)。 r++。 if(s[i]==39。 i++。,39。) k。(39。amp。,39。之前的子串賦給hstr,并使s成為刪除子串hstr和39。/*子表*/ }val。}第五章 數(shù)組與廣義表:includeincludeincludedefine MaxLen 100typedef struct node/*定義廣義表結構*/{ int tag。s2,str)。s1,str)。 char str[MaxLen]。 while(n=0) { del(s1,n,length(s2))。 } if(is1len) return 1。j++。amp。 while (is1len) { j=0。 printf(t=)。s1)。s,3,1,amp。s,3,1)。s)。 create(amp。\039。 =n。 =i+s2len1。ni1。 else printf(%d\n,sch)。 sch[slen]=39。 if(pos+nslen) for(i=pos+n1。 sch[slen]=39。 for(j=0。 if(slen+tlenMaxLen) return 0。 sch[slen]=39。 for(i=0。\039。ipos+n1。/*添加字符串結束符*/}strtypr subs(strtype *s,int pos,int n)/*求子串*/{ int i。i++) s2ch[i]=s1ch[i]。}int length(strtype *s)/*求串長度*/{ return slen。 int len。%s39。 if(judge(h)==1) printf(39。 ode *h。 else break。 p=pnext。 int top=0。r=p。pnext=NULL。 while(s[i]!=39。 struct node *next。 } printf(\n)。 printf(余下元素出列:)。 printf(出隊一次:)。 printf(g入隊\n)。 printf(f入隊\n)。 printf(出對一次:)。 printf(e入隊\n)。 printf(d入隊\n)。 printf(出隊一次:)。 printf(c入隊\n)。 printf(b入隊\n)。 printf(a入隊\n)。 len。 }}int dequeue(queue qu,char *x){ int front。 else { rear=(rear+1)%MaxSize。 system(pause)。m,amp。 return (st[1][1])。 } if(top==1amp。 st[top][1]=0。amp。 top。amp。 st[top][3]=1。 st[top][0]=no(st[top][2],st[top][3])。/*初值n進棧*/ do /*開始循環(huán)*/ { if(st[top][1]==0) { if(st[top][0]==3) { top++。 st[top][0]=no(m,n)。}int no(int m,int n){ if(m==0) return 1。寫出非遞歸算法;3。 if(pvalue(exp,amp。 scanf(%s,amp。}void main(){ char str[MaxLen]。/*除0錯誤*/ break。 case39。 case39。 case39。/*數(shù)字進棧*/ } else /*為運算符時,計算并退棧*/ { switch(ch) { case39。39。)/*為數(shù)字字符時轉換為數(shù)字*/ { d=0。 amp。/*t作為exp的下標,top作為st的下標*/ while ((ch=exp[t+1])!=39。 return 1。t++。t++。 || st[top]==39。||ch==39。 } top++。(39。39。 } top。(39。st[top]=ch。t++。t++。amp。amp。t++。amp。\039。}includedefine MaxLen 100int trans(char str[],char exp[]){ int st[MaxLen]。 scanf(%s,str)。 else return 0。 } if(empty(amp。{39。st,amp。break。amp。]39。(39。st,amp。break。:push(amp。)。[39。(39。i++) { switch(str[i]) { case39。st)。}/**//*假設一個算術表達式中可以包含三種括號,圓括號(和)、方括號[和]和花括號{和},且這三種括號可按任意的次序嵌套使用(如:..[..{..}..[..]..]..[..]..(..)..).編寫判別給定表達式中所含括號是否正確配對出現(xiàn)的算法(已知表達式已存入數(shù)據(jù)元素為字符的順序表中*//*輸入:{a+[b+(c+d)+e]+f}*/includeincludeint correct(char *str){ stack st。 for(i=sttop。 return 0。 return 1。 }}int pop(stack *st,elemtype *x)/*退棧*/{ if(sttop==0) { printf(棧下溢出\n)。 return 0。 int top。 printf(從右向左)。 h=create(amp。 } printf(%d ,edata)。 else { while(p!=e)/*遍歷最后一節(jié)點前的所有節(jié)點*/ { printf(%d ,pdata)。 } return head。/*r為當前節(jié)點的前一個節(jié)點*/ } else { prelink=xor(r,s)。 } s=(dlist *)malloc(sizeof(dlist))。x)。 dlist *head,*r,*s,*pre。 add2=(long)p2。}dlist。 head3=connect(head1,head2)。 head1=create()。/*刪除哨兵*/ h3=h3next。pb=pbnext。 pb=pbnext。pc=pa。/*創(chuàng)建哨兵*/ pc=h3。 headc=bine(heada,headb)。 } return(hc)。 panext=pb。 if(len(pa)!=len(pb)) { printf(兩個單鏈表長度不同\n)。 disp(head)。 }}void main(){ nodetype *head。q=r。 q=pnext。 } }}/*試寫一算法,對單鏈表實現(xiàn)就地逆置*/includeincludenodetype *invert(nodetype *h)/*實現(xiàn)單鏈表逆置*/{ nodetype *p,*q,*r。 else { while(pb!=NULL)/*有兩個及兩個以上的節(jié)點的情況*/ { free(pa)。 } return h。pnext!=NULL) { s=pnext。 free(p)。 } return h。 } else { p=find(h,i)。/*創(chuàng)建節(jié)點s*/ sdata=x。 p=pnext。 if(ilen(h)||i=0) return NULL。 i++。 } printf(\n)。 printf(輸出一個單鏈表:\n )。 t=s。 } else/*建立其余節(jié)點*/ { s=(nodetype *)malloc(sizeof(nodetype))。/*以0表示輸入結束*/ if(i==1)/*建立第一個節(jié)點*/ { h=(nodetype *)malloc(sizeof(nodetype))。 while(1) { printf( 輸入第%d個節(jié)點data域值:,i)。nodetype *create()/*建立單鏈表,由用戶輸入各節(jié)點data域之值,以0表示輸入結束*/{ elemtype d。}2. 線
點擊復制文檔內(nèi)容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1