当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

南京大学:《计算机问题求解》课程教学资源(课件讲稿)算法的基本结构

资源类别:文库,文档格式:PDF,文档页数:29,文件大小:971.38KB,团购合买
点击下载完整版文档(PDF)

问题求解论题1-4: 算法的基本结构 陶先平陈道蓄 南京大学

问题求解论题1-4: 算法的基本结构 陶先平 陈道蓄 南京大学

问题1: 你会吃蟹黄汤包吗? 轻轻提,慢慢移,先开窗,再喝汤

吃一只汤包的“算法” 顺序很重要: ·将包子从蒸笼中轻轻提起,and then ·将包子慢慢移动到面前的碟子中,and then ·在包子的上方咬开一个小口,and then ·通过小口吸食包子里的汤,and then ·将包子送入口中 完成!

吃一只汤包的“算法” •顺序很重要: •将包子从蒸笼中轻轻提起,and then •将包子慢慢移动到面前的碟子中,and then •在包子的上方咬开一个小口,and then •通过小口吸食包子里的汤,and then •将包子送入口中 完成!

顺序,是组织算法的最基本的方法 按照算法步骤,顺序书写指令

顺序,是组织算法的最基本的方法 按照算法步骤,顺序书写指令

如何理解下面这句话? My second remark is that our intellectual powers are rather geared to master static relations and that our powers to visualize processes evolving in time are relatively poorly developed.For that reason we should do our utmost to shorten the conceptual gap between the static program and the dynamic process,to make the correspondence between the program(spread out in text space)and the process (spread out in time)as trivial as possible. ----E.W.Dijkstra

如何理解下面这句话? • My second remark is that our intellectual powers are rather geared to master static relations and that our powers to visualize processes evolving in time are relatively poorly developed. For that reason we should do our utmost to shorten the conceptual gap between the static program and the dynamic process, to make the correspondence between the program (spread out in text space) and the process (spread out in time) as trivial as possible. ----E.W.Dijkstra

问题2: 但是我们并不只吃一只, 怎么办?

问题2: 但是我们并不只吃一只, 怎么办?

策略一:控制数量 注意: 这个过程的“结构”与计 开始 假如规定吃8只: 数器的初始值没有关系! Bound iteration 设一个计数器,并 将其值设定为0。 吃一只汤包 计数器值加1,并 否 判断其是否为8 是 结束

Bound iteration

策略二:吃饱为止 开始 Unbound iteration 是 是否已饱? 结束 吃一只汤包 如果即使饱了,也希望再品尝一个,该怎么办? 问题:你能正确选择采用何种策略设计循环吗?

如果即使饱了,也希望再品尝一个,该怎么办? Unbound iteration 问题:你能正确选择采用何种策略设计循环吗?

有人知道饱不饱,但有人不知道! 问惠7: 开始 如果翼判断的 否 要吃汤包的 是 不止是两种可 人不到5岁吗? 能。那怎么办? 选用策略2 选用策略1 结束

问题: 如果说顺序、分支和循环构成了算法 组织的三个基本结构,那么顺序结构是算 法组织的基本中的基本。为什么?

问题: 如果说顺序、分支和循环构成了算法 组织的三个基本结构,那么顺序结构是算 法组织的基本中的基本。为什么?

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共29页,试读已结束,阅读完整版请下载
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有