专业广州网站建设软件开发流程报告

web/2025/9/29 17:17:13/文章来源:
专业广州网站建设,软件开发流程报告,erp定制软件开发公司推荐,tp5企业网站开发百度云【0】README 0.1#xff09;本文总结于 数据结构与算法分析#xff0c; 但源代码均为原创#xff0c;旨在实现 不相交集ADT的两个操作#xff1a;合并集合union查找集合find#xff1b; 0.2#xff09; 不相交集ADT 的 Introduction #xff0c; 参见 http://blog.csd…【0】README 0.1本文总结于 数据结构与算法分析 但源代码均为原创旨在实现 不相交集ADT的两个操作合并集合union查找集合find 0.2 不相交集ADT 的 Introduction 参见 http://blog.csdn.net/PacosonSWJTU/article/details/49716905 【1】灵巧求并算法——按集合大小求并 1.1大小求并法定义上面的Union执行是相当任意的 通过使第二棵树 成为第一棵树的子树而完成合并对其的改进是借助任意的方法打破现有关系 使得总让较小的树成为较大树的子树我们把这种方法叫做 大小求并法 1.2可以看到 如果Union 操作都是按照大小求并的话那么任何节点的深度均不会超过 logN 1.3首先注意节点的深度为0 然后它的深度随着一次 Union 的结果而增加的时候该节点则被置于至少是 它以前所在树两倍大的一棵树上因此它的深度最多可以增加 logN次 1.3.2 Find 操作 的运行时间为 OlogN 而连续M次操作则花费 OMlogN1.3.3 下图指出在16次Union操作后可能得到这种最坏的树而且如果所有的Union都对相等大小的树进行 那么这样的树是会得到的 1.4为了实现这种方法 我们需要记住每个树的大小。由于我们实际上只使用一个数组因此可以让每个根的数组元素包含它 的树的大小的负值 1.5已经证明若使用按大小求并则连续 M次运算需要 OM平均时间 这是因为 当随机的Union执行时 整个算法一般只有一些很小的集合通常是一个元素与 大 集合 合并 1.6souce code printing 1.6.1download source code https://github.com/pacosonTang/dataStructure-algorithmAnalysis/blob/master/chapter8/p203_unionBySize.cSource Code Statements S1显然本源代码只对元素的size进行了加没有减因为我想的话 元素只能合并一次也即是元素C起初合并到了集合A就不能再次合并到集合B 元素C就一直属于集合A的子集了S2当然这个代码只是 大致上实现了按大小求并的思想如果元素C还可以再次合并到其他集合的话这就涉及到集合根元素的size的加减问题了需要的话添加之即可1.6.2souce code at a glance #include stdio.h #include malloc.h#define ElementType int #define Error(str) printf(\n error: %s \n,str) struct UnionSet; typedef struct UnionSet* UnionSet;// we adopt the child-sibling expr struct UnionSet {int parent;int size;ElementType value; };UnionSet makeEmpty(); UnionSet* initUnionSet(int size, ElementType* data); void printSet(UnionSet* set, int size); void printArray(ElementType data[], int size); int find(ElementType index, UnionSet* set);// initialize the union set UnionSet* initUnionSet(int size, ElementType* data) {UnionSet* set; int i;set (UnionSet*)malloc(size * sizeof(UnionSet));if(!set){Error(out of space, from func initUnionSet); return NULL;} for(i0; isize; i){set[i] makeEmpty();if(!set[i])return NULL;set[i]-value data[i];}return set; }// allocate the memory for the single UnionSet and evaluate the parent and size -1 UnionSet makeEmpty() {UnionSet temp;temp (UnionSet)malloc(sizeof(struct UnionSet));if(!temp){Error(out of space, from func makeEmpty!); return NULL;}temp-parent -1;temp-size 1;return temp; }// merge set1 and set2 by size void setUnion(UnionSet* set, int index1, int index2) {//judge whether the index1 or index2 equals to -1 ,also -1 represents the rootif(index1 ! -1)index1 find(index1, set);if(index2 ! -1)index2 find(index2, set);if(set[index1]-size set[index2]-size){set[index2]-parent index1;set[index1]-size set[index2]-size;}else{set[index1]-parent index2;set[index2]-size set[index1]-size;} } //find the root of one set whose value equals to given value int find(ElementType index, UnionSet* set) {UnionSet temp; while(1){temp set[index];if(temp-parent -1)break;index temp-parent;}return index; } int main() {int size;UnionSet* unionSet;ElementType data[] {110, 245, 895, 658, 321, 852, 147, 458, 469, 159, 347, 28};size 12;printf(\n\t test for union set by size \n);//printf(\n\t the initial array is as follows \n);//printArray(data, size); printf(\n\t the init union set are as follows \n);unionSet initUnionSet(size, data); // initialize the union set overprintSet(unionSet, size);printf(\n\t after union(1,5) union(2,5) union(3,4) union(4,5) \n);setUnion(unionSet, 1, 5);setUnion(unionSet, 2, 5);setUnion(unionSet, 3, 4);setUnion(unionSet, 4, 5);printSet(unionSet, size);printf(\n\t after union(9,8) union(7,6) union(3,6) \n);setUnion(unionSet, 9, 8);setUnion(unionSet, 7, 6);setUnion(unionSet, 3, 6); printSet(unionSet, size);return 0; }void printArray(ElementType data[], int size) {int i;for(i 0; i size; i) printf(\n\t data[%d] %d, i, data[i]); printf(\n\n); } void printSet(UnionSet* set, int size) {int i;UnionSet temp;for(i 0; i size; i){ temp set[i];printf(\n\t parent[%d] %d, i, temp-parent); }printf(\n); }1.6.3printing result 【2】灵巧求并算法——按集合高度求并 2.1按高度求并定义 另外一种方法是按照高度求并按照高度求并是按大小求并的简单修改推荐 2.2它同样保证所有的树的深入最多是 OlogN)。我们使得 浅的树 成为深 的树的子树这是一种平缓算法 因为只有当两颗相等深度的树求并时树的高度才会增加此时树的高度增加1。 2.3source code printing result 2.3.1download source code https://github.com/pacosonTang/dataStructure-algorithmAnalysis/blob/master/chapter8/p205_unionByHeight.c2.3.2source code at a glance #include stdio.h #include malloc.h#define ElementType int #define Error(str) printf(\n error: %s \n,str) struct UnionSet; typedef struct UnionSet* UnionSet;// we adopt the depth-sibling expr struct UnionSet {int parent;int height;ElementType value; };UnionSet makeEmpty(); UnionSet* initUnionSet(int depth, ElementType* data); void printSet(UnionSet* set, int depth); void printArray(ElementType data[], int depth); int find(ElementType index, UnionSet* set);// initialize the union set UnionSet* initUnionSet(int size, ElementType* data) {UnionSet* set; int i;set (UnionSet*)malloc(size * sizeof(UnionSet));if(!set){Error(out of space, from func initUnionSet); return NULL;} for(i0; isize; i){set[i] makeEmpty();if(!set[i])return NULL;set[i]-value data[i];}return set; }// allocate the memory for the single UnionSet and evaluate the parent and depth -1 UnionSet makeEmpty() {UnionSet temp;temp (UnionSet)malloc(sizeof(struct UnionSet));if(!temp){Error(out of space, from func makeEmpty!); return NULL;}temp-parent -1;temp-height 0;return temp; }// merge set1 and set2 by depth void setUnion(UnionSet* set, int index1, int index2) {//judge whether the index1 or index2 equals to -1 ,also -1 represents the rootif(index1 ! -1)index1 find(index1, set);if(index2 ! -1)index2 find(index2, set);if(set[index1]-height set[index2]-height) set[index2]-parent index1; else if(set[index1]-height set[index2]-height) set[index1]-parent index2; else{set[index1]-parent index2;set[index2]-height; // only if the height of both of subtrees is equal, the height increases one} } //find the root of one set whose value equals to given value int find(ElementType index, UnionSet* set) {UnionSet temp; while(1){temp set[index];if(temp-parent -1)break;index temp-parent;}return index; } int main() {int size;UnionSet* unionSet;ElementType data[] {110, 245, 895, 658, 321, 852, 147, 458, 469, 159, 347, 28};size 12;printf(\n\t test for union set by depth \n);//printf(\n\t the initial array is as follows \n);//printArray(data, depth); printf(\n\t the init union set are as follows \n);unionSet initUnionSet(size, data); // initialize the union set overprintSet(unionSet, size);printf(\n\t after union(0, 1) union(2, 3) union(4, 5) union(6, 7) union(8, 9) union(10 ,11) \n);setUnion(unionSet, 0, 1);setUnion(unionSet, 2, 3);setUnion(unionSet, 4, 5);setUnion(unionSet, 6, 7);setUnion(unionSet, 8, 9); setUnion(unionSet, 10, 11); printSet(unionSet, size);printf(\n\t after union(1, 3) union(5, 7) union(9, 11) \n);setUnion(unionSet, 1, 3);setUnion(unionSet, 5, 7);setUnion(unionSet, 9, 11);printSet(unionSet, size); printf(\n\t after union(3, 7) union(7, 11) \n);setUnion(unionSet, 3, 7);setUnion(unionSet, 7, 11); printSet(unionSet, size); return 0; }void printArray(ElementType data[], int size) {int i;for(i 0; i size; i) printf(\n\t data[%d] %d, i, data[i]); printf(\n\n); } void printSet(UnionSet* set, int size) {int i;UnionSet temp;for(i 0; i size; i){ temp set[i];printf(\n\t parent[%d] %d, i, temp-parent); }printf(\n); }2.3.3printing results

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/84016.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

企业网站备案注销免费的写作网站

目录 List 用法 1. 增 2. 删 3. 查 内部编码 应用场景 前言 Redis 中的 List 和 Set 数据结构各有特点,适用于不同的应用场景。List 提供了有序的列表结构,适合用于消息队列和任务列表等场景;Set 提供了无序且不重复的集合结构&#…

创意互动网站sem扫描电镜

生成签名证书指纹 在DevEco Studio工具侧生成密钥(.p12)和证书请求文件(.csr)。请根据以下使用场景,在AppGallery Connect侧申请应用证书(.cer)、Profile(.p7b)文件等。…

襄阳网站建设八零后谷歌推广关键词匹配

来源:今日头条11月27日,今日头条CEO朱文佳在36kr wise大会上谈及头条搜索。在他看来,要做好搜索,有三件事最重要。首先是技术,技术决定搜索的体验;其次是内容,内容是搜索的根本;最后…

高端家装修公司淘宝关键词优化

第一步 打开Database windows-prefenrence-showview-DBbrowser ,此时会在工具底部有个DBbrowser ,选中它,再它所控制的页面的任意位置 右击new---跳转到一个配置driver的页面 (选择连接方式)图一打开myeclipse然后点击window窗口 点击Open Perspective…

东莞企业公司网站建设网站上地图怎么做的

Twitter BootStrap已经火过大江南北,对于无法依赖美工的程序员来说,这一成熟前卫的前端框架简直就一神器,轻轻松松地实现出专业的UI效果。GitHub上相关的的开源项目更是层出不穷,在此整理列举一些感觉不错的组件或增强实现&#x…

高要网站建设公司网站在哪里备案

平台 本文以展锐 Android10平台为例。 编译 编译时用 make Launcher3QuickStep -j4 ,而不是 make Launcher3 -j4 界面结构 Launcher.java 对应布局 launcher.xml 当前界面 Workspace, CellLayout 是单一页。 控制应用图标隐藏 复写AppFilte…

ppt模板免费下载的网站网络推广与推广

摘要:数学修养对软件开发之路起着什么作用?码农如何修炼自己的内功并成长为优秀的软件开发员?带着相关思考,社区之星第10期采访了中南大学副教授——刘伟。他对数学修养、设计模式、软件架构和重构方面的独特见解,相信…

沈阳市建设工程安全监督站网站中国互联网金融公司排名

目录 Linux vi/vim 什么是 vim? vim 键盘图 vi/vim 的使用 命令模式 输入模式

免费做初级会计试题网站有哪些国内做优秀的农业信息网站

开发环境: 1、Qt 6.7.2 2、Pyside6 3、Python 3.11.4 4、Windows 10 重要的事情说三遍,使用自定义qml参考链接: Qt官网参考网址!!! 重要的事情说三遍,使用自定义qml参考链接: Qt官网参考网址!!! 重要的事情说三遍,使用自定义qml参考链接: Qt官网参考网址!!!…

牛商网站建设定制vx免费

Kubernetes 的网络模型 通过前面教程的学习,我们已经可以将容器化的应用程序在 Kubernetes 中运行起来,并且发布到 Kubernetes 内/外的网络上。 通常,Docker 使用一种 host-private 的联网方式,在此情况下,只有两个容…

二级域名做网站注意网站开发与维护难吗

大家好,我是若川。很多关注我的新朋友可能不知道我组织了源码共读活动~也有很多人不知道我是谁。有人以为我是80后。有人以为我是全职自媒体等等。若川的 2021 年度总结,弹指之间 这篇文章写了我是16年毕业的,或许有些启发。源码共读按照从易…

外链提交网站网站 签约

力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 分析知:设指针值从1开始依次递增,每次将coins里的值累加起来看能否得到或者大于当前指针值 ,否则就将该指针值累加起来,即需要添加的数 class Solution …

js网站特效记事本做网站报告

Zookeeper脑裂原因: 主要原因是Zookeeper集群和Zookeeper client判断超时并不能做到完全同步,也就是说可能一前一后,如果是集群先于client发现,那就会出现上面的情况。同时,在发现并切换后通知各个客户端也有先后快慢…

网站上的产品介绍如何做网站怎么设置支付功能

在局域网中,怎样得到PPPoE服务器的mac地址是一件头疼的事情,特别是在windows环境下;得到PPPoE服务器mac地址的实现方法有两种:1.在windows下,我们运行wireshark软件,可以得到所有进出网卡的数据包格式和内容…

房屋租赁网站开发需求分析网站建设 招标

来源:http://www.heibai.net/articles/hacker/mimapojie/2009/0908/841.html MYSQL数据库用户密码跟其它数据库用户密码一样,在应用系统代码中都是以明文出现的,在获取文件读取权限后即可直接从数据库连接文件中读取,例如asp代码中…

浙江直播网站建设wordpress企业官网

转载于:https://www.cnblogs.com/wainiwann/p/8793418.html

昆明网站建设开发外包怎么在自己的网站上传视频

大清早打开vs2008,出现这么诡异的错, 删了一个dll的就好了。如图

企业网站mp4怎么处理网站建设公司如何

Monkey monkey是安卓的命令行工具,可以运行在虚拟机或者实际设备中。 monkey的目的就是为了测试app的稳定性,看App是否会崩溃 monkey的特点:只能对程序包进行测试,无法对源码进行测试;moneky的事件数据流是随机的,无法…

汉寿网站建设用来做视频连接的网站

一、引用 1、初步理解 引用在语法上的理解就是起别名,用法就是在类型后面加&,例子:int a 1; int& b a; 上例所示,执行后,b就是a的别名,它们代表同一块空间,a的改变会影响b&#xff0…

免费网站加速器wordpress微信登录调用

本文来编写一个实例说下mysql中的EXISTS和NOT EXISTS使用详解 文章目录 exists用法SQL中in, not in, exists, not exists的区别使用实例本文小结 exists用法 exists: 如果括号内子查询语句返回结果不为空,说明where条件成立,就会执行主SQL语句。如果括号…