You can reduce this problem to the sum-subset problem<http://en.wikipedia.org/wiki/Subset_sum_problem> .
Let A be the array. Compute S = A[0] + ... + A[N-1], where N is the length of A. For k from1 to N-1, let T_k = S * k / N. If T_k is an integer, then find a subset of A of size k that sums to T_k. If you can do this, then you're done. If you cannot do this for any k, then no such partitioning exists. On Fri, May 18, 2012 at 12:10 PM, Prem Krishna Chettri <[email protected]>wrote: > I guess this is Subset minimization problem's Modification.. > > > Algo.. > > 1> Get all the Subset of the particular array. Best Algo O(n2). > 2> Now try to find the subsets having similar average. Again best algo > known is O(n2). > > > Anyone have better options?? > > BR, > Prem > > > On Fri, May 18, 2012 at 12:05 PM, 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 view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/fSAXqe-gkJcJ. >> 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.
