Electronics Circuits & Tutorials - Electronics Hobby Projects - A Complete Electronic Resource Centre
Electronics Circuits & Tutorials

Home About us Electronic Tutorials Engineering Hobby Projects Online Dictionaries Contact us
Tutorials
  • Basic/Beginners
  • Intermediate/Advance
  • Microcontrollers
  • Microprocessors
  • Electronics Symbols
  • Electronics Formulas
  • Dictionary of Units

     more....

Dictionaries
  • Electronics Terms
  • Abbreviations
  • Computer Terms
  • Physics Glossary
  • Science Glossary
  • Space & Solar Terms
  • Semiconductor Symbols / Abbreviation
  • Radio Terminology Bibliography

     more....

Projects
  • Engineering Projects
Home > Electronics Tutorials > Online Computer Terms Dictionary > B

Online Computer Terms Dictionary - B

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)
 {
   mid = (first+last)/2;	/* truncate to integer */
   if (target == thing[mid])
     return mid;
   if (target < thing[mid])
     last = mid-1;
   else
     first = mid+1;
 }
 if (target == thing[last])
   return last;
 return NOT_FOUND;

(2003-01-14)

 


Nearby terms: binary file « binary large object « binary package « binary search » Binary Synchronous Transmission » binary tree » BIND
 

Discover
  • C/C++ Language Programming Library
  • Electronic Conversions
  • History of Electronics
  • History of Computers
  • Elec. Power Standards
  • Online Calculator and Conversions
  • Electrical Hazards - Health & Safety
  • Datasheets
  • Quick Reference links
  • Electronics Magazines
  • Career in Electronics
  • EMS Post Tracking

     more......

Home Electronic Tutorials Engineering Hobby Projects Resources Links Sitemap Disclaimer/T&C

Copyright © 1999-2020 www.hobbyprojects.com  (All rights reserved)