Recent questions tagged time-complexity

2 votes
2 answers
1471
0 votes
2 answers
1474
If I have two lists of length 2 then no of comparisons in the worst case would be 2 only , since If I have say 10,20 in list A and 5,7 in list B so then on merging 10 is ...
1 votes
1 answer
1475
2 votes
2 answers
1477
4 votes
2 answers
1478
1 votes
1 answer
1479
I have already gone through the links of stackoverflow on this topic but still couldn't understand it clearly , so please explain the logic behind this .
0 votes
1 answer
1480
0 votes
2 answers
1484
If I have a problem A for which no polynomial time algo exists then what do we achieve by reducing it to another problemB and then proving by contradiction that if we cou...
6 votes
2 answers
1486
Assume that a CPU can process $10^8$ operations per second. Suppose you have to sort an array with $10^6$ elements. Which of the following is true? 1. Insertion sort will...
1 votes
1 answer
1491
Assuming n>2 A() { while(n>1) { n = n/2; } }
1 votes
1 answer
1492
How n + n/2 + n/4 + .... 1 can approximate it as an infinite GP?Is it =1+2+4+8+..........n/4 + n/2 +n ?=O(2^n) ?
0 votes
1 answer
1493
Is it loglog(2^2^2^2)=4Let n=(2^(2^(2^2)))=2^16Loglogn=4T(n)=1+T(2^8)=2+T(2^4)=3+T(2^2)=4+T(2)=5Let n= (2^(2^(2^(2^(2^2)))))=2^(2^65536)Loglog n = 65536
1 votes
2 answers
1494
time complexity questionSum=0 for(i=1; i<=n;i++) { for(j=1;j<=i;j++) { if(j%i==0) { for(k=1;k<=n;k++) { sum=sum+k; } } } }
0 votes
2 answers
1497
0 votes
1 answer
1499
Consider a binary tree having 'n' elements or 'n' nodes the tree is organized in such a way that at every level 'i' there are 'i' nodes assuming root to be at level 1 the...
0 votes
2 answers
1500