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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

1982


How do you determine whether to use a stream function or a low-level function?

897


How many types of operator or there in c?

834


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1656


What is the difference between if else and switchstatement

1559


What does the c in ctime mean?

784


What is local and global variable in c?

840


What is I ++ in c programming?

854


How many main () function we can have in a project?

854


How can I invoke another program or command and trap its output?

844


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

842


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

1004


write a program to find the given number is prime or not

4262


Differentiate between the = symbol and == symbol?

920


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

944