I am trying to build a kd tree to search for multiple points, but I am confused about using the "median" in the wikipedia article. For ease of use, the wikipedia article indicates the pseudo-code of the kd-tree structure as:
function kdtree (list of points pointList, int depth)
{
if pointList is empty
return nil;
else
{
var int axis := depth mod k;
select median by axis from pointList;
var tree_node node;
node.location := median;
node.leftChild := kdtree(points in pointList before median, depth+1);
node.rightChild := kdtree(points in pointList after median, depth+1);
return node;
}
}
I got confused in the line "select median ...", simply because I'm not quite sure what the "correct" way to use the median is here.
, () (, 5 , 3 2 ), - "" , (, 6 , 3 4 - 2 3, - 2.).
, , , ? , 2?
, !
-Stephen