Home arrow JavaScript arrow Binary Searching

Binary Searching

Binary Searching involves searching for an element in an array, where the items are arranged in ascending or descending order. That means the entries in the array are sorted. If you want to learn how to write a function that does this, keep reading.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 6
June 30, 2008
  1. · Binary Searching
  2. · Tutorial Approach
  3. · Demonstration of Binary Search
  4. · Demonstration continued
  5. · Algorithm for Binary Search

print this article

Binary Searching
(Page 1 of 5 )


At the moment, I am writing a series of articles concerning database programming for www.devhardware.com. Some recordset APIs are supplied with a Find function; you just use the Find function without knowing how it was written. Other APIs may not have any Find function; this means that you have to write the Find function yourself (when you need one).

Therefore, if you are a database programmer, knowing how to write an efficient Find function is a big plus. In this article, I show you how to write the binarySearch function, which is very efficient for traditional (client side) database programming.

There are other reasons why you would want to understand Find functions, in particular the binarySearch function. Maybe you want to write a database programming API. Maybe you did not understand the topic well at your university (or associate degree program). Maybe they did not even cover it at your university. Maybe you are a self-trained programmer and you want to learn more. Maybe you are a teacher or lecturer and you want to get a better understanding of the topic in order to teach it well. Maybe you want to write a Find function for an array of strings, which is not concerned with a database.

Well, I will show you how to write the BinarySearch function, since it is the type relevant to the series I am writing. I will use JavaScript. You need a browser and text editor to try the code.

blog comments powered by Disqus

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials