Recent questions tagged time-complexity

1 votes
2 answers
333
2 votes
0 answers
334
Which one of the following notations is most relevant for finding the best algorithm for a problem?(A) $o(f(n))$(B) $O(f(n))$(C) $\omega (f(n))$(D) $ \Omega (f(n))$
3 votes
4 answers
337
What is the time complexity to delete an arbitrary node from binary heap?O(n)O(log n)O(1)O(n log n)
1 votes
4 answers
338
Which of the following gives O(1) complexity if we want to check whether an edge exists between two given nodes in a graph?Adjacency ListAdjacency MatrixIncidence MatrixN...
3 votes
4 answers
339
What is the time complexity for insertion in binary tree in worst case?O(1)O(log n)O(n)O(n log n)
1 votes
1 answer
341
0 votes
1 answer
342
for(k=1;k<(n+1);k++) { for(m=1;m<(n+1);m+=k){ x=x+1; } }What is the T.C. of the following code?Is it $n^{2}$ or $n\log n$??
1 votes
1 answer
344
What is the best case and worst case of the algorithm? And when will best case and worst case will happen??int main() { for(i=1 ; i<=n ; i++) { if(n%i == 0) { for(j=1 ; j...
1 votes
1 answer
346
Please help to find the time complexity of this loop. void main(){int n;while(n>=1){n=n-2;}}
0 votes
2 answers
347
O(n-1)+O(n)=O(n)O(n/2)+O(n)=O(n)but O(1)+O(2)+O(3)+...+O(n)=O(n(n+1)/2)=O(n^2)why?
1 votes
0 answers
349
Is this the correct way to solve ?Q) int algorithm(int n){ int sum =0;k,j; for (k=0;k<n/2;k++) for(j=0;j<10;j++) sum++; return 4*algorithm(n/2)*algorit...
0 votes
2 answers
352
what is the time complexity to find the determinant of a n*n upper triangular matrix in terms of n?
0 votes
1 answer
357
for(i=n, j=0; i>0; i/=2, j+=i)Let val(j) denote the value stored in the variable j after termination of the for loop. Whjch is correct?a. val(j)=theta(logn)b. Val(j)= the...
1 votes
1 answer
359
Can any one please help me out in understanding how to read :f(n)=O(n^2)I am confused in :1] f(n) is the upper bound of n^22]f(n)’s upper bound is n^2Or is their any a...
1 votes
1 answer
360
What is the time complexity of the following recurrence relation and step to derive the same$T(n) = T(\sqrt{n}) + log(logn)$