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

正文內容

數據結構的c語言算法-免費閱讀

2025-07-11 06:58 上一頁面

下一頁面
  

【正文】 } }}void preorder(BTree *b)/*先序遍歷的遞歸算法*/{ if(b!=NULL) { printf(%d ,bdata)。 level[top][0]=n+width。 printf(\n)。break。 switch(level[top][1]) { case 0:type=39。 int level[MaxSize][2],top,n,i,width=4。 if(b==NULL)/*根節(jié)點*/ b=p。break。(39。void creatree(BTree *b,char *str)/*根據嵌套括號表示法的字符串*str生成鏈接存儲的二叉樹*/{BTree *stack[MaxSize],*p。得到g2\n)。 if(g1=NULL) printf(g1:NULL\n)。 } } else q=NULL。/*刪除線性表頭中的x得到s*/ if(s==NULL)/*新表的表頭為空的情況*/ { p=plink。*q){ gnode *s,*t。 disp(g1)。 rlink=b。/*處理表頭*/ if(plink!=NULL) { reverse(plink,t)。q){ gnode *r,*s,*t,*b。 disp(g3)。 g3=create((a,(b),(c,d),e,(f)))。q!=NULL) flag=0。ptag!=0) if(p!=q) flag=0。 printf(\n復制的廣義表: )。 } }}void main(){ gnode *p,*q。 } else return(0)。 printf())。amp。 while(qamp。 qlink=p。\039。 } else/*子表的情況*/ { gh=(gnode *)malloc(sizeof(gnode))。 char subs[MaxLen],hstr[MaxLen]。) i++。amp。 else if(s[i]==39。 char rstr[MaxLen]。void disastr(char s[],char hstr[])/*本函數為輔助建立廣義表的函數從字符串s中取出第一個39。s1,amp。 gets(str)。}void delall(strtype *s1,strtype *s2){ int n。amp。s6)。 s5=replace(amp。s,7,1)。 } return (s)。ks1len。 int n,k。i++) sch[in]=sch[i]。j++) sch[j+i1]=tch[j]。 return 1。}}int concat(strtype *s,strtype *t)/*連接兩個串*/{ int i。 if(pos+n1length(s1))/*參數不正確*/ =0。 for(i=0。 getch()。 scanf(%s,str)。 while(p!=NULL) { top。 } return h。) { p=(ode *)malloc(sizeof(ode))。}/*假設稱正讀和反讀都相同的字符序列為“回文”,例如:‘abba’和‘abcba’是回文,‘abcde’和‘ababab’則不是回文。x)。f39。e39。x)。b39。 }}void main(){ char x。 len++。 printf(digui c(%d,%d)=%d\n,m,n,f1(m,n))。st[top][1]!=0)/*棧中已有一個元素,且已計算出值,則退出循環(huán)*/ break。 m1=st[top1][2]1。amp。 st[top][1]=0。/*初值0進棧*/ st[top][2]=m。 else if(n==0) return f1(m1,1)。 if(trans(str,exp)==0) printf(原算術表達式不正確\n)。 } } (*n)=st[top]。:st[top1]=st[top1]*st[top]。:st[top1]=st[top1]+st[top]。039。) { if(ch=39。 } exp[t]=39。) { exp[t]=st[top]。 } else if(ch==39。amp。top。(39。939。\039。039。 else printf(表達式括號不匹配\n)。amp。amp。[39。break。)39。 case39。break。str[i]!=39。i) printf(%d ,stdata[i])。 else return 0。 stdata[sttop]=x。}/*運行結果:創(chuàng)建一個雙鏈表(以0結束) 輸入第1節(jié)點值:3輸入第1節(jié)點值:5輸入第1節(jié)點值:8輸入第1節(jié)點值:2輸入第1節(jié)點值:6輸入第1節(jié)點值:0從左向右遍歷節(jié)點序列: 3 5 8 2 6 從右向左遍歷節(jié)點序列: 6 2 8 5 3 */第三章 棧和隊列:includedefine MaxLen 20/*順序棧存放的最多元素個數為Maxlen1*/typedef char elemtype。 }}void main(){ dlist *h,*e。 printf(遍歷節(jié)點序列: )。 if(i==1)/*是第一個節(jié)點的情況*/ { pre=head=s。 while(1) { printf( 輸入第%d節(jié)點值: ,i)。這是本函數的功能*/{ int add1,add2,add3。 disp(head1)。/*h1單鏈表還有節(jié)點時*/ if(pb!=NULL) pcnext=pb。 } else if(padatapbdata) { pcnext=pb。}includenodetype *connect(nodetype *h1,nodetype *h2){ nodetype *pa=h1,*pb=h2,*h3,*pc。 pa=q。線性表A,B和C均以單鏈表做存儲結構,且C表利用A表和B表中的結點空間構成。 h=p。 return NULL。 if(pa!=NULL) { pb=panext。/*查找第i1個節(jié)點,并由p指向該節(jié)點*/ if(p!=NULLamp。 pnext=s。 }}nodetype *ins(nodetype *h,int i,elemtype x)/*單鏈表head中第i個節(jié)點(i=0)之后插入一個data域為x的節(jié)點*/{ nodetype *p,*s。}nodetype find(nodetype *h,int i)/*返回第i個節(jié)點的指針*/{ nodetype *p=h。 while (p!=NULL) { printf(%d ,pdata)。snext=NULL。d)。 struct linknode *next。 na=create(A)。jna。 while(inaamp。 int na,nb,nc。amp。 }}void main(){ sqlist A。 getch()。 n=create(A)。 return 0。 break。/*ab*/ if(A[i]B[j]) return 1。amp。 while(inaamp。 disp(A,n)。/*查找插入位置i*/ for(j=n。A[i]!=x) i++。 else { for(j=i1。 else { for(j=n1。 printf(輸出一個順序表: \n)。n)。c)。 }main(){int a,b,c。*x=*y。*y=t。scanf(%d,%d,%d,amp。printf(%d %d %d,a,b,c)。 for(i=0。 if(n==0) printf(空表)。j=i。jn。 if(in) return 1。j=i。 n=insert(A,n,10)。amp。j==nb) return 0。 else return 1。 case 1:printf(AB\n)。 } else { for(j=i+k1。 disp(A,n)。 }/*運行結果:創(chuàng)建一個順序表 輸入元素個數:5輸入第1個元素值:1輸入第1個元素值:2輸入第1個元素值:3輸入第1個元素值:4輸入第1個元素值:5輸出一個順序表1 2 3 4 5輸入I,k:2 2輸出一個順序表1 4 5 */ /*試寫一算法,實現順序表的就地逆置,即利用原表的存儲空間將線性表(a1,a2,...,an)逆置為(an,an1,...,a1).*/includevoid invert(sqlist A,int n){ int m=n/2,i。 int n。j=0) if(A[i1]B[j1]) i。 na=create(A)。amp。j++) C[k++]=A[j]。 disp(A,na)。}nodetype。 if(d==0) break。tnext=s。 p=pnext。 int j=1。 s=(nodetype *)malloc(sizeof(nodetype))。 } else printf(輸入的i值不正確\n)。amp。 if(pb=NULL)/*只有一個節(jié)點的情況*/ free(pa)。 } else { p=h。 return h。注意:單鏈表的長度值m和n均未顯示存儲*/includenodetype *bine(nodetype *ha,nodetype *hb){ nodetype *hc=ha,*pa=ha,*pb=hb,*q,*r。 pb=r。 h3=(nodetype *)malloc(sizeof(nodetype))。pc=pb。/*h2單鏈表還有節(jié)點時*/ pc=h3。 disp(head2)。 add1=(long)p1。 scanf(%d,amp。r=NULL。 if(h==NULL) printf(空表\n)。 int i。typedef struct sqstack{ elemtype data[MaxLen]。 return 1。}int gettop(stack *st,elemtype *x)/*獲取棧頂元素*/{ if(sttop==0) { printf(棧下溢出\n)。 printf(\n)。\039。 case39。{39。:if(!(pop(amp。 case39。)) ok=0。x==39。ok) return 1。 getch()。 amp。 amp。) { exp[t]=ch。)/*判斷為左括號*/ { top++。t++。 st[top]!=39。*39。top。\039。039。 }while((ch=exp[t++])!=39。break。break。 return 1。 else { printf(波蘭表達式: %d\n,exp)。 else return f1(m1,f1(m,n1))。/*初值m進棧*/ st[top][3]=n。 st[top][2]=st[top1][2]1。st[top1][0]==2) { st[top1][1]=st[top][1]。 top。 }while(top=1)。 printf(feidigui c(%d,%d)=%d\n,m,n,f2(m,n))。/*隊列長度增1*/ return 1。 queue qu。)。 printf(%c\n,x)。)。)。 printf(%c\n,x)。試寫一個算法判別讀入的一個以‘’為結束符的字符序列是否是回文.*/includeincludedefine MaxLen 100typedef struct node{ char data。 pdata=s[i]。}int judge(ode *h){ char st[MaxLen]。 if(pdata==st[top]) p=pnext。 h=create(str)。
點擊復制文檔內容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1