I am trying to implement an efficient algorithm for nearest-neighbour search problem.
I have read tutorials about some data structures, which support operations for this kind of problems (for example, R-tree, cover tree, etc.), but all of them are difficult to implement.
Also I cannot find sample source code for these data structures. I know C++ and I am trying to solve this problem in this language.
Ideally, I need links that describe how to implement these data structures using source code.
You could try a linesweep algorithm to find the closest pair of points: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lineSweep.