How can we denote the following function in terms of big-O notation?

118 Views Asked by At

I have got a function and want to denote it in terms of bigO notation.

f(n) = log4n+n*(1/3). Is this function O(n)? (* here is the multiplication) Thanks for your help

2

There are 2 best solutions below

0
On

In the context of computational complexity, we want to describe the behaviour of $f(n)$ as $n\rightarrow \infty$. $\frac{\log 4n }{n}\rightarrow 0$ as $n\rightarrow \infty$ so $f(n)/n\rightarrow 1/3$ so surely for $n$ large, $f(n)/n<\alpha $ for some constant $\alpha>1/3$. So by definition, $f(n)=O(n)$.

0
On

I'm assuming you mean

$$ f(x) = \log(4n) + \frac{1}{3} n $$

Well, big-oh plays nicely with finite sums

$$ f(x) = O(\log(4n)) + O(\frac{1}{3} n) $$

and it ignores constant multiples

$$ f(x) = O(\log(4n)) + O(n) $$

and when combining terms, you just keep the max

$$ f(x) = O(n) $$

$\square$