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

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

资源类别:文库,文档格式:PPTX,文档页数:31,文件大小:1.28MB,团购合买
点击下载完整版文档(PPTX)

论题1-4: 算法的基本结构 陶先平马骏 南京大学

论题1-4: 算法的基本结构 陶先平 马骏 南京大学

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

轻轻提,慢慢移,先开窗,再喝汤

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

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

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

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

冯诺依曼体系结构 计算机之父 John Von Neumann 1903-1957 程序存储,顺序执行 控制器 地址 程序存储器 指令将存器 雷令0 控制器 指令 指今1 指令2 输入设备 运算器 输出设备 (ALU) 地址 数据存储港 输出 数据0 中央处理器 数据 数据1 数据2 存储器

冯·诺依曼体系结构 程序存储,顺序执行 John Von Neumann 1903-1957 计算机之父

如何理解下面这句话? 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. https://enwikipedia.org/wiki/Edsger_WDijkstra ----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 https://en.wikipedia.org/wiki/Edsger_W._Dijkstra

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

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

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

Bound iteration 假如规定吃X只 X

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

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

有人知道饱不饱,但有人不知道 问题: 开始 如果要判断的情况不只有 两种,该怎么办? 否 要吃汤包的 是 人不到5岁吗? if(c1){ switch(X){ case 1:...break; }else if(c2){ 选用策略2 选用策略1 case 2:...break; default:... else if... 结束 elset }

有人知道饱不饱,但有人不知道 if(c1){ … }else if(c2){ … } else if… … }else{ … } switch( X){ case 1:…break; case 2:…break; default:… } 问题: 如果要判断的情况不只有 两种,该怎么办?

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

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

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