posted 14 years ago
definitely an interesting problem, I tried this and if I start my "sorted" array at 1 I get 1 less then the key as a final result (1,2,3,4,5....). If I start it at 0 I get the key. (0,1,2,3,4,5...)
with "sorted" as {0,1,2,3,4,5,6,7,8,9} and key = 5
first: start=5 end=end
second: start=5 end=7
anyway, here is my netbeans code....
anyway, seems to work great if I start the list at 0