- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
实用文案
实用文案
标准文档
标准文档
实验报告
实验六 图的应用及其实现
一、实验目的
?进一步功固图常用的存储结构。
?熟练掌握在图的邻接表实现图的基本操作。
3?理解掌握AOV网、AOE网在邻接表上的实现以及解决简单的应用问题。
二、实验内容
一.基础题目:(本类题目属于验证性的,要求学生独立完成 )
[题目一]:从键盘上输入AOV网的顶点和有向边的信息,建立其邻接表存储结构, 然后对该图拓扑排序,并输出拓扑序列?试设计程序实现上述 AOV网 的类型定义和基本操作,完成上述功能。
[题目二]:从键盘上输入AOE网的顶点和有向边的信息,建立其邻接表存储结构, 输出其关键路径和关键路径长度。试设计程序实现上述AOE网类型定义和基本 操作,完成上述功能。
测试数据:教材图7.29
[题目五】连通OR不连通
描述:给定一个无向图,一共n个点,请编写一个程序实现两种操作:
D x y从原图中删除连接x, y节点的边。
Q x y询问x, y节点是否连通
输入
第一行两个数 n,m (5=nv=40000,1v=m=100000 )
接下来m行,每行一对整数x y (x,y=n ),表示x,y之间有边相连。保证没
有重复的边。
接下来一行一个整数 q (q=100000 )
以下q行每行一种操作,保证不会有非法删除。
输出
按询问次序输出所有Q操作的回答,连通的回答 C,不连通的回答D 样例输入
3
2
3
3
5
Q 1 2
D 1 2
Q 1 2
D 3 2
Q 1 2
样例输出
C
C
D
【题目六】 Sort Problem
An asce nding sorted seque nee of disti net values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted seque nee A, B, C, D implies that A B, B C and C D. in this problem, we will give you a set of relations of the form A B and ask you to determ ine whether a sorted order has bee n specified or not.
【Input ]
In put con sists of multiple problem in sta nces. Each in sta nee starts
with a line containing two positive integers n and m . the first value
indicated the number of objects to sort, where 2 = n = 26. The objects to be sorted will be the first n characters of the uppercase
alphabet. The sec ond value m in dicates the nu mber of relati ons of the
form A B which will be give n in this problem in sta nee. 1 = m = 100.
Next will be m lin es, each containing one such relati on con sist ing of
three characters: an uppercase letter, the character and a second
uppercase letter. No letter will be outside the range of the first n letters of the alphabet. Values of n = m = 0 in dicate end of in put.
[Output ]
For each problem in sta nee, output con sists of one line. This line should be one of the follow ing three:
Sorted seque nee determ in ed: y y y … y.
Sorted seque nee cannot be determ in ed.
Incon siste ncy found.
y y y
原创力文档


文档评论(0)