-1

I have pure theoretical question on KD Tree hierarchy. Let's say that we have two dimensional tree with 'left rule'.

One of tree nodes has two children which should be sorted by X value. In the same time, both children have the same X value.

illustration

So, what should I do in this case?

To my opinion, there are two option, rather I am sorting them by second (Y) value and distributed according to the 'left rule' — to the left goes one with smallest Y value, and to the right with bigger.

And the second option could be finding distances between these children points and it parent and distributing it according to distance value: closest goes to the left, the other to the right.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
VVK
  • 435
  • 2
  • 27

1 Answers1

0

Maybe it is a very unsuccessful illustration, but still there could be an issue of having two nodes as 'median' candidates with the same evaluation parameter, doesn't matter X or Y.

VVK
  • 435
  • 2
  • 27