On Sun, Apr 13, 2008 at 10:17 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
>
> Nelson Castillo wrote:
(cut)
> That won't work correctly unless the numbers are sorted correctly:
>
> $ perl -le' print for sort { $a cmp $b } 0, 2, 3, 11, 12'
> 0
> 11
> 12
> 2
> 3
Hi. I wanted to stress that with different comparators the search
behaves differently. The
set is intentionally sorted in the wrong way in the first call to
binary_search.
I know that in short: you need to use the same comparator for sorting
and for searching.
N.-
--
http://arhuaco.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/