Recent questions tagged time-complexity

1 votes
2 answers
721
What is the worst case time complexity to find kth smallest element into an array of ‘n’ element?
2 votes
1 answer
722
T(n)=4T(n/2)+nTC using iterative method with steps in short :)T(1) = 1
3 votes
1 answer
723
time complexity questions like :h(n)=O(n2);f(n)= O(logn);g(n)=omega(n2);what is the complexity of :::: 1. h(n)-g(n)=?? 2. h(...
2 votes
0 answers
724
void fun(intn) { int s=0; for(i=1;i<=n;i++) { for(j=1;j<=i*i;j++) { if(j%i==0) { for(k=1;k<=j;K++) s++ } } } }
2 votes
1 answer
725
2 votes
1 answer
726
Given h(n) < f(n) < g(n).statement 1: h(n)=O(f(n)); g(n)=Ω(f(n))Statement 1 is True / False?
6 votes
1 answer
727
2 votes
0 answers
728
which function will grow faster?a) x$\sqrt{x}$ b) x!
4 votes
1 answer
732
In implementation of queue using stack, deletion of second element from front take Ο(1) time, when insertion take Ο(n) time.Which of the following is correct ?True / Fa...
2 votes
1 answer
733
#include<stdio.h int calculate(int n) { int count=0; while(n!=0){ n=(n&(n<<1)); count++ } return count; }output for calculate(143)
1 votes
0 answers
735
foo(int n, int a[]) { int i=0,j=0; for(i=0;i<=n;i++) while (j<n && A[i]<A[j]) j++; }Time complexity of foo()
2 votes
0 answers
736
1 votes
1 answer
737
A) Ο(logn)B) Ο(n logn)C) Ο(n)2D) Ο(n2 logn)
3 votes
1 answer
738
What is the time complexity of the following code?void foo(int n) { int s=0; for( i=1 ; i<=n ; i++ ) for( j=1 ; j<= i*i ; j++) if( j%i==0 )...
1 votes
0 answers
740
what is recurrence relation of harmonic number/series ? and it's time complexity
3 votes
1 answer
741
You have an array of n elements. Suppose you implement quick sort by always choosing the central element of the array as the pivot. Then the tightest lower bound for the...
0 votes
3 answers
742
i am getting t.c as O(n^5) but given answer as O(n^4) what should be the answer
1 votes
0 answers
743
What is the worst case time complexity to count pairs of numbers with difference ‘k’ from an input array of ‘n’ numbers?a) O(logn)b) O(nlogn)c) O(n^2)d) O(n^2logn...
3 votes
1 answer
744
–1 votes
0 answers
745
2 votes
1 answer
746
can we solve this T(n) = T(n/2) + 1 using master theorem?
0 votes
1 answer
747
what is the recurrence relation for binary search and linear search?please explain how to derive them.
0 votes
3 answers
748
$100n\log n = O(n\log n)$How they are equal?
2 votes
1 answer
749
1 votes
0 answers
750
What will be the time complexity for the following recurrence relation?T(n)=n1/2 T(n1/2)+100n if n>1= 1,Otherwise Θ(n) Θ(n2) Θ(n log n) Θ(n log logn) ...