title: Algorithm that returns j'th smallest element from two sets
body: <p>I have an assignment asking that from two sets M and N of equal size <em>j</em> holding distinct numbers, with access only to the functions kthsmallestM(int k) and kthsmallestN(int k), which return the k'th smallest integer from M and N respectively, the algorithm should find the <em>j</em>'th smallest element from M+N. </p>
  
  <p>The way to do this using brute force is rather obvious, but the algorithm should run with O(log <em>j</em>) calls to kthsmallestM or kthsmallestN. I'm not looking for a complete solution, but I've been stuck on this for a while, so just some pointers to get me started would be appreciated!</p>
  
  <p><strong>What I've tried:</strong>
  Checking if the largest element of M is smaller than the smallest element of N and vice versa, in which case, the answer would simply be the largest element of M or N, depending on the situation. I tried using that to make a recursive algorithm that performs the same check for smaller elements of both sets, but that quickly turns into O(n).</p>
  
  <p>Any tips?</p>