Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Binary Search

Name: Anonymous 2009-10-16 22:31

Hey guys

I need an easy example for "Binary Search". I've tried google, but cant find an easy example.

Preferably with an example with numbers (5, 4, 7, 8, etc), also I know this method works only with sorted numbers.

Name: Anonymous 2009-10-17 7:21

{1,2,3,4,5,6,7,8,9}

Searching for 8.


What is the median value?
5

Is that equal to the value you are looking for?
It is less

Repeat search on subset containing elements 5+1 thru end

What is the median value?
7


Is that equal to the value you are looking for?
It is less


Repeat search on subset containing elements 7+1 thru end


What is the median value?
8

Is that equal to the value you are loooking for?

Yes

winrar

Don't change these.
Name: Email:
Entire Thread Thread List