Question: Problem Description Given the pseudocode below to find a target number I between 1 and r ( both Inclusive ) : while ( 1 )
Problem Description
Given the pseudocode below to find a target number I between and r both Inclusive:
while
int i d r if i mid r piid t else if i idmid; else printFound;
break:
You are required to answer q queries, where in each query, you will be provided with values and r For each query, determine the following:
What is the probability that the above code will fall to print "Found" when any value i where l i r is chosen? Express this probability as an integer where the fraction SPQ and gcdP Q You should compute P Q lambda modulo where QA denotes the multiplicative inverse of a modulo
Problem Constraints fA
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
