Skip to Content
0
Former Member
Jun 25, 2008 at 02:54 PM

binary search question

30 Views

Hi,

I want to use binary search in my code, just not sure, how to do it right.

Let's say I have an IT with columns A B C D.

I want to search this table first based on value in A and later based on B.

How should I sort this table?

>sort IT by A B

>read table with key A = '1' binary search

>read table with key B = 'X' binary search

or

>sort IT by A

>read table with key A = '1' binary search

>sort IT by B

>read table with key A = 'X' binary search

?

What happens, if I sort this table by A and let the system search based on value in B?

Thank you,

Olian