From: serialhex Date: 2011-05-15T06:21:21+09:00 Subject: Re: search nearest to elements in array (hash) --000e0cdfd6f2da931104a34300e3 Content-Type: text/plain; charset=ISO-8859-1 On Sat, May 14, 2011 at 5:05 PM, Mateus .. wrote: > Hi! > > I'm interesting, what is the best way to find nearest element in array > in comparison with "needle"? > > Thank you! > > hi, ok, i'm not sure i understand the question. are you asking for the 'nearest' as in ["foo", "needle", "bar", "baz"] with "foo" & "bar" being the nearest, or something like a hamming distance ( http://en.wikipedia.org/wiki/Hamming_distance) which would be ["foo", "needle", "bar", "baz", "feedle"] and "needle" & "feedle" being nearest (because they have a hamming distance of 0 & 1 respectively). hex --000e0cdfd6f2da931104a34300e3--