How to calculate time complexity of any algorithm or program ....

need help on this..

rupali
0
Newbie Poster

## Recommended Answers

Jump to Post>How to calculate time complexity of any algorithm or program ....

The most common metric for calculating time complexity is Big O notation. This removes all constant factors so that the running time can be estimated in relation to N as N approaches infinity. In general you can think of …

Jump to PostIf you feel like reading this post slowly and carefully, it will describe what this notation _really_ means.

All functions have some kind of behavior as n grows towards infinity. For example, if f(n) = 1/n, then as n grows towards infinity, f(n) gets closer and closer to zero. …

Jump to Postsum=0;

for(i=0;i<n;i++)

for(j=0;j<i;j++)

sum++;

what is the actual running time of this code??Not positive, but it's probably theta (n * n!) = theta (n^2).

The reason I'd say that is because the outer loop is O(n) and the inner loop is always one less than whatever the value is …

Jump to Postما هو معنى تقدير برنامج كمبيوتر

I quite agree. Very strongly worded.

Jump to PostJust for my understanding, it means that the time complexity that we find using Big-Oh, Omega or Theta is not the actual execution time of the program?

Correct. The two are related, but not 1-to-1.

…Also which method will be best from the above two methods

## All 114 Replies

Narue
5,707
Bad Cop
Team Colleague

Killer_Typo
commented:
WOW incredible post, most of it over my head but all the same, incredible!
+4

hamidvosugh
commented:
Excelent brief
+3

rype69
0
Newbie Poster

NubKnacker
0
Newbie Poster

Narue
5,707
Bad Cop
Team Colleague

NubKnacker
0
Newbie Poster

Narue
5,707
Bad Cop
Team Colleague

NubKnacker
0
Newbie Poster

Narue
5,707
Bad Cop
Team Colleague

NubKnacker
0
Newbie Poster

Rashakil Fol
978
Super Senior Demiposter
Team Colleague

Killer_Typo
commented:
incredible post, make me want to move farter and deeper into computers!
+4

NubKnacker
0
Newbie Poster

Rashakil Fol
978
Super Senior Demiposter
Team Colleague

NubKnacker
0
Newbie Poster

Gotcha
0
Newbie Poster

amrfalcon2004
0
Newbie Poster

Rashakil Fol
978
Super Senior Demiposter
Team Colleague

Narue
5,707
Bad Cop
Team Colleague

Rashakil Fol
978
Super Senior Demiposter
Team Colleague

Narue
5,707
Bad Cop
Team Colleague

Rashakil Fol
978
Super Senior Demiposter
Team Colleague

vartotojas
0
Light Poster

nagarjuna
0
Newbie Poster

arshad mohammed
0
Newbie Poster

navaraj
0
Newbie Poster

navaraj
0
Newbie Poster

navaraj
0
Newbie Poster

jagadisha
0
Newbie Poster

fahimarif
0
Newbie Poster

Rashakil Fol
978
Super Senior Demiposter
Team Colleague

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.