Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need a binary alogrithm search

Status
Not open for further replies.

davemib

Programmer
Dec 31, 2002
30
0
0
GB
can some 1 help me with this????

an array is made of random numbers and then sorted. ask the user to enter a number i.e.4. the search will start

would a binary alogrithm look like this:?

choose a mid point = midpoint=numberofitems / 2
if it matches the searched the value then stop
if it is more than search item then pick a new mid point to the left of the current mid point
if it is less than search item then pick a new mid point to the right of the current mid point
keep repeating until the search value is found.

some one there who can help me with this????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top