澳洲国立大学作业题,大牛们给点意见啊

szp895 2013-10-15 06:55:59
替朋友发的,关于Kruskal算法题目,各位大大们,能否给点意见,不需要能把代码写出来(当然能给出感激不尽,嘿嘿)能给个思路或者伪代码也行,谢谢了!题目和翻译如下:
A complete graph is an undirected graph with an edge between each pair of vertices.
A randomly weighted complete graph is a complete graph in which each edge is assigned a weight which is a random real number uniformly distributed between 0 and 1. Let L(n) be the expected (average) weight sum of the edges in a minimum spanning tree of a randomly weighted complete graph with n vertices.

Your tasks are to (i) estimate L(n) and the running time of Kruskal's algorithm (22 points) when n = 10; 100; 150; 200; (ii) Observe the changing trend of the value of L(n) with the growth of n. Justify why this happens (3 points).

More precisely, write code using one language such as C, C++, Java, or Python program that does this: For each size of n = 10; 100; 150; 200, generate 50 randomly weighted complete graphs with n vertices and determine the weighted sum of the edges in the minimum spanning trees of the graphs as well as the running times of Kruskal's algorithm (the graph generation time will not be taken into account). Print (i) the average of the weighted sum of the 50 MSTs and the average running time of Kruskal's algorithm for nding the 50 weights; (ii) Explain the changing trend of the value of L(n) with the growth of n.

Your program should have the following properties.
1. Do not read any input, Write one line of output for each n, and at most 5 extra lines of explanatory output.
2. Store the graph as a symmetric matrix containing the edge weights.
3. Implement Kruskal's algorithm, using subroutines of Quick Sort and Directed Forest for disjoint sets, you need to implement both of these two subroutines, rather than calling them from the program language library.


随机加权完全图的是一个完整的图,其中每个边缘分配重量是0和1之间的均匀分布的随机实数。
设L(n)为最小生成树里顶点总和的权重,n为边的数量。

任务是
1. 用C,C++,JAVA或者Python编写,估算下当n=10,100,150,200的时候生成50个随机加权完成图,估算下最小生成树在Kruskal算法的运行时间。
2. 观察随着n的变化,L(n)的变化趋势。并证明原因。

你的程序需要满足下面几点要求。
1. 为每一个n写一行单独的输出,和最多5行的解释。
2. 把这个图保存为对称矩阵,包括所有顶点权重。
3. 使用快速排序和Direct Forest的子程序实现Kruskal算法,不能直接调用库里的方法。


再一次感谢了!
...全文
235 2 打赏 收藏 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kosora曹 2013-10-16
  • 打赏
  • 举报
回复
同一楼,Kruscal说到底就是一个并查集,国外称为Union/Find。
teemai 2013-10-15
  • 打赏
  • 举报
回复
建议发到【数据结构与算法】版去。 CSDN > CSDN论坛 > 高性能开发 > 数据结构与算法
代码下载链接: https://pan.quark.cn/s/a8fbca3925b4 《鸿蒙OS开发环境构建》指南系统性地阐述了配置和筹备鸿蒙OS开发所需的各种工具和条件的具体方法。鸿蒙OS,亦称HarmonyOS,是由华为研发的一款面向全场景的分布式操作系统,其目标是提供跨平台、多设备间无缝协作的使用体验。本指南涉及了从Linux服务器到Windows工作站的完整开发流程。指南中提及了MobaXterm,这是一款用于连接Linux源码服务器的软件,使得开发人员能够在Windows环境中远程访问Linux服务器。同时,HiTool作为烧录工具,用于将编译后的系统镜像写入开发板。IPOP.EXE则是一款串口终端软件,用于执行串行通信和调试任务。Embedded Studio用于开发设备驱动程序,而DevEco Studio是华为提供的图形化应用程序开发平台,支持C/C++语言,拥有代码编辑、编译、烧录和调试功能,被视为OpenHarmony智能设备开发者的首选集成开发环境。在硬件配置方面,指南列出了必需的设备,包括Linux服务器(推荐Ubuntu 16.04及以上版本),Windows工作台(兼容XP/7/10),以及Hi3518EV300 IoT Camera单板。开发期间,Windows工作台通过USB线与单板相连接,以实现数据传输。此外,为了开展开发工作,还需要安装putty、IPOP、tftp服务器等辅助软件,以及HiTool用于烧录操作。在软件系统要求方面,Linux服务器需要安装bash、Python3.7+、gn、ninja、LLVM等构建工具,这些工具对于生成和执行编译脚本具有关键作用。在Windows工作台上,建议采用Visual Studi...

62,620

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧