Because he cant know if particular value is in the array. For example array

is 10, 20 , 30 , 40, 50, and he must find first number greater than 34.

Anyway he can still do it using binary search. Search until either find that

value or n is 0; (n which is in binary search distance from current value,

and in beginning arraylength/2, in loop n=n/2). If the value is found just

pick next number, if not (n=0) see if current value is less or greater than

that value and than go lineary up or down depending on current value,

because you are already very close to that value.

Sorry because this doesnt belong to this newsgroup.

> Why not search for that particular value using a binary search and then

> choose the next one in the array?

> ........Wayne

> "Recycling electrons into words since 1996."

> Visit www.JustPC.com for details about my Visual Basic books, including

> my newest: Windows Game Programming With Visual Basic and DirectX,

> and the ASP.NET Database Programming Bible. Subscribe to the JustPC

> Developer's Journal - a free email newsletter for Visual Basic programmers

> > Well, i can't use binary search because I'm don't know what's the number

> i

> > want to find... the binary search need an argument that say the number

> that

> > i want to search not the first number greater than this number.

> > Someone Knows ?

> > Thanks

> > Ernesto