Quik efficiency calculation question

Discussion in 'Software' started by Computer Acolyte, Jun 7, 2004.

  1. Computer Acolyte

    Computer Acolyte Private First Class

    let's say we have a for loop from 1 to n, in which there's an if condition that in the first case leads to 3 actions and in the other case to just one.

    The magnitude of this would be O(n), but what about the equation?
    Do we just pick the worse case and make it O=3n? If not then how do we calculate it?
     
  2. Wyatt_Earp

    Wyatt_Earp MajorGeek

    Theoretically, yes, I think you take the worst case scenario. However applied in the real world, the efficiency would be somewhere between n and 3n.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds