Hi,
suppose in XY plane if some N  points (xi,yi)'s are given and given
some input (x,y) , how can we find out n closest points to the given
input point (x,y)?
please try some efficient algo...

Also (N>>n)

Solution :

Keep a max Heap , now scan through the N points if a points distance
is less than the top of heap , we delete the top most element of the
heap,and push this new element in the heap.
Initially we will fill the heap by n points.

Complexity : O(N*logn)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to