This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: number for i . Each processor has local variables a , b , row , col , index and tmp . Assume that all memory cells in a PRAM that do not contain input contain zero. row := d i/n 2 e ; col := d i/n e - b i/n 2 c × n ; index := i- b i/n c × n ; 1 read M[(row-1) × n + index] into a ; read M[ n 2 + (col-1) × n + index] into b ; tmp := a ∧ b ; if tmp == 1 then write 1 in M[(row-1) × n + col] . • the number of processors = n 3 • the number of steps = 2 (reads) 3. Each i th processor reads v i and w i and compare them. If v i ≥ w i , then it writes 1 into i th memory cell. Otherwise, it writes 0. This computation takes O (1) time since it can be done in parallel using n processors. Then, by Binary Fan-in technique, the sum of the values in each memory cell can be computed in O (log n ) time. If the sum is larger than b n/ 2 c , V is stronger than W . 2...
View Full Document
- Spring '08
- Algorithms, WI