Question

So I have this problem to do and I am not really sure where to start:

Using the definition of Big-O, prove the following:

  1. T(n) = 2n + 3 ∈ O(n)
  2. T(n) = 5n + 1 ∈ O(n2)
  3. T(n) = 4n2 + 2n + 3 ∈ O(n2)

if anyone can point me in the right direction (you don't necessarily have to give me the exact answers), I would greatly appreciate it.

Was it helpful?

Solution

You can use the same trick to solve all of these problems. As a hint, use the fact that

If a ≤ b, then for any n ≥ 1, na ≤ nb.

As an example, here's how you could approach the first of these: If n ≥ 1, then 2n + 3 ≤ 2n + 3n = 5n. Therefore, if you take n0 = 1 and c = 5, you have that for any n ≥ n0 that 2n + 3 ≤ 5n. Therefore, 2n + 3 = O(n).

Try using a similar approach to solve the other problems. For the second problem, you might want to use it twice - once to upper-bound 5n + 1 with some linear function, and once more to upper bound that linear function with some quadratic function.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top