@Bittu. The "ungreedy" algorithm works. Repeatedly tie the two shortest ropes.
E.g., suppose the ropes are 3, 4, 5, and 6 units long. Then tie 3 and 4, giving 7. Now 5 and 6 are the two shortest, so tie them, giving 11. Finally, 7 + 11 = 18. Dave On Mar 28, 1:41 am, bittu <[email protected]> wrote: > you are given n ropes,maybe of different length. the cost of tying two > ropes is the sum of their lengths.Find a way to tie these ropes > together so that the cost is minimum. > > Thanks > Shashank -- 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.
