bearophile wrote:
Andrei Alexandrescu:
int[] a = [ 1, 2, 3, 4 ];
int[] b = [ 2. 3 ];
I guess you meant:
int[] b = [ 2, 3 ];
find(a, b);
find(assumeSorted(a), b);
find(a, assumeSorted(b));
find(assumeSorted(a), assumeSorted(b));
find(a, boyerMooreFinder(b));
Are you talking about finding the position of a subarray into a bigger array?
Then the two useful cases are:
a.index(b);
a.indexBoyerMoore(b);
The other cases aren't common enough, I think.
Bye,
bearophile
Binary search is rather common.
As an aside, your use of "index" suggests you return integrals out of
the function. IMHO that's strongly unrecommended.
Andrei