d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help With Determining O(n) For Certain Cases
Add Reply New Topic New Poll
Member
Posts: 5,988
Joined: May 6 2006
Gold: 30.00
Jul 8 2013 12:57pm
I' mreviewing for my test and trying to understand these practice problems

If you could please show me through how to solve these, I'd greatly appreciate it!

1. A method is O(Nlog2N). It takes .001 seconds for the method to run when N = 1,000. What is the expected time for the method to run when N = 2,000? Simplify your answer.

2. A method takes 2 seconds to run when processing 2,000 pieces of data. It takes the same method 16 seconds to run when processing 4,000 pieces of data. What is the most likely order Big (O) of the method given the timing data?

3. A method is O(N^2). It takes 5 seconds for the method to run when N = 20,000. What is the expected time for the method to run when N = 40,000.
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Jul 8 2013 01:48pm
1. plug and chug yo

2. plot two points on a graph. now figure out what the most likely shape of the curve is, and write down the general form of the equation for that curve.

3. do 2, then do 1.

This post was edited by irimi on Jul 8 2013 01:49pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll