World's most popular travel blog for travel bloggers.

[Solved]: What does $\log^{O(1)}n$ mean?

, , No Comments
Problem Detail: 

What does $\log^{O(1)}n$ mean?

I am aware of big-O notation, but this notation makes no sense to me. I can't find anything about it either, because there is no way a search engine interprets this correctly.

For a bit of context, the sentence where I found it reads "[...] we call a function [efficient] if it uses $O(\log n)$ space and at most time $\log^{O(1)}n$ per item."

Asked By : Oebele

Answered By : David Richerby

You need to ignore for a moment the strong feeling that the "$O$" is in the wrong place and plough on with the definition regardless. $f(n) = \log^{O(1)}n$ means that there exist constants $k$ and $n_0$ such that, for all $n\geq n_0$, $f(n) \leq \log^{k\cdot 1}n = \log^k n$.

Note that $\log^k n$ means $(\log n)^k$. Functions of the form $\log^{O(1)}n$ are often called polylogarithmic and you might hear people say, "$f$ is polylog $n$."

You'll notice that it's easy to prove that $2n=O(n)$, since $2n\leq k n$ for all $n\geq 0$, where $k=2$. You might be wondering if $2\log n = \log^{O(1)}n$. The answer is yes since, for large enough $n$, $\log n\geq 2$, so $2\log n \leq \log^2n$ for large enough $n$.

On a related note, you'll often see polynomials written as $n^{O(1)}$: same idea.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/48527

0 comments:

Post a Comment

Let us know your responses and feedback