BinarySearch[l,k]
searches sorted list l for key k and gives the position of l containing k, if k is present in l. Otherwise, if k is absent in l, the function returns 
 where k falls between the elements of l in positions 
 and 
. 
BinarySearch[l,k,f]
gives the position of k in the list obtained from l by applying f to each element in l.
Details and Options
  
    
   See Also
 Tech Notes
 Related Guides
 Combinatorica`
   Combinatorica`
  BinarySearch
BinarySearch[l,k]
searches sorted list l for key k and gives the position of l containing k, if k is present in l. Otherwise, if k is absent in l, the function returns 
 where k falls between the elements of l in positions 
 and 
. 
BinarySearch[l,k,f]
gives the position of k in the list obtained from l by applying f to each element in l.
Details and Options
- To use BinarySearch, you first need to load the Combinatorica Package using Needs["Combinatorica`"].