Question: This question is about searching and solving a problem in modular arithmetic. ( a ) Consider the following vector of integers: 1 , 2 ,
This question is about searching and solving a problem in modular arithmetic.
a Consider the following vector of integers:
By hand, directly run through the Binary Search algorithm on this vector
searching for the value Show your working and how you choose elements to
inspect.
b It can be argued that the Binary Search algprithm is optimal. Very briefly explain
what this means. You do not have to provide an argument, just explain what the
statement means.
c A modular square root of a nonnegative integer modulo is a nonnegative
integer such that ie and are congruent modulo For
instance, if is and is then could be since mod is or could be
since mod is also That is there can be multiple square roots. There is a
short revision on modular arithmetic at the end of this question. The modular
square roots and are also assumed to be integers less than Note that is
always assumed to be greater than
Consider the following piece of pseudocode that finds the smallest square root of
an integer modulo :
function RECMOD
if RECMODNRECMODyxRECMOD then
return
end
return RECMOD
end function
function MODSQUAREROOT
for
RECMOD then
return
end
end for
end function
Briefly explain why the worstcase time complexity RECMOD
for inputs a and
What is the worstcase time complexity of MODSQUAREROOTy N in Big O
notation and in terms of the inputs N andor y
iii. Briefly explain your solution to part of c ie the worstcase time complexity
of MODSQUAREROOTy N
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
