@Ankit: Ur solution has some flaws I think. Ur solution assumes that we r
dividing the sorted array into 2 halves, but the question says:  divide an
integer array into 2 sub-arrays and make their averages equal. Take some
test case and apply ur solution to it.
 We cud do this problem in the following way :
1. Sort the array

2. Take 2 containers i.e. arrays

3. Start adding elements from the sorted array into the container which has
less average. Note that the average of the 2 new arrays can be maintained in
2 variables and need not computed each time an element is added

-- 
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