@abhijeet how could partitioning the array elements into two parts with half the total sum each help, if the no. of elements in the two parts be unequal resulting into unequal average?
On Sun, May 20, 2012 at 1:11 AM, abhijeet srivastva < [email protected]> 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 <[email protected]> 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 <[email protected]>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 [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. >>> >> >> -- >> 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. >> > > -- > 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. > -- 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.
