Big-O Notation regarding logarithms

后端 未结 4 459
离开以前
离开以前 2021-01-06 10:22

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

4条回答
  •  逝去的感伤
    2021-01-06 10:55

    I'll assume you mean f(n), not f(x). For 1 and 2, log^5(n) is equivalent to O(log log log log log(n)), while log(n^5) = 5 log(n) = O(log n).

    For 3 and 4, I disagree. log(6*log n) = log(6) + log(log n) = O(log log n), which is the same as 4 - O(log log n).

提交回复
热议问题