You’re in the right place if you want to improve your Java programming skills and learn lots about the various ways to organize data efficiently for your applications. You’ll also learn about analysis of algorithms, formal specifications, automated unit testing, performance analysis, and a few more things.
Catalog Description: This course covers the analysis, design, and implementation of data structures including arrays, stacks, queues, linked lists, binary trees, heaps, balanced trees, and graphs. Other topics include sorting, hashing, Java generics, unit testing, and benchmarking. Course work involves both written homework and Java programming assignments.
Prerequisite(s): 601.107: Introductory Programming in Java or 601.220: Intermediate Programming.
Policies: Please read the general course policies and take them to heart. Additional policies specific to this course may be posted at a later date.
There is no required text book for this course, but it’s highly recommended that you obtain reference material to supplement lecture. Here are some suggestions.
checkstylethat you may run into
Homework assignments are designed for you to practice certain skills and techniques, they are not graded. If you want feedback on your solutions, please ask in office hours.
Projects are designed to evaluate how well you’ve mastered course material. They are graded. Please check the individual projects for due dates and the structure your solutions should have. See our Piazza site for detailed submission instructions.
This is not a schedule. It’s a “log” of what we did, roughly, in each lecture. Don’t expect it to turn into a schedule, it won’t.
Lockableinterface for objects such as
Chestin an adventure game, example of a “conceptual” wrist watch and its many possible implementations
Counterinterface, implementing the interface with a
SimpleCounterclass, the interface design tradeoff: too specific vs. not specific enough, testing the
assertfor automated, self-contained testing, interface versus specification versus implementation, a first glimpse at algebraic specifications of abstract data types
Counterspecification; developing a specification for
Variable; notation for type parameters; notation for functions with multiple parameters; the
Anyspecification; see Piazza for writeups of all the specifications
Variableinterface and a
SimpleVariableimplementation; developing a specification for
Array; partial functions and preconditions in specifications
Arrayinterface and a
SimpleArrayimplementation; exceptions in Java to enforce precondition (for partial functions in the specification); the difference between
RuntimeExceptionin Java; testing exceptions
Iteratorinterfaces in Java; adjusting the
Arrayinterface to be iterable; implementing the iterator; nested classes in Java; hacking a second implementation of
Arraybased on singly-linked lists, complete with iterator
assertEqualsmethod; some background on
-classpathto compile and run JUnit 4 test cases; the ADT Stack.
Stackinterface with arrays; problem with fixed array size; idea of “resizing” an array by making a bigger one, copying the existing data, then “switching” the arrays; normal worst-case analysis would say
pushis now O(n); more detailed analysis shows that
pushis amortized O(1) instead; hacking the
ArrayStackimplementation; testing multiple implementations of the same interface; using inheritance to split the JUnit test driver into an “interface driver” base class that has the test cases for all implementations of
Stackas well as several “implementation drivers” that just make instances of the unit under test; the difference between “black box” or “opaque box” testing (based strictly on a specification) and “white box” or “glass box” testing (based on what we know about a particular implementation); discussion of when it makes sense to put additional test cases into one of the “implementation drivers” instead.
%to “bend” arrays into circles; efficient array-based queues; the double-ended queue (aka deque) abstraction.
Treeinterface for generic, n-ary trees.
Treeinterface (using lists, arrays, or parent-sibling representation, various tradeoffs); tree traversals (breadth-first or level-ordered using a queue, depth-first using recursion; difference between pre, in, and post-order traversals).
Graphinterface, our first with two generic type parameters; splitting
Edgeto allow better type-checking; returning
Iterable<Edge<E>>from methods that have many results.
Set<T>implementations based on arrays or lists; taking advantage of value-orientation: self-organizing sets; the move-to-front and swap-to-front heuristics.
Map<K, V>; simple map implementations, complexity; ordered maps; introduction to binary search trees (BSTs).
insert; outline of
remove; predecessors and successors.