1.                 This problem explores how, when using a faster computer, thespeedup is affected by the algorithm’s complexity. Suppose we cansolve a problem size nin time t on aparticular computer. Now we are given a computer 16 times faster.In the same time t,approximately what size problem can you solve with the followingcomplexities: θ(n), θ(n2) ,θ(2n) ? Show anywork you need to do the problem.

(a) θ(n)

           (b) θ(n2)

         (c) θ(2n).

2.                 Suppose we have an array A[1 .. n] of integers, such that A[i] isthe maximum value of A.

           A[0] A[i] > A[i+1] > A[i+2] . . . A[n-1] > A[n]

Describe an algorithm to find the maximum element of A in timefaster thanθ(n)



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *