Question: You are given two sorted arrays A and B each containing n distinct integers and a natural number r < = 2 n as input.
You are given two sorted arrays A and B each containing n distinct integers and a natural number r n as input. Assume that there is no common element in A and B Let C be set of all elements either in A or B that is C is union of A and B For an element p in array C rankp in C is a total number of elements in C which are less than or equal to pEg if C then rank in C is as elements in C are less than or equal to Give an efficient algorithm to find an element p in C with rankp r Give proper Pseudocode for the algorithm. Analyze the time complexity of the algorithm.
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
