- 1、本文档共15页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数据结构上机(Data structure on computer)
[network synthesis - self-study examination questions]
Weave a C program, it can be read according to the data to construct a directed graph G, and output G DFS traversal sequence (starting from V0), the form of input n V0, Vi0, Vi2, V1, Vi1, V2...... Vi, Vin, -1, -1 (-1, -1) are the input end tags, and the remaining values are =0 and n0.
(Note: the executable name of the program must be e3.exe).
#include
Typedef, enum, {False, True}, Boolean;
Int G[100][100];
Int n;
Void (CreatG) / * to establish the adjacency matrix of a graph G[][]*/
{int, I, j;
Printf (Input the, number, of, the, node:);
Scanf (%d, n);
Printf (\n);
For (i=0; Ifor (j=0); J G[i][j]=0;
Do
{scanf (%d%d, i, j);
G[i][j]=1;
}while ((I! =-1) (J! =-1));
}
Void (TopSort) / * * / output topological sorting, topological sequence
{int, I, j;
Int degree[100]; / * in accordance with precursor vertex priority that degree[] storage nodes in.*/
Boolean, visited[100], flag=True;
Printf (The Topolgical Order as follow:);
For (i=0; i{degree[i]=0;
Visited[i]=False;
}
Printf (\n);
While (flag==True)
{
For (i=0; Ifor (j=0; jdegree[i]=G[j][i]+degree[i]);
I=0;
While ((IIF (i{printf) (%d), I);
Visited[i]=True;
For (j=0; J {G[i][j]=0; degree[j]=0;}
}
Else flag=False;
}
}
(main)
{CreatG ();
TopSort ();
}
1., a C program, which can be read according to the data to construct a directed graph G, and output G adjacency matrix and DFS traversal sequence (starting from V0), the form of input n Vi0, Vj0, Vj2, Vi1, Vj1, Vi2...... Vim, Vjm, -1, -1 (-1, -1 are input end tags), they are all integers, and 100n0, and the rest of the values are =0, and
(Note: the executable name of the program must be e1.exe, stored in your account or in its debug directory)
2. compiling a C program, it can read two sets of integers (each integer to -9999 for the end tag number is not greater than 1000), and in order to output both of all integers in the first set of integers and not in the second group of integers (w
您可能关注的文档
- 6.1 模板(6.1 templates).doc
- 06全口带入及问题(06 full mouth intake and problems).doc
- 6aunit3第一课时(6aunit3 first class).doc
- 6级英语单词p(6 English words p).doc
- 7 给水排水(7 water supply and drainage).doc
- 7 地形图测绘(7 topographic mapping).doc
- 7.4《流体压强与流速的关系》说课稿(7.4 the relation between fluid pressure and velocity).doc
- 7.3使用燃料对环境的影响(7.3 environmental impact of the use of fuel).doc
- 7a单词(7A word).doc
- 7侧翼理论(7 flank theory).doc
- 2024年秋季新外研版三年级上册英语课件 M10U2.pptx
- 2024年秋新人教版数学一年级上册课件 第2单元 6~10的认识和家、减法 2 6~9的加、减法 第5课时 8和9的加、减法.pptx
- 2024年秋新人教版一年级上册数学教学课件 五 20以内的进位加法 第6课时 练一练.pptx
- 2024年新人教版一年级数学上册课件 第四单元 11~20的认识 课时1 10的再认识.pptx
- 2024年新人教版数学一年级上册 第5单元 20以内的进位加法 4 解决问题 第3课时 练一练.pptx
- 2024年秋新人教版七年级上册数学教学课件 5.2 第2课时 移项.pptx
- 2024秋新鲁教版英语六年级上册课件 Unit 1 Section B (1a-1d) (第4课时).pptx
- 2024年新苏教版数学一年级上册全册教学课件 第一单元 0~5的认识和加减法练习二.pptx
- 2024年新鲁科版八年级上册物物理教学课件 第三章 光现象3.5 凸透镜成像的规律.pptx
- 2024年秋季新西师大版一年级上册数学课件 第二单元 0~9的加减法 2.认识减法 第3课时 做张减法表 .pptx
最近下载
- 金刚砂耐磨地坪工程劳务施工合同协议书范本.doc
- 2024年洛阳文化旅游职业学院单招职业技能测试题库精编答案.docx VIP
- DL_T 2078.2-2021CN 调相机检修导则 第2部分: 保护及励磁系统.docx
- GB39800.2-2020 个体防护装备配备规范 第2部分:石油、化工、天然气.pdf
- T_CIATCM 121-2024 共享中药房中药调剂信息系统建设指南.pdf VIP
- 优秀仓管员全能战实训练.doc VIP
- 2010太阳能热水系统在北京奥运村工程中的应用.pdf VIP
- 建筑工程安全资料全套整理版.doc
- 保健食品原料目录 营养素补充剂(2023年版).docx
- SA51024矽力杰 中文资料 规格书 pdf 下载电源管理芯片全线.pdf VIP
文档评论(0)