UNB/ CS/ David Bremner/ teaching/ cs3383/ assignments/ CS3383 Assignment 10

Due: 2020-11-26 11:59 PM

Q1 Matrix times vector

Write a multithreaded algorithm to compute the product of an n × n matrix and an n-vector.

Q2 Divide and flounder

Consider the following parallel search algorithm.

function ParSearch (A, p, q, k)
  If p > q return FALSE
  If A[p] = k  return TRUE
  if p = q return FALSE
  right ← spawn ParSearch(A, p + 2, q, k)
  left ← ParSearch(A, p+1,p+1, k)
  sync
  return left OR right
end function