Question: Suppose you are given an algorithm BinRep ( b ) that generates the binary representation of a given decimal integer b with time complexityGiven n

Suppose you are given an algorithm BinRep(b) that generates the binary representation of a given decimal integer b with time complexityGiven n in NOand(loga,bb). in N we want to compute
fa,b(n)=a3n,modb;
that is a to the power of 3n modulo b.
i. Write pseudocode for an algorithm to compute fa,b(n).
ii. Determine the efficiency class of the time complexity of your algorithm in item (i) for fa,b(n), when a,b are fixed natural numbers.
iii. Compute
f2,21(8)=238,mod21
using either your own algorithm in the previous part or the binary-exponentiation algorithm. Trace your steps while computing f2,21(8) for this question.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!