Algo:

1. Sort the array
2. modify binary search on the set comparing average of both the set.
3. if aveage (start, mid) > average (mid , end) then go to left sub
set else right subset.


This could lead to solution in o(nlogn) time. Please comment futher!!

Cheers,
Ankit Sinha

On Sat, Aug 27, 2011 at 12:40 PM, wujin chen <[email protected]> wrote:
> take a subset from the array, if the average is equal then output the
> result.
> backtracing can do this.
> the time complexity seems not low, any good idea~~?
>
> 2011/8/27 sukhmeet singh <[email protected]>
>>
>> how to divide an integer array into 2 sub-arrays and make their averages
>> equal?
>> array is unsorted and we can also take any numbers and the numbers in the
>> array need not be contiguous in the original array.
>> how many total such array's are possible. Output them
>>
>> --
>> 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.

Reply via email to