Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design and Analysis of Algorithms Peng ZHANG ( 张鹏 ) School of Computer Science and Technology, Shandong University.

Similar presentations


Presentation on theme: "Design and Analysis of Algorithms Peng ZHANG ( 张鹏 ) School of Computer Science and Technology, Shandong University."— Presentation transcript:

1 Design and Analysis of Algorithms Peng ZHANG ( 张鹏 ) algzhang@sdu.edu.cn School of Computer Science and Technology, Shandong University

2 2 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Text Book Introduction to Algorithms (Second Edition) Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein – CLRS01 Higher Education Press, The MIT Press, 68 RMB CormenLeisersonRivestStein

3 3 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Reference Books Algorithm Design Jon Kleinberg, Éva Tardos, Cornell University 《图算法》:马绍汉编著,山东大学出版社。 Algorithm Design Techniques and Analysis, M.H. Alsuwaiyel (Saudi Arabia), 电子工业出版社, 40 元。 《算法设计与分析》:王晓东编著,清华大学出版社, 30 元。 《计算机算法导引 — 设计与分析》:卢开澄编著,清华大 学出版社, 21 元。 《算法设计与分析》:郑宗汉编著,清华大学出版社, 32 元。

4 4 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Grading Scheme Total 100  Assignments and Attendance: 5%  Project: 15%  Final Examination: 80% Caution:  Please do not sign attendance for others  Please do not copy others’ programs and assignment –Otherwise, 0 mark will be given  Please keep quiet in class

5 5 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Contents Part I  Explore techniques on a graph –Breadth-first search algorithm (BFS) –Depth-first search algorithm (DFS)  Applications of DFS –Classifying edges (for directed or undirected) –Topological sort (for directed acyclic) –Strongly connected components decomposing (for directed) –Bi-connected components decomposing (for undirected)

6 6 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Contents (continued) Part II  Minimum spanning tree problem (for undirected) –Kruskal’s algorithm –Prim’s algorithm  Bottleneck spanning tree problem Part III  Single-source shortest paths problem (for directed) –Bellman-Ford algorithm –Dijkstra’s algorithm  All-pairs shortest paths problem –Matrix-multiplication based algorithm –Floyd’s algorithm –Johnson’s algorithm

7 7 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Contents (continued) Part IV  Maximum flow problem (for network) –Ford-Fulkerson algorithm –Dinic’s algorithm  Applications of Max-flow problem –Maximum matching algorithm for Bipartite graphs Part V  Uniquely decodable coding problem –UDC algorithm –Huffman’s algorithm

8 8 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Why Study this Course? Closely related to our lives Help to guide how others analyze and solve problems Help to develop the ability of analyzing and solving problems via computers Very interesting if you can concentrate on this course

9 9 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Prerequisite Data Structure C, Java or other programming languages A little mathematics

10 10 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Where does “algorithm” come from? Due to ancient Arab mathematician Abū ʿ Abdallāh Mu ḥ ammad ibn Mūsā al- Khwārizmī (780 ~ about. 850). His two books:  “liber algorismi” ( 花拉子米算术 ), derives the word “algorithm”.  “al-jabr w’al-muqabala” ( 还原与对消 ), derives the word “algebra”. Muhammad al-Khowarizmi, from a 1983 USSR commemorative stamp scanned by Donald Knuth

11 11 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Alan M. Turing June 23, 1912 – June 7, 1954

12 12 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Turing’s Paper A. M. Turing. On computable numbers, with an application to the entscheidungsproblem. Originally published by the London Mathematical Society in Proceedings of the London Mathematical Society, Series 2, Vol.42 (1936 - 37) pages 230 to 265, with corrections from Proceedings of the London Mathematical Society, Series 2, Vol.43 (1937) pages 544 to 546.

13 13 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Algorithms in China Prof. Andrew C.-C. Yao Winner of Turing Award 2000.

14 14 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Two Design Methods Dynamic programming Greedy approach

15 15 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ The Largest Common Sequence Problem Algorithm LCS-Length(X, Y) Computing the length of an LCS of X = x 1 x 2... x m and Y = y 1 y 2... y n. 1. for i  1 to m do 2. c [ i, 0]  0. 3.endfor 4. for j  0 to n do 5. c [0, j ]  0. 6.endfor 7. for i  1 to m do 8. for j  1 to n do 9. if x i = y j then 10. c [ i, j ]  c [ i  1, j  1] + 1 11. b [ i, j ]  “  \” 12. else 13. if c [ i  1, j ]  c [ i, j  1] then 14. c [ i, j ]  c [ i  1, j ] 15. b [ i, j ]  “  ” 16. else 17. c [ i, j ]  c [ i, j  1] 18. b [ i, j ]  “  ” 19. endif 20. endif 21. endfor 22.endfor 23. return c and b.

16 16 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ The Elements of Dynamic Programming 1.Optimal substructure property An optimal solution to the original problem contains an optimal solution to the subproblem. 2.Subproblem overlapping property The same subproblem arise in the procedure of recursive decomposition of the original problem.

17 17 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ The Elements of Greedy Approach 1.Greedy choice property The local optimal (greedy) choices can lead to an optimal solution to the original problem. 2.Optimal substructure property An optimal solution to the original problem contains an optimal solution to the subproblem.

18 18 © 2005, 2009, 2011 SDU http://www.sciencenet.cn/u/algzhang/ Thanks for attention!


Download ppt "Design and Analysis of Algorithms Peng ZHANG ( 张鹏 ) School of Computer Science and Technology, Shandong University."

Similar presentations


Ads by Google