You are on page 1of 1

CS 218M Practice Problems

1. Suppose you are given rectangular tiles with height 1 and width 2. You
have to use these to tile a rectangle of height 3 and width 2n. Describe
an algorithm to find the number of ways in which this can be done.
2. Given a sequence of n numbers, design an algorithm to find the longest
increasing subsequence of the given sequence.
3. Consider a post office that sells stamps in three different denominations,
1 rupee, 7 rupee and 10 rupee. Design an algorithm that will find the
minimum number of stamps for a postage value of N rupees.
4. Given a character string x1 x2 ..xn we want to convert it into another
string y1 y2 .., ym . The operations allowed are add a character, delete a
character, or replace one character by another. Describe an algorithm
to find the minimum number of operations needed to convert one given
string into another.
5. Give an algorithm that takes an n-node path G with weights assigned to
its nodes and returns an independent set in G of maximum total weight.
6. Let G be directed graph with notes s and t. Design an algorithm to find
the minimum number of edges whose removal separates s from t. Show
that this number is also the maximum number of edge-disjoint st paths
in G
7. Consider a flow network in which vertices, as well as edges, have capacities. That is, the total incoming flow (which, by conservation, equals
the total outgoing flow) at any given vertex is subject to a capacity constraint. Show how to reduce the problem of determining the max-flow
in such a network to an ordinary max-flow poblem.
8. Let D = (dij ) be a p q matrix with real entires and row sums ai and
column sums bj . Show that it is possible to round each dij , ai , bj up or
down to an integer so that the sum of the rounded entries in each row
(column) equal the rounded row (resp. column) sum. Give an algorithm
to find such a rounding.
9. Let G be a graph. A clique of G is a set of vertices such that any two
vertices in the set are joined by an edge. Show that the problem of
deciding if a graph has a clique of size k is NP-complete.

You might also like