I saw the same question 3 times on Stack Overflow: Complexity of an algorithm Time complexity for two pieces of code Tricky Big-O complexity
I wanted to ask the question in one of them but I couldn't since I'm new on the website and can't comment.
Can someone please explain to me why the complexity is O(logm + logn) and not O(logm * logn)? I tried solving it myself and O(logm * logn) makes more sense to me... since if for example you run it with n=16 and m=1000 then you get about 6 + 4... and it makes more sense that it'll run 6 * 4 times ...
Can you please clarify it for me..? Thanks :)