人与计算机猜数伪代码,pseudocode伪代码-天津大学计算机科学与技术学院.ppt

pseudocode伪代码-天津大学计算机科学与技术学院

8.1 CONCEPT INFORMAL DEFINITION Algorithm(算法): a step-by-step method for solving a problem or doing a task.(逐步解决问题或完成任务的方法) In this definition, an algorithm is independent of the computer system(独立于计算机系统). More specifically, we should also note that the algorithm accepts a list of input data and creates a list of output data.(输入一组数据,产生一组输出数据) Input The algorithm accepts the list of five integer as input. Processing The algorithm uses five steps to find the largest integer. Output Because there are no more integers to be processed, the algorithm outputs the value of Largest, which is 13. DEFINING ACTIONS REFINEMENT GENERALIZATION 8.2 THREE CONSTRUCTS 8.3 ALGORITHM REPRESENTATION FLOWCHART(流程图) A flowchart is a pictorial representation of an algorithm. It shows how the algorithm flows from beginning to end. PSEUDOCODE(伪代码) Pseudocode is an Englishlike representation of an algorithm. It is part English and part structured code.(类似英语的表示方法) 8.4 MORE FORMAL DEFINITION Algorithm: an ordered set of unambiguous steps that produces a result and terminates in a finite time(一组明确步骤的有序集合,它产生结果并在有限时间内终止). ORDERED SET(有序集合) An algorithm must be a well-defined, ordered set of instruction. UNAMBIGUOUS STEPS (明确步骤) Each algorithm must be clearly and unambiguously defined. PRODUCE A RESULT (产生结果) An algorithm must produce a result; otherwise, it is useless. The result can be data that are returned to the calling algorithm or same other effect (e.g., printing). TERMINATE IN A FINITE TIME(在有限时间内终止)An algorithm must terminate (halt). If it does not (e.g., has an infinite loop), you have not created an algorithm. 8.5 SUBALGORITHMS(子算法) The principles of structured programming, require that an algorithm be broken into small units called subalgorithms (the terms subprograms, subroutines, procedures, function, methods, and modules are also used). Each subalgorithm is in turn divided into smaller subalgorit

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值