[高等教育]第8章算法.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[高等教育]第8章算法

Figure 8-12: part II Example of selection sort Figure 8-13 Selection sort algorithm Figure 8-14 Bubble sort 8.5.4 排序 2.冒泡排序 Figure 8-15: part I Example of bubble sort Figure 8-15: part II Example of bubble sort Figure 8-16 Insertion sort 8.5.4 排序 3.插入排序 8.5.4 排序 4.其他排序算法 Figure 8-17: part I Example of insertion sort SHZ, 2010 Chapter 8 Algorithms 第8章 算法 Understand the concept of an algorithm. Define and use the three constructs for developing algorithms: sequence, decision, and repetition. Understand and use three tools to represent algorithms: flowchart, pseudocode, and structure chart. After reading this chapter, the reader should be able to: OBJECTIVES Understand the concept of modularity and subalgorithms. List and comprehend common algorithms. CONCEPT 8.1 算法:一种逐步解决问题或完成任务的方法 概念 Figure 8-1 Informal definition of an algorithm used in a computer 算法的非正式定义 Figure 8-2 Finding the largest integer among five integers 8.1.2 示例 从五个整数中找出最大值 Figure 8-3 Defining actions in FindLargest algorithm 定义算法的动作: Figure 8-4 FindLargest refined 精化:算法动作的标准化 Figure 8-5 Generalization of FindLargest 泛化:使算法能够适应一般情况 THREE CONSTRUCTS 8.2 算法的三种基本结构: 顺序、选择、循环 三种结构 Figure 8-6 Three constructs ALGORITHM REPRESENTATION 8.3 算法的表示 Figure 8-7 Flowcharts for three constructs 流程图 Figure 8-8 Pseudocode for three constructs 伪代码 Example 1 Write an algorithm in pseudocode that finds the average of two numbers Solution See Algorithm 8.1 on the next slide. AverageOfTwo Input: Two numbers Add the two numbers Divide the result by 2 Return the result by step 2 End Algorithm 8.1: Average of two Example 2 Write an algorithm to change a numeric grade to a pass/no pass grade. Solution See Algorithm 8.2 on the next slide. Pass/NoPassGrade Input: One number if (the number is greater than or equal to 70) then 1.1 Set the grade to “pass” else 1.2 Set the grade to “nopass” End if Return the grade End Algorithm 8.2: Pass/no pass Grade Example 3 Write an algorithm to change a numeric grade to a

文档评论(0)

ctuorn0371 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档