|Just another Perl shrine|
Binary searchby akvats01 (Initiate)
|on Mar 29, 2013 at 15:01 UTC||Need Help??|
akvats01 has asked for the
wisdom of the Perl Monks concerning the following question:
I am beginner in perl.
I have implemented binary search for leaning purpose. The code shows abrupt results. For few items in the list, it returns the exact position, but it is not able to find out the position of other elements especially towards the end of array.
Like the Key is 2,65 etc the result is 1 but if the key is 34,100,or 42 etc the result is : not found
I wonder, if this code is not working it should not work for any thing. Please tell me where am I wrong.