Hani
Hani

Reputation: 61

Big-O notation prove

I'm trying to prove that this formula (n2+1)/(n+1) is O(n)

As you know, we need to come up with n0 and C.

So I'm confused a little bit about how to choose an appropriate C since the equation here is division.

So with C=1, (n2+1) / (n+1) / n

(n2+n) / (n+n) / n >= (n2+1) /(n+1)

but I'm stuck here in how to simplify the division here.

Upvotes: 0

Views: 139

Answers (2)

Patrick87
Patrick87

Reputation: 28292

Choosing c = 1:

(n^2 + 1)/(n + 1) <= 1*n        definition of Big-Oh with c = 1
n^2 + 1 <= n^2 + n              multiplying both sides by n + 1
1 <= n                          subtracting n^2 from both sides
n >= 1                          rearranging

Therefore, the choice n0 = 1 works for c = 1.

Upvotes: 0

Phillip Ngan
Phillip Ngan

Reputation: 16106

As n tends to infinity your original equation becomes n^2/n which is equivalent to O(n)

Upvotes: 2

Related Questions