Binary Search example step by step

BINARY SEARCH

In binary searching, first thing is to do sorting, because binary search can only perform on a sorted list. Best example of a binary search is dictionary. Dictionary is a sorted list of word definitions. Telephone directory is also a sorted list of names, addresses and numbers.

Advantages

  • More efficient than linear search. For an array or list of N elements, perform at most log2N comparisons.

Disadvantage

  • Requires that the elements of the list be in sorted order. For unsorted lists binary search will not work.

SEARCHING

Searching is the process of finding or locating an element or number in a given list.

Examples

  1. Looking for meaning of a word in dictionary
  2. Looking for a telephone number by giving name
  3. Looking for a name and address by giving telephone number

Other searching algorithms

  • Exponential search
  • Fibonacci search
  • Interpolation search

binary search example

binary search example

binary search example

binary search example

Gopal Krishna

Hey Engineers, welcome to the award-winning blog,Engineers Tutor. I'm Gopal Krishna. a professional engineer & blogger from Andhra Pradesh, India. Notes and Video Materials for Engineering in Electronics, Communications and Computer Science subjects are added. "A blog to support Electronics, Electrical communication and computer students".

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »