Hi
Yes, this is a homework question, but not my homework. I'm trying to help a friend.

The problem is complicated to describe.
There is a file which contains geographic location data (longitude, latitude) for objects (trees).
Some trees have multiple entries in the file with slightly different locations. This is due to accuracy of recording the positions from different people.

The task is to examine the input file and if a tree is close (within 40m) to another, then consider that as one item with a new location as the average of the two readings. The new locations are then stored on another file.

The problem is when you have 3 or more trees close together and you have to consider this as one group and return the average of all 3 (or more).

The average of a&b&c is not the same as the average of a&b averaged with c.

So, a could be close to b, but not to c. But if b is close to c, then all three a,b,c are said to be close and the average position needs to be given.

How? Any creative approach you can think of?
Thanks for ANY suggestions.