720 likes | 895 Views
Thinking about Algorithms Abstractly. Welcome. Jeff Edmonds www.cse.yorku.ca~jeffcourses3101 jeff@cse.yorku.ca CSB 3044, ext. 33295 416-538-7413 . Jeff Edmonds York University. Lecture 1. COSC 3101. Course Material. Videos Of my lectures Fall 2011. Slides. Text.
E N D
Thinking about Algorithms Abstractly Welcome Jeff Edmonds www.cse.yorku.ca\~jeff\courses\3101 jeff@cse.yorku.caCSB 3044, ext. 33295 416-538-7413 Jeff Edmonds York University Lecture1 COSC 3101
Course Material Videos Of my lectures Fall 2011 Slides Text Steps, Assignments, Practice Tests, Unit Tests, Exam Extra Text: Cormen, Leiserson, Rivest, and Stein "Introductin to Algorithms", Good to have, but not needed for this course.
Course Material www.cse.yorku.ca\~jeff\courses\3101\syllabus
What do you think about 3101? • Was by far the hardest course ever. • I got the worst midterm mark ever. • I almost gave up. • But opened a door to such an interesting world for me. • Learned to see things abstractly and from different angles • After working a few years, I realized that 3101 was the most useful course I took.
A Contract to Learn It deeply saddens me when a third of the class does not learn the material sufficiently to pass. I will do everything in my power to help you learn this material. I request that you do everything in your power. Everyone can learn it.
Tough Love Last year and this summer, I threatened them every day. They performed better than ever before! And my course evaluations were better.
Think about Algorithms Abstractly This course requires completely changing the way you think about algorithms. Though I keep warning people, they tend not to get it until they are Devastated by the midterm Change your thinking now.
Study Now! You spend 50hrs/week on your programming course. People do work hard on my assignments. But they don’t really study the material deeplyuntil they fail the midterm.
Marks We will work you HARD: • 6 assignments • 5 practice tests • 5 unit tests • Participation • An exam • Mark = 0% 0% -4% 4%*5=20% 11%*5=55% 2% 10% 35% 78% Σi=1..5 [ 0.04 Ti + 0.07 Max(Ti,E) ] + [ 0.02 P + 0.08 Max(P,E) ] + 0.35 E
Marks 5 unit tests: • Each unit test, half the class fails. “Fail early, fail often” • Then almost everyone starts to listen and passes the exam. • Don’t want to people who fail the midterms to give up • Want people to work on the midterms 4%*5=20% 11%*5=55% 7% max(Ti,E) 4% Ti
Marks Class Participation: • Asking/Answering questions in class • Attending office hours • Talking to me outside of class • Submitting a photo *
Marks Σi=1..5 [ 0.04 Ti + 0.07 Max(Ti,E) ] + [ 0.02 P + 0.08 Max(P,E) ] + 0.35 E
Together I think it is important for people to not feel isolated with the material.
Together You’re cool! Are you free sometime this weekend? Yes!The best way to learn is to teach each other!
Together Some students feel too intimidated to talk to the professor. Actually, he is just a guywho has been doing this for a while.
Together Office hours: Before/after class tend to be the best time.Longer or private questions, when requested, can be taken back to my office, CSB 3044.
Boss assigns task: • Given today’s prices of pork, grain, sawdust, … • Given constraints on what constitutes a hotdog. • Make the cheapest hotdog. Everyday industry asks these questions.
Your answer: • Um? Tell me what to code. With more sophisticated software engineering systems,the demand for mundane programmers will diminish.
Your answer: • I learned this great algorithm that will work. Soon all known algorithms will be available in libraries.
Your answer: • I can develop a new algorithm for you. Great thinkers will always be needed.
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; }}
Course Content • A survey of algorithmic design techniques. • Abstract thinking. • How to develop new algorithms for any problem that may arise.
Study: • Many experienced programmers were asked to code up binary search.
Study: • Many experienced programmers were asked to code up binary search. 80% got it wrong Good thing is was not for a nuclear power plant.
What did they lack? • Formal proof methods?
What did they lack? • Formal proof methods? Yes, likely Industry is starting to realize that formal methods are important. But even without formal methods …. ?
What did they lack? • Fundamental understanding of the algorithmic design techniques. • Abstract thinking.
Course Content Notations, analogies, and abstractions for developing, thinking about, and describing algorithms so correctness is transparent
A survey of fundamental ideas and algorithmic design techniques For example . . .
Logic Quantifiers Logs and Exps g "b Loves(b,g)"b g Loves(b,g) 2a× 2b = 2a+b2log n = n Time Classifying Functions Time Complexity f(i) = nQ(n) t(n) = Q(n2) Input Size Adding Made Easy Recurrence Relations ∑i=1 f(i). T(n) = a T(n/b) + f(n) Some Math
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
? ? Recursive Algorithms
Greedy Algorithms NEED A PIC HERE (NOT POOH)
Reduction = • Rudich www.discretemath.com
Course Material www.cse.yorku.ca\~jeff\courses\3101\syllabus
Course Material Steps: • For each unit, I spoon feed you the key ideas from each unit as a set of steps. • Learn them! Understand them! • With only them, you are on your way to passing. Without them, you are on your way to failing. • Lectures consists of many examples of using these steps. Assignments: Practice key ideas. Do them! Practice Tests: Do them! Text “How to Think about Algorithms”: Buy it and read it.
Book Slides Videos Pros • Don’t have to take notes. • Lower fear level that you will miss something. • Flexible to miss a class or two if working, parenting, sick, … • Read/watch ahead to be prepared for a good discussion. • Read/watch after to review and as a reference.
Book Slides Videos Pros • REALLY good students might feel they don’t have to come to class (some might be right). Cons • Cocky students will think they don’t need to come classbut are wrong. • Lazy students will use them as an excuse to skip classand then never really get to them. Test every other week!Cant be delayed.
Useful Learning Techniques Before reading the solutions to the assignments. • Work hard on solving them on your on. • Study the text and slides. • Get help, but not answers from friends, TA, professor, …
Useful Learning Techniques After reading the solutions to the assignments. • Study the solutions. • Understand the solutions. • Memorize the solutions. • The questions on the tests will be different. • But the answers will be surprisingly close.
Useful Learning Techniques Please interact with me in class. Help me know what people are not understanding Slow down the slides (Though we do have a lot of material to cover)