CPSC 629: Analysis of Algorithms
Midterm Information


General Information

The midterm exam will be Thursday March 11 in class.

It will be a closed book exam (no notes, books, or neighbors). However, I will allow you to use one 8.5x11 page of notes (one side), which you must turn in with your exam.


Material

All of the following are considered to be fair game:


Some Review Questions

  1. Dynamic Programming: A carpenter has a piece of wood of a certain length that must be cut at positions a1, a2 ..., an where ai is the distance from the left end of the original piece of wood. Notice that after making the first cut, the carpenter now has two pieces of wood; after making the second cut, the carpenter has three pieces of wood, etc. Assume that the cost of making a cut in a piece of wood of length l is equal to l, and is the same no matter which position in that piece of wood is being cut. Let L be the length of the original piece of wood.

    First, derive the recurrence relation which could be used to design a recursive algorithm to find the minimum total cost for making all the cuts.

    Second, describe a top-down recursive dynamic programming algorithm to find the minimum total cost for making all the cuts that minimizes the total cost. Analyze the worst-case running time and storage requirements of your algorithm.

    Third, describe a bottom-up recursive dynamic programming algorithm to find the minimum total cost for making all the cuts adn the order in which to make the cuts that minimizes the total cost. Analyze the worst-case running time and storage requirements of your algorithm.

  2. Greedy Algorithms: Consider the problem of finding a minimum spanning tree of a graph. Formulate this problem in terms of finding a maximum-weight independent set in a weighted matroid. This will require defining a matroid, and proving that it satisfies the matroid properties, and also showing that an optimal subset in your matroid corresponds to a minimum spanning tree of your graph. Think of at least one other graph problem which can be formulated as a weighted matroid problem.

  3. Amortized Analysis: Review the aggregate, accounting, and potential methods. What is the main difference between the aggregate and the accounting or potential methods? What is the main difference between the accounting and the potential method?

    Consider a linked list Lwhich supports the operations insert(L,x) (inserts x at the head of the list), delete(L) (deletes tail of the list), and empty(L) (the empty operation removes all elements from the list). Use each of the 3 methods to calculate the amortized cost of n operations.

    Now suppose we also include the operation fill(L,x,k) which inserts k copies of x into the list. Use each of the 3 methods to calculate the amortized cost of n operations.

  4. Data Structures: Review B-Trees, binomial heaps, and Fibonacci heaps. What is the main advantage of a B-tree over a binomial or Fibonacci heap? What is the main advantage of a Fibonacci heap over a binomial heap? Think of at least one algorithm which benefits from the advantages you have stated.