CPSC 311: Analysis of Algorithms
Information and Review Questions for Exam 2
Spring 2003


General Information

The second exam will be on Thursday April 3. It will cover material from Chapters 10, 11, 12, 21, 22, and 23 in the text. It will be a closed book exam (no notes, books, or neighbors) except you will be allowed a one page cheat sheet (both sides) which must be turned in with the exam. There will be 5 or 6 questions worth a total of 100 points. Remember to show your work - partial credit will be given.


Material

All of the following are considered to be fair game:


Review Questions

Below are some suggested review exercises/problems for the exam. It is strongly recommended that you be able to do all of these problems. Solutions will not be handed out. Finally, be sure to check your email -- clarifications and/or explanations will be mailed to the class if needed.

  1. Study Homeworks #5, #6, and #7 and Quizzes 6-8; variations of some of these questions will appear on the exam.

  2. Data Structures (Chapt 10, 11, 12): Consider inserting the following keys, in this order, into a hash table of size m=13.

    keys to insert (in this order): 9, 1, 22, 14, 27

  3. Graph Representation, DFS, BFS (Chapt 22):

  4. Disjoint Sets (Chapt 21): Consider the set of elements U=(1,2, ..., n1). Give a sequence of n1 makeset operations, n1 union operations, and n2 find operations that take Theta(n1n2) time when we use simple unions without path compression (for the disjoint-set forest implementation). Explain. Draw the resulting disjoint-set forest.

    How long does this same sequence of n1 + n1 + n2 operations take when we use weighted-unions without path compression (again, with the disjoint-set forest implementation)? Explain. Draw the resulting disjoint-set forest.

    How long does this same sequence of n1 + n1 + n2 operations take when we use weighted-unions with path compression (again, with the disjoint-set forest implementation)? Explain. Draw the resulting disjoint-set forest.

  5. Minimum Spanning Trees (Chapt 23): Let G=(V,E) be a connected, undirected, weighted graph. Know the analysis of Kruskal's and Prim's algorithms for finding a minimum spanning tree. You should be able to derive the worst-case running times of these algorithms in terms of both V (number of vertices) and E (number of edges).

    Know the correctness proof of these algorithms. You should be able to produce these proofs on your own.