Question: suppose there are two separate online databases A and B that each contain n integers, so there are 2n integers in total between the two

suppose there are two separate online databases A and B that each contain n integers, so there are 2n integers in total between the two databases. You can access these databases through queries of the form QUERY A(k) and QUERY B(k) and the respective database will return the kth smallest integer that it contains. Each query takes O(1)-time. Give an O(log n)-time algorithm to return the nth smallest integer of the 2n integers. Use the master method to prove the runtime of your algorithm is O(log n).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!