To obtain the -th smallest entry of two ascending sorted arrays of lengths , choose prefix lengths with . Search for the two boundary inequalities in the title, treating missing left boundaries as and missing right boundaries as . Then all selected entries precede all unselected entries, so their largest boundary value is the answer. If , decrease ; if , increase . These failures are monotone because one prefix grows as the other shrinks. Binary search thus takes comparisons when the shorter array supplies the searched prefix. Repeated values retain their multiplicities in the ranks.
Articles by others on the same topic
There are currently no matching articles.