Question: Find - Index - 2 ( A [ 1 : n ] ) : For j = 1 to n: Sample i in { 1
FindIndexA : n:
For j to n:
Sample i in n uniformly at random and if Ai mod output i and terminate;
otherwise, continue.
If the forloop never terminated, go over the array A one element at a time to find an index i with Ai
mod and output it as the answer.
Again, we skip the proof of correctness of this algorithm.
d What is the worstcase running time of FindIndexA : n What about its worstcase
expected running time? Remember to prove your answer formally. points
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
