Recent questions tagged time-complexity

0 votes
0 answers
661
What is the time complexity of the following piece of code in the terms of n?$Main()${$n=2^{2^k};$$for(i=1; i<=n; i++)${ $j=2;$ $while(j<=n)$ { $j=j^2;$ }}...
0 votes
3 answers
663
What is the time complexity of the following code?for(i=n;i>=1;)i=i/2;
0 votes
3 answers
665
int main() { int i; for(i=1;i<=n;i++) f(i); } void f(int n) { int A[n]; int j; for(j=1;j<=n;j++) cout<<j; }What will be the time and space complexity of the following cod...
1 votes
2 answers
666
T(n)=T(n-1)+2n where T(1)=1Solve recurrence relation
0 votes
0 answers
667
#DAAProve that if: f(n) = amnm + am-1nm-1 + am-2nm-2 + am-3nm-3 + .........+ a1n + a0 then f(n) = O(nm) .
1 votes
1 answer
669
Which sorting algorithm is good if we already knew the range of number -Counting Sort OR Radix Sort
1 votes
2 answers
670
7 votes
3 answers
671
Why is recursive equation of following code $T(n)=T(n/2)+O(1)$, not $T(n)=8*T(n/2)+O(1)$? int x=0; int A(n) { if(n==1) return 1; else { X+=8A(n/2)+n^3; } return X; }
0 votes
1 answer
674
Which of the following sorting algorithm has almost the same worst case and best case complexity?1- Quick Sort2- Merge Sort3- Shell Sort4- Heap Sort PS: Is it heap or sh...
1 votes
1 answer
675
show how to sort n number in the range [0,n^2-1] in O(n)time?
0 votes
1 answer
678
What is the running time of the function?Int function(int n) {If(n<=1)return;For(int i=1;i<n;i++);For(int j=0;j<3;j++);Function (n-1);
3 votes
1 answer
679
$f(n)=2n^2+ n log n$$g(n)= \dfrac{n}{logn} + log^2n$ then $f(n)\times g(n)$ is:$n^2logn$$\dfrac{n^3}{logn}$$n^3log^2n$$n^2log^2n$
0 votes
1 answer
681
How much time will it take for deleting $i^{th}$ and a number $n(random)$ node from a heap?
1 votes
1 answer
682
Please find the time complexity of the following code:-int i,s1;i=1,s1=1; while(s1<=n) { i++; s1+=s1+i; printf("Hope"); }
3 votes
4 answers
684
The time complexity of computing the transitive closure of binary relation on a set of $n$ elements is known to be$O(n)$$O(n*\log(n))$$O(n^{\frac{3}{2}})$$O(n^{3})$
3 votes
2 answers
686
Please give some example regarding number of edges in dense graph is - |E| < |V2|I get that when we take log both sides we get O(ElogV), but I can't get this |E| < |V2|
0 votes
1 answer
687