On Mon, Jun 17, 2013 at 11:35 PM, Douglas Seifert <doug / dseifert.net> wrote:

> You have said that the size of your two arrays is small, so the fact that
> the find_index based solution is o(n^2) probably doesn't matter.
>

Yes, that's what I was figuring.  Your analysis is spot on.


>  For kicks, a o(n) solution compared to the o(n^2) solution here:
>
> https://gist.github.com/seifertd/5800639
>
> It involves precomputing a lookup index for the data you need to sort.
>

Your "gen_lookup:" is exactly what I'd did for larger arrays.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/