## Pages

### Data Structure Binary Search Algorithm

Data Structure Algorithm for  Binary Search pseudo-code.
After knowing and completely understanding this algorithm for  Binary Search . You will be able to write a Data Structure Program for  Binary Search  in any language. The basic ideology and idea behind all the programs will be same. Yes the programs will differ according to the syntax and semantics of the language. This is a part of Mumbai University MCA Colleges Data Structure MCA Sem 2

Algorithm Binary(list, from, to, target, location)
1 if from = to (* terminating condition *)
1 set location to from
2 return list[from] = target
2 end if
3 middle := (to – from) DIV 2;
4 if list[middle] = target (* found target *)
1 set location to middle
1 return TRUE
5 else
1 if list[middle] < target (* select second half *)
1 set found to Binary(list, middle+1, to, target, location)
2 else (* select first half *)
1 set found to Binary(list, from, middle-1, target, location)
3 end if
6 end if
7 return found
end Binary

Hope this Algorithm is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.