954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Big Oh - Pick a "C" and "N"

Pick a "c" and "n" for the problem below.

f(n) = 2nlgn, g(n) = n^2-n


My answer is below, but I am not sure if I am correct. I've been trying to figure out this same problem for a while. The real solution is at the bottom, but I don't know how 2nlgn turned into 2n^2.Any help or suggestions is appreciated.


f(n) = 2nlgn, g(n) = n^2-n

2nlgn <= cn^2-n

2nlgn/n^2 + n/n^2 <= cn^2/n^2

2nlgn/n^2 + 1/n <= c

1 <= 1

c = 1, n = 1

Real solution:

2n lg n <= 2nn <= 2n^2 <= 3(n^2-n) n >= 3

NinjaLink
Posting Pro in Training
419 posts since Mar 2008
Reputation Points: 8
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You