[SOLVED] COMP9101-Assignment 2

20.99 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

Rate this product
  1. Given positive integers M and n compute Mn using only O(logn) many multiplications.
  2. You are given a polynomial P(x) = A0+A1x100+A2x200 where A0,A1,A2 can be arbitrarily large integers. Design an algorithm which squares P(x) using only 5 large integer multiplications.
  3. Assume you are given a map of a straight sea shore of length 100n meters as a sequence on 100n numbers such that Ai is the number of fish between ith meter of the shore and (i + 1)th meter, 0 ≤ i ≤ 100n − 1. You also have a net of length n meters but unfortunately it has holes in it. Such a net is described as a sequence N of n ones and zeros, where 0’s denote where the holes are. If you throw such a net starting at meter k and ending at meter k+n, then you will catch only the fish in one meter stretches of the shore where the corresponding bit of the net is 1. Find the spot where you should place the left end of your net in order to catch the largest possible number of fish using an algorithm which runs in time O(nlogn).

 

Hint: Let N0 be the net sequence N in the reverse order; look at the sequence A ∗ B0; see the figure.

  1. (a) Compute the convolution

(b) Compute the DFT of the sequence

  1. Find the sequence x satisfying x∗h1,1,−1i = h1,0,−1,2,−1i. Hint: what polynomials correspond to the given sequences?
Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.