|
This is a recursive version so I'm not sure it's necessarily faster computation-wise, even if it is non-recursive it is not all that much faster than BS, but in terms of number of comparisons it supposed to have fewer # of comparisons than binary given data is uniformely distributed and large, it supposed to approximate to a straight line if graphed in size vs. array[size] plane.
It had fewer # of tries than BS on ints on 5500 range.
My implementation may suck, but sorry, I did not invent the whole idea of this search and do not find it erroneous given proper conditions.
I'll test it out for other data-types, it should not be necessarily dependent on the data-type but how it's distributed. It's worst case is O(n) comparisons, which is roughly the size of data.
I also would like to see DaWei's.
__________________
got math? yumm...
"All men by nature desire to know" -Aristotle, Metaphysics
|