Frederik
How is the unoptimized algorithm O(log (n+m))? There are essentially two binary searches, with a complexity of log(n) and log(m), respectively. The sum is log(n)+log(m) = log(n*m). Thus, it seems to me the total complexity should be O(log (n*m)). Am I missing something?