algorithm - Best data structure for nearest neighbour in 1 dimension -


Here is a list of values ​​to me (one-dimensional) and I would like to know how to learn the best data structure / algorithm I have a query value near most solutions (all?) I have 2 or more dimensions for the questions here Can someone suggest me an approach for my case?

My instinct tells me to sort the data and use binary search in some way, however, there is no limit to the timing of construction or inclusion for any tree, so maybe no one just sort Can suggest suggesting a better tree than the list.

If you need something faster than o (log), which you You can easily get from the sorted array or binary search tree, so you can use one.

VEB trees give you to O (logs (logs)).

Comments