Find the time complexity of Binary Search Algorithm.
Time complexity of binary search
In binary search each step of the algorithm divides the list of items being searched in half of the list.
So we can say that
T(n)= T(n/2) +1 where n>1
= T(n/4) +1 +1
= T(n/22) + 2
= T(n/23) +3
……………..
………………
=T(n/2k) + k
If n=2k then k= log2n
= T(1) + log2n
So
T(n)= O(log2n)
Best case condition occur when the element to be searched in first time. Then complexity is O(1).
Write a C program to find the value of Sine(X).
Write short notes on the following:
What is Decomposition in project estimation method ?
Briefly differentiate between CDMA and GSM technologies.
Write a C program to check a number is even or odd.
Write a C program to convert binary to decimal using function.