- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
计算机导论ch08.ppt
Key terms Algorithm:算法,是一种逐步解决问题或完成任务的方法。每个算法都有自己不同于其他算法的名字。 Informal definition:非正式定义 Input data :输入数据 output data :输出数据 Findlargest:取最大值。(一种算法的名字) Refinement:精化 Generalization:普遍化(泛化) Key terms Three Constructs:三种结构 Sequence:顺序 Decision(selection):判断(选择) repetition:循环 Key terms flowchart:流程图。使用大图的形式掩盖了算法的所有细节,只显示算法从开始到结束的整个流程。 pseudocode:伪代码。类似英语的表示法。 Key terms More formal definition:更正式的定义 1、Ordered set:有序集合。 2、unambiguous steps:明确步骤 3、produce a result:产生结果。 4、terminate in a finite time:在有限的时间内终止。 Key terms subalgorithm:子算法。 subprogram:子程序 subroutine:子例程 procedure:过程 function:函数 method:方法 module:模块 summation:求和 product:乘积 Smallest and largest:最大和最小 Sorting:排序 Selection sort:选择排序 Bubble sort:冒泡排序 Insertion sort:插入排序 Searching:查找 Sequential search:顺序查找 binary search:折半查找 Iterative:迭代 recursion:递归。算法自我调用。 Factorial:阶乘 There are two methods for solving a problem: Iteration Recursion 非正式地讲,算法(Algorithm)是一步一步解决问题或完成任务的方法。 算法正式定义为一组步骤明确的有序集合,它产生结果并在有限的时间内终止。 迭代算法(iterative algorithm)只包括参数而不包括算法本身。 Factorial Input: A positive integer num if (num is equal to 0)then 1.1 return 1else1.2 return num × Factorial (num – 1) End if End Algorithm 8.8: Recursive factorial Summary ? 算法接受一个输入数据的列表,生成一个输出数据的列表。 Algorithm:An ordered set of unambiguous steps that produces a result and terminates in a finite time. Note: SUBALGORITHMS 8.5 Figure 8-9 Concept of a subalgorithm FindLargest Input: A list of positive integers Set Largest to 0 while (more integers) 2.1 FindLargerEnd while Return Largest End Algorithm 8.6: Find largest FindLarger Input: Largest and current integer if (the integer is greater than Largest)then 1.1 Set Largest to the value of the integerEnd ifEnd Subalgorithm: Find larger BASIC ALGORITHMS 8.6 Figure 8-10 Summation (1)Initialization (2)Iteration (3)Return Three Part: Figure 8-11 Product Figure 8-11 Sorting 1.Why sorting? 2. Sorting Selection Sort Bubble Sort Insertion Sort 3. Other Sorting: Quick Sort Heap Sort
原创力文档


文档评论(0)