数据构造实验报告_1.docx





《数据构造实验报告_1.docx》由会员分享,可在线阅读,更多相关《数据构造实验报告_1.docx(8页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、数据构造实验报告实验名称:数据构造实验五实验内容:1.使用邻接矩阵建立一个图,深度遍历。2使用邻接表建立一个图,广度遍历。3.建立一个图,存储构造本人确定,并进行拓扑排序。实验代码:1.#includestdio.h#defineInfinity100#defineMaxVertexNum20typedefenumDG,DN,UDG,UDNGraphKind;typedefintVRType;typedefcharVertexType;boolVisitMaxVertexNum;typedefstructArcCellVRTypeadj;ArcCell,AdjMatrixMaxVertexNu
2、mMaxVertexNum;typedefstructVertexTypevexsMaxVertexNum;AdjMatrixarcs;/邻接矩阵intvexnum,arcnum;/图的当前顶点数和弧数GraphKindkind;MGraph;intLocateVex(MGraphG,VertexTypev)for(inti=0;iinti,j,k;printf(请输入顶点数:n);scanf(%d,&G.vexnum);printf(请输入弧数:n);scanf(%d,&G.arcnum);i=0;while(igetchar();scanf(%c%c%d,&v1,i=LocateVex(G
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据 构造 实验 报告 _1

限制150内