
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.
†