CS410, Summer 1998 Lecture 28 Outline Dan Grossman Goals: * Review what we've learned, point out some pervasive themes, and put this course in its place in the curriculum, field, and life. Announcements: * Dan's office is moving soon, so check his web page if you need to find him after he moves. * Final is 10:30 Monday in the same room as class. The intention is to test the material since the prelim, but it may assume knowledge of material from before the prelim. Roughly 1/3 of the points are for graph questions, 1/3 for sorting, and 1/3 for other things. * Review session is Sunday 4-6 in Upson 211. * Fill out course evaluations. We listed on the board all the subjects we covered. They could be grouped as basic data structures, trees, heaps, hashing, amortization, union-find, sorting, tries, and graphs. Here are some general principles that came up more than twice: 1. Get log n running time by dividing a problem in half. Yes, binary search comes up everywhere. 2. Implicit vs. explicit pointers. Often conceptually we had objects related to each by terms like child, parent, left, successor, edge, etc. We could often exploit the random access of arrays by "naming" our objects 1,2,...,n and implicitly using array indices instead of pointers. This helped with heaps, union-find, and graphs. We could translate "real" objects to small integers with the help of a dictionary, such as a balanced tree or a hash table. 3. As in any computer science endeavor, we abstracted to general principles rather than getting stuck on specifics. In particular, we abstracted over: a. problems. Rather than finding the shortest distance from Ithaca to Boston we learned how to find the shortest path in a weighted graph. Now your job is to go off and recognize when specific problems fit the frameworks we studied. b. language. Nothing in this course pertains particularly to Java. Sure we discussed the "object-oriented way" to do things from time to time, but data structures transcend syntax and even programming styles. c. data types. This is basically what polymorphism is. See below. 4. Polymorphism Often our data structures would operate over "any kind of object that has such-and-such functionality". For example, comparison sorts work with any objects that can define a "less than" relationship. Stacks and queues work for any kind of object whatsoever. Discovering the minimal functionality required of data helps in at least two ways: * by implementing the data structure to handle any data meeting the requirements, we get better re-use of our work * it gives insight into what the data structures and algorithms are really doing. Sometimes, however, specializing our algorithms to a specific case makes them faster. For example, lists are trees which are graphs. So if we wanted to know how many list items were between i and j in some list, treating the list as a graph and running BFS would work just fine. But it's a lot of overhead because we're not specializing to the task at hand. Specializing the right amount is art. 5. Using Abstract Data Types Not only good programming practice, it framed just about every discussion we had. Where does CS410 fit in the Cornell curriculum? In CS100 you learned syntax. In 211/212 you learned a simple model of computation. You learned how to reason about assignment, function application, objects, etc. in a simple model of a processor and memory. 280 gave you the math that computer scientists need to effectively reason. 410 gives the fundamental structures that solve tasks efficiently in this model. 414 shows that this model is a big facade and teaches what it takes to deal with a world where lots of things happen at once and compete for resources. 482 discusses more advanced algorithms and teaches algorithm design techniques (whereas we often just "looked up the way to do it"). Of course, there are many other important courses (222, 381/482, 412 (closest to what I do), etc.), but I think those described above put 410 in its place. Finally, let me repeat what we said in lecture 1: This is fundamental material every competent programmer must know. You should know most of it in your sleep and, looking back on it, feel like you didn't learn very much in this class. Where does CS410 fit in science and society? We've generally played with toy problems or abstract problems. But economists, physicists, politicians, etc. have real, important data that needs to be structured and analyzed. We know the basic building blocks to do this efficiently. Where does this course fit in the university? You are here to get an education. Sitting in lecture is only one small part of that. It has been my job to help with that aspect, and I have learned a lot by doing it. You have all worked very hard in this course, and hopefully you work just as hard in the other aspects of your life. See you around.