binary search

Part of the TechTarget Network of Enterprise IT Web Sites

Search our IT-specific encyclopedia for:
 
Browse alphabetically:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
All Categories Computing Fundamentals

binary search

A binary search, also called a dichotomizing search, is a digital scheme for locating a specific object in a large set. Each object in the set is given a key. The number of keys is always a power of 2. If there are 32 items in a list, for example, they might be numbered 0 through 31 (binary 00000 through 11111). If there are, say, only 29 items, they can be numbered 0 through 28 (binary 00000 through 11100), with the numbers 29 through31 (binary 11101, 11110, and 11111) as dummy keys.

To conduct the search, the keys are listed in tabular form. The position of the desired object is compared with the halfway point in the list (which lies between the two keys in the center of the list). If the key of the desired object is smaller than the halfway point value, then the first half of the list is accepted and the second half is rejected. If the key of the desired object is larger than the halfway point value, then the second half of the list is accepted and the first half is rejected. The process is repeated, each time selecting half of the list and rejecting the other half, until only one object remains. This is the desired object.

The following list shows an example of a binary search to choose the fifth object in a set of 13 objects. Keys are denoted X; the desired keyis denoted by +. Dummy keys are denoted O.

XXXX+XXXXXXXXOOO(initial list)
XXXX+XXX(first half accepted)
+XXX(second half accepted)
+X(first half accepted)
+(first half accepted)
Last updated on: May 03, 2008

>  Enterprise Software related Research & News
>  White Papers for the Retail Industry

Are you a Know-IT-All?
What handy input device did Douglas Englebart invent?
Answer

word of the day Get the Word of the Day
twitter Follow us on Twitter

WORD OF THE DAY...
SAP
LEARN MORE ABOUT...
SAP trends
USA Contributors
Worldwide Contributors
Awards and Recognition
Our 60+ tech-specific sites
WhatIs.com RSS Feeds
About Us   |   Contact Us   |   For Advertisers   |   For Business Partners   |   Reprints   |   RSS   |   Awards
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints




All Rights Reserved, Copyright 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts