Clifford Heath wrote:
> Marcin Raczkowski wrote:
>> class KDNode
> ....
>>    def parase(points, depth = 0)
> ....
>>      points = points.sort_by{|point| point[@axis]}
> 
> Is this the standard way to build a kdtree?
> 
> Seems awfully wasteful to re-sort the values for
> each level. Can't you build @dim copies of the
> original array, each sorted one on that dim, then
> build the kdtree over the partitions on that?
> 
> Clifford Heath.
> 
> 

Problem is more complex than you think.
Solution that have @dim copies are o(nlogn) but
if i have @dim copies sorted by axis, after first split i have to 
somehow mark other copies - so next 2 splits will operate only on 
elements that belongs to proper branch.

Maybny i understood it wrong and there's better solution, but for now 
I'm focusing on writing proper algorithm , then i might think how to 
optimize it.