计算机问题求解(PPT讲稿)算法在计算机科学中的地位(算法的效率)

计算机问题求解-论题22 算法的效率 2018年03月14日
计算机问题求解 – 论题2-02 - 算法的效率 2018年03月14日

问题1:你如何理解这里的“优化”?算 法级?程序级? (2)for I from I to n do (2)L(1)←L(1)×10MAX ( compute the maximum score in MAX (2) FACTOR←100MAX (3)for I from I to n do (3.1)L(1)←L(1)×FACT0R
问题1:你如何理解这里的“优化”?算 法级?程序级?

问题2:以下两个程序,在执行效率上有什么 区别? 对一个二维数组Am:进行遍历 n程序1: a for from 1 to m do for j from 1 to n do A[1,12403]A14A1,5A1,6A17| a do something with Al,J] A[2 1 A(2.2)(2.3.4 A(2.5)A2.6)(2. 7 n程序2: n for j from 1 to n do for from 1 to m do a do something with A[, J
问题2:以下两个程序,在执行效率上有什么 区别? ◼ 对一个二维数组A[m,n]进行遍历: ◼ 程序1: ❑ for I from 1 to M do ◼ for J from 1 to N do ❑ do something with A[I,J] ◼ 程序2: ❑ for J from 1 to N do ◼ for I from 1 to M do ❑ do something with A[I,J] A[1,1] A[1,2] A[1,3] A[1,4] A[1,5] A[1,6] A[1,7] … A[2,1] A[2,2] A[2,3] A[2,4] A[2,5] A[2,6] A[2,7] … …

问题3: 你能说岀如何用 Linear Search算法搜索一个未排序 的序列吗?书中给昌的优化方法是什么?这种优化 是量上的优化还是厥上的优化?? 给定一个算法,什么样的优 化算是质上的优化?
给定一个算法,什么样的优 化算是质上的优化?

问题4 “算法分析”主要是干什么? 优化一个算法: 首先要完成算法“性能”的度量,依此判定算法的优劣; 度量一个算法的性能,首先要给出描述算法性能的模型 算法的渐进时间复杂度模型
优化一个算法: 首先要完成算法“性能”的度量,依此判定算法的优劣; 度量一个算法的性能,首先要给出描述算法性能的模型 算法的渐进时间复杂度模型

个插入排序方法 Our first algorithm, insertion sort, solves the sorting problem introduced in Chap- ter l Input: A sequence of n numbers (a1, a2,..., an) Output: A permutation (reordering)(a'.d,,..., a" )of the input sequence such that a 1<
一个插入排序方法

插入法: 在“插入每张 牌前,手上的 牌都是已经排 好序的
插入法: 在“插入每张 牌前,手上的 牌都是已经排 好序的

范例 总是已绎排好序的片段 国b 总是已经排好序的片段
范例 总是已经排好序的片段 总是已经排好序的片段

伪代码 提请注意:你应 Ⅰ NSERTION-SORT(4) 该会证明这个算 I for j= 2 to A length 法的正确性! //Insert A[i into the sorted sequence A[..j-1 5 while i>0 and Ai> key Ali+1=Ai 8A1+1]=key
伪代码 提请注意:你应 该会证明这个算 法的正确性!

算法的性能度量模型 算法性能涉及 口空间性能(空间复杂度) ■算法在给定合法输入的情况下,要消耗多少“临时”存储空间 口局部变量、过程调用的堆栈空间等 ■特定场合中较为关注 口时间性能(时间复杂度) ■算法在给定合法输入的情况下,需要执行多少时间 重点关注内容! 算法的时间复杂度模型 口执行指令条数的统计模型:数数字!
算法的性能度量模型 ◼ 算法性能涉及 ❑ 空间性能(空间复杂度) ◼ 算法在给定合法输入的情况下,要消耗多少“临时”存储空间 ❑ 局部变量、过程调用的堆栈空间等 ◼ 特定场合中较为关注 ❑ 时间性能(时间复杂度) ◼ 算法在给定合法输入的情况下,需要执行多少时间 ◼ 重点关注内容! ◼ 算法的时间复杂度模型 ❑ 执行指令条数的统计模型:数数字!
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 9 Service and Broadcast Receiver.pptx
- 泛型编程 Generic Programming(PPT讲稿)Templates.ppt
- 北京大学SAS俱乐部:SAS软件会员培训(PPT讲稿)SAS编程语言入门.ppt
- 中国科学技术大学:《数据结构及其算法》课程电子教案(PPT课件讲稿)第三章 栈和队列.pps
- 白城师范学院:《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第六章 关系数据理论.pptx
- 安徽广播影视职业技术学院:《ASP动态网页设计实用教程》课程教学资源(PPT讲稿)第1章 ASP基础(贾海陶).ppt
- 《MATLAB应用基础》课程教学资源(PPT课件讲稿)第4章 MATLAB的数值计算.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第七章 中间代码生成.ppt
- 上海交通大学:Basic Raster Graphics Algorithms for Drawing 2D Primitives.ppt
- Transport Layer Identification of P2P Traffic.ppt
- 复旦大学:《数据库基础与应用》课程PPT教学课件(Access案例教程)第1章 数据库基础知识.pptx
- 香港科技大学:Advanced Topics in NextGeneration Wireless Networks.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第五章 语法分析——自下而上分析.ppt
- 香港城市大学:Introduction to Real-Time Systems(Design and Analysis of Algorithms).pptx
- 《网站设计与建设 Website design and developments》课程教学资源(PPT课件讲稿)第一部分 Web基础知识 第3章 图形与Web设计.ppt
- 《汇编语言》课程PPT教学课件:第三章 80x86寻址方式和指令系统.ppt
- 清华大学:高校信息门户建设(PPT讲稿).ppt
- 《计算机辅助设计 Computer Aided Design》课程PPT教学课件:第一篇 CAD技术 第一章 几何造型方法介绍和分类.ppt
- 西安电子科技大学:《操作系统 Operating Systems》课程教学资源(PPT课件讲稿)Chapter 02 进程和线程 Processes and Threads.ppt
- 《数字图像处理 Digital Image Processing》课程教学资源(PPT课件讲稿)第2章 图像的基本知识及运算.ppt
- 《计算机组装与维修》课程教学资源(PPT讲稿)第7章 显示器.ppt
- 《Java语言程序设计》课程教学资源(PPT课件讲稿)第四章 Applet及其应用.ppt
- 《编译原理实践》课程教学资源(PPT讲稿)词法分析程序的自动生成器LEX.ppt
- 华中科技大学:《面向对象程序设计》课程PPT教学课件(Visual C++ 编程)第2讲 Visual C++ 6.0开发环境.ppt
- 东南大学:《泛型编程 Generic Programming》课程教学资源(PPT课件讲稿)Chapter 14 Templates.ppt
- Coded Caching under Arbitrary Popularity Distributions.pptx
- Distributed Systems and Networking Programmin(SOAP – Introduction).ppt
- 北京师范大学现代远程教育:《计算机应用基础》课程教学资源(PPT课件讲稿)第5章 Microsoft Excel 2010.pptx
- 图形处理及多媒体应用(PPT课件讲稿).pps
- Vitebi 译码.ppt
- 香港城市大学:Rank Aggregation in MetaSearch.ppt
- 《计算机网络技术》课程教学资源(PPT课件讲稿)第5章 广域网.ppt
- 中国科学技术大学:《现代密码学理论与实践》课程教学资源(PPT课件讲稿)第二部分 公钥密码和散列函数 第8章 数论入门(苗付友).pptx
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)向量体系结构.pptx
- 南京大学:《面向对象技术 OOT》课程教学资源(PPT课件讲稿)面向对象的分析与设计简介 OOA & OOD:An introduction.ppt
- 北京师范大学现代远程教育:《计算机应用基础》课程教学资源(PPT课件讲稿)第1章 计算机常识(主讲:马秀麟).pptx
- 《并发控制技术》课程教学资源(PPT课件讲稿)第7章 事务管理 transaction management.ppt
- 山东大学软件学院:非线性规划(PPT讲稿)一维搜索方法.ppt
- 合肥工业大学:《计算机网络技术》课程教学资源(PPT课件讲稿)第4章 交换网的运行.ppt
- 长春工业大学:《网页设计与制作》课程教学资源(PPT课件)第5章 Div+CSS布局技术.ppt