Hence shown never play cricket when someone in the group is stronger than the whole team together,,,:D Anyways my original solution was not taking into account that players can be excluded.(Thats unfair in a real scenario ryt?) Its a classical 0/1 knapsack problem which can be implemented either as a greedy solution or dp,,,,
On Thu, Aug 4, 2011 at 7:26 PM, Amol Sharma <amolsharm...@gmail.com> wrote: > @saurabh: see this case > input 100, 1, 1, 1,1 > > your algo - > group 1 - 100 > group 2 - 1 1 1 1 > > but the group with 2 equal strength can be formed as > G1 - 1 1 > G2 - 1 1 or 1 1 each... > i mean it is not necessary to take all the people.....but your algo takes > the the person with max strength at start....which is not correct......there > will be many cases where it will fail.... > > it might be correct if it is compulsory to take all the persons in the two > groups > > a knapsack dp solution will be the best for this particular problem...if u > can thin of any other approach then suggest !! > > P.S : Sorry for replying after such a long time :P > > -- > > > Amol Sharma > Third Year Student > Computer Science and Engineering > MNNIT Allahabad > > > > > On Mon, Aug 1, 2011 at 2:00 AM, Nitish Garg <nitishgarg1...@gmail.com>wrote: > >> Can you explain a bit more? >> Thanks >> Nitish Garg >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/-LiQq0dHHksJ. >> >> 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. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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.