Binary Search Algorithm
1.
[Initialize segment variable] set beg=LB,End=UB and Mid=int(beg+end)/2.
2.
Repeat step 3 and 4 while beg<=end and Data[mid] != item.
3.
If item< data[mid] then set end=mid-1
4.
Else if Item>data[mid] then set beg=mid+1[end of if structure]
5.
Set mid= int(beg+end)/2.[End of step 2 loop]
6.
If data[mid]=item then set Loc= Mid. Else set loc=null[end of if structure]
7.
Exit.