页数:17页文件大小:98.1 KB来源: 计算机专业英语ppt课件
本课件对应5.1 Algorithms and Flowcharts(算法与流程图)一节,说明算法的顺序、选择与循环三种基本结构,并给出用流程图描述解题步骤的方法。课文配中英文对照译文、生词短语表与课后练习,可用于课堂讲授与课前预习。
| 单词 | 词性 | 中文释义 |
|---|---|---|
| Algorithm | n. | [数]算法 |
| decision | n. | 决定,判断 |
| discipline | n. | 纪律,学科 |
| v.训练iteration | n. | 迭代,重复,反复 |
| procedure | n. | 程序 |
| pseudocode | n. | 伪代码 |
| Repetition | n. | 重复,循环 |
| sequence | n. | 顺序,序列 |
| structure | n. | 结构 |
| v.构成,组织terminate | v. | 停止,结束 |
The computer scientist Niklaus Wirthstated that:Programs=Algorithms+Data The algorithm is part of the blueprint or plan for the computer program;analgorithmis:“An effective procedure for solving a problem in a finite number of steps.”计算机科学家NiklausWirth提出这样的公式:程序=算法+数据。算法是计算机程序的蓝图或计划的一部分,一个算法就是:“用有限的步骤解决问题的有效的过程。”
所谓有效,就是说找到了答案并且停止了,也就是说有有限的步骤。一个设计良好的算法总是能得到答案,也许不是希望的答案但是会有答案。也可能答案本身就是没有答案。一个设计良好的算法应该保证能够终止。
It is effective, which means that an answer is found and it finishes, that is it has a finite number of steps. Awell-designed algorithm will always provide an answer, and it may not be the answer you want but there will be an answer. It maybe that the answer is that there is no answer. Awell-designed algorithm is also guaranteed to terminate.
算法的主要特征如下:顺序(或者处理)、判断(或者选择)、循环(或者重复)。
The key features of an algorithm are: Sequence (also known as Process)Decision (also known as Selection)Repetition (also known as Iteration or Looping)
数学家Bohm和Jacopini于1964年证明:任何一个程序均可用“顺序”、“判断”和“循环”来陈述。Bohm和Jacopini的工作非常有意义,因为它最终形成了当前应用广泛的结构化定理。
In 1964 the mathematicians Corrado Bohmand Guiseppe Jacopini demonstrated that any algorithm can be stated using sequence, decision and repetition. The work of Bohmand Jacopiniwas of great importance since it eventually led to the disciplines of structured program design that are much used today.
顺序算法就是处理过程的每一步以特定的顺序执行,在这种算法中的每一个过程要处在正确的位置,否则算法可能会失败。
判断结构——If…then…,If…then…else…
Sequence means that each step or process in the algorithm is executed in the specified order. In an algorithm each process must be in the correct place, otherwise the algorithm will most probably fail.
The Decision constructs—If... then…, If... then... else...
In algorithms the outcome of a decision is either true or false,and there is no in between.[1]The outcome of the decision is based on some condition that can only result in a true or false value.分析:本句为复合句。定语从句中的result in...,意为“产生某种作用或结果”。例如:Our effort resulted in success.我们的努力终于成功了。
判断算法的结果或者是真或者是假,不可能有中间值。判断的结果基于某些条件,条件的结果只可能是真值或假值。判断语句的形式为:if条件then过程
A proposition in this sense is a statement,which can only be true or false. Itiseither true that today is Wednesday or false that today is Wednesday. Itcan'tbe both true and false. If the proposition is true then the process,which follows the then,isexecuted.此形式中的条件是一个陈述,只能是真或假。譬如:今天是星期三这个说法或者是真或者是假,不可能又是真又是假。如果条件是真,then后的过程被执行。
判断语句还可以写成如下形式:If条件then过程1else过程2这是if... then... else...形式的判断语句,表示如果条件的结果为真,则执行过程1,否则执行过程2。The decision can also be stated as:if proposition then process 1 else process 2 Thisistheif... then... else... form of the decision. This means that if the proposition is true then execute process 1 else or otherwise execute process 2.
The Repetition constructs—Repeat and While Repetition takes two forms, the Repeatloop and the Whileloop. The repeat loop is used to iterate or repeat a processor sequence of processes until some condition becomes true. It has the general form:
循环结构——直到型循环和当型循环循环有两种形式,直到型循环和当型循环直到型循环用来重复一些过程直到条件为真,一般形式如下
The first form of the decision if proposition then process has anull else,thatis,thereisnoelse第一种形式的判断语句的else为空,也就是说没有else。
Repeat Process 1 Process 2……Process NUntilpro position The repeat loop does some processing before testing the state of the proposition.这种循环在测试条件状态之前先执行过程。
当型循环当条件为真时重复一些过程,一般形式如下While proposition Process 1 Process 2……ProcessN
当型循环先测试条件的状态Thewhileloop is used to iterate or repeat a processor sequence of processes while some condition becomes true. It has the general form: While proposition Process 1 Process 2……Process NThewhileloo ptests the state of the proposition first.
Therearefour different ways of stating algorithms: Step-Form, Pseudocode, Flowchart, and Nassi-Schneiderman. The first two are written forms. The written form is just a normal language.[2]A problem with human language is that it can seem to be imprecise. Intermsof meaning, what Iwritemaynot be the same as what you read.[3]Pseudocodeis also human language but tends toward more precision by using a limited vocabulary.分析:本句是复合句。句中that it can seem to be imprecise为表语从句,作is的表语,其中it指代“人类语言”。分析:本句是简单句。句中tends towards…,意为“倾向……”,“趋于……”;by using a limited vocabulary是介词短语作状语,修饰tends toward more precision。
有四种表示算法的方法:Step-Form、伪代码、流程图和N-S流程图前两种方法是书写形式的,是普通语言。使用人类语言的问题是它可能看起来不精确,也就是说作者所写的和读者读到的可能不一致。伪代码也是人类语言,但通过使用特定的词汇而倾向于更精确。
后面的两种是面向图形的,也就是说它们使用符号和语言来表示顺序、判断和循环流程图是程序设计的图形表示法,只要掌握了规则,就很容易画流程图,画得好的流程图也很容易读。图5.1所示为基本的流程图符号。Thelasttwo are graphically-oriented,that is they use symbols and language to represent sequence,decision and repetition. Flowcharts area graphical method of designing programs and once the rules are learned they are very easy to draw. Awell-drawn flowchart is also very easy to read。Figure 5.1 shows the basic flowchart symbols.
The major symbols are the DECISION(also known as selection)andtheSEQUENCE(orprocess)symbols. The START and STOPsymbolsa recalled the terminals. The SUBPROCE SSsymbolisa variation on the sequence symbol.主要的符号是判断(或者选择)符号和顺序(处理)符号,开始和结束的符号称为端点符号,子过程的符号是顺序符号的变形。DECISION SEQUENCE STOPSTARTSUB PROCESS
Figure 5.1 Basic Flowchart Symbols
习题5.1 一 判断正误:根据课文内容判断下列说法正误。
Put“true”or“false”in the brackets for the following statements according to the passage.
习题5.1 二 练习:根据课文内容完成下列练习。
Fillinthe blanks according to the passage.
习题5.1 三 翻译:将下列单词和短语译成中文。
Translate the following words and expressions into Chinese.
下载地址:{{downurl}}
{{{a}}}
{{#b}}{{{b}}}
{{/b}} {{/title}} {{#nolog}}登陆注册
{{/nolog}} {{#djsx}}点我刷新
{{/djsx}} {{#gocz}} {{/gocz}} {{#ffqr}} {{/ffqr}}