Re: [algogeeks] For a given set of points find a point along with 3 others that are closest to each other

2013-05-04 Thread sreekanth guru
// Repeat the following for n vertices.
i = 1 to n.
1. construct the min heap with the distance from i to all other points.
only with direct edges. If there is no direct edge make it infinite.
2. remove min edge(i, x) from heap. Now reheapify the min heap with x
vertex direct edges.
3. repeat step two for two more times(as you need 3 other points).
4. record the sum of all edge lengths.

for i = 1 to n
find the min sum.

while re heapifying you need to use better techniques otherwise complexity
will increase.

Thanks.







-Sreekanth



On Thu, May 2, 2013 at 10:19 PM, Nishant Pandey 
nishant.bits.me...@gmail.com wrote:

 Guys i am looking for optimize algorithm for this, please help.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] For a given set of points find a point along with 3 others that are closest to each other

2013-05-03 Thread Nishant Pandey
Guys i am looking for optimize algorithm for this, please help.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.