Search code examples
time-complexitylogarithm

Is lg*(n) time complexity better than lg(n)?


I am trying to understand the time complexity of the lg*(n) [log*(n) base 2] in comparison to lg(n) and I wonder which of them is faster...can someone explain it, please? Thanks in advance.


Solution

  • According to Wikipedia, the iterative logarithm (log*) is one of the slowest growing time complexities. In fact, of all the commonly uses complexities, it is the second slowest, beaten only by the inverse Ackerman function. This means it grows significantly slower, and as a result completes much faster, than the log function.

    Source: https://en.wikipedia.org/wiki/Iterated_logarithm#Analysis_of_algorithms