sort ropes according to lengths say 1 .2...3.......n
now tie like N-----------1-----------(N-1)======N+1+1+N-1=2N+1; (N-1)----------2----------(N-2) ===N-1+2+2+(N-2)=2N+1; N-2-----------3-----------N-3====2n+1; hope i am correct On Mon, Mar 28, 2011 at 10:47 PM, Gunjan Sharma <gunjan.khan...@gmail.com>wrote: > The second cost will be 5+23 irrespective of the end. Correct me u think > otherwise. > > > On Mon, Mar 28, 2011 at 10:44 PM, Raunak Agrawal > <raunak.ra...@gmail.com>wrote: > >> @Kunal: >> >> >> Eg: Rope 1: Size 10 mtr >> Rope 2: Size 13 mtr >> Rope 3: Size 5 mtr >> >> >> Cost of tying rope 1 and rope 2 = 10 +13 = 23 >> >> Now we have tow end...one for rope 1 and another for rope 2 which can be >> tied with rope 3. >> >> So tie Rope 3 end with rope 2 end : (Length of rope 2 + 3) = (5 + 13) = 18 >> >> So total cost = 23 +18 = 41. >> >> >> So for different combination we can have different cost....please let me >> know in case there is any doubt. >> >> On Mon, Mar 28, 2011 at 10:35 PM, Kunal <kunal.shrivas...@gmail.com>wrote: >> >>> If you have already tied ropes 1 and 2 then their final length would be >>> 23 now you are left with two ropes o length 23 and 5 which suns out to be >>> 28. This remains the same in each of your two examples. >>> >>> Why did you add 13 twice ? I mean you can tie them in 28 cost if you >>> first tie any two and then tie with the left one. Why use 3 knots when it >>> can be done in 2 !! >>> >>> Sent from my iPhone >>> >>> On Mar 28, 2011, at 8:36 PM, Raunak Agrawal <raunak.ra...@gmail.com> >>> wrote: >>> >>> I think the possible solution is : >>> >>> *Tie the highest two ropes at the end of the rope.* >>> * >>> * >>> This is because of the following reason: >>> >>> Eg: Rope 1: Size 10 mtr >>> Rope 2: Size 13 mtr >>> Rope 3: Size 5 mtr >>> >>> Rope1--> Rope2--> Rope3 Cost: (10+13) + (13+5) = 41 >>> >>> Rope1-->Rope3--> Rope2 Cost: (10+5) + (5+13) = 33 >>> >>> >>> So the optimum cost is : *1st Highest length Rope + 2*(Length of all >>> other ropes other that two having the highest size) + 2nd Highest Rope*. >>> >>> >>> On Mon, Mar 28, 2011 at 7:49 PM, Gunjan Sharma <<gunjan.khan...@gmail.com> >>> gunjan.khan...@gmail.com> wrote: >>> >>>> The question seems to be correct. Think again.... >>>> >>>> >>>> On Mon, Mar 28, 2011 at 5:24 PM, kunal srivastav >>>> <<kunal.shrivas...@gmail.com> >>>> kunal.shrivas...@gmail.com> wrote: >>>> >>>>> if you tie all of them and the cost is sum of invidual lengths then in >>>>> the end the cost will be sum of all lengths irrespective of any order that >>>>> we tie them in.. >>>>> i think the ques would req you to say that the cost is the longer of >>>>> the two..plz check >>>>> >>>>> >>>>> On Mon, Mar 28, 2011 at 12:11 PM, bittu < <shashank7andr...@gmail.com> >>>>> shashank7andr...@gmail.com> 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 <algogeeks@googlegroups.com> >>>>>> algogeeks@googlegroups.com. >>>>>> To unsubscribe from this group, send email to >>>>>> <algogeeks%2bunsubscr...@googlegroups.com> >>>>>> algogeeks+unsubscr...@googlegroups.com. >>>>>> For more options, visit this group at >>>>>> <http://groups.google.com/group/algogeeks?hl=en> >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> <http://thezeitgeistmovement.com>thezeitgeistmovement.com >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to <algogeeks@googlegroups.com> >>>>> algogeeks@googlegroups.com. >>>>> To unsubscribe from this group, send email to >>>>> <algogeeks%2bunsubscr...@googlegroups.com> >>>>> algogeeks+unsubscr...@googlegroups.com. >>>>> For more options, visit this group at >>>>> <http://groups.google.com/group/algogeeks?hl=en> >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> >>>> >>>> -- >>>> Regards >>>> Gunjan Sharma >>>> Chairman IEEE Students Chapter IIT Roorkee >>>> B.Tech IV year CSE >>>> >>>> Contact No- +91 9997767077 >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to <algogeeks@googlegroups.com> >>>> algogeeks@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> <algogeeks%2bunsubscr...@googlegroups.com> >>>> algogeeks+unsubscr...@googlegroups.com. >>>> For more options, visit this group at >>>> <http://groups.google.com/group/algogeeks?hl=en> >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Regards > Gunjan Sharma > Chairman IEEE Students Chapter IIT Roorkee > B.Tech IV year CSE > > Contact No- +91 9997767077 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Arpit Bhatnagar (MNIT JAIPUR) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.