ImageVerifierCode 换一换
格式:DOC , 页数:14 ,大小:1.73MB ,
资源ID:4617895      下载积分:8 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/4617895.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(算法2010-2011考题-答案.doc)为本站上传会员【丰****】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

算法2010-2011考题-答案.doc

1、Learn General Secretary on "two to learn a" strengthening "four Consciousnesses" important speech caused a strong reaction in the country.   Time, watching "red treasure", the origin of building the party back to power, how to strengthen services for the masses, improve party cohesion, fighting to

2、become the grass-roots party members and masses hot topic. Grass-roots party organizations "two" is to strengthen the service of party members and cadres, the pioneer spirit. Distribution of grass-roots party organizations in all walks of people, clothing, shelter, which belongs to the nerve endings

3、 of the party organization and comments reputation has a direct perception of the masses.   Strengthen the party ahead of the "pedal" spirit; strengthen the party members and cadres "success does not have to be me" and "the first to bear hardships, the last to" service spirit to set the party's pos

4、itive image among the people is important. Grass-roots party organizations "two" is to cleanse all people not happy not to see "stereotypes", establish the honest faithful, diligent faith for the people. No need to avoid mentioning that, some members of our party can not stand the "money," corrosion

5、 of temptation, thin, Xu Zhou, such abuse and corrupt bribery, malfeasance borers, and rats. Two, is to clean up, thin, Xu, Zhou's solution to restore the party's fresh and natural, solid and honest work style.   Cleansing "take, eat, card," undesirable and behaviour, "cross, hard and cold, push" a

6、ttitude. Grass-roots party organizations "two" is to strengthen the sense of ordinary party members, participating in consciousness, unity consciousness. For reasons known, members of grass-roots party branches less mobile, less resources, and the construction of party organizations have some lag. T

7、wo studies, is to focus on the grass-roots party branches "loose, soft, loose" problem, advance the party members and cadres, "a gang working", "Hong Kong report."   Strong cleanup actions, style and rambling, presumptuous "unqualified" party members, pays special attention to party members and cad

8、res "joining party of thought" problem. "Party building" is obtained in the long-term development of our party's historical experience accumulated. Two is our party under the new historical conditions, strengthen the party's construction of a new "rectification movement." Grass-roots party organizat

9、ions should always catch the hard work, results-oriented. Two educational outcomes are long-term oriented and become an important impetus for the work. "Two" should have three kinds of consciousness "two" study and education, basic learning lies in the doing. Only the Constitution address the serie

10、s of party rules, and do solid work, be qualified party members had a solid ideological basis. Only the "learning" and "do" real unity, to form a "learn-learn-do-do" the virtuous cycle, and ultimately achieve the fundamental objective of education. This requires that the Organization 1、使用分治法写一个算法完成

11、一个无序的整数数组的归并排序,并分析算法的时间复杂度。要求:算法的函数表示是MergeSort(1,n)算法对于A[1:n]进行排序,A是一个全局数组,含有n个元素。算法的实现可利用Merge(low,mid,high)计数,其功能是将全程数组A[low:high]进行合并排序,函数调用前,A[low,high]由两部分已经排序的子数组构成:A[low:mid]和A[low+1:high],函数的任务是将这两部分子数组合并成一个整体排好序的数组,再存于数组A[low:high]。(实现时,可认为Merge是已知的,不需要编写)(20分) 解: (1)递归实现的归并排序: 1. //2d7

12、1 递归实现二路归并排序   2. #include "stdafx.h"   3. #include         4. using namespace std;    5.    6. int a[] = {10,5,9,4,3,7,8};   7. int b[7];   8.    9. template    10. void Merge(Type c[],Type d[],int l,int m,int r);   11.    12. template    13. void Merg

13、eSort(Type a[],int left,int right);   14.    15. int main()   16. {   17.     for(int i=0; i<7; i++)   18.     {   19.         cout<

14、     }   27.     cout<   31. void Merge(Type c[],Type d[],int l,int m,int r)   32. {   33.     int i = l,j = m + 1,k = l;   34.     while((i<=m)&&(j<=r))   35.     {   36.         if(c[i]<=c[j])   37.         {   38.             d[k++] = c

15、[i++];   39.         }   40.         else   41.         {   42.             d[k++] = c[j++];   43.         }   44.     }   45.    46.     if(i>m)   47.     {   48.         for(int q=j; q<=r; q++)   49.         {   50.             d[k++] = c[q];   51.         }      52.     }   53.    

16、 else   54.     {   55.         for(int q=i; q<=m; q++)   56.         {   57.             d[k++] = c[q];   58.         }   59.     }   60. }   61.    62. template    63. void MergeSort(Type a[],int left,int right)   64. {   65.     if(left

17、nt i = (left + right)/2;   68.         MergeSort(a,left,i);   69.         MergeSort(a,i+1,right);   70.         Merge(a,b,left,i,right);//合并到数组b   71.    72.         //复制回数组a   73.         for(int g=left; g<=right; g++)   74.         {   75.             a[g] = b[g];   76.         }   77.  

18、   }   78. }   (2)非递归实现的归并排序: 1. //2d7-1 自然二路归并排序   2. #include "stdafx.h"   3. #include         4. using namespace std;    5.    6. int a[] = {10,5,9,4,3,7,8};   7. int b[7];   8.    9. template    10. void Merge(Type c[],Type d[],int l,int m,int r);   11.    12.

19、 template    13. void MergePass(Type x[],Type y[],int s,int n);   14.    15. template    16. void MergeSort(Type a[],int n);   17.    18. int main()   19. {   20.     for(int i=0; i<7; i++)   21.     {   22.         cout<

20、l;   25.     MergeSort(a,7);   26.     for(int i=0; i<7; i++)   27.     {   28.         cout<   34. void Merge(Type c[],Type d[],int l,int m,int r)   35. {   36.     int i = l,j = m + 1,k = l;   37.

21、    while((i<=m)&&(j<=r))   38.     {   39.         if(c[i]<=c[j])   40.         {   41.             d[k++] = c[i++];   42.         }   43.         else   44.         {   45.             d[k++] = c[j++];   46.         }   47.     }   48.    49.     if(i>m)   50.     {   51.         for

22、int q=j; q<=r; q++)   52.         {   53.             d[k++] = c[q];   54.         }      55.     }   56.     else   57.     {   58.         for(int q=i; q<=m; q++)   59.         {   60.             d[k++] = c[q];   61.         }   62.     }   63. }   64.    65. template  

23、  66. //合并大小为s的相邻子数组   67. void MergePass(Type x[],Type y[],int s,int n)   68. {   69.     int i = 0;   70.     while(i<=n-2*s)   71.     {   72.         //合并大小为s的相邻两段子数组   73.         Merge(x,y,i,i+s-1,i+2*s-1);   74.         i = i + 2*s;   75.     }   76.     //剩下的元素个数少于2s   77.     if

24、i+s   91. void MergeSort(Type a[],int

25、 n)   92. {   93.     Type *b = new Type[n];   94.     int s = 1;   95.     while(s

26、题时采用的贪心准则。(最优有装载问题:一批集装箱要装上一艘载重量为c的轮船,其中集装箱i的重量为wi。最优装载问题要求确定在装在体积不受限制的情况下,将尽可能多的集装箱装上轮船。)(10分) 解: 算法分析:采用重量轻者先装的贪心选择策略,可产生最优装载问题的最优解。具体描述如下: 2、贪心选择性质 变换目标后可以证明最优装载问题具有贪心选择性质(归纳法) 3、最优子结构性质 最优装载问题具有最优子结构性质(反证法) 由最优装载问题的贪心选择性质和最优子结构性质,容易证明算法loading的正确性。 算法loading的主要计算量在于将集装箱依其重量从小到大排序,故

27、算法所需的计算时间为O(nlogn) 3、设使用动态规划算法求解最长公共子序列,写出子序列长度c[i][j]的递归表达式,写出求解序列(A,B,F,G)和序列(D,C,B,F)的最长公共子序列时c[i][j] 的值。(20分) 解: C[i,j]: 保存Xi与Yj的LCS(最长公共系序列)的长度 递归法递推表达式: 动态规划法递推表达式: 算法: void LCSLength(int m,int n,char *x,char *y,int**c,int**b) { inti,j; for (i= 1; i<= m; i++) c[i][0] = 0; for

28、 (i= 1; i<= n; i++) c[0][i] = 0; for (i= 1; i<= m; i++) for (j = 1; j <= n; j++) { if (x[i]==y[j]) { c[i][j]=c[i-1][j-1]+1; b[i][j]=1;} else if (c[i-1][j]>=c[i][j-1]) { c[i][j]=c[i-1][j]; b[i][j]=2;} else { c[i][j]=c[i][j-1]; b[i][j]=3; } } } 构造最长公共子序列 void LCS(inti,intj,char *x,int**b)

29、 { if (i==0 || j==0) return; if (b[i][j]== 1){ LCS(i-1,j-1,x,b); cout<

30、 p[5]={(0,0),(4,6)}; q[5]=p[5]Å(w4,v4)={(5,4),(9,10)}。从跳跃点集p[5]与q[5]的并集p[5]Èq[5]={(0,0),(4,6),(5,4),(9,10)}中看到跳跃点(5,4)受控于跳跃点(4,6)。将受控跳跃点(5,4)清除后,得到p[4]={(0,0),(4,6),(9,10)} q[4]=p[4]Å(6,5)={(6,5),(10,11)} p[3]={(0,0),(4,6),(9,10),(10,11)} q[3]=p[3]Å(2,3)={(2,3),(6,9)} p[2]={(0,0),(2,3),

31、4,6),(6,9),(9,10),(10,11)} q[2]=p[2]Å(2,6)={(2,6),(4,9),(6,12),(8,15)} p[1]={(0,0),(2,6),(4,9),(6,12),(8,15)} p[1]的最后的那个跳跃点(8,15)给出所求的最优值为m(1, c)=15 5、试用优先队列式分支限界算法解旅行商问题,给出针对下图实例的解空间树的扩展过程与队列变化状态。(15分) 解: 一个例题: 6、设f(x)是[0,2]上的连续函数,且,试利用概率算法计算定积分的近似值(设生成随机数的函数是已知的)。(15) 解: (1)随机投点法计算定

32、积分: 基本思想是在矩形区域上随机均匀的投点实现。本算法的基本思想是在积分区间上随机均匀的产生点, 即在[a,b]上随机均匀的取点, 求出由这些点产生的函数值的算术平均值, 再乘以区间宽度, 即可解出定积分得近似解。 随机化算法 :用随机投点法计算定积分: #include "stdafx.h"   #include "RandomNumber.h"   #include    using namespace std;    double Darts(int n,double a,double b);   double f(double x);   i

33、nt main()   {       int n1 = 100,n2 = 1000,n3 = 1000,n4 = 10000,n5 = ;       double a = 2.0,b = 3.0;       cout<<"n1="<   5. using namespace std;   6.    7. double Darts(int n,double a,double b,double d);   8. double f(dou

37、ble x);   9.    10. int main()   11. {   12.     int n1 = 100,n2 = 1000,n3 = 1000,n4 = 10000,n5 = ;   13.     double a = 2.0,b = 3.0;   14.     double d = f(b);   15.     cout<<"n1="<

42、y realize their value. "Learning" is the Foundation, the Foundation is not strong, shaking; " "Is the key to net to net thousands of accounts.    "Two" education, "" lay the basis, going to "do" the key grip, so that the "learning" and "doing" back to standard, so that the majority of party members

43、"learn" learning theory of nutrients, in the "doing" practice party's purposes. Second, to establish a sense of depth. "Learning" and "do" not Chu drawn, entirely different, but the organic unity of the whole. "Two" learning education, we need to explore integrating "learning" in "do", exhibit "do"

44、in "Science". To avoid the "learning" into simple room instruction, "do" into a monotone for doing.    Should exploration "learn" in the has "do", "do" in the has "learn" of education and practice of carrier, makes general grass-roots members can in "learn" in the has "do" of achievements sense, in

45、"do" in the has "learn" of get sense, real makes party of theory brain into heart, put for people service concept outside of Yu shaped. Third, to adhere to long-term the awareness. Style construction on the road forever, "two" had to catch the long-term. "Two" study and education, by no means, assau

46、lt-style wind-sport, but the recurrent education within the party. In recent years, the party's mass line education practice and "three-three" special education in grass-roots borne rich fruits, vast numbers of party members and cadres withstood the baptism of the spirit. "Two" greater need to focus

47、 on longer hold long-term, to establish and perfect the effective mechanism of the education, focusing on the creation of long-term education, strive to make the vast number of party members to maintain their vanguard Color, maintain the party's advanced nature and purity. Awareness-raising, antenna

48、s and atmosphere – a discussion on how leading cadres of party members "two" current, "two" activity is in full swing up and down the country, party cadres as a "key minority" is both a barometer and impetus. The "two" meaning enough deep, is to determine the party cadres can resolve to study hard f

49、irst. In the "two" in the process, some cadres of himself, standing long, high awareness, that Constitution Party rules is simple, its not worth bothering some party cadres think speak series has nothing to do with the grass-roots work, water business learning series of speeches seen as window dressing. These "lazy, casual, and decadent" ideas learning lacks motivation, a serious impediment to "two" effect. John Stuart Mill once said, only a basic element of human thought patterns change dramatically, human destiny can make great improvement. The same, only party members and

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服