CSCI 311 Final Exam Review Questions

Final Exam Dates:
  • Thursday 12 December 2019 11:45 a.m. Breakiron 066 (3 p.m. Section)
  • Tuesday 17 December 2019 8:00 a.m. Dana 115 (11:00 a.m. Section)
  • Thursday 19 December 2019 3:30 p.m. Breakiron 165 (1:00 p.m. Section)

The final exam will be cumulative. I will write a 1.5-hour exam that will be roughly 2/3 material we've covered since the last exam and 1/3 material covered in the first two exams. You will have two hours to complete the exam. The two hours will start at the beginning of the exam period. I am likely to give one question from a previous exam on the final, though it may vary slightly in the details,

The questions for the final exam covering the most recent material similar to (but not limited to) the questions below. You may want to study the previous exams and review questions for coverage of the earlier material.


  1. Identify the following:

  2. Write (pseudo-)code and state the running times for:

  3. True/False. Explain your answer.

  4. What two properties are needed to make an optimization problem a good candidate for dynamic programming?

  5. Give code or pseudocode for an efficient solution to the longest common subsequence problem (you should be able to do this for both the bottom-up and top-down approaches).

  6. Give code or pseudocode for the rod-cutting problem (you should be able to do this for both the bottom-up and top-down approaches).

  7. Give code or pseudocode for the Knapsack problem for the case of unlimited, indivisible objects (you should be able to do this for both the bottom-up and top-down approaches).


  8. How can depth-first search be used to determine if a graph is connected?

  9. What is the purpose of using the union-find data type in Kruskal's algorithm? Explain where in the algorithm it is used, what its inputs are, and what operations are applied.

  10. What is the running time for depth-first search on a graph represented using an adjacency matrix? Using adjacency lists?

  11. For the graph below, show the progess of Kruskal's, Prim's, and Dijkstra's algorithms. In particular, show the edges in order as they are added to the spanning or shortest-path tree. For Prim's and Dijkstra's algorithms, label each vertex with its weight and predecessor values after each new vertex is added to the minimum spanning tree/shortest-path tree.

  12. Computing single-source shortest distances in unweighted graphs (i.e., graphs where every edge represents the same distance) can be done with a simpler algorithm than Dijkstra's algorithm. In such graphs, distance is merely the number of edges on a path. Give such a simpler algorithm for finding single-source shortest paths in an unweighted graph.

  13. Given a directed graph G on which each edge (u,v) has an associated value r(u, v), which is a real number in the range between from 0 to 1 that represents the reliability of a communication channel from u to v. We interpret r(u, v) as the probability that the channel from u to v will not fail, and we assume that these probabilities are independent. Modify Dijkstra's algorithm to find the most reliable path between two given vertices. [Note: this is a challenging question intended to get you thinking about other ways in which priority-first search can be used. It won't be on the exam, but figuring it out will improve your knowledge in ways that could help you on the exam.]