home AS/A2 d1 AS/A2

D1 Topic 1: Algorithms
Binary search algorithm backmore

 View full screen  


Summary
The Binary Search Algorithm is used to locate the position of a name in a list of names in alphabetical order.
  1. find the midpoint of the list and compare with the required item
  2. if they match then stop
  3. if the required item occurs before the midpoint then discard the bottom half of the list if the required item occurs after the midpoint then discard the top half of the list
  4. repeat 1, 2 and 3 until finished
Flash powered - you will need the Flash 5 plugin This page uses Macromedia Flash. Your browser will need to have the Flash plugin installed - freely available from Macromedia.