CMPS 144 Spring 2022
Final Exam Preview
You should be prepared to formulate solutions to the following kinds of
problems on the final exam.
- Programming Assignments:
- Given the specification of a "new" method for the
SliderPuzzleConfig class, deveop that method.
- Given a description of an approach to doing a "saddleback search"
that is different from what you were to use in Prog. Assg. #6, be
able to develop a method that employs the described alternative
approach.
- Runtime complexity: Given a code segment involving
loops, be able to figure out how many iterations occur
(as a function of some measure N of input size) and to
characterize that number in terms of "big-Oh" notation
(e.g., O(N), O(N2)).
(See the "Big-Oh Examples" and "Analysis of Selection and
Insertion Sort Algorithms" links on the course web page.)
- Recursion:
- Be able to trace execution of a recursive method.
- Given a recurrence relation describing the running time of a
recursive method/algorithm (as function of some measure N of
input size), be able to use the "repeated substittion" method
to lead you towards a "solution".
(See "Recursion: Timing" link on course web page.)
- Given a recursive method, be able to express its running time
as a recurrence relation.
(See "Recursion: Timing" link on course web page.)
- Hashing and Hash Tables: (See Lab #14)
Given a hash table (where open addressing is used with the
linear probing collision resolution strategy),
- compute the expected number of probes in both successful and
unsuccessful searches (for that specific table), and be able
to compare the latter number with how many probes could be
expected to be made in an unsuccessful search, based only
upon the table's packing density.
- show at which address a new <key,value>-pair would be
inserted (given its key's home address).
- show how any <key,value>-pairs would move within the
table as a consequence of removing one of them.
- Binary Trees:
- Huffman Trees/Coding: Given a list of symbols and their
respective frequencies-of-occurrence, build a corresponding
Huffman Tree and show the symbol-to-codeword mapping that
the tree induces. (See Lab #14.)
- Heaps: Interpreting an array as representing a
complete binary tree, show steps involved in "heapifying" it,
so as to turn it into a min- or max-heap, or in preserving its
heapness in the face of removing the item from its root.
Be able to trace execution of the HeapSort algorithm.
(See Lab #13.)
- Binary Search Tree: Given one, show how it would change
as a result of inserting or deleting specified keys.
(See Lab #12.)
- Loop Invariants:
Given some task to carry out, and a loop invariant to guide you,
develop code to solve the problem in a manner consistent with the
given loop invariant. (Remember the 2- and 3-color partitioning
problems?) (See Lab #4.)