Recent questions tagged time-complexity

5 votes
2 answers
841
Consider the following functionVoid func(int n){Int k=n;Int i=0;for(;i<n;i++){while(k>1){k>>=1;}}What is the worst case time complexity of the function?
1 votes
0 answers
843
First statement is False because complexity will be O(E2).I think the second statement is true? But not sure
5 votes
1 answer
844
6 votes
2 answers
845
In a min-heap, the next largest element of a particular element can be found in ___ time.A) O(1)B) O(log n)C) O(n)
1 votes
1 answer
846
Which of the following is true about time complexity for generating $\color{blue} {n^{th}}$ Fibonacci number ? a)$O(n)$b)$O(Logn)$c)$O(2^n)$d)$\Omega(n)$
5 votes
0 answers
848
//n is a prime number hereint main() { for(i=1;i<=n;i=2*i) { for(j=1;j<=n;j++) { if(n%i==0) { k=1; while(k<=n) { a=b+c; k=k+1; } } } } }
0 votes
1 answer
850
An array a of unknown size is filled with special symbol let's say # . Time required to find the size of a is:Please give proper explanation
0 votes
1 answer
851
In sorted array of size n time required to verify if there exist 2 number a and b such that a+ b = s in worst case Where s is a constant.
4 votes
1 answer
852
for (i=n ; i>0 ; i ) { for ( j=1;j<n ; j=j*2) { for ( k=0;k<j ;k++) { } } }time complexity ??how to find of inner and innermost loop?
3 votes
0 answers
853
2 votes
1 answer
854
1 votes
2 answers
855
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 votes
1 answer
856
What will be the time complexity of the following code?A() { int i,j,k,n; for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { for(k=1;k<=100;k++) { printf("ABCD"); } } } }
5 votes
1 answer
858
4 votes
1 answer
860
for(i=0;i<=n;i++){ for(j=0;j<=i2;j++){ for(k=0;k<=$\frac{n}{2}$;k++){ x=y+z;}}}How many times the x=y+z statement will execute?
1 votes
1 answer
862
1 votes
2 answers
863
Complexity of equation -T(n)=. 2T(n-1)-1 if n>0 1. Otherwise
0 votes
1 answer
864
time taken to delete a node from min heap if you know the value but not positionTo find the position of the number in min heap should not be log(n)why is it so O(n)
3 votes
2 answers
865
Given a 2D array X[m][n] which has m rows and n columns. The array X is row wise and column wise sorted (i.e) each individula row and column is sorted. What is the comple...
4 votes
1 answer
866
True or FalseMerge sort on Linked list takes O(nlogn)
1 votes
1 answer
867
Given 2 long integers having n digits , it is required to multiply them.Assuming the numbers are represented in an array of size n . The time complexity to multiply them ...
2 votes
1 answer
868
Given that ready contains at some point of time a maximum of n process , the time complexity to schedule and dispatch a process from ready queue onto CPU using priority ...
3 votes
1 answer
869
Solve the following recurrence relation$T(n)=4T(n/2)+n^2 \sqrt 2$