I got asked an interview question that wanted me to discern the Big-O notation of several logarithmic functions. The functions were as follows:
f(x) = log5(x)
f(x) = log(x5)
f(x) = log(6*log x)
f(x) = log(log x)
I was told that the Big-O for the first and second are not equivalent and the third and fourth are not equivalent after mistakenly guessing the opposite. Can anyone explain why they are not equivalent and what their Big-O are then?
So you have O(log log log log log x), O(log x), O(log log x) and O(log log x), three distinct Big-O classes.
If your interviewer said 3 and 4 were different, either he was mistaken or you've misremembered the question (happens all the time).
This is a matter of math:
So the Big O is
So (1) and (2) aren't equivalent, but (3) and (4) are (though they're different from both (1) and (2))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With