We discussed this some time ago. It's NP hard. So an algorithm that gets the correct answer every time will run in exponential time. You can do it in pseudo-polynomial time -- polynomial in the magnitude of the elements - by using the DP method used for subset sum.
On May 18, 2:35 am, payal gupta <[email protected]> wrote: > How do you partition an array into 2 parts such that the two parts have > equal average?...each partition may contain elements that are > non-contiguous in the array... -- 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.
