0

I have a set of problems where I am given an f(n) and g(n) and I am supposed to determine where f(n) is O(g(n)), Ω(g(n)) or Θ(g(n))

And I must also determine the c(s) and n0 for the correct relationship.

How do I get started on a problem like this?

Here's an example for the kind of problem I am given

f(n)= lg(n^2) g(n)=n lg(n)

user906153
  • 1,218
  • 8
  • 30
  • 43

2 Answers2

1

You need to reduce f(n) to a form that makes it easy to compare to g(n). For your case:

f(n) = log(n2)
f(n) = 2 log(n)

That should be enough to answer your problem for that example - the process is going to be pretty much the same for the rest of the set.

Carl Norum
  • 219,201
  • 40
  • 422
  • 469
1

You can do this using limits as follows

Limit as n tends to infinity(sorry i have no idea how to produce mathematical equations here) of f(n)/g(n)

If the value obtained is

A constant then f(n) = Θ(g(n))

Infinity then f(n) = Ω(g(n))

Zero then f(n)= O(g(n))

Desert Ice
  • 4,461
  • 5
  • 31
  • 58