Big Oh Classification [closed] - big-o

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Say that I have a function that has the following growth:
2000n^2 + log n
Is it possible for me to conclude that the function is part of the set of functions that fall into the category of O(n)?

O(some function) is the limiting behavior of a function.
Does there exist some C such that C*n describes the upper limit of the function you described for all n?
If you look closely at your function, you can set C to 2000 such that 2000*n^2 = C*n^2...which is greater than C*n.
So no, it is not O(n).

No since O(log n) < O(n^x) for any fixed x, O(2000n^2 + log(n)) = O(n^2)
An easier way to see this is that since O(log n) < O(n^x), O(log n) < O(n^2) and so O(2000n^2 + log(n)) <= O(2000n^2 + n^2) = O(2001n^2) = O(n^2) and since O(2000n^2 + log(n)) has an n^2 term, it is at least as big as n^2 giving us O(2000n^2 + log(n)) >= O(n^2). Now we have that O(2000n^2 + log(n)) <= O(n^2) and O(2000n^2 + log(n)) >= O(n^2) so we can conclude that O(2000n^2 + log(n)) = O(n^2)

Related

Time complexity of Introduction to Algorithms [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm learning the Introduction to Algorithms and I'm confused about the answers of exercises:
10*log10 = O(log n^2)
// I think it should be 10*log10 = Theta(log n^2)
n^1.01 = Omega( n* (log n)^2 )
// I think should be n^1.01 = O( n* (log n)^2 )
(log n)^log n = Omega ( n / log n )
// I think should be (log n)^log n = O ( n / log n )
n*2^n = O (3^n)
// I don't know how to prove this.....
Is my thinking correct? I'm appreciating if you can provide with some proof of those four questions.
Thanks indeed.
I think you are confusing the things. Equality (=) in complexity theory must be read as "belongs to class" and not "equals". And then you have to cleary realize the meaning of Big-Oh notation (and other omegas and thetas...). For example, O(n) represents ALL functions that grow no faster than linear function. More formally, if f(n) = O(n) (reads "f(n) belongs to class O(n)"), there exists constant c such that for any n: f(n) < c*n. For instance both f(n) = n and f(n) = log(n) belong to O(n) (i.e., they grow no faster).
Let us consider one of your examples:
n*2^n = O(3^n).
In order to prove that we must find some constant c such that:
n*2^n < c * 3^n;
Some math:
n*2^n < c * 3^n => n < c * (1.5)^n;
You can easily see that, even for c=1 this holds, which proves the statement.
Again, be sure you understand the complexity terminology well.

Comparing big theta values [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to order these different big theta values from largest to smallest:
Θ(n2)
Θ(2n log n)
Θ(n log n2)
Θ(2n2)
Θ(log n)
Θ(n log 2n)
Θ(k2)
Θ(22n)
Θ(n3)
Θ(n)
Θ(2n)
Θ(n1.5)
Θ(√n)
Θ(2n2)
and some of the values are equivalent. Particularly, I want to know if a constant term makes one big-theta value larger than an identical big-theta term without the constant term (for example, are these two values equivalent: Θ(22n) & Θ(n)?).
Θ(log n)
Θ(√n) = Θ(n1/2)
Θ(n) = Θ(2n) = Θ(22n)
Θ(n log n) = Θ(2n log n) = Θ(n log n2) = Θ(n log 2n)
Θ(n1.5)
Θ(n2) = Θ(2n2)
Θ(n3)
Considering your comment:
n log 2n = n (log 2 + log n) = n log 2 + n log n
log 2 is a constant non-zero value, so:
Θ(n log 2n) = Θ(n log 2 + n log n) = Θ(n + n log n) = Θ(n log n)
See the sum and multiplication by a constant properties of the big-{O,Theta, Omega}-notations.
If try replacing n with a huge value then you can figure it out yourself without even asking it to the forum:
o(1)
O(log log n)
O(log n)
O(n^c)
O(n)
O(n log n)
O(n^2)
O(c^n)
O(n!)

Show that n^2 is not O(n*log(n))? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Using only the definition of O()?
You need to prove by contradiction. Assume that n^2 is O(n*log(n)). Which means by definition there is a finite and non variable real number c such that
n^2 <= c * n * log(n)
for every n bigger than some finite number n0.
Then you arrive to the point when c >= n /log(n), and you derive that as n -> INF, c >= INF which is obviously impossible.
And you conclude n^2 is not O(n*log(n))
You want to calculate the limit of
(n * log(n)) / (n ^ 2) =
= log(n) / n =
= 0 if n approaches infinity.
because log(n) grows slower than n.

Lower bound : resource required by an algorithm for some class of input size n [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've been asked to find the lower bound of the following :
T(n)= 23n^3-n^2-n.
So here is how i proceeded and i don't know whether I'm tackling it the proper way:
T(n)>=c(23n^2-n^2) for all n greater than n>=n0
23n^3-n^2-n >=(22n^2) for all n>=2.
T(n)>=c|n^2| for all n>=2
c=22 n0=22.
T(n) is in Big Omega n^2
HELP PLEASE!
Note that n^3 >= n^2 for n >= 1. So, -n^3 <= -n^2 for n >= 1.
Note that n^3 >= n for n >= 1. So, -n^2 <= -n for n >= 1.
So
23n^3 - n^2 - n >= 23n^3 - n^3 - n^3 = 21n^3.
Thus, 21n^3 is a decent lower bound.
Intuitively this makes sense as 23n^3 - n^2 - n is clearly cubic in nature, and thus should have lower bound and upper bound of cn^3 for some c (different c for the lower bound from the c for the upper bound).

To prove lg n! = theta(n lg n) [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I was trying to prove lg n! = theta(n lg n)
I used the below expression to prove it
0 <= c1(n lg n) <= lg n! <= c2(n lg n) - equation 1
By using lg n! <= c2(n lg n) from the above equation, I could prove that lg n! = big O(n lg n)
however to prove lg n! = big omega(n lg n), I need to use the other part of equation 1 which is
c1(n lg n) <= lg n! - equation 2
can anyone help me as to how to solve equation 2 to prove big omega. The hint which I got to know is to do perform integration. But I'm not able to do it. Kindly help me out here
Thank you very much.

Resources