Binary Search in Netbeans Java with Source Code

Binary search

The process of looking for something or someone is the meaning of search. The binary searching is the process of searching in which the searching process is divided into half of the array.  If we get match in the middle of the index then it return the index of the middle number but it is not found then you need to check whether the value of the search key is either less than the item in the middle of the item or is higher than the mid value and starts again from the step one.. The first half is called the lower half and the second half is known as upper half. If it is higher than the mid value than the search is only done on the upper half and vice versa. The array should be in arranged from.
Pseudo code
Search (A,n,x)
{
For (i= 0 to n-1)
If A[i]==x
{
Return i;
}
Return-1;
}

Click on download to the source code of the binary search
Download

Leave a Reply

Your email address will not be published. Required fields are marked *