You are on page 1of 3

CSN-523: Computational Geometry

(Spring 2016-2017)
Tutorial-1 Date: Jan 18, 2017
Name: Batch (B1/B2): Enrolment Number:

1. State the definition of O(n), (n) and (n), where n is the size of the input instance of a problem.

Solution:
Refer to book.

2. Find the exact solution of the following recurrence. (Assume n = 2k.) You may use either the
repeated substitution method, or the master-theorem.

Solution:

3. True or false with justification: Let A be an algorithm that operates on a list of n objects, where n
is a power of two. A spends (n2) time dividing its input list into two equal pieces and
selecting one of the two pieces. It then calls itself recursively on that list of n/2 elements. Then
A's running time on a list of n elements is O(n).

Solution:
FALSE. The time taken on a list of n elements is at least the (n2) time taken before the recursive
call. Since this is (n2) rather than just O(n2), it is (n2). Thus the total time is (n2), and a
function cannot be both (n2) and O(n).
4. In this you are to answer some questions about the following graph.
(e) (f)
| |
| |
|17 |15
| |
3 | 10 | 1
(A)-------------(c)-------------(g)---------(h)
| | | /
| | | /
|7 |9 |11 /5
| | | /
| 12 | 14 | /
(b)-------------(d)-------------(i)

(a) In what order are edges added to the Minimum Spanning Tree (MST) using Kruskal's
Algorithm (merging subtrees)? List the edges by giving their endpoints.
(b) In what order are edges added to the MST using Prim's Algorithm (growing a single tree)
starting from vertex A?

Solution:
(a) gh,Ac,hi,Ab,cd,cg,fg,ce
(b) Ac,Ab,cd,cg,gh,hi,fg,ce

5. Formally define Polynomial-Time Reducibility.

Solution:
Refer to book.

6. What is the definition of P, NP, NP-complete and NP-hard?

Solution:
Refer to book.

7. Show that Set Cover is NP-complete by making use of Vertex Cover.

Solution:
The easy part is to show that SC (Set Cover) is in NP by observing that a solution for SC can be
easily checked in polynomial time. Now we have to show VC<SC by showing how to solve VC
by using an imaginary program for SC. Consider a VC instance (graph G and bound b). Number
all the edges from 1 to m. Our set of SC elements will be the set of edge numbers
{1,2,...,m}. Our subsets will correspond to vertices, one subset for each vertex. The subset for
vertex v will consist of all the numbers corresponding to the edges that use vertex v.

Observe that if VC has a vertex cover of size b then the subsets corresponding to those vertices
form a set cover also of size b. If we start with a set cover of size k then the subsets used in the
set cover correspond to a vertex cover of same size. Thus, G has a set cover of size b iff the
derived SC problem has a set cover of size b. This means that VC<SC and SC is NP-complete.

8. True or false with justification: Let X be a decision problem. If we prove that X is in the class NP
and give a poly-time reduction from X to 3-COLORING, we may conclude that X is NP-
complete.

Solution:
FALSE. This would be true if the reduction were from 3-COLORING to X, for example. But as
stated, X might be a language in P (since P is contained within NP, and any P problem can be
reduced to 3-COLORING as 3-COLORING is NP-complete). If X were both in P and NP-
complete, it would follow that P=NP. Since the given statement implies P=NP, we cannot
conclude that it is true.

You might also like