0

Suppose there is a function f(x)= 19n^2/5n +1-n
I want to calculate upper and lower bound. But I had this confusion that whether I have to calculate in terms of n^2? Because dominating term is n^2

or If I solve the above equation as f(x)= 19n/5 +1-n (canceling n in 1st term) then what? Then I have to calculate c1 and c2 in terms of n? because that will be the dominating term .

So, Kindly tell me that in which term do I have to calculate c1 and c2 i.e n or n^2?? Can I cancel n in 19n^2/5n or not? What will be its asymptotic form? f(n)∈Θ(n^2) or f(n)∈Θ(n) ?

Tom
  • 23
  • 1
  • 6
  • This is more of a math than a programming question, so it is more appropriate for the Math SE. – meowgoesthedog Nov 28 '18 at 10:49
  • Seems you have ended at the wrong site. Maybe https://math.stackexchange.com/ is better – Support Ukraine Nov 28 '18 at 11:02
  • I don't think I am in the wrong site. I know 2nd step is mathematically possible but I want to ask that that while calculating c1 and c2, is it asymptotically possible? – Tom Nov 28 '18 at 11:18

1 Answers1

1

Well if you have

f(n) = 19n^2 / (5n) - n + 1

you can, for the purpose of finding asymptotic bounds, indeed cancel out the n's to obtain

f(n) = (19/5)n - n + 1 = (14/5)n + 1

The easy way to do this is observing that (14/5)n is a dominating term here so +1 can be ignored, and 14/5 is a (positive) constant which can therefore also be ignored.

Therefore, we have that f(n) ∈ Θ(n).

In terms of lower and upper bound coefficients c1 and c2, this can be motivated by the fact that you can find two such coefficients (greater than zero!) such that c1 * n is asymptotically smaller than f(n), whereas c2 * n is asymptotically larger than f(n). For instance, consider c1 = 1 and c2 = 3.

Berthur
  • 4,300
  • 2
  • 14
  • 28