Overview Coming into this course, you should already be familiar with Abstract Data Types and with the way that Java classes are used to implement them. To be certain that everyone is on the same page, however, this module examines some critical information about ADTs & classes in Java. Some of this material should be review for you. If not, you can find more detailed treatments in the pre-requisite course CS251. Some optional review readings have been suggested as well. We will also take the time to focus on some fine points of class implementation that you may not have seen much prior emphasis on, particularly copying and comparing objects. This opening week of the course is also an opportunity to select your personal programming environment for use in this course. We will look briefly back at the options that you practiced in CS252 and will offer some additional possibilities. | Activities
|
Overview
Generics and iterators are often used together to provide patterns for code that can be applied to a wide range of underlying data structures. | Activities
|
Overview An important theme throughout this semester will be viewing the process of developing software as an engineering process. Now, engineers in traditional engineering disciplines, civil engineers, electrical engineers, and the like, face trade offs in developing a new product, trade offs in cost, performance, and quality. Software developers face the same kinds of choices. Early on, you may have several alternative designs and need to make a decision about which of those designs to actually pursue. It’s no good waiting until the program has already been implemented, written down in code. By then you’ve already committed to one design and invested significant resources into it. In this module, we’ll look at mathematical techniques for analyzing algorithms to determine what their speed will be, or, more precisely, how badly their speed will degrade as we apply them to larger and larger amounts of data. The key to doing this will be to analyze the code for its worst case complexity. | Activities
|
Overview A substantial amount of the data that we work with is arranged into a simple linear ordering, one thing after another. Of course, you are already quite familiar with one way of doing this, by putting the data into arrays. In this module we explore one of the two most common variations on ADTs for maintaining data in a sequence: array-style storage and linked-lists. Array-style storage provides $O(1)$ access to any element in the sequence, but can require lengthy ($O(n)$) operations to add or remove elements. Linked lists allow for efficient ($O(1)$) insertion and removal of data from any location in the sequence, at the cost of limiting access to moving sequentially from one end of the list to the other. | Activities
|
Overview Functional programming is a style of coding that treats functions as data, allowing them to be passed to and returned from other functions, stored in data structures, and, of course, still be called/executed like a function. Java has a number of places where it supports the functional style. In some cases this is optional. In others this is simply a means to writing cleaner, more readable code. | Activities
|
Overview Recursion is a style of programming in which a function solves a problem by calling itself on “smaller” subproblems, then combines the subproblem solutions into a solution of the overall problem. Recursion is an alterative to iteration (looping) that can sometimes lead to cleaner code. Sometimes one can achieve more readable, expressive algorithms by using ADTS that limit one’s choices. Stacks and queues do not do anything that an
Stacks can also be used to rewrite a recursive algorithm into an iterative form. | Activities
|
Overview In Part I, we analyzed the speed of algorithms exclusively from the point of view of the worst case. One might argue that this is unnecessarily pessimistic on our part. There are some algorithms for the worst case input is rare enough that we might not be worried about it, particularly if we believe that typical inputs can be handled much more quickly. We therefore next turn to the idea of average case complexity a measure of how the average behavior of a program degrades as the input sets get larger and larger. A common class of algorithms for which average case analysis is particularly important are sorting algorithms: arranging a sequence of items into a desired order. | Activities Average Case
Sorting
Midterm Exam
|
Overview Not all data is intended to be treated as a sequence. Associative containers, including sets (collections of items with no duplicates) and maps (lookup “tables” that can search for data associated with keys), can contribute to efficient and elegant application algorithms. | Activities . From this point on, the course materials are “under construction”.
|
Overview Hashing is a fast searching strategy for providing fast associative containers (sets and maps). Hashing stores data in arrays (primarily), but does not store them in any predictable order, or even contiguously. Instead, hashing uses a special “hash function” to compute a desired location for any key we want to insert. If you don’t actually know the internal details of the hash function, its choices of locations would seem arbitrary, almost random. Nonetheless, it works, and in many cases works well. Hash tables can often store and search for data in O(1) average time. | Activities
|
Overview Most of the data structures we have looked at so far have been devoted to keeping a collection of elements in some linear order. Trees are the most common non-linear data structure in computer science. Trees turn out to be exceedingly useful in searching. Properly implemented, a tree can be both searched and inserted into in O(log N) time. Compare this to the data structures we’ve seen so far, which may allow us to search in O(log N) time but insert in O(N), or insert in O(1) but search in O(N). | Activities
|
Overview Trees are useful in representing things that naturally occur in hierarchies (e.g., many company organization charts are trees) and for things that are related in a “is-composed-of” or "contains manner (e.g., this country is composed of states, each state is composed of counties, each county contains cities, each city contains streets, etc.) | Activities
|
Overview By this point in the semester, you’ve learned a lot of algorithms. Many practical problems can be solved by direct application of these. But what do you do when faced with an unfamiliar problem, one for which none of the “canned” algorithms in your personal toolbox are suitable? When you have to design your own algorithms, you should consider some of the common patterns or styles that are available to you. This lesson looks at these styles, many of which we have seen before, and a few new ones as well. | Activities
|
Overview A priority queue is an ADT that allows us to repeatedly find and remove the largest (or smallest) item from a colleciton of data. They take their name from the idea that they implement a “queue” of items awaiting processing, but one in which some items have higher priority than others and so get to jump to the head of the line if nothing ahead has even higher priority. Priority queues are generally implemented using heaps, a tree with very special ordering properties. | Activities
|
Overview A graph is a collection of vertices (nodes) connected by edges in arbitrary fashion. Graphs are used to represent data relationships that are far more complicated than could be represented using trees or lists. | Activities
|
Symbol Key | |
---|---|
Conference | |
Slides & Lecture Notes | |
Textbook readings | |
Exam | |
Lab Assignment | |
Assignment | |
Project | |
CS252 (Unix) Assignment |
All times in this schedule are given in Eastern Time.