Q:

Finding kth smallest elements from A union B

In 2 sorted array A and B each of size n how to find kth smallest element in A union B in just O(log n) time? I know it takes O(n) to find A union B.

A:

This can be done in O(log n) time in the following way : 
Main thing to be done : Since the arrays are sorted, you can use binary search to find element of A in B.
Overall solution : http://leetcode.com/2011/01/find-k-th-smallest-element-in-union-of.html

