<?xml version="1.0" encoding="windows-1252"?>
<node id="69611" title="Re: (Golf) Nearest Neighbors" created="2001-04-04 10:42:25" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="49266">
danger</author>
<data>
<field name="doctext">
&lt;p&gt;
As [Tortue] points out, all the ones using lexigraphic sorting fail on
some sets of numbers. Stripping leading spaces and newlines, my stab
weighs in at 87 characters:
&lt;/p&gt;

&lt;code&gt;
sub nn {
    @_=sort{$a&lt;=&gt;$b}@_;
    $_[1]-$_[0]&gt;$_[$_+1]-$_[$_]and@_[0,1]=@_[$_,$_+1]for 1..@_-2;
    @_[0,1]
}
&lt;/code&gt;


</field>
<field name="root_node">
69570</field>
<field name="parent_node">
69570</field>
</data>
</node>
