CMPS 144 Spring 2019
Final exam preview
You can expect the following kinds of problems on the test.
The items in this first list pertain to topics not covered in the
midterm test and thus are more likely to appear on the final exam
than those that did appear in the midterm test.
- Given a binary search tree (in the form of a diagram),
show what the tree would "look like" after performing
insertions and deletions of specified values. (See Lab 12.)
- Given a priority queue (represented as a heap shown in the
form of a diagram), show what it would "look like" after
performing insertions of specified values and deleteMin()
operations. (See Lab 13.)
- Given an undirected graph with edge weights (in the form of
a diagram), show the minimum spanning tree that Kruskal's
Algorithm would produce when applied to that graph.
(See Lab 13.)
- Given a representation of a collection of mergeable clusters
(in the form of a diagram), show what the representation
would look like after performing a specified merge() or
leaderOf() operation. (Mergeable clusters are used in
Kruskal's algorithm, where the nodes in each tree (in the
forest) form a cluster.
- Given an array-based representation of a positional list
(in the form of a diagram), list the elements from front to rear
and show what the representation would "look like" as a
consequence of specified insertions and deletions having occurred.
(See Lab 11.)
- Given a task to be performed upon a positional list, write
the code to do it. (See Lab 11.)
- Given a task to be performed upon a binary tree (based upon
either the RecBinTree or PosBinTree interfaces), write
the code to do it.
- Develop a new method (specifications provided, of course)
for the IntRangeSet class. (See Lab 10.)
- Given is the source code for a small hierarchy of related classes
(e.g., a parent class, a couple of child classes, perhaps a grandchild
class). Also given is a client program that either creates or is given
objects from those classes and invokes methods upon them.
Tell what happens (e.g., what output is printed).
To do this correctly, you need to understand how method dispatch
works in deciding which version of a method to call.
The following are problems pertaining to topics that may or may
not have appeared in the midterm test.
- Evalute an FPAE using a pair of stacks.
- Perform a breadth-first search of a directed graph
using a queue.
- Given an array-based or reference-based representation
of a stack or queue, and operations performed upon it,
show how the representation would change.
- Given a recursive method, "execute" it and report
its effects (or the result it returns).
- Given a recursive method, formulate a recurrence relation
describing its "running time".
- Given a recurrence relation (describing some recursive
algorithm's running time), find a "closed form" solution
using the repeated substitution method.
- Given a relatively simple task that can be solved
recursively, develop a recursive method that does so.
- Given code segments involving (probably nested) loops,
determine the number of iterations as a function of
some natural number N describing input size.
- 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.