Array value (Enter the values in ascending order):

Search value:


*-Press submit after entering every value of the array and finally enter the search value


ALGORITHM FOR BINARY SEARCH


1.Start
2.Get input elements as 'array','count' as the number of elements
3.Get the search element 'search'
4.left=0,right=count
mid=(left+right)/2
5.while(left less_than or equals right) do
5.1 if(array[mid] equals search)
{
print "element found at position"[index]
break
}
5.2 else if(array[mid] greater_than search)
{
right=mid-1
mid=(left+right)/2
}
5.3 else if(array[mid] less_than search)
{
left=mid+1
mid=(left+right)/2
}
6.Stop