Compute the frequency count and big-oh notation for a certain code segment
could anyone please give a source code. Thanks!
Re: Compute the frequency count and big-oh notation for a certain code segment
Could anyone please give monies? :D
Thanks!
// Json
Re: Compute the frequency count and big-oh notation for a certain code segment
source code for what?
pinoy ka ba?
Quote:
Could anyone please give monies?
hahahahaha !
Re: Compute the frequency count and big-oh notation for a certain code segment
Here's the general method for easily computing the performance of a code segment:
Find out what you want to vary for a section. Ex.: In a sorting algorithm, you vary how many elements to sort. In a primality test, you vary the number you want to test if it's prime.
Surround your code with timers (I use the Date class), and then subtract the differences in time.
Code :
Date start = new Date();
// code section goes here
Date end = new Date();
You can find the difference in the times by using getTime() method, which returns the number of milliseconds from a date back in 1970 to the time the Date object was created.
Then, run the code with a variety of inputs, generally I like a lot of small points kind of clustered along with some medium-size inputs.
After you have your points, take a regression of them (there are many ways to do this). Run your algorithm a few more times with some absolutely large values and check that they fit into your regression model.