Meaning of lg * N in Algorithmic Analysis

前端 未结 6 1897
暖寄归人
暖寄归人 2021-02-05 05:23

I\'m currently reading about algorithmic analysis and I read that a certain algorithm (weighted quick union with path compression) is of order N + M lg * N. Apparently though th

6条回答
  •  执念已碎
    2021-02-05 06:16

    The answers given here so far are wrong. lg* n (read "log star") is the iterated logarithm. It is defined as recursively as

             0             if n <= 1
    lg* n =
             1 + lg*(lg n) if n > 1 
    

    Another way to think of it is the number of times that you have to iterate logarithm before the result is less than or equal to 1.

    It grows extremely slowly. You can read more on Wikipedia which includes some examples of algorithms for which lg* n pops up in the analysis.

提交回复
热议问题