

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Pruhs; Class: ALGORITHM DESIGN; Subject: Computer Science; University: University of Pittsburgh; Term: Fall 2007;
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CS 1510 Midterm 2 Fall 2007
∑n i=1 vi. The problem is to determine if there are three disjoint subsets S, P and T of V such that (^) ∑
vi ∈S
vi =
∏ vi∈P
vi =
∑ vi ∈T
v i^3
That is, no element of V can be in more than one of S, P and T. You want the sum of the numbers in S to be equal to the product of the numbers in P , and equal to the sum of the cubes of the numbers in T. It is okay for a number to be in none of S, P or T. Give an algorithm for this problem whose running time is polynomial in n and L.
(a) Explain how to solve the Parallel Prefix Problem on an EREW machine in time O(log n) on input of size n with n processors. Start with defining the Parallel Prefix Problem. (b) What is the efficiency of the algorithm in the previous subproblem? Start with a def- inition of efficiency. You need not have solved the previous subproblem to answer this question. (c) What would the Folding Principle say about the time for the algorithm in the first subproblem if there were only n^1 /^4 processors? Start with a definition of the Folding Principle. You need not have solved the first subproblem to answer this question. (d) Explain how to solve the Parallel Prefix Problem on an EREW machine in time O(log n) on input of size n with n/ log n processors.
(a) Explain how to find the maximum of n numbers in time O(1) on an CRCW-common machine with n^2 processors. (b) Explain how to find the maximum of n numbers in time O(log log n) on an CRCW- common machine with n processors.
(a) Show that the following CLIQUE problem is NP-hard:
INPUT: A graph G and an integer k OUPUT: 1 if G has a clique of size k, and 0 otherwise
A clique is a collection of mutually adjacent vertices. Use the fact that the following INDEPENDENT SET problem is NP-complete.
INPUT: A graph G and an integer k OUPUT: 1 if G has an independent set of size k, and 0 otherwise
An independent set is a collection of mutually nonadjacent vertices.
(b) Show that the following problem is NP-hard:
INPUT: A graph G and an integer k OUPUT: 1 if G has a clique of size k and an independent set of size k, and 0 otherwise
Use the fact that both that the CLIQUE and INDEPENDENT SET problems above are NP-complete. This was one of the homework problems. (c) Show that the following problem is NP-hard:
INPUT: A graph G and an integer k OUPUT: 1 if G has a clique of size k or an independent set of size k, and 0 otherwise
Use the fact that both that the CLIQUE and INDEPENDENT SET problems above are NP-complete.