欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    《计算机科学导论》(第三版)第08章.ppt

    • 资源ID:5051854       资源大小:1.49MB        全文页数:40页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    《计算机科学导论》(第三版)第08章.ppt

    1.1,1.2,Objectives:,1.3,Objectives(continued):,1.4,8.1 Concept,In this section we informally define an algorithm and elaborate on the concept using an example.,1.5,Figure 8.1:Informal definition of an algorithm,1.6,Figure 8.2:Finding the largest integer among five integers,1.7,Figure 8.3:Defining actions in FindLargest algorithm,1.8,Figure 8.4:FindLargest refined,1.9,Figure 8.5:Generalization of FindLargest,1.10,8.2 Three constructs,Computer scientists have defined three constructs for a structured program or algorithm.The idea is that a program must be made of a combination of only these three constructs:sequence,decision(selection),and repetition.It has been proven there is no need for any other constructs.Using only these constructs makes a program or an algorithm easy to understand,debug,or change.,1.11,Figure 8.6:Three constructs,1.12,8.3 Algorithm Representation,So far,we have used figures to convey the concept of an algorithm.During the last few decades,tools have been designed for this purpose.Two of these tools,UML and pseudocode,are presented here.,1.13,Figure 8.7:UML for three constructs,1.14,Figure 8.8:Pseudocode for three constructs,1.15,Algorithm 8.1:Calculating the sum of two integers:,1.16,Algorithm 8.2:Assigning pass/no pass grade:,1.17,Algorithm 8.3:Assigning a letter grade:,1.18,Algorithm 8.4:Finding the largest integer:,1.19,Algorithm 8.5:Find the smallest integers among 1000:,1.20,8.4 A More Formal Definition,Now that we have discussed the concept of an algorithm and shown its representation,here is a more formal definition.Let us elaborate on this definition.,1.21,8.5 Basic Algorithms,Several algorithms are used in computer science so prevalently that they are considered“basic”.We discuss the most common here.This discussion is very general:implementation depends on the language.,1.22,Figure 8.9:Summation algorithm,1.23,Figure 8.10:Product algorithm,1.24,Figure 8.11:Selection sort,1.25,Figure 8.12:Example of selection sort,1.26,Figure 8.13:Selection sort algorithm,1.27,Figure 8.14:Bubble sort,1.28,Figure 8.15:Example of bubble sort,1.29,Figure 8.16:Insertion sort,1.30,Figure 8.17:Example of insertion sort,1.31,Figure 8.18:An example of a sequential search,1.32,Figure 8.19:Example of a binary search,1.33,8.6 Subalgorithms,The three programming constructs described earlier allow us to create an algorithm for any solvable problem.The principles of structured programming,however,require that an algorithm be broken into small units called subalgorithms.Each subalgorithm is in turn divided into smaller subalgorithms.,1.34,Figure 8.20:Concept of a subalgorithm,1.35,8.7 Recursion,In general,there are two approaches to writing algorithms for solving a problem.One uses iteration,the other uses recursion.Recursion is a process in which an algorithm calls itself.,1.36,Figure 8.21:Iterative definition of factorial,1.37,Figure 8.22:Recursive definition of factorial,1.38,Figure 8.23:Tracing the recursive solution of factorial,1.39,Algorithm 8.6:Iteration solution to factorial problem:,1.40,Algorithm 8.7:A recursive solution of the factorial problem:,

    注意事项

    本文(《计算机科学导论》(第三版)第08章.ppt)为本站会员(牧羊曲112)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开