# binary search

Also found in: Dictionary, Thesaurus, Medical.

## binary search

[′bīn·ə·rē ′sərch] (computer science)

A dichotomizing search in which the set of items to be searched is divided at each step into two equal, or nearly equal, parts. Also known as binary chop.

## binary search

(algorithm)A search algorithm which repeatedly divides an
ordered search space in half according to how the required
(key) value compares with the middle element.

The following pseudo-C routine performs a binary search return the index of the element of vector "thing[first..last]" equal to "target":

if (target < thing[first] || target > thing[last]) return NOT_FOUND; while (first < last)

The following pseudo-C routine performs a binary search return the index of the element of vector "thing[first..last]" equal to "target":

if (target < thing[first] || target > thing[last]) return NOT_FOUND; while (first < last)

**mid =**if (target == thing[last]) return last; return NOT_FOUND;## binary search

A technique for quickly locating an item in a sequential list. The desired key is compared to the data in the middle of a sequential index or in the middle of a sequential file. The half that contains the data is then compared in the middle, and so on, either until the key is located or a small enough group is isolated to be sequentially searched. See binary.Want to thank TFD for its existence? Tell a friend about us, add a link to this page, or visit the webmaster's page for free fun content.

Link to this page: