I can't imagine one that is not polylogarithmic but logarithmic.
$O(\log N)$ satisfies both.
What about $O(\log^{3}N)$, $O(\log^{100}N)$, and $O(\log^{10000}N)$ ?
Let's say $N=10^{10}$
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It only takes a minute to sign up.
Sign up to join this communityI can't imagine one that is not polylogarithmic but logarithmic.
$O(\log N)$ satisfies both.
What about $O(\log^{3}N)$, $O(\log^{100}N)$, and $O(\log^{10000}N)$ ?
Let's say $N=10^{10}$
Definitions:
An algorithm is said to run in
That means they are the same for $k=1$. Otherwise they are different and your other examples are all polylogarithmic. I'm not sure how exactly to explain what the difference is but maybe a picture will help you:
An algorithm is said to take logarithmic time if T(n) = O(log n)
.
An algorithm is said to run in polylogarithmic time if T(n) = O((log n)^k)
, for some constant k.
Logarithmic time
An algorithm is said to take logarithmic time if $T(n) = O(\log n)$. Due to the use of the binary numeral system by computers, the logarithm is frequently base 2 (that is, $\log_2 n$, sometimes written $\lg n$). However, by the change of base for logarithms, $\log_a n$ and $\log_b n$ differ only by a constant multiplier, which in big-$O$ notation is discarded; thus $O(\log n)$ is the standard notation for logarithmic time algorithms regardless of the base of the logarithm.
Algorithms taking logarithmic time are commonly found in operations on binary trees or when using binary search.
An $O(\log n)$ algorithm is considered highly efficient, as the operations per instance required to complete decrease with each instance.
A very simple example of this type is an algorithm that cuts a string in half, then cuts the right half in half, and so on. It will take $O(\log n)$ time ($n$ being the length of the string) since we chop the string in half before each print (we make the assumption that console.log and str.substring run in constant time). This means, in order to increase the number of prints, we have to double the length of the string.
Polylogarithmic time
An algorithm is said to run in polylogarithmic time if $T(n) = O((\log n)^k)$, for some constant $k$. For example, matrix chain ordering can be solved in polylogarithmic time on a Parallel Random Access Machine.
^
.
$\endgroup$