How can I test the running time of a method?

c.What is the running time of your method smallest, as a function of n, the number of elements in the list? Use big-Oh notation.
I quoated from a java problem..
Anyone can tell me how I can test the running time? Thanks ! :D

it depends on what is in the method. For example a for loop executed n times would have a O(n). A double for loop (each loopp run n times) will have O(n^2). Do this: determine how many times each loop in the method is run. This is the first term in your runtime equation. Do this for all other loops in the method and add them all together. Most other statements that are not iterative should have a constant runtime so O(1). For conditional statements, the runtime depends on the most time consuming portion of the statement. Once all these are added together, take the O(equation) which should just leave the biggest term. i.e. O(5n^2+3n+8) = O(n^2). Hope this helps.
note: this does not apply to recursive methods

Similar Messages

  • How can I get the run time of a method?

    I click a button "draw" to invoke a method such as draw many shades.
    It hangs a long time.
    I want to get the information of how long it spent.
    How can I do it?
    I'm new guy, more detailed please .
    one example would be much better
    ThankS all :)

    Try JAMon. It is much more flexible than currentTimeMillis() and easier to use.
    import com.jamonapi.*;
    drawShape()
    Monitor mon=MonitorFactory.start();
      ..code being timed...
    System.out.println(mon.stop());// prints time in ms.
    }steve - http://www.jamonapi.com - a fast, free, simple performance tuning API.

  • How can I limit the run time of my VI so that it starts when the arrow is clicked, and stops automatically when a specified time has elapsed using Labview 7?

    I can't seem to find the proper tools to do this. Any help would be greatly appreciated. Thanks in advance.

    I'm guessing that you're running something in a While loop, so you should be able to stop whenever you want.
    In LabVIEW 7, there is a new Express VI on the Time & Dialg palette named Elapsed Time. You specify the time you want, and it generates a boolean True after that amount of time has passed. Just connect this boolean to the Wile loops conditional terminal, either directly or "OR" it with a stop button so you can stop it yourself if needed.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • How can I get the elapse time for execution of a Query for a session

    Hi ,
    How can I get the elapse time for execution of a Query for a session?
    Example - I have a report based on the procedure ,when the user execute that it takes say 3 min. to return rows.
    Is there any possible way to capture this session info. for this particular execution of query along with it's execution elapse time?
    Thanks in advance.

    Hi
    You can use the dbms_utility.get_time tool (gives binary_integer type value).
    1/ Initialize you time and date of beginning :
    v_beginTime := dbms_utility.get_time ;
    2/ Run you procedure...
    3/ Get end-time with :
    v_endTime := dbms_utility.get_time ;
    4/ Thus, calculate elapsed time by difference :
    v_elapsTime := v_endTime - v_beginTime ;
    This will give you time elapsed in of 100th of seconds...
    Then you can format you result to give correct print time.
    Hope it will help you.
    AL

  • How can I see the elapsed time on imported video?

    I'm trying to make a video in iMovie 11'.  I would like to be able to view the elapsing time of the song I imported so I can match video footage with audio.  With the older version of iMovie, I could see a time clock on the bottom of the video I was importing, so I could match the mouth to the lyrics. 
    In the older iMovie version, the entire audio would play when only part of the clips had been imported by me.  Now with this version, the song stops playing when the clips stop.  So partial completion of the video, doesn't allow a full time clock of the total song to allow me to match the voice on the audio with the film of someone singing.
    In short, I can't find the running time clock for the video player in the project library.
    Can you help me with thsi?  The help menu has not anweered my questions.
    Thanks.
    Dave Demoise

    I agree with Bengt W. There are many reasons, even in a simple movie, to want to know the timing of things. This is a surprisingly frustrating product. For want of timing information, you are requiring your users to pay $300?
    In my situation, I took some video of a show (with the performers permission) with an iPad and an iPod.  All I want to do is make a movie with one video as the main position with a series of cutaway clips from the other. It is incredibly frustrating to do this without knowing where you are within each clip.
    When helpful and capable forum participants like we have here have to spend time explaining how best to make do with a product, it's a clear indication of a fault with the product. Now, I either have to spend extra time in iMovie making due with this crippled interface, or I have to spend time looking for an alternative product.
    Consider this a feature request!

  • How can i use the airport time capsule as a external hard drive?

    how can i use the airport time capsule as a external hard drive?

    Why do you recommend not place things like iTunes libraries or photo libraries on the drive? It was what I am looking for...
    I suggest that you ask the experts over in the iPhoto Support Community about their opinions on placing an iPhoto or Aperture library on the Time Capsule....even if you plan to use a wired connection for your Mac and the Time Capsule.
    But, if Terrence Devlin answers, be prepared for a lecture about why you should not ever do this.
    If you place the iTunes library on the Time Capsule, be prepared for iTunes to give you messages about not being able to find the library.
    In addtion, LaPastenague has the answer for you in a nutshell......corruption problems.
    Bottom line....the Time Capsule is for your backups.....not "everyday" files and especially not libraries.

  • How can I get the Date & Time to appear on my final project in iMovie11?

    I am using iMovie 11 and have imported video from a Canon Vixia-HF21 camera. The EXIF data is imported along with the video but when I produce the final product, the date and time do not appear.  How can I get the Date  & Time data to appear on the final product?

    There is a date and time Title you can use. If I recall correctly, it displays date plus hours and minutes, but not seconds.

  • How can i set the date time year to my i pod

    how can i set the date time year to my i pod touch

    Hello Theodora,
    You can do this via your iPod's Settings application.
    B-rock

  • How can i test the boolean state of button action?

    Hello,
    in as2.0, how can i test the boolean value if a button was
    pressed or not?
    I have a simple function im trying to work with like this...
    button_btn.onRelease = function (success:Boolean) {
    if (success) {
    trace("we pressed the button - value is true");
    else {
    trace("value is false");
    working with booleans in this way is new to me - any pointers
    will do - thanks!

    Well, I'm not really that familiar with using video in flash,
    but from what I understand of what you are going for, these are my
    suggestions:
    If the code within your button has scope of the variable you
    are testing for:
    _global.myInfoObject;
    button_btn.onRelease = function(){
    if( myInfoObject.code == (value your are testing for) ) {
    trace("value is correct);
    } else {
    trace ("value incorrect");
    if you aren't in scope you can always maybe forward the
    onRelease function to some handler that is in scope:
    var myInfoObject;
    var release = function(){
    //to do code here;
    button_btn.onRelease = release;
    I hope some of these ideas help a little.
    You can always send your .fla to my email at
    [email protected] and I'll take a look at it.

  • HT202213 Why would my Apple TV suddenly stop recognizing my library.  Nothing has changed.  How can I test the Apple TV.  I have the latest updates.

    Why would my Apple TV suddenly stop recognizing my library.  Nothing has changed.  How can I test the Apple TV.  I have the latest updates.

    Could have to do with home sharing. Try turining off and then back on home sharing on your AppleTV.

  • How can we test the camera megapixel?

    Hi All,
    I need to know how can we test the camera megapixel?
    For instance: If i have a 2MP camera how would i test it is 2MP, is there any measurement device or standards for mega pixel?

    1600 x 1200 is 2mp not 1.3. Your friends phone must also be 2mp or the picture was taken on another phone.
    It's easy to work out yourself.
    1600 multiplied by 1200 = 1,9200,000 pixels more commonly known in the industry as 2mp.
    1.3mp is 1280 x 960 (1,228,800 pixels).
    More megapixels does not always equal better quality. The lens and software are also a big quality factor. I have seen many 1.3mp phones that take better pictures than a 2mp phone because they have a better lens.
    Message Edited by psychomania on 18-Jul-2008 10:26 AM

  • How can I reduce the recording time of the webcam?

    How can I reduce the recording time of the webcam?
    thanks
    Alex

    Keep in mind that Logic also has a limit of 8550 quarter notes. So changing the time signature to 4/8 can get longer recording times. So make sure you change this setting along with the song end. See page 93 in the reference manual.
    MBP 1.83 & MDD 1G DP   Mac OS X (10.4.7)   Logic Pro 7.2.2, Motu 828MkII+828, Firebox LC&XT, Tranzport, Unitor8+(3x)AMT-8's

  • In LV6.1, can I get the run-time menu refnum of a VI from the VI Path?

    Actually, for any version of LabVIEW, can I get the run-time menu refnum from the VI Path (or the VI reference)?
    Thanks!
    Enrique
    www.vartortech.com

    I just thought of a workaround...you could have a Menu Bar Ref indicator on your main VI front panel.  When your VI runs, you could have the Current VI's Menubar function wire the refnum into that indicator.  Then, in your subVI that has the VI reference, you could use VI Server to read the value of that indicator, then cast the value into a refnum wire, then you'd have access to the menubar reference in the subVI without having to pass it in to a subVI terminal.  Would that work?
    Oh, another simpler idea would be to simply wire the Menubar reference into a global, and read that global in the subVI.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • How can I change the running head on the title page only?

    For APA formatting the running head needs to run throughout a paper, but only on the title page is it preceeded by "Running Head:". How can I change the running head on this page only?

    Menu > Insert > Section Break
    Click your cursor in the new (2nd) section.
    Menu > View > Show Inspector
    Inspector > Layout > Section > Page Numbers > uncheck Continue from previous section
    Menu is the menu at the top of your screen when you are in Pages, or anywhere else on the Mac. very hard to miss.
    Yes that is kind of a dumb question.
    Peter

  • How can i request the actual time code of digital video recorder, i am using RS232 interface for asking actual time code of digital video recording

    how can i request the actual time code of digital video recorder, i am using RS232 interface for asking actual time code of digital video recording

    If you have an RS-232 interface to the digital video recorder, it may be that you can send a command to the video recorder in order to get the time code sent back to your application - you would then read this as a string and then incorporate this data into your program.
    The best source of help will be any documentation you have relating to the serial (RS-232) interface with the digital video recorder. This documentation should have commands that you can send to the recorder and expected response strings that you should get back from the device. This task should be straightforward but can often be frustrating without documentation about the video recorder. This will not be something that you can "guess" - past experience in writing serial communication ap
    plications has shown that a good manual is your best friend.
    Failing this if you have any source code for example programs that have already been written to communicate with the recorder, you might be able to extract the relevant ASCII strings and use them within your application. This is true whether you are using LabVIEW or a text-based language.
    Jeremy

Maybe you are looking for

  • How to set multiple parameters in one EXECUTE IMMEDIATE sql

    I want to set both nls_language and nls_date_language, and set them as different languages. fnd_global.set_nls_context() doesn't work. So I think maybe I can use the EXECUTE IMMEDIATE, and add them together into one statement. But I don't know how to

  • Xcode: Can I create a flag visible to code on a per-configuration basis?

    Hi all, I want to be able to create or change some flag in a build configuration, so I can do something like this in my code: #ifdef (configuration flag) // add some code #endif The idea is that I want to include some code in one configuration, but s

  • Google like search

    Hi, i'm trying to do a google like search in a J2EE application using Oracle 8.1.7 with Intermedia Text. Thus, I want to query database and return a set with first the 'AND results' and then the 'OR result'. The result set must be distinct. I came up

  • Suggestion on Code

    Hi,    here i am doing duplicate name check so for that i used Function module as   call function 'Z_DUPLICATE_CHECK'       exporting         lv_first = lv_name2         lv_last  = lv_name1         lv_email = lv_email_id      lv_tel   = lv_tel      

  • "Sent" folder in Mail doesn't sync with "Sent" folder on Gmail. PLEASE HELP!!!!

    I am completely stumped by this and really REALLY frustrated. I can't figure out how to make the "sent" folder in mail (i.e the one with the paper plane icon) contain ALL my sent messages from Gmail. It works perfectly fine on my iPhone and iPad but