# Recent questions tagged time 1
2
Consider the following function(n) { val=0; for i=1 to n { if(n<=10000) for j=1 to n for k=1 to n val = val + 1; else for j=1 to n val = val + 1; } } The running time of the above function can best be described by $T(n)=$____________ $A)\theta(n^{3})$ $B)\theta(n^{2})$ $C)\theta(n)$ $D)\theta(1)$
3
4
C function let n>=m. int gcd(n,m) { if(n%m==0) return m; n=n%m; return gcd(m,n); } time complexity
1 vote
5
while solving this recursive equation: T(n)=T(n/3)+T(2n/3)+n; i tried the master theorem ignoring the less long term T(n/3) this gave me : T(n)=T(2n/3)+n; and it leads to O(n) Time complexity. And doing with recursive tree method it gave me N(logN base 3/2).. So what is wrong with master theorem approach?
6
To prove that the time complexity of equation T(n) = T(α n) + T((1 – α)n) + βn is Θ(n logn).
1 vote
7
What will be the time complexity of A() { int i,j,k,n; for(i=1;i<=n;i++) { for(j=1;j<=(i^2);j++) { for(k=1;k<=(n/2);k++) { printf("ABCD"); } } } }
1 vote
8
what is the time complexity of finding a number in a heap sort in worst case & what is the time complexity for deleting the element from heap?
1 vote
Which of the following is true? $f(n)=O\left(\left(f\left(n\right)\right)^{2}\right)$ $f(n)=O\left(g\left(n\right)\right)\Rightarrow 2^{f\left (n\right)}=O\left(2^{g\left(n\right)}\right)$ $f(n)+O\left(f\left(n\right)\right)=\theta \left(f\left(n\right)\right)$ Both (a) and (b)