how to determine the complexity of an algorithm as log(n)



how to determine the complexity of an algorithm as log(n)..

Answer / karthik

log(n) is depth of binary tree containing n-elements..
so if we split array into two and omit one part and consider
another part... and continue this process.....
in problems like this the complexity will be log(n)..

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

0 Answers  


Give the logic for this #include<stdio.h> #include<conio.h> void main() { clrscr(); int a=10,b; b=++a + ++a; printf("%d", b); getch(); } Output: 24......How?

2 Answers   Accenture,


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

0 Answers   Wilco,


Write a program to find the given number is odd or even without using any loops(if,for,do,while)

4 Answers   CNC, Gokul,


What are the different file extensions involved when programming in C?

0 Answers  






Is a pointer a kind of array?

0 Answers  


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

0 Answers  


Explain bitwise shift operators?

0 Answers  


What is scope of variable in c?

0 Answers  


write a “Hello World” program in “c” without using a semicolon?

9 Answers   CTS, TCS, Wipro,


What is main () in c language?

0 Answers  


code for inverse a matrix

0 Answers  


Categories