天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 2 Algorithm Analysis

数据结构 Data structures 主讲人:李晓红
数据结构 Data Structures 主讲人: 李晓红

口教材( Text Book) 数据结构与算法分析 晋言描述 Data structures and Algorithm Analysis in C (2nd Edition) Mark allen weiss
教材 (Text Book) Data Structures and Algorithm Analysis in C (2nd Edition) Mark Allen Weiss

口参考书目( Reference) 《数据结构》(C语言版)严蔚敏等编著,清华大学出版社 《数据结构》(用面向对象方法与C++描迷) 殷人昆等编著,清华大学出版社
参考书目 (Reference) «数据结构 »(C语言版)严蔚敏等编著,清华大学出版社 «数据结构 »(用面向对象方法与C++描述) 殷人昆等编著,清华大学出版社

课程评分方法 Grading Policies ■圜 a Lecture Grade(80)=Final Exam(80) Laboratory grade(15)=∑Lab(i)×015 B Other Grade(5)=Attendance Homework
课程评分方法 (Grading Policies) Lecture Grade (80) = Final Exam (80) Laboratory Grade (15) = 0.15 5 1 = 5 i 1 Lab ( i ) Other Grade(5)=Attendance + Homework

作业&出勤 ◆布置作业的下周五交,迟交不交扣分。做 则有分,不计对错,一周后公布参考答案。 ◆必须按照软件学院规范做作业,否则不计 分,13作业未交者不能参加期末考试 ◆点名三次不到者不能参加期末考试
作业&出勤 ◆ 布置作业的下周五交,迟交不交扣分。做 则有分,不计对错, 一周后公布参考答案。 ◆ 必须按照软件学院规范做作业,否则不计 分,1/3作业未交者不能参加期末考试。 ◆ 点名三次不到者不能参加期末考试

实验 Laboratory projects 共5次;迟交罚扣为10%/day;抄袭者0分 罔3人一组,各组自行分工(例如:按功能模块、按开 发过程等),各自工作量应相当,试验报告中必须写 明各自工作量 A通过e-mai提交,请在邮件标题写明班级学号及试验 I,并在文档末尾写明分工 @助教( Teaching assistant): e杜洪伟(dhw98426@126c0m) e潘东(pandong912agmail.com)
实验 (Laboratory Projects) 共 5 次;迟交罚扣为 10% /day;抄袭者0分; 3人一组,各组自行分工(例如:按功能模块、按开 发过程等),各自工作量应相当,试验报告中必须写 明各自工作量; 通过e-mail提交,请在邮件标题写明班级学号及试验 ID,并在文档末尾写明分工。 助教(Teaching Assistant): ☺ 杜洪伟(dhw198426@126.com) ☺ 潘东 (pandong912@gmail.com)

CHAPTER 2 ALGORITHM ANALYSIS Definition) An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition, all algorithms must satisfy the following criteria (1)Input There are zero or more quantities that are externally supplied. (2)Output At least one quantity is produced. (3)Definiteness Each instruction is clear and unambiguous. (4)Finiteness If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after finite number of steps. (5) Effectiveness Every instruction must be basic enough to be carried out, in principle, by a person using only pencil and paper. It is not enough that each operation be definite as in (3); it also must be feasible
CHAPTER 2 ALGORITHM ANALYSIS 【Definition】An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition, all algorithms must satisfy the following criteria: (1) Input There are zero or more quantities that are externally supplied. (2) Output At least one quantity is produced. (3) Definiteness Each instruction is clear and unambiguous. (4) Finiteness If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after finite number of steps. (5) Effectiveness Every instruction must be basic enough to be carried out, in principle, by a person using only pencil and paper. It is not enough that each operation be definite as in(3); it also must be feasible

Note: A program is written in some programming language, and does not have to be finite(e.g. an operation system). An algorithm can be described by human languages, flow charts, some programming languages, or pseudo code I Example] Selection Sort: Sort a set of n> 1 integers in increasing order. From those integers that are currently unsorted, find the smallest and place it next in the sorted list. for (i=0; i<n; i++)t Examine list[i to list[n-1]and suppose that the smallest integer is at list[min]; Interchange list[ and list(min]; Sort= Find the smallest integer Interchange it with list[i
Note: A program is written in some programming language, and does not have to be finite (e.g. an operation system). An algorithm can be described by human languages, flow charts, some programming languages, or pseudocode. 〖Example〗 Selection Sort: Sort a set of n 1 integers in increasing order. From those integers that are currently unsorted, find the smallest and place it next in the sorted list. for ( i = 0; i < n; i++) { Examine list[i] to list[n−1] and suppose that the smallest integer is at list[min]; Interchange list[i] and list[min]; } Sort = Find the smallest integer + Interchange it with list[i]

81 What to Analyze Machine compiler-dependent run times Time space complexities machine compiler independent ° Assumptions: O instructions are executed sequentially 2 each instruction is simple, and takes exactly one time unit 3 integer size is fixed and we have infinite memory Typically the following two functions are analyzed: Tavo(n& TworstN--the average and worst case time complexities, respectively, as functions ofinput size N
§1 What to Analyze ➢ Machine & compiler-dependent run times. ➢ Time & space complexities : machine & compilerindependent. • Assumptions: instructions are executed sequentially each instruction is simple, and takes exactly one time unit integer size is fixed and we have infinite memory • Typically the following two functions are analyzed: Tavg(N) & Tworst(N) -- the average and worst case time complexities, respectively, as functions of input size N

[Example] Matrix addition void add (int all[ MAX SIze, int b][ MAX SIzE1, int CLI[ MAX SIZE, int rows, int cols for(i=0; i< rows; i++)/*rows+1*/ for(j=0; j< cols; j++)/*rows(cols+1)*/ c[i]j]=a[i[j]+bi]j]; /*rows. cols * T(rows, cols )=2 rows cols rows+ 1
〖Example〗 Matrix addition void add ( int a[ ][ MAX_SIZE ], int b[ ][ MAX_SIZE ], int c[ ][ MAX_SIZE ], int rows, int cols ) { int i, j ; for ( i = 0; i < rows; i++ ) for ( j = 0; j < cols; j++ ) c[ i ][ j ] = a[ i ][ j ] + b[ i ][ j ]; } /* rows + 1 */ /* rows(cols+1) */ /* rows cols */ T(rows, cols ) = 2 rows cols + 2rows + 1
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 10 The Disjoint Set ADT.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第九章 变量的作用域与生存期.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第八章 文件访问.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第七章 结构体与共用体.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第六章 函数.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第五章 指针.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第四章 数组.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第三章 程序的控制结构.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第二章 C程序设计基础.ppt
- 成都理工大学工程技术学院:《C程序设计教程》第一章 C程序概述.ppt
- 《vc++课件》类的设计和对象的使用.ppt
- 《vc++课件》c++基础2.ppt
- 《vc++课件》c++基础1.ppt
- 《vc++课件》对话式应用程序设计.ppt
- 《vc++课件》单文档应用程序设计.ppt
- 《vc++课件》Windows编程基础.ppt
- 《vc++课件》模板和IO流.ppt
- 《vc++课件》多态.ppt
- 《vc++课件》多继承和虚基类.ppt
- 《vc++课件》继承.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 3 Lists.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 4 Stacks Queues.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 5 trees.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 6 Graph Algorithms.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 7 Search.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 8 Sorting.ppt
- 天津大学:《数据结构 Data Structures》课程PPT教学课件(英文版)Chapter 9 String.ppt
- 《C++程序设计》第十一讲 输出与输入.ppt
- 《C++程序设计》第二讲 C++语言基础.ppt
- 《C++程序设计》第九讲 派生与继承性.ppt
- 《C++程序设计》第六讲 类与对象.ppt
- 《C++程序设计》第七讲 类与对象.ppt
- 《C++程序设计》第三讲 C++语言基础.ppt
- 《C++程序设计》第十二讲 输出与输入.ppt
- 《C++程序设计》第十讲 虚函数与多态性.ppt
- 《C++程序设计》第八讲 类与对象.ppt
- 《C++程序设计》第四讲 C++语言基础.ppt
- 《C++程序设计》第五讲 类与对象.ppt
- 《C++程序设计》第一讲 面向对象程序设计.ppt
- 《10步之内学会 Photoshop CS》(英文版)Adobe® Photoshop® CS in 10 Simple Steps or Less.pdf