How to find the kth smallest element in the union of two sorted arrays?
I hope I am not answering your homework, as it has been over a year since this question was asked. Here is a tail recursive solution that will take log(len(a)+len(b)) time. Assumption: The inputs are correct, i.e., k is in the range [0, len(a)+len(b)]. Base cases: If length of one of the arrays is 0, the answer … Read more