Big-O Notation regarding logarithms

后端 未结 4 494
离开以前
离开以前 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:30

    f(x) = log^5(n)
    f(x) = log(n^5) -> 5 log(n)
    O(5 log(n)) < O(log(n)^5)
    
    f(x) = log(6*log n) -> log(6)+log(log(n))
    f(x) = log(log n) 
    log(log n) < log(6) + log(log(n)) 
    

    , although log(6) is a constant so they have same O

提交回复
热议问题