北航算法导论官方课件1
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
注册用户数3.7亿,在线商品数8亿(2011年1月)
产品分类?不同类型产品成交金额分析?消费行为分析? 物流配送?
大数据量稀疏矩阵的SVD(奇异值分解)算法R=U·S·V’
支付宝、阿里巴巴 全国居民身份证管理系统: n = 1.3×109 人 国家安全防护指纹识别系统:n >= 1.3×109 人 2671 = A B ……
12
BeihangSoft.cn
1.1 What are algorithms 2. Algorithm is a tool for solving a well-specified
comutational problem
Problem ? general questiones needed to be computed
《Introduction to Algorithms》(Second Edition),
T. H. Cormen, C. E. Leiserson, R. L. Rivest (2002, Turing Award),
The MIT Press
《The Art of Computer Programming》, Donald E, Knuth
Algorithm (a tool)
instance (input) ?
input1 ? input2 ? input3 ? ……
output
13
BeihangSoft.cn
1.1 What are algorithms
2. Algorithm is a tool for solving a well-specified comutational problem (example)
input3 ?
oOuutptpuut t: <26,31,41,41,58,59>
……
lgorithm
14
BeihangSoft.cn
1.1 What are algorithms Sorting is a fundamental operation in computer science
An algorithm is said to be correct
11
BeihangSoft.cn
1.1 What are algorithms 1. Algorithm is any well-defined computational procedure
(算法:一个定义明确的是可计算过程)
Input
< 31,41,59,26,12,58 >
Computational Procedure algorithm
BeihangSoft.cn
First Example: Identifying Genes in Human DNA (基因识别)
Identifying all the 100,000 genes in human DNA determining the sequences of the 3 billion(109) chemical base pairs that make up human DNA.
如何读这本书
8
BeihangSoft.cn
Introduction to Algorithms
Practice and contest http://www.bianchengla.com/ New OJ is coming…
Slides http://par.buaa.edu.cn/songyou/
First Example: Identifying Genes in Human DNA
Identifying all the 100,000 genes in human DNA determining the sequences of the 3 billion(109) chemical base pairs that make up human DNA.
< 31,41,59,26,12,58 > <31,41,26,12,58,59> <31,26,12,41,58,59>
……
Output
“冒泡”排序是可 计算过程
<12,26,31,41,58,59>
Well-defined: know what to do each step; always halts with correct answer . Efficiency: good or bad?
input sequence siuncshtatnhacte a1' a2' L an'
uestiones
(input) ?
be computed
input1 ?
An instance of the sorting problem
input2 ?
Input: <31,41,59,26,41,58>
20% 20% 10%
20%
20%
10%
课堂要求
学术很自由,课堂很严肃:不迟到、早退;不允许接听电话、大声聊天…
考核形式与分数比例
30分:平时上机(5分*6次)
10分:课堂测验(2分*5次)
30分:期末上机
30分:期末笔试
10分:大作业(软件创作;一定代码量的应用程序,演示效果好,用到 一些典型的算法;小论文;竞赛获得比较好的奖;......)
5
BeihangSoft.cn
Introduction to Algorithms
网S友tu:de“n没ts有:读过《Intro…》un,dergraduate, graduate 不C能ou算r是se一p个ro真pe正rt的y:程序员b”ase & core in co“计m算pu机ti算ng法的圣经” Bibliography
3
lg(3109
)seconds
94.45seconds
✓ The both sort methods are feasible in reason ✓ But insertion sort is impractical
3
BeihangSoft.cn
Second Example: Fibonacci Number F(n) = F(n-1) + F(n-2)
➢ Input size: n = 3*109
➢ Insertion sort: running time n2
t = s/v :
3109 3109instruc 9109seconds
9 109
y 31.71years
109 instruc/s
60 60 24365
பைடு நூலகம்
2
BeihangSoft.cn
if, for every input instance, it halts with the correct output
Incorrect algorithm
might not halt at all on some input instances, or might halt with an answer other than the desired one can sometimes be useful (if error rate can be controlled)
Problem:to sort a sequence of numbers into nondecreasing order
Input: A sequence of n numbers <a1,a2,L , an >
Output: A permutation (reordering) <a1' ,a2' ,L , an' > of the
Introduction to Algorithms
算法导论
北京航空航天大学 软件学院
College of Software, Beihang University 宋 友 (Song You)
Tel : 010-8233-8263 Email : SongYou@buaa.edu.cn Homepage: http://par.buaa.edu.cn/songyou/ Office: 工程训练中心 301-2
1974, Turing Award
“计算机程序设计
B正il优l G秀a《 《的teT计s程:h算“e序如D机员果e和s,i你g难n请认解a读n为性dK你A》n是nu,ath一lyM的s名i.sR真o.f
Computer Algori理th论ms的》荷, A马ho史诗” 加里,D. S. 约翰逊
(为什么算法研究非常有意义)
What is the role of algorithms relative to other technologies used in computers?
(相比计算机科学的其他技术,算法的角色和地位)
10
BeihangSoft.cn
1.1 What are algorithms
Computing: information processing Scientific computing (modeling, computing, verifying )
数学:公理、规则 => 定理 “上帝创造”。描述客观世界,给人们带来无穷乐趣和痛苦。
例如:Pi的小数点后面是否存在1000个连续的7 1900, Hilbert, 巴黎世界数学家大会,“是否存在一个通用的过程
re_type f(type n) {
if(n<=2) return 1;
else return f(n-1)+f(n-2);
}
f1 = 1; f2 = 1;
for(i=3; i<=n; i++){ f = f1 + f2; f1 = f2; f2 = f;
}
4
BeihangSoft.cn
Examples… 淘宝网 (www.taobao.com)
10分:讨论班(课堂知识点分析;上机题分析;相关最新算法分析;一 些工程应用的算法分析;……)
10分:鼓励同学们参与出题(包括上机题。给出题目和解题报告。)
7
BeihangSoft.cn
Introduction to Algorithms
课程安排 课堂讲解:基本理论讲解,基本方法的介绍分析 上机实践:基本习题和经典习题的上机实践 实际的项目训练:在以后的整个软件工程实践中,注 重程序设计的可行性,程序实现的效率,软件测试的 性能分析,……。
➢ Insertion sort: running time n2
3109 3109instruc 109 instruc/s
9 109
seconds
60
9 109 60 24
365
y
31.71years
➢ Merge sort: running time nlgn
3109
lg(3109 )instruc 109 instruc/s
(30亿组化学基对组成人类DNA,如何界定这些序列,从而进行基因识别)
➢ Computer: 3G Hz CPU, 3*109B/s, suppose that it executes one billion instructions per second
(设该计算机的运行速度为 10亿条基本指令/s )
《计算《机计程算序机设算计法艺设术计》与,分如析果》你,卢开澄,谭明术
能读懂《整算套法书设的计话和,分请析给》我,发朱一洪份,陈增武,段振华
你的简《历电。子”计算机算法设计与分析》,陈增武
......
6
BeihangSoft.cn
Introduction to Algorithms
学习方式 听课-看书-做作业-上机实践(编程)-课外创作-考核
(算法),可以自动判定任意命题是否正确?”
Before 1936
算法:过程、工具 “人创造”。方便人们研究数学;解决实际问题。
1936, Turing ( undergraduate in Cambridge Univ.) 1946, John Von Nouma, first electronic computer
Paper, project to submit songyou@buaa.edu.cn
9
BeihangSoft.cn
1 The Role of Algorithms in Computing
What are algorithms?
Why is the study of algorithms worthwhile?
产品分类?不同类型产品成交金额分析?消费行为分析? 物流配送?
大数据量稀疏矩阵的SVD(奇异值分解)算法R=U·S·V’
支付宝、阿里巴巴 全国居民身份证管理系统: n = 1.3×109 人 国家安全防护指纹识别系统:n >= 1.3×109 人 2671 = A B ……
12
BeihangSoft.cn
1.1 What are algorithms 2. Algorithm is a tool for solving a well-specified
comutational problem
Problem ? general questiones needed to be computed
《Introduction to Algorithms》(Second Edition),
T. H. Cormen, C. E. Leiserson, R. L. Rivest (2002, Turing Award),
The MIT Press
《The Art of Computer Programming》, Donald E, Knuth
Algorithm (a tool)
instance (input) ?
input1 ? input2 ? input3 ? ……
output
13
BeihangSoft.cn
1.1 What are algorithms
2. Algorithm is a tool for solving a well-specified comutational problem (example)
input3 ?
oOuutptpuut t: <26,31,41,41,58,59>
……
lgorithm
14
BeihangSoft.cn
1.1 What are algorithms Sorting is a fundamental operation in computer science
An algorithm is said to be correct
11
BeihangSoft.cn
1.1 What are algorithms 1. Algorithm is any well-defined computational procedure
(算法:一个定义明确的是可计算过程)
Input
< 31,41,59,26,12,58 >
Computational Procedure algorithm
BeihangSoft.cn
First Example: Identifying Genes in Human DNA (基因识别)
Identifying all the 100,000 genes in human DNA determining the sequences of the 3 billion(109) chemical base pairs that make up human DNA.
如何读这本书
8
BeihangSoft.cn
Introduction to Algorithms
Practice and contest http://www.bianchengla.com/ New OJ is coming…
Slides http://par.buaa.edu.cn/songyou/
First Example: Identifying Genes in Human DNA
Identifying all the 100,000 genes in human DNA determining the sequences of the 3 billion(109) chemical base pairs that make up human DNA.
< 31,41,59,26,12,58 > <31,41,26,12,58,59> <31,26,12,41,58,59>
……
Output
“冒泡”排序是可 计算过程
<12,26,31,41,58,59>
Well-defined: know what to do each step; always halts with correct answer . Efficiency: good or bad?
input sequence siuncshtatnhacte a1' a2' L an'
uestiones
(input) ?
be computed
input1 ?
An instance of the sorting problem
input2 ?
Input: <31,41,59,26,41,58>
20% 20% 10%
20%
20%
10%
课堂要求
学术很自由,课堂很严肃:不迟到、早退;不允许接听电话、大声聊天…
考核形式与分数比例
30分:平时上机(5分*6次)
10分:课堂测验(2分*5次)
30分:期末上机
30分:期末笔试
10分:大作业(软件创作;一定代码量的应用程序,演示效果好,用到 一些典型的算法;小论文;竞赛获得比较好的奖;......)
5
BeihangSoft.cn
Introduction to Algorithms
网S友tu:de“n没ts有:读过《Intro…》un,dergraduate, graduate 不C能ou算r是se一p个ro真pe正rt的y:程序员b”ase & core in co“计m算pu机ti算ng法的圣经” Bibliography
3
lg(3109
)seconds
94.45seconds
✓ The both sort methods are feasible in reason ✓ But insertion sort is impractical
3
BeihangSoft.cn
Second Example: Fibonacci Number F(n) = F(n-1) + F(n-2)
➢ Input size: n = 3*109
➢ Insertion sort: running time n2
t = s/v :
3109 3109instruc 9109seconds
9 109
y 31.71years
109 instruc/s
60 60 24365
பைடு நூலகம்
2
BeihangSoft.cn
if, for every input instance, it halts with the correct output
Incorrect algorithm
might not halt at all on some input instances, or might halt with an answer other than the desired one can sometimes be useful (if error rate can be controlled)
Problem:to sort a sequence of numbers into nondecreasing order
Input: A sequence of n numbers <a1,a2,L , an >
Output: A permutation (reordering) <a1' ,a2' ,L , an' > of the
Introduction to Algorithms
算法导论
北京航空航天大学 软件学院
College of Software, Beihang University 宋 友 (Song You)
Tel : 010-8233-8263 Email : SongYou@buaa.edu.cn Homepage: http://par.buaa.edu.cn/songyou/ Office: 工程训练中心 301-2
1974, Turing Award
“计算机程序设计
B正il优l G秀a《 《的teT计s程:h算“e序如D机员果e和s,i你g难n请认解a读n为性dK你A》n是nu,ath一lyM的s名i.sR真o.f
Computer Algori理th论ms的》荷, A马ho史诗” 加里,D. S. 约翰逊
(为什么算法研究非常有意义)
What is the role of algorithms relative to other technologies used in computers?
(相比计算机科学的其他技术,算法的角色和地位)
10
BeihangSoft.cn
1.1 What are algorithms
Computing: information processing Scientific computing (modeling, computing, verifying )
数学:公理、规则 => 定理 “上帝创造”。描述客观世界,给人们带来无穷乐趣和痛苦。
例如:Pi的小数点后面是否存在1000个连续的7 1900, Hilbert, 巴黎世界数学家大会,“是否存在一个通用的过程
re_type f(type n) {
if(n<=2) return 1;
else return f(n-1)+f(n-2);
}
f1 = 1; f2 = 1;
for(i=3; i<=n; i++){ f = f1 + f2; f1 = f2; f2 = f;
}
4
BeihangSoft.cn
Examples… 淘宝网 (www.taobao.com)
10分:讨论班(课堂知识点分析;上机题分析;相关最新算法分析;一 些工程应用的算法分析;……)
10分:鼓励同学们参与出题(包括上机题。给出题目和解题报告。)
7
BeihangSoft.cn
Introduction to Algorithms
课程安排 课堂讲解:基本理论讲解,基本方法的介绍分析 上机实践:基本习题和经典习题的上机实践 实际的项目训练:在以后的整个软件工程实践中,注 重程序设计的可行性,程序实现的效率,软件测试的 性能分析,……。
➢ Insertion sort: running time n2
3109 3109instruc 109 instruc/s
9 109
seconds
60
9 109 60 24
365
y
31.71years
➢ Merge sort: running time nlgn
3109
lg(3109 )instruc 109 instruc/s
(30亿组化学基对组成人类DNA,如何界定这些序列,从而进行基因识别)
➢ Computer: 3G Hz CPU, 3*109B/s, suppose that it executes one billion instructions per second
(设该计算机的运行速度为 10亿条基本指令/s )
《计算《机计程算序机设算计法艺设术计》与,分如析果》你,卢开澄,谭明术
能读懂《整算套法书设的计话和,分请析给》我,发朱一洪份,陈增武,段振华
你的简《历电。子”计算机算法设计与分析》,陈增武
......
6
BeihangSoft.cn
Introduction to Algorithms
学习方式 听课-看书-做作业-上机实践(编程)-课外创作-考核
(算法),可以自动判定任意命题是否正确?”
Before 1936
算法:过程、工具 “人创造”。方便人们研究数学;解决实际问题。
1936, Turing ( undergraduate in Cambridge Univ.) 1946, John Von Nouma, first electronic computer
Paper, project to submit songyou@buaa.edu.cn
9
BeihangSoft.cn
1 The Role of Algorithms in Computing
What are algorithms?
Why is the study of algorithms worthwhile?