If I have a large set of Coordinates e.g. (3,4), (5,-6) etc. Where x and y are integers. Is it possible to order them using a BST? How might I go about determining what should be on the left vs. right node? It's been racking my brain for days.

The reason why I'm looking at BST instead of simply using a list of coordinates is so that I can more efficiently (vs. linear search) determine those coordinates that would be in the Moore neighborhood (Chebyshev distance 1) of another.

I've thought about alternating comparisons to x and y values - is that a good approach? How else might I apply BST to this situation? Or is using BST untenable?

I'm still quite new to Binary Trees and their uses. Would greatly appreciate any kind thoughts and advice (any major programming language is fine)

You probably want to order them so that you can find neighboring cells easily. If one coordinate is on the edge of a cell, you need to check the distance to the coordinates in the neighboring cell. I usually put them in a two dimensional array, that way I can look up the coordinates in a neighboring cell by just cells[x][y+1] for instance.
–
aioobeMar 22 '12 at 13:15

Despite the simplicity of the approach by aioobe to create a grid of cells (two dimensional array), it was a bit heavy handed/inefficient to store the state of all possible cells/coordinates especially when I may have cases where there is only have a handful of actual coordinates in a very large space (sparse array).

Ultimately I realised using a BST is feasible (there are other approaches) and this is what I did to find Moore Neighbours efficiently using a balanced BST: