Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started