Final exam study guide
Object oriented programming and Java
- Fields, static fields, local variables (Lecture 2)
- Explain the difference between a local variable, a field, and a static field
- Execute Java code while maintaining the heap, stack, and static area
- Classes and interfaces, is-a relationship (Lecture 5 and Lecture 6)
- Be able to determine when one type is-a 'nother type.
- Determine whether a method signature is an appropriate implementation of an interface
- Access modifiers and encapsulation (Lecture 3)
- Know the meaning of public, private, and protected
- Explain why these are important and when to use them
- Subclasses and overloading (Lecture 7)
- Understand the difference between overloading and overriding
- Execute code that has uses overridden methods
- Exceptions (Discussion 3)
- Be able to execute code that throws and catches exceptions
- Generics (Lecture 7 and lecture 8)
- Understand the meaning of
class C<E>
- Be able to use generic types
- Be able to determine the is-a relationship for generic types with wildcards
- Standard library
- Be comfortable with the following types from the standard library:
- List, Map, Comparator, Iterator, String, Object
Programming methodology
- Recursion (Lecture 9 and lecture 10)
- Be able to develop and execute recursive algorithms
- Array diagrams (Discussion 6)
- Know the meaning of
a[i..j]
and a[i..j)
- Understand array diagrams
- Loop invariants (Lecture 15 and discussion 6)
- Know the four loopy questions
- Use them to develop an algorithm from a precondition, postcondition, and invariant
- Given a precondition and a postcondition, produce a loop invariant that generalizes them
- Class invariants
- Develop classes by writing down representation invariants (or class invariants)
Data structures
- big-O notation
- Know the meaning of "f is O(g)"
- Know the relationship between O(1), O(log n), O(n), O(n^2), O(n^k), O(2^n)
- Be able to analyze algorithms containing loops
- Be able to analyze simple divide-and-conquer algorithms (e.g. binary search and mergesort)
- Linked lists
- Understand singly- and doubly-linked lists
- Be able to write basic recursive and iterative algorithms to traverse lists
- Heaps
- Know the heap invariant
- Understand how to store a heap in an array
- Arrays
- Know when use of arrays (or ArrayLists) is appropriate
- Hashtables
- Understand the basic layout and operations of a hashtable.
- Be able to insert and find elements in a hashtable (including resizing)
- Adjacency list/matrix
- Be able to draw an adjacency list and an adjacency matrix for a graph
- Understand the tradeoffs between these
- Binary trees, binary search trees, abstract syntax trees
- Know the binary search tree invariant
- Be able to find an element in a binary search tree
- Be able to perform pre- post- and in-order traversal
Algorithms
You should be able to write down the specifications and invariants for the following algorithms, and be able to execute them "by hand":
- Sorting
- Insertion, Selection, Quick, Merge
- Graph traversals
- Breadth-first search, Depth-first search
- Dijkstra's algorithm
- Prim's algorithm
- Finding a coloring
- Topological sort