Is $ 2 ^ { \log _ 3 n + 1 } $ linear running time?

199 Views Asked by At

Today, our professor said that $ 2 ^ { \log _ 3 n + 1 } $ is linear running time. I did not understand why. Can someone explain this to me? Thanks

6

There are 6 best solutions below

0
On BEST ANSWER

Note $2^{\log_3 n+1}= 2(3^{\log_3 2})^{\log_3 n}=2n^{{\log_3 2}}$ and ${\log_3 2}< 1$. So it is bounded by a linear function in $n$.

0
On

It's not linear, it's sublinear. $2^{\log_3(n)} = n^{\log(3)(2)} \approx n^{0.6309}$.

0
On

$O(2^{log_3 n +1}) = O(2^{log_3 n}) = O(2^{\frac{log_2 n}{log_2 3}}) = O(n^{log_3 2})$ which is not linear.

0
On

Somewhere along the way, it may have become confused as to whether "linear time" means $\Theta(n)$, i.e. bounded above by $cn$ and bounded below by $dn$ where $c,d$ are positive constants, or whether is merely means $O(n)$, i.e. bounded above by $cn$ where $c$ is a positive constant. Your stated running time is $O(n)$ but not $\Theta(n)$, as shown in other answers.

0
On

Sublinear is linear, like as $n \in O(n^2)$. So $O(2^{\log_3(n)+1})=O(n^{\log_3 2})=O(n).$

0
On

Meh. This could be wrong, and if it is, feel free to correct me! This isn't linear time. Here's is why:

$2^{{\log_{3} n}+1} = 2^{\frac{log_2 n}{log_2 3}+1} $

And I think this is..like the..same as this:

$2(2^{log_2 n})^{\frac {1}{log_2 3}} = 2n^{\frac {1}{log_2 3}}$

And, if I'm not mistaken: $\frac {1} {log_2 3} < 1 \rightarrow n^{\frac {1} {log_2 3}} < n$

So it appears to me that it is actually faster than linear time :D But I guess technically you could consider this as running in linear time since you could say its upper bound is linear time. :D