@ prem... can U submit the code...for
all Subsets of the particular array with O(n^2). thanks.. On Sun, May 20, 2012 at 1:11 AM, abhijeet srivastva < nwaab.abhij...@gmail.com> wrote: > This is a subset sum problem. You have to find a subset of elements of > array whose sum is x/2, where x is sum of all the elements of the array. > > > On Sat, May 19, 2012 at 2:07 PM, payal gupta <gpt.pa...@gmail.com> wrote: > >> this wont work out as we need to partition the elements to get the >> average of the two parts to be equal and not the sum of the two parts.. >> >> >> On Fri, May 18, 2012 at 11:57 PM, Ramindar Singh <ramin...@gmail.com>wrote: >> >>> Not sure if i am correct but still be very close. >>> >>> 1. Intial Array is A with n elements >>> 2. Sort the Array's in descending order >>> 3. take 2 more arrays B and C in which u keep the partition >>> 4. pull the one element from A to B and keep keep track of the sum's in >>> both the arrays B & C >>> 5. Try to reach the sum in B by pulling the elements from A >>> 6. Continue till all the n elements are partitioned. >>> 7. If in the end still some difference is there b/w B and C, it can be >>> settled by exchanging the elements among them as they both would be sorted. >>> >>> hope this helps... >>> >>> -- >>> 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/-/BRRM2sjulSEJ. >>> >>> 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, GAURAV CHAWLA +919992635751 +919654127192 -- 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.