Use a binary search to find a value i in the range 1..k such that A[i] >= B[k-i] and A[i] <= B[k-i+1], in which case the median is A[i]
or A[i] <= B[k-i] and A[i+1] > B[k-i], in which case B[k-i] is the median. Don On Nov 10, 10:07 am, shady <[email protected]> wrote: > Given two sorted arrays, how to find the kth smallest element in the > union of the arrays in a logarithmic time algorithm ? > i have already formed a recursive solution, can anyone give the > iterative approach, only pseudo-code :) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
