Homework Questions for Parallel Algorithms | CS 1510, Assignments of Computer Science

Material Type: Assignment; Professor: Pruhs; Class: ALGORITHM DESIGN; Subject: Computer Science; University: University of Pittsburgh; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-9fw-1
koofers-user-9fw-1 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 1510 Parallel Algorithms Homework Problems
1. Explain how to find the logical AND of nbits in time O(log n) using nprocessors on an EREW PRAM.
What is the efficiency of this algorithm?
2. Explain how to find the logical AND of nbits in time O(log n) using n/ log nprocessors on an EREW
PRAM. What is the efficiency of this algorithm?
3. Explain how to find the logical AND of nbits in time O(1) using nprocessors on a CRCW PRAM.
4. You know that lots of famous computer scientists have tried to find a fast efficient parallel algorithm
for the following Boolean Formula Value Problem:
INPUT: A Boolean formula Fand a truth assignment Aof the variables in F.
OUTPUT: 1 if Amakes Ftrue, and 0 otherwise.
Moreover, most computer scientists believe that there is no fast efficient parallel algorithm for the
Boolean Value Problem. You want to find a fast efficient parallel algorithm for some new problem N.
After much effort you can not find a fast efficient parallel algorithm for N, nor a proof that Ndoes
not have a fast efficient parallel algorithm. How could you give evidence that finding a fast efficient
parallel algorithm for Nis at least a hard of a problem as finding a fast efficient parallel algorithm for
Boolean Formula Value problem? Be as specific as possible, and explain how convincing the evidence
is.
Note that “fast and efficient” means poly-log time with a polynomial number of processors. The term
“poly-log” means bounded by O(logkn) for some constant k.
††
5. Design a parallel algorithm that takes as input a integer nand an integer x, and creates an array Aof
nintegers, where each entry of Ais equal to x. Your algorithm should take time O(log n) on a EREW
PRAM using nprocessors. What is the efficiency of this algorithm?
††
6. Design a parallel algorithm that takes as input a integer nand an integer x, and creates an array Aof
nintegers, where each entry of Ais equal to x. Your algorithm should take time O(log n) on a EREW
PRAM using n/ log nprocessors. What is the efficiency of this algorithm?
††
7. Design a parallel algorithm that takes as input a integer nand an integer x, and creates an array A
of nintegers, where each entry of Ais equal to x. Your algorithm should take time O(1) on a CRCW
PRAM using nprocessors. What is the efficiency of this algorithm?
8. Design a parallel algorithm for the parallel prefix problem that runs in time O(log n) with n/ l og n
processors on a EREW PRAM.
††
9. Give an algorithm that given an integer ncomputes n!, that is nfactorial, in time O(log n) on an
EREW PRAM with nprocessors. Make the unrealistic assumption that a word of memory can store
arbitrarily large integers.
pf3
pf4

Partial preview of the text

Download Homework Questions for Parallel Algorithms | CS 1510 and more Assignments Computer Science in PDF only on Docsity!

CS 1510 Parallel Algorithms Homework Problems

  1. Explain how to find the logical AND of n bits in time O(log n) using n processors on an EREW PRAM. What is the efficiency of this algorithm? †
  2. Explain how to find the logical AND of n bits in time O(log n) using n/ log n processors on an EREW PRAM. What is the efficiency of this algorithm? †
  3. Explain how to find the logical AND of n bits in time O(1) using n processors on a CRCW PRAM. †
  4. You know that lots of famous computer scientists have tried to find a fast efficient parallel algorithm for the following Boolean Formula Value Problem: INPUT: A Boolean formula F and a truth assignment A of the variables in F. OUTPUT: 1 if A makes F true, and 0 otherwise. Moreover, most computer scientists believe that there is no fast efficient parallel algorithm for the Boolean Value Problem. You want to find a fast efficient parallel algorithm for some new problem N. After much effort you can not find a fast efficient parallel algorithm for N , nor a proof that N does not have a fast efficient parallel algorithm. How could you give evidence that finding a fast efficient parallel algorithm for N is at least a hard of a problem as finding a fast efficient parallel algorithm for Boolean Formula Value problem? Be as specific as possible, and explain how convincing the evidence is. Note that “fast and efficient” means poly-log time with a polynomial number of processors. The term “poly-log” means bounded by O(logk^ n) for some constant k. ††
  5. Design a parallel algorithm that takes as input a integer n and an integer x, and creates an array A of n integers, where each entry of A is equal to x. Your algorithm should take time O(log n) on a EREW PRAM using n processors. What is the efficiency of this algorithm? ††
  6. Design a parallel algorithm that takes as input a integer n and an integer x, and creates an array A of n integers, where each entry of A is equal to x. Your algorithm should take time O(log n) on a EREW PRAM using n/ log n processors. What is the efficiency of this algorithm? ††
  7. Design a parallel algorithm that takes as input a integer n and an integer x, and creates an array A of n integers, where each entry of A is equal to x. Your algorithm should take time O(1) on a CRCW PRAM using n processors. What is the efficiency of this algorithm? †
  8. Design a parallel algorithm for the parallel prefix problem that runs in time O(log n) with n/ log n processors on a EREW PRAM. ††
  9. Give an algorithm that given an integer n computes n!, that is n factorial, in time O(log n) on an EREW PRAM with n processors. Make the unrealistic assumption that a word of memory can store arbitrarily large integers. †
  1. Design a parallel algorithm for multiplying two n by n matrices that runs in time O(log n) time on a CREW PRAM with n^3 / log n processors. What is the efficiency of this algorithm? ††
  2. Design a parallel algorithm that given a polynomial p(x) of degree n and an integer k computes the value of p(k). You algorithm should run in time O(log n) on a EREW PRAM with O(n/ log n) processors. Assume that the polynomial is represented by its coefficients. ††
  3. We consider the problem of computing Fn, the nth Fibonacci number, given an integer n as input. Show how to solve this problem in time O(log n) on a EREW PRAM with n processors. Make the unrealistic assumption that Fn will fit within one word of memory for all n, that is, assume that all arithmetic operations take constant time. Recall that Fn is defined by the following recurrence: F 0 = F 1 = 1, and Fn = Fn− 1 + Fn− 2 for n > 1. HINT: Note that for j > (^0) [ 1 1 1 0

] [

Fj Fj− 1

]

[

Fj+ Fj

]

  1. The input to this problem is a character string C of n letters. The problem is to find the largest k such that C[1]C[2].. .C[k] = C[n − k + 1]... C[n − 1]C[n] That is, k is the length of the longest prefix that is also a suffix. Give a EREW parallel algorithm that runs in poly-logarithmic time with a polynomial number of processors. ††
  2. The input to this problem is a character string C of n letters. The problem is to find the largest k such that C[1]C[2].. .C[k] = C[n − k + 1]... C[n − 1]C[n] That is, k is the length of the longest prefix that is also a suffix. Give a CRCW parallel algorithm that runs in constant time with a polynomial number of processors. ††
  3. Design a parallel algorithm for adding two n bit integers. You algorithm should run in O(log n) time on a CREW PRAM with n processors. NOTE: If your algorithm is EREW, you might want to rethink since I don’t know how to do this easily with out CR. † † † HINT: Use divide and conquer and generalize the induction hypothesis.
  4. Explain how to modify the all-pairs shortest path algorithm for a CREW PRAM that was given in class so that it runs in time O(log^2 n) on a EREW PRAM with n^3 processors. †
  5. Explain how to modify the all-pairs shortest path algorithm for a CREW PRAM that was given in class so that it actually returns the shortest paths (not just their lengths) in time O(log^2 n) on a EREW PRAM with n^3 processors. ††

it for at least 15 minutes and couldn’t solve it, so decided to assign it as homework several years ago. No one has solved it yet.

† † ††