280 likes | 483 Views
CSE 3101E Design and Analysis of Algorithms. Prof. J. Elder. Textbooks. Required Text: Cormen, T.H., Leiserson, C.E., Rivest, R.L. & Stein, C. (2001). Introduction to Algorithms , 2nd Ed. Cambridge, Mass: MIT Press. Available in the York University Bookstore
E N D
CSE 3101E Design and Analysis of Algorithms Prof. J. Elder
Textbooks • Required Text: • Cormen, T.H., Leiserson, C.E., Rivest, R.L. & Stein, C. (2001). Introduction to Algorithms, 2nd Ed. Cambridge, Mass: MIT Press. • Available in the York University Bookstore • Also available from www.amazon.ca for $68.01 • Optional Text: • Edmonds, J. How to Think about Algorithms. New York, NY: Cambridge University Press. COSC 3101, PROF. J. ELDER
Assignments • You will learn best if you try to tackle each problem by yourself initially. • You are encouraged to discuss the problems and work in groups to overcome roadblocks. • You are encouraged to team up with a partner and write up a single assignment report (maximum 2 per group). • Make the reports as concise and organized as possible. Marks may be taken off for excess verbosity or lack of clarity. • Late assignments are not excepted (except for medical emergencies – please see syllabus). COSC 3101, PROF. J. ELDER
Eduardo Corral Soto Eduardo will be marking all assignments. Please direct any questions regarding the marking of assignments to Eduardo. If you believe there was an error in marking your assignment, please bring it to Eduardo’s attention promptly (within a week). Office hour: Mon 9:30-10:30 (Location TBA) Teaching Assistant COSC 3101, PROF. J. ELDER
Please ask questions! Help me know what people are not understanding! COSC 3101, PROF. J. ELDER
On the slides • These slides: • are available from the website www.elderlab.yorku.ca/~elder/teaching/cse3101 • may change up to the last minute as I polish the lecture. • Include slides originally created by J. Edmonds: Thanks Jeff! COSC 3101, PROF. J. ELDER
Lectures • I will teach the first 18 lectures • Jeff Edmonds will teach the last 3 lectures on dynamic programming COSC 3101, PROF. J. ELDER
Course Content • A list of algorithms. • Learn their code. • Trace them until you are convinced that they work. • Implement them. • Worry about details. class InsertionSortAlgorithm extends SortAlgorithm { void sort(int a[]) throws Exception { for (int i = 1; i < a.length; i++) { int j = i; int B = a[i]; while ((j > 0) && (a[j-1] > B)) { a[j] = a[j-1]; j--;} a[j] = B; }} COSC 3101, PROF. J. ELDER
Innovation Abraham Lincoln Thomas Edison Steve Wozniak and Steve Jobs COSC 3101, PROF. J. ELDER
The future belongs to the computer scientist/engineer who has • Knowledge: An up to date grasp of fundamental problems and solutions • Ability:Principles and techniques that can be adapted to solve new problems COSC 3101, PROF. J. ELDER
Course Content • A survey of algorithmic design techniques. • Abstract thinking. • How to develop new algorithms for any problem that may arise. COSC 3101, PROF. J. ELDER
A survey of fundamental ideas and algorithmic design techniques For example . . . COSC 3101, PROF. J. ELDER
Classifying Functions Time Complexity t(n) = Q(n2) f(i) = nQ(n) Time Input Size Recurrence Relations Summations T(n) = a T(n/b) + f(n) ∑i=1 f(i). Mathematical Tools COSC 3101, PROF. J. ELDER
0 i-1 i T+1 i i 9 km 5 km Iterative Algorithms Loop Invariants <preCond> codeA loop <loop-invariant> exit when <exit Cond> codeB codeC <postCond> One step at a time Code Relay Race COSC 3101, PROF. J. ELDER
? ? Recursive Algorithms COSC 3101, PROF. J. ELDER
Graph Search Algorithms COSC 3101, PROF. J. ELDER
Network Flows COSC 3101, PROF. J. ELDER
Greedy Algorithms Example: Making Change COSC 3101, PROF. J. ELDER
2 8 9 5 8 4 4 6 2 3 5 7 5 6 1 3 2 5 4 8 Dynamic Programing 4 5 3 2 COSC 3101, PROF. J. ELDER
Read Ahead You are expected to read the lecture notesbefore the lecture. This will facilitate more productive discussionduringclass. COSC 3101, PROF. J. ELDER
We are going to test you on yourability to explain the material. One good way to study is to explain the material over and over again toyourself or to each other. Explaining COSC 3101, PROF. J. ELDER
Be Creative Ask questions. Why is it done this way and not thatway?
Guesses and Counter Examples • Guess at potential algorithms for solving a problem. • Look forinput instances for which your algorithm gives the wrong answer. • Treat it as a game between these two players. COSC 3101, PROF. J. ELDER
Refinement:The best solution comes from a process of repeatedly refining and inventing alternative solutions COSC 3101, PROF. J. ELDER • Rudich www.discretemath.com