算法导论课后答案


-
算法导论答案
NSERTION-SORT(A) for j+2 to length[A] do key←A的 //Insert AD] into the sorted sequence A[1. j-1 l·」 while i>o and askey doA[+1]·A[的 i←-j-1 A[+1]←key Algorithm 1 LINEAR-SEARCH(A, V Input: A=a1, a2,,. an) and a value v Output: An index i such that v= Ali or nil ifv2A 讠←1 Tondo if Ali]-y then return L d if return nil As a loop invariant wc say that none of the elcmcnts at index All,...,i 1] arc cqual to v. Clcarly, all properties arc fullfllcd by this loop invariant A、B各存放了一个二进制n位整数的 BINARY-ADD(A,B,C) 各位数值,现在通过二进制的加法对1fag-0 这两个数进行计算,结果以二进制形2forj-1ton 式把各位上的数值存放在数组C中 3 do 4key←A]+B+fag key存储临时计算结果,fag为进位 5 C0+ key mod 2 标志符,按位相加,8、9行不能少 if key >1 fad←1 g 8 if flag=1 C[n+们 n3/100-10n2-100n+3=O(n3) Assume that FIND-MIN(A, r, s returns the index of the smallest element in A between indices r and s. Clearly, this can be implemented in O(s -r)time ifr>s Algorithm 2 SELECTION SORT(A) Input: A=a1, a2,...anI Output: sorted A Or L TIND-MIN(A, 1, n) Ai+÷Ai end for As a loop invariant we choose that Al,...,i-I] are sorted and all other elements are greater than these. We only need to iterate to m-1 since according to the invariant the nth element will then the largest The n calls of FIND-MIN gives the following bound on the timc complexity This holds for both the best and worst -case running time Given that each element is equally likely to be the one searched for and the element searched foris present in the array, a linear search will on the average have to search through half th e elements Tais is because half the time the wanted element will be in the first half and half the time it will be in the second half. Doth the worst-case and average-case of LINEAR-SEARCH is O(n) Modify the algorithm so it tests whether the input satisfies some special-case con dition and, if It does, output a pre-computed answer. The best-case running time Is generally not a good measure of an algorithm 如下所示: 3,9,26,38,41,49,52,57 3,26,41,52 9,38,49,57 26,52 38,57 9,49 52 构建左半部分和右半部分的辅助数组 由题意得: 根据数学归纳法: 给出基本条件( base case) 当n=2时,T(2)=2l2=2。符合条件。 给出假设: 当n2时,T(2)=212成立。 那么, 当n=2时,T(21)=2T(21/2)+2 2T(22)+2+ 2(2g2t)+2 2+1g21 所以得证! Since it takes O(n )time in the worst case to insert ALn] into the sorted array All.n-l, we get the recurrence e(1) ifn=1 (n)= T(n-1)+0(n)if n The solution to this recurrence is T(n)=9(r) 给出一个递归算法.显然最坏情况的运行时间为(gn) BINARY-SEARCH(A, v, p, r) ifp2 r and y≠A[p]then return nil end if [ n/2」 j←Al(r-p)/2】 if v=al] then return e se if v<All then return BINARY-SEARCH(A; v,p; j) ese return BINARY-SEARCH(A; v;i;r) en 将插入排序的顺序查找改为二分查找的算法: I NSERTION-SORT(A) 9forj←2 to length 10 do key - a 11 △inse ul into the sorted sequence a[1.j-1] high←j-1 14 while low s high 15 mid = low+ high)/ 2 16 If key==A[mid then break 18 ikey≤A[md]then 19 high←mid-1 if key>Amid] then 21 Ow id +1 id toj1 A[i+1]←a[i Am]←key 在最坏情況下,二分查找的时间复杂度是rlgn,但插入时数组移动的时间复杂度仍是n。 故总体运行时间不能改善为ongn)。(但若排序中采用链表的数据结构,则可改善。) Give a O(nlgn] time algoriThm for deternining if there exist two elements in an set S whose sum eXac some value x Algorithm 4 CHECKSUMS(A, X Input: An array A and a value x. Output: A boolean valuc indicating if there is two clements in A whose sum is x A∈SORI(A ength] fori← to n do if Ali>0 and BINARY-SEARCh(A, Ali-x, 1, n) then return trle end if end for return false Clearly, this algorithm dces the job. (It is assumed that nil cannot be true in the if-statement. 第章 因为f)和g都是渐近非负的函数,所以根据定义有:存在NN2使得:当nN时f(n≥20, 同时,当n>N2时,g(n)>0.所以,我们取N。=max(NN此时,当n>N时,同时有f(n)>0,s(n)>0. 下面我们取C1=1/2,C2=1,根据f(n),g()的非负性保证,当n№时,有: f(n)+g(n) ≤maxf(),g(n)}≤f(n)+g(n) 所以,得证! To show that (n +a)=e(n), we want to find constants cl, C2, 7o>0 such that 0≤an≤(m+a)≤c2 no for all n≥ Note that 7+a≤n+|a when a|≤n and a≥n-|a when al≤n Thus, when n≥2|a 0≤=≤n+a≤2n Since b>0, the inequality still holds when all parts are raised to the power b 0≤(n)≤(n+a)≤(2n), 2)n≤(m+a)≤2n2 Thus, C1=(1/2), C2=26, and no=2 lal satisfy the definition Let the running time be T(n). T(n)20(n)means that T(n)> f(n)for some function f(n) in the set O(n). This statement holds for any running time T(n) since the function g(n)=0 for all n is in O(n), and running times are always nonnegative Thus the statement tells us nothing about the running time 2+1=0(2)因为2+1=2x2≤2x2,所以成立 2=0(2)不成立。用反证法:如果有2=02成立,根据定义需要有:2n≤c2,由此需 要: slac.矛盾!对于任意大的n是不可能成立的,因为c是一个常数。 首先证明充分性:即由f(n)=e(g(m)推出f(n)}=0(g(n)且f(m=Q(g(nj) 根据定义:有存在NaCo,使得:当n>N时有:Cg(m)≤f(m)≤C1g(m)在根据O,和Q 定义有f(n)=O(g(n)且f(n)=Q(g(n) 在证明必要性:即由fn}=O(g(n)且fn=Q(g(m)推出fn)=eg(m) 根据O,和Ω定义有:存在№,C1使得:当n>N1时有f(n)≤C1gn),同样地,存在N2,Co 使得:当n>N2时有cog(n)≤f(n),此时,我取N=max(N1,N2.则有如下事实成立:当n>No 时有:Cg(m≤f(n)≤C1g(m),即f(m)=egm)所以,得证! 由定义可易证,回记号渐近地给出—个函数的上界和下界,0记号给出一个函数的渐近上界 而g给出渐近下界。 Solution: Let fCo((n))n alg(n)). That means f=o(g(n)=w(g n). By the definition of o, we have lim(f(n)/g(2)=0 But the detinition ofo we have lim(f(n)/g(n))=co Becauise of0≠∞, we have a obvious contradiction Q(g(n,m))=f(n, m). there exist positive constants c, no, and mo such that0≤cg(n,m)≤f(n,m) for all n> no and m≥mo} o(g(n,m))=If(n, m). there exist positive constants cl, C2, no, and o such that0≤c8(n,m)≤f(m,m)≤C28(n,m) for all n≥ no and n1≥mo} 依题意可知,若n,≤n2 则有fm2)≤fn2),gn2)≤g(n2)f(m1)≤f(n2),g(m1)≤gn2 [f(n2)+g(m2)-[(m2)+g(m2)] f(n,)-f(n,)+g(n 故£(n)+g(n)是单调递增的,后两个类似可得证。 logh a· logan= logh n· logh a commutativity of logh n 10gb/2 a (log x )y=log x (both sides) logh n_ logb c ogx. y(both sides) c>0,32>0,使得对所有的n≥,有0≤c2<n1,故|=w(2 如>033>0,使得对所有的nn有0≤n|≤cx3,故=O(12) 设「1gn1=m 则有m!=√2xmmc2m> 2 e (me)=e(nmt)>nlmm+ >n如an Solon! is not polynomially bounded Iglgn=m, m!<m<(2")=2m<2 andolan2m1-1,n≥22 glg|<2”≤ no So1glgn! is polynomially bounded. 后者大 数学归纳法易证 用数学归纳法证明

1.66MB
算法导论课后习题与思考题答案合集
1969-12-08算法导论课后习题与思考题答案合集。。。算法导论课后习题与思考题答案合集,算法导论课后习题与思考题答案合集
407KB
算法导论课后答案
2016-10-302.11MB
算法导论课后答案 中文版
2010-07-01算法导论课后答案 中文版 包括大部分重要的题
5.78MB
算法导论课后答案中英文
2016-03-19算法导论课后答案中英文
5.8MB
算法导论课后习题答案
2019-04-08算法导论的答案 有2,3,4,5,6,7,9章的答案,分文件夹
4.90MB
算法导论第三版课后题答案
2014-08-13算法导论第三版课后题答案以及算法导论第三版课本(英文版),答案并不是很全,但是绝大部分重要的都有
16.74MB
算法导论课后习题完整答案
2019-03-08该书是一本十分经典的计算机算法书籍,与高德纳(Donald E.Knuth)的《计算机程序设计艺术》(The Art Of Computer Programming)相媲美。 《算法导论》由Thomas H.Cormen、Charles E.Leiserson、Ronald L.Rivest、Clifford Stein四人合作编著(其中Clifford Stein是第二版开始参与的合著者)。本书的最大特点就是将严谨性和全面性融入在了一起。
1.49MB
算法导论及课后习题与思考题答案.pdf
2012-11-08与算法导论(第二版)配套使用,优秀程序员必读之经典。
257KB
算法导论课后答案(英文版)
2009-10-09算法导论的课后答案 希望对大家有帮助^_^
高并发下的Nginx性能优化实战
2019-12-24<p> <b><span style="background-color:#FFE500;">【超实用课程内容】</span></b> </p> <p> <br /> </p> <p> <br /> </p> <p> 本课程内容包含讲解<span>解读Nginx的基础知识,</span><span>解读Nginx的核心知识、带领学员进行</span>高并发环境下的Nginx性能优化实战,让学生能够快速将所学融合到企业应用中。 </p> <p> <br /> </p> <p style="font-family:Helvetica;color:#3A4151;font-size:14px;background-color:#FFFFFF;"> <b><br /> </b> </p> <p style="font-family:Helvetica;color:#3A4151;font-size:14px;background-color:#FFFFFF;"> <b><span style="background-color:#FFE500;">【课程如何观看?】</span></b> </p> <p style="font-family:Helvetica;color:#3A4151;font-size:14px;background-color:#FFFFFF;"> PC端:<a href="https://edu.csdn.net/course/detail/26277"><span id="__kindeditor_bookmark_start_21__"></span></a><a href="https://edu.csdn.net/course/detail/27216">https://edu.csdn.net/course/detail/27216</a> </p> <p style="font-family:Helvetica;color:#3A4151;font-size:14px;background-color:#FFFFFF;"> 移动端:CSDN 学院APP(注意不是CSDN APP哦) </p> <p style="font-family:Helvetica;color:#3A4151;font-size:14px;background-color:#FFFFFF;"> 本课程为录播课,课程永久有效观看时长,大家可以抓紧时间学习后一起讨论哦~ </p> <p style="font-family:"color:#3A4151;font-size:14px;background-color:#FFFFFF;"> <br /> </p> <p class="ql-long-24357476" style="font-family:"color:#3A4151;font-size:14px;background-color:#FFFFFF;"> <strong><span style="background-color:#FFE500;">【学员专享增值服务】</span></strong> </p> <p class="ql-long-24357476" style="font-family:"color:#3A4151;font-size:14px;background-color:#FFFFFF;"> <b>源码开放</b> </p> <p class="ql-long-24357476" style="font-family:"color:#3A4151;font-size:14px;background-color:#FFFFFF;"> 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化 </p> <p class="ql-long-24357476" style="font-family:"color:#3A4151;font-size:14px;background-color:#FFFFFF;"> 下载方式:电脑登录<a href="https://edu.csdn.net/course/detail/26277"></a><a href="https://edu.csdn.net/course/detail/27216">https://edu.csdn.net/course/detail/27216</a>,播放页面右侧点击课件进行资料打包下载 </p> <p> <br /> </p> <p> <br /> </p> <p> <br /> </p>
Java8零基础入门视频教程
2016-09-29这门课程基于主流的java8平台,由浅入深的详细讲解了java SE的开发技术,可以使java方向的入门学员,快速扎实的掌握java开发技术!
Java基础与实践
2018-07-31Java语言是目前流行的一门程序设计语言。本课程是一套全面讲解Java语言程序设计的开发类课程,由浅入深地介绍Java基础内容,主要包括基本类型及运算符、控制执行流程、字符串、面向对象、集合与数组、文件及流、异常、多线程等完整的Java知识体系。
手把手教你蓝牙协议栈入门
2020-07-16<p> 本课程定位是:引领想学习蓝牙协议栈的学生或者从事蓝牙,但是对蓝牙没有一个系统概念的工程师快速入门 </p> <p> 课程是多年从事蓝牙经验总结出来的,希望能让你看完有一种醍醐灌顶的感觉。 </p> <p> 不要在摸着石头过河了·学习完这些你肯定还是要继续学习蓝牙协议栈,但是至少懂了蓝牙的一些概念以及适合高效的学习方法 </p> <p> 本课程一共分为4个小节: </p> <p> 1)蓝牙教程计划.mp4 ,主要介绍下我们的视频规划以及后续的蓝牙教程规划 </p> <p> 2)蓝牙的前生后世.mp4 主要介绍下蓝牙的产生背景概念,以及蓝牙从开始产生到现在最新的5.2的发展过程,新赠的功能特性 </p> <p> 3)市面蓝牙架构调查.mp4 主要介绍市面蓝牙产品的架构以及HCI蓝牙芯片的详细架构,让你对蓝牙有一个整体的认识,对于后续做蓝牙产品选型大有帮助 </p> <p> 4)快速学习蓝牙文档介绍_工具介绍.mp4 主要介绍HCI蓝牙芯片的协议栈以及profile获取途径以及学习蓝牙的高效工具,引领你快速找到适合自己的方法来学习蓝牙 </p>
基于SSM技术的在线商城系统[实战视频]
2018-07-04本课程基于【SSM】【Maven】【BootStrap】【MySQL】【BootStrap】技术,使用IntelliJ IDEA开发工具。 主要是锻炼SSM技术的运用,通过项目实战,加强对框架技术的理解和运用,如果你是SSM的初学者,这套视频课程适合你!!
C语言入门--必须基础17讲
2017-07-28适合没有基础的人群学习C语言,简单的入门教程。帮助小白理解什么是开发,什么是编程。做的很简单,很多细节没有详细讲解,不适合用来深入研究。学了这个,你能理解什么是编程,什么是C语言。
SpringBoot实战教程:SpringBoot企业级线上商城项目讲解
2019-09-27<div style="color:rgba(0,0,0,.75);"> <span style="color:#4d4d4d;"> </span> <div style="color:rgba(0,0,0,.75);"> <span style="color:#4d4d4d;"> </span> <div style="color:rgba(0,0,0,.75);"> <div style="color:rgba(0,0,0,.75);"> <span style="color:#4d4d4d;">当前课程中商城项目的实战源码是我发布在 GitHub 上的开源项目 newbee-mall (新蜂商城),目前已有 6300 多个 star,</span><span style="color:#4d4d4d;">本课程是一个 Spring Boot 技术栈的实战类课程,课程共分为 3 大部分,前面两个部分为基础环境准备和相关概念介绍,第三个部分是 Spring Boot 商城项目功能的讲解,让大家实际操作并实践上手一个大型的线上商城项目,并学习到一定的开发经验以及其中的开发技巧。<br /> 商城项目所涉及的功能结构图整理如下:<br /> </span> </div> <div style="color:rgba(0,0,0,.75);"> </div> <div style="color:rgba(0,0,0,.75);"> <p style="color:#4d4d4d;"> <img alt="modules" src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9uZXdiZWUtbWFsbC5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vcG9zdGVyL3N0b3JlL25ld2JlZS1tYWxsLXMucG5n?x-oss-process=image/format,png" /> </p> </div> <p style="color:rgba(0,0,0,.75);"> <strong><span style="color:#e53333;">课程特色</span></strong> </p> <p style="color:rgba(0,0,0,.75);"> </p> <div style="color:rgba(0,0,0,.75);"> </div> <div style="color:rgba(0,0,0,.75);"> <ul> <li> 对新手开发者十分友好,无需复杂的操作步骤,仅需 2 秒就可以启动这个完整的商城项目 </li> <li> 最终的实战项目是一个企业级别的 Spring Boot 大型项目,对于各个阶段的 Java 开发者都是极佳的选择 </li> <li> 实践项目页面美观且实用,交互效果完美 </li> <li> 教程详细开发教程详细完整、文档资源齐全 </li> <li> 代码+讲解+演示网站全方位保证,向 Hello World 教程说拜拜 </li> <li> 技术栈新颖且知识点丰富,学习后可以提升大家对于知识的理解和掌握,可以进一步提升你的市场竞争力 </li> </ul> </div> <p style="color:rgba(0,0,0,.75);"> </p> <p style="color:rgba(0,0,0,.75);"> <span style="color:#e53333;">课程预览</span> </p> <p style="color:rgba(0,0,0,.75);"> </p> <div style="color:rgba(0,0,0,.75);"> </div> <div style="color:rgba(0,0,0,.75);"> <p style="color:#4d4d4d;"> 以下为商城项目的页面和功能展示,分别为: </p> </div> <div style="color:rgba(0,0,0,.75);"> <ul> <li> 商城首页 1<br /> <img alt="" src="https://img-bss.csdnimg.cn/202103050347585499.gif" /> </li> <li> 商城首页 2<br /> <img alt="" src="https://img-bss.csdn.net/202005181054413605.png" /> </li> <li> </li> <li> 购物车<br /> <img alt="cart" src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9uZXdiZWUtbWFsbC5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vcG9zdGVyL3Byb2R1Y3QvY2FydC5wbmc?x-oss-process=image/format,png" /> </li> <li> 订单结算<br /> <img alt="settle" src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9uZXdiZWUtbWFsbC5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vcG9zdGVyL3Byb2R1Y3Qvc2V0dGxlLnBuZw?x-oss-process=image/format,png" /> </li> <li> 订单列表<br /> <img alt="orders" src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9uZXdiZWUtbWFsbC5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vcG9zdGVyL3Byb2R1Y3Qvb3JkZXJzLnBuZw?x-oss-process=image/format,png" /> </li> <li> 支付页面<br /> <img alt="" src="https://img-bss.csdn.net/201909280301493716.jpg" /> </li> <li> 后台管理系统登录页<br /> <img alt="login" src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9uZXdiZWUtbWFsbC5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vcG9zdGVyL3Byb2R1Y3QvbWFuYWdlLWxvZ2luLnBuZw?x-oss-process=image/format,png" /> </li> <li> 商品管理<br /> <img alt="goods" src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9uZXdiZWUtbWFsbC5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vcG9zdGVyL3Byb2R1Y3QvbWFuYWdlLWdvb2RzLnBuZw?x-oss-process=image/format,png" /> </li> <li> 商品编辑<br /> <img alt="" src="https://img-bss.csdnimg.cn/202103050348242799.png" /> </li> </ul> </div> </div> </div> </div>
Python进阶-Pandas数据分析库
2018-12-18<p> <br /> </p> <p style="font-family:"color:#3D3D3D;font-size:16px;background-color:#FFFFFF;"> 您观看课程学习后<br /> 免费入群领取【超全Python资料包+17本学习电子书】 </p> <p style="font-family:"color:#3D3D3D;font-size:16px;background-color:#FFFFFF;"> <img src="https://img-bss.csdn.net/201909261022146699.jpg" alt="" /> </p> <p> <br /> </p> <p> Pandas是python中非常常用的数据分析库,在数据分析,机器学习,深度学习等领域经常被使用。本课程会讲解到pandas中最核心的一些知识点,包括Series以及DataFrame的构建,赋值,操作,选择数据,合并等等,以及使用pandas对文件进行读取和写入,使用pandas绘图等等。 </p>
Java软件开发工程师全套课程(笔记+项目实战案例)
2020-06-08Java软件开发系列课程,一站式学习全套Java技术。 包含三个阶段课程: 第一阶段: Java基础入门——JavaSE核心技术 本阶段为Java基础入门,包含:初识Java、变量、运算符、选择结构、循环结构、方法、数组、面向对象、抽象类和接口、常用类、枚举、泛型、内部类、集合、异常、I/O、设计模式、数据库、JDBC、项目实战 第二阶段: Java进阶开发——Web开发技术 本阶段为JavaWeb开发技术,包含:HTML、CSS、JavaScript、jQuery、Bootstrap、Servlet、JSP、Ajax、MVC等 第三阶段: Java高级开发——JavaEE框架技术 Java框架技术,包含:IDEA、Maven、MyBatis、Spring、SpringMVC、SpringBoot、SpringCloud、Shiro、Redis、ZooKeeper、Dubbo、Kafka、Nginx、Git、Docker、Vue.js、在线商城实战等 教学全程采用笔记+代码案例的形式讲解,由浅入深,每个知识点都有详细的讲解,通俗易懂!
- 偷偷地告诉学弟学妹们一个高效学习编程的秘密!大学四年悄悄惊艳他们,嘘 121982021-04-16今天来给大家谈一谈如何高效地学习编程。 无论什么时候,找到学习的目标,以及学习的套路都非常的重要。找不到的话,就只能事倍功半,付出了很多努力,却迟迟得不到最好的回报。 三四年前,我特别喜欢收藏文章,觉得有些技术文写得真好,忍不住收藏了!等过了一段时间后,闲得无聊,就去翻收藏夹,想着学一波,谁知道竟然找不到——不是微信给我删了,而是收藏夹里躺的“尸体”实在是太多了,根本就找不到。 后来,我就总结了一个小窍门——每周收藏夹里最多躺五篇文章,如果想进来第六篇,之前的必须得清一篇。别小看这个小窍门,它真的有督促我去
-
下载
70无人驾驶行业发展研究报告V5.0.docx
70无人驾驶行业发展研究报告V5.0.docx
-
下载
20210418-开源证券-中小盘周报:华为“造车”落地,关注华为智能汽车主题.pdf
20210418-开源证券-中小盘周报:华为“造车”落地,关注华为智能汽车主题.pdf
-
下载
【苹果仿芒果TV模板】仿芒果TV听书模板源码+苹果cms内核.zip
【苹果仿芒果TV模板】仿芒果TV听书模板源码+苹果cms内核.zip
-
下载
Eclipse中文版.zip
Eclipse中文版.zip
-
下载
python人工智能gradent分类算法.rar
python人工智能gradent分类算法.rar
-
下载
第十二届蓝桥杯省赛java.zip
第十二届蓝桥杯省赛java.zip
-
下载
75生物医药行业发展研究V5.0.docx
75生物医药行业发展研究V5.0.docx
-
下载
03-GrayTrans.rar
03-GrayTrans.rar
-
下载
vscode配置好的c/c++环境的配置文件
vscode配置好的c/c++环境的配置文件
-
下载
zabbix-release-4.4-1.el8.noarch.rpm
zabbix-release-4.4-1.el8.noarch.rpm
