Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Compute the frequency count and big-oh notation for a certain code segment

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Compute the frequency count and big-oh notation for a certain code segment

    could anyone please give a source code. Thanks!


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Compute the frequency count and big-oh notation for a certain code segment

    Could anyone please give monies?

    Thanks!

    // Json

  3. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: Compute the frequency count and big-oh notation for a certain code segment

    source code for what?
    pinoy ka ba?


    Could anyone please give monies?
    hahahahaha !

  4. #4
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default 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.

    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.

Similar Threads

  1. select count(*)
    By jacinto in forum JDBC & Databases
    Replies: 4
    Last Post: March 2nd, 2010, 09:30 PM
  2. Replies: 6
    Last Post: October 23rd, 2009, 03:53 AM
  3. count components inside a JPanel
    By dewboy3d in forum AWT / Java Swing
    Replies: 1
    Last Post: August 2nd, 2009, 03:17 PM
  4. Creating A Count Matrix In Java
    By statsman5 in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: July 14th, 2009, 04:40 PM