算法课件全121301ADA06分治法合并排序
28页1、2019/6/21,2,2012-2013-01 Design and Analysis of Algorithm SCUN,Review of last class,The string match algorithm and its best-case, worst-case and average-case analysis,In last lecture, we have learned:,Brute force method and its advantages and disadvantages,The bubble sort algorithm and its best-case, worst-case and average-case analysis,Divide And Conquer (I),Chapter 4,2、Application to combinatorial problem Chess board cover,3、Application to numerical problem Strassens matrix multiplication,*4、A
2、pplication to geometric problem Closest pair,1、Application to sorting problem Merge sort, Quick sort,2019/6/21,4,2012-2013-01 Design and Analysis of Algorithm SCUN,Goals of the Lecture,At the end of this lecture, you should be able to Understand the divide-and-conquer technique Master the idea of merge sort algorithm Master the best-case, worst-case and average-case analysis of merge sort algorithm,2019/6/21,5,2012-2013-01 Design and Analysis of Algorithm SCUN,Example,The brute force algorithm f
3、or above problem:,1. void max_min(int A,int 8. 9. ,How to find both the maximum and minimum elements in an array of size n? 8, 3, 6, 2, 1, 9, 4, 5, 7,2019/6/21,6,2012-2013-01 Design and Analysis of Algorithm SCUN,Examples (cont.),Can we solve this problem much better?,Time complexity analysis of above algorithm,T(n) = 2n-2,The answer is yes, we can solve it like the following,2019/6/21,7,2012-2013-01 Design and Analysis of Algorithm SCUN,Improvement algorithm,1. void maxmin(int A,int 12. 13. ,20
4、19/6/21,8,2012-2013-01 Design and Analysis of Algorithm SCUN,Improvement algorithm (cont.),14. else 15. mid = (low + high) / 2; 16. maxmin(A, 20. 21. ,2019/6/21,9,2012-2013-01 Design and Analysis of Algorithm SCUN,Examples (cont.),Time complexity analysis of improvement algorithm The basic operation is comparison, so let T(n) denotes the comparisons. For simplicity, we assume n is a power of 2. When n=2, the algorithm do one comparison (by row 5); When n2, the algorithm do two recursive calls of
《算法课件全121301ADA06分治法合并排序》由会员E****分享,可在线阅读,更多相关《算法课件全121301ADA06分治法合并排序》请在金锄头文库上搜索。
逍遥游复习 知识点整理
近现代法德关系史 高三展示课3稿
当代大学生人生信仰及追求的调查研究
长相思 纳兰性德-ppt课件
课件:危机意识 一
英语ppt演讲关于阿甘正传
发达国家基础教育改革的动向与趋势 修改版
中国民间美术 课件.ppt
生物质发电技术与系统 课程ppt 第1章 生物质发电技术现状及发展趋势 2学时 -----2016
现代信号处理思考题 含答案
执业药师继续教育 抑郁症的药物治疗 100分
小学生的成长档案模板不用修改 万能型
增订六版 现代汉语 上册 第二章文字 思考与练习答案
国家财政ppt课件
加拿大英语介绍
六年级统计图的选择课件
中学生成长档案ppt
中国现代文学史期末复习整理
lohi和hihilo训练对女子赛艇运动员运动能力影响的比较研究
风雨贾平凹阅读答案
2024-04-11 25页
2024-04-11 37页
2024-04-11 28页
2024-04-11 31页
2024-04-11 36页
2024-04-11 29页
2024-04-11 22页
2024-04-11 27页
2024-04-11 34页
2024-04-11 32页