無(wú)向圖的鄰接表表示及遍歷實(shí)驗(yàn)報(bào)告電子版_第1頁(yè)
無(wú)向圖的鄰接表表示及遍歷實(shí)驗(yàn)報(bào)告電子版_第2頁(yè)
無(wú)向圖的鄰接表表示及遍歷實(shí)驗(yàn)報(bào)告電子版_第3頁(yè)
無(wú)向圖的鄰接表表示及遍歷實(shí)驗(yàn)報(bào)告電子版_第4頁(yè)
無(wú)向圖的鄰接表表示及遍歷實(shí)驗(yàn)報(bào)告電子版_第5頁(yè)
已閱讀5頁(yè),還剩2頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

promote the extension of strictly administering the party grass-roots, but also the educational practice of the mass line of the party and three-three special education results achieved further inherited and expanded. To realize two a learning education is a necessary solution to the present problems of party construction. Strengthen problem consciousness and insisted on problem-oriented, is full of strictly administering the party since the partys 18 a distinctive feature, a successful experience. Secretary Wang noted that some party members still have political awareness, lack of political responsibility issues, party awareness and consciousness of the problem belief does not really believe, slim does not actually fix problems, outspoken, and jump on the assessment of the partys policies, and so on. Bi Lifu Secretary pointed out that a quarter of the economic situation is very serious, there is pressure on environment, seasonal factors and other objective reasons, but mainly subjective problem, is the problem of party members and cadres. Some depressed, negative slack, not responsible, . Double six, one, and two took the lead, build energy burst, Hongshan district, economic prosperity, eco-livable, civilized and harmonious island. It certainly can not be separated from the whole area 646 grass-roots party organizations and 14,146 members of broad participation and support. Through the two study and education, so that every cell of the party health, every organization is strong, so that all members of the vanguard and exemplary role, all the fighting bastion role of grass-roots party organizations into full play so that we can cross the Rapids, overcome all difficulties and the smooth realization of the Thirteen-Five goal. Second, basic learning, focus on learning education must understand the learning content and learning styles Foundation learning these four words are important information inside is very large, capture profound work truth in life. For example, I often say that the good Carpenter NAO Carpenter, why do some carpenters made furniture to have everybody likes it, Carpenter we are not willing to look for him? are apparently two people high and low technology, dig into the deep is firmer when both of his apprentices are not solid, there is no good that way. Luban art of story primary school are learn had, first after six mark test practice conduct, and practice cultivation, and practice perseverance, and practice patience, then with seven days seven night mill axe theory armed, and unity action, seriously learning XI General Secretary on reform development stable, and Interior diplomatic defense, and rule party ruling army of important thought, seriously learning to XI comrade for General Secretary of Central ruling acting political new concept new thought new strategy, seriously learning XI General Secretary study in Inner Mongolia important speech spirit, Guide party members and a deep understanding of a series of important speeches rich connotation and core ideas, which began so thoroughly Marxist positions福州大學(xué)數(shù)計(jì)學(xué)院數(shù)據(jù)結(jié)構(gòu)上機(jī)實(shí)驗(yàn)報(bào)告專業(yè):應(yīng)用數(shù)學(xué)學(xué)號(hào)姓名班級(jí)實(shí)驗(yàn)名稱圖的實(shí)驗(yàn)實(shí)驗(yàn)內(nèi)容無(wú)向圖的鄰接表表示及遍歷實(shí)驗(yàn)?zāi)康暮鸵笳莆請(qǐng)D的鄰接表表示方法及實(shí)現(xiàn)技術(shù)掌握在圖的鄰接表表示方式下的圖的遍歷操作問(wèn)題描述和主要步驟【實(shí)驗(yàn)內(nèi)容】從鍵盤輸入無(wú)向網(wǎng)絡(luò)G的頂點(diǎn)個(gè)數(shù)v、邊的個(gè)數(shù)e。建立由v個(gè)頂點(diǎn)、e條邊構(gòu)成的無(wú)向圖G,采用鄰接表表示。V個(gè)頂點(diǎn)的值由鍵盤輸入,元素類型為字符型,e條邊的信息亦由鍵盤輸入 調(diào)用圖的深度優(yōu)先搜索遍歷圖并輸出相應(yīng)的遍歷序列代碼:#include stdafx.h#include #include #define MAX 20 /無(wú)向圖最大頂點(diǎn)數(shù)typedef struct nodeint adjvex; /頂點(diǎn)序號(hào)struct node *next; /指向下一條弧的頂點(diǎn)*pointer;typedef structchar data; /頂點(diǎn)名稱pointer first; /頭指針headtype;typedef structheadtype adlistMAX;int n; /頂點(diǎn)數(shù)int e; /邊數(shù)lkgraph;typedef struct treechar data; /結(jié)點(diǎn)名稱struct tree *lchild; /存放第一個(gè)孩子struct tree *rchild; /存放兄弟*BTree;typedef structint *base;int *top;SqStack; /用于簡(jiǎn)單路徑算法,最大長(zhǎng)度為MAXbool visitMAX; /遍歷中判斷是否被訪問(wèn)int t_num; /非連通圖生成子樹BTree tMAX;bool flag=false; /判斷是否存在簡(jiǎn)單路徑void creategraph(lkgraph *g)/建立無(wú)向圖的鄰接表pointer p;int i,j,e=0;char c; /吸收回車printf(無(wú)向圖鄰接表的建立:n);printf( 頂點(diǎn)位置序號(hào)從0開始n);printf( 頂點(diǎn)名稱用一個(gè)字符表示n);s1: printf( 請(qǐng)輸入無(wú)向圖的頂點(diǎn)數(shù)(小于等于20):n);scanf(%d,&i);if(i20) goto s1; /頂點(diǎn)數(shù)目輸入不符合要求g-n=i;for(i=0;in;i+) /初始化c=getchar();printf(請(qǐng)輸入頂點(diǎn)名稱:n);scanf(%c,&g-adlisti.data);g-adlisti.first=NULL;printf(請(qǐng)輸入一條邊的兩個(gè)頂點(diǎn),用“,”隔開(當(dāng)輸入的第一個(gè)數(shù)為-1時(shí),停止輸入):n);scanf(%d,%d,&i,&j);while(i!=-1)e+;p=(pointer)malloc(sizeof(struct node);p-adjvex=j;p-next=g-adlisti.first;g-adlisti.first=p;p=(pointer)malloc(sizeof(struct node);p-adjvex=i;p-next=g-adlistj.first;g-adlistj.first=p;printf(請(qǐng)輸入一條邊的兩個(gè)頂點(diǎn),用“,”隔開(當(dāng)輸入的第一個(gè)數(shù)為-1時(shí),停止輸入):n);scanf(%d,%d,&i,&j);g-e=e;void show(lkgraph *g)/鄰接表輸出pointer p;printf(鄰接表輸出:n);for(int i=0;in;i+)printf(%c: ,g-adlisti.data);p=g-adlisti.first;while(p!=NULL)printf(%5d,p-adjvex);p=p-next;printf(n);void DFS(lkgraph *g,int v,BTree q)/從頂點(diǎn)v出發(fā),遞歸地深度優(yōu)先遍歷gvisitv=true;BTree q1,l;q1=(BTree)malloc(sizeof(struct tree);q1-lchild=NULL;q1-rchild=NULL;printf(%5c,g-adlistv.data);q-data=g-adlistv.data;pointer p=g-adlistv.first;for(int w=0;p!=NULL;p=p-next)w=p-adjvex;if(!visitw)DFS(g,w,q1);l=q;if(l-lchild=NULL)l-lchild=q1;elsel=l-lchild;while(l-rchild!=NULL)l=l-rchild;l-rchild=q1;q1=(BTree)malloc(sizeof(struct tree);q1-lchild=NULL;q1-rchild=NULL;void DFSTraverse(lkgraph *g)printf(圖的深度優(yōu)先遍歷:n);printf(請(qǐng)輸入起始點(diǎn)序號(hào)(0%d):n,(g-n-1);int m,i;scanf(%d,&m);for(int v=0;vn;v+)visitv=false; /初始化if(!visitm)t0=(BTree)malloc(sizeof(struct tree);t0-lchild=NULL;t0-rchild=NULL;DFS(g,m,t0);printf(n);t_num=1;for(v=0,i=1;vn;v+)if(!visitv)ti=(BTree)malloc(sizeof(struct tree);ti-lchild=NULL;ti-rchild=NULL;DFS(g,v,ti);t_num+;i+;printf(n);BTree CreateBiTree()/將森林轉(zhuǎn)化為二叉樹BTree T,p,q;T=t0;p=T;for(int i=1;irchild=q;p=p-rchild;return T;void preorder(BTree l)/先序遍歷if(l!=NULL)printf(%5c,l-data);preorder(l-lchild);preorder(l-rchild);void pasorder(BTree l)/后序遍歷if(l!=NULL)pasorder(l-lchild);pasorder(l-rchild);printf(%5c,l-data); SqStack& InitStack(SqStack &s)/構(gòu)造空棧s.base=(int*)malloc(MAX*sizeof(int);s.top=s.base;return s;void lujing(lkgraph *g,int a,int b,SqStack &s)int w,*i;pointer p;visita=true;*s.top=a;s.top+;i=s.top;if(a=b) /找到簡(jiǎn)單路徑,輸出flag=true;while(i!=s.base)i-;printf(%5d,*i); printf(n); p=g-adlista.first;while(p!=NULL)w=p-adjvex;if(!visitw)lujing(g,w,b,s);p=p-next;visita=false;s.top-;void Menu()printf(*n);printf(1建立無(wú)向圖n);printf(2指定起始點(diǎn),深度優(yōu)先遍歷n);printf( 先序遍歷深度優(yōu)先生成樹n);printf( 后序遍歷深度優(yōu)先生成樹n);printf(3求兩點(diǎn)簡(jiǎn)單路徑n);printf(0退出n);printf(*n);void main()lkgraph *g;SqStack s;BTree T;s=InitStack(s);int x;Menu();scanf(%d,&x);while(x!=0)if(x=1)g=(lkgraph*)malloc(sizeof(lkgraph);creategraph(g);show(g);else if(x=2)DFSTraverse(g);T=CreateBiTree();printf(n深度優(yōu)先生成樹的先序遍歷為:n);preorder(T);printf(n深度優(yōu)先生成樹的后序遍歷為:n);pasorder(T);printf(n);else if(x=3)printf(請(qǐng)輸入起始點(diǎn)和終點(diǎn)位置,以“,”隔開:n);int a,b;scanf(%d,%d,&a,&b);for(int i=0;in;i+)visiti=false;lujing(g,a,b,s);if(flag=false)printf(不存在簡(jiǎn)單路徑!n);elseprintf(輸入錯(cuò)誤n);Menu();scanf(%d,&x);實(shí)驗(yàn)結(jié)果(截圖表示)研究與探討通過(guò)這次實(shí)驗(yàn)對(duì)無(wú)向圖的鄰接表表示和深度優(yōu)先遍歷有了更深的了解,實(shí)驗(yàn)中還存在一些問(wèn)題,需要多做實(shí)驗(yàn)加強(qiáng)。涉及重大決策事項(xiàng)、重要人事任免、重大項(xiàng)目安排和大額度資金使用等,具有決策、行政執(zhí)法、行政許可、部門管理等決策、審批、自由裁量、事務(wù)管理決定權(quán)的領(lǐng)導(dǎo)崗位。To sum up, is divided into 9 main parts: 1. with regard to persisting and developing socialism with Chinese characteristics. 18 since the XIOn more than one occasion, General Secretary of the historical origin and development process of socialism with Chinese characteristics, the road of socialism with Chinese characteristics, System Info, system, uphold and develop the understanding of socialism with Chinese characteristics is determined to have been profoundly expounded, further strengthened the party and the people adhere to and develop the confidence and determination of the socialism with Chinese characteristics. XI General Secretarys speech in this regard include the peoples yearning for a better life, that is our goal, closely focus on the development of socialism with Chinese characteristics study and publicize the spirit of party 18, the unwaveringly adhere to the development of socialism with Chinese characteristics, the persistence and good use of Mao Ze-Dongs thought of soul. 2. with regard to the Chinese dream of realizing the great rejuvenation of the Chinese nation. 18 closing soon, the new Central collective leadership when they visited the exhibition of the road to recovery, XI, General Secretary of the solemn declaration the great rejuvenation of the Chinese nation, the greatest dream of the Chinese nation in modern times. Zhihou, on more than one occasion, General Secretary expounded the scientific connotation of Chinese dream, realize the Chinese dream must take the road, carry forward the spirit and cohesion of Chinese forces, gradually formed the China dream, a strategic thought. And practice with the Chinese dream, reflects the history of the new session of the CPC Central Committee, and conforms to the development trend and the people hope, embodies the greatest common divisor and the consensus of Chinese people at home and abroad, inspiring all peoples forging ahead in unity, the spirit of unswervingly follow the road of socialism with Chinese characteristics flags and high melody. This aspects XI General Secretary of speech main including achieved

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論