@abhishek,sharad: It is not important to have equal no. of players in
2 team and difference in skills of 2 teams may not be zero always. The
aim is to have as balanced a team as possible baced on skill sets. For
example is there are 4 players with skill [9,2,1,2,], then the
solution is Team1 [9] and Team2 [2,1,2]. This is not balanced but this
is the best way we can divide the 2 teams so that they are "as
balanced / competitive as possible, because the difference in sum
skills of the 2 team is least". Since 1 member has skill 9 (which is
very high as compare to others) and he can be in one team only, the
above division is optimal.

Also note that there can be more than one solution to the above
problem. For example if skills of 6 players are [1,2,2,1,1,1] then you
can divide them as [(1,1,1,1,),(2,2,)] or [(2,1,1,)(2,1,1)], in both
case the difference in sum skills is zero (which may not be always so
as i meantioned before)....

Thanks,
Veer

On May 31, 5:54 am, sharad kumar <aryansmit3...@gmail.com> wrote:
> @abhishek:i meant after sorting split the array into 2 part each  with equal
> sum....
>
> On Sun, May 30, 2010 at 11:45 PM, Abhishek Sharma 
> <jkabhishe...@gmail.com>wrote:
>
>
>
>
>
> > @sharad: if you find the subarrays of equal sum then the number of players
> > might differ in the team... also can you tell me how will you do
> > that..according to me time cmoplexity will be higher..
>
> > According to me:
> > sort the palyers based on skill points (O(nlogn) --mergesort) then assign
> > the players one by one to each team (O(n))
>
> > Ex: Consider 10 players to be assigned to two teams.
> >        skill points: 12, 12, 7, 8, 15, 19, 11, 14, 5, 10.
>
> > Ans:
> > after sorting: 5, 7, 8, 10, 11, 12, 12, 14, 15, 19.
> > Team1: 5, 8, 12, 14, 19
> > Team2: 7, 11,12,15.
>
> > This is not exactly even but i think is the closest approach.
> > correct me if I am wrong..
>
> > Regards,
> > Abhishek
>
> > On Sun, May 30, 2010 at 8:21 PM, sharad kumar 
> > <aryansmit3...@gmail.com>wrote:
>
> >> sort the players based on skill point and get the subarray of equal
> >> sum......
>
> >> On Sun, May 30, 2010 at 6:58 PM, Veer Sharma 
> >> <thisisv...@rediffmail.com>wrote:
>
> >>> Hi Friends,
>
> >>> This is my first post to this forum. A "Hi" to all of you and here is
> >>> my first problem...
>
> >>> Giiven int n, the total number of players and their skill-point.
> >>> Distribute the players on 2 evenly balanced teams.
>
> >>> Lets see who gives the best solution (least space complexity / least
> >>> time complexity or both...)
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algoge...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups­.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >> --
> >> yezhu malai vaasa venkataramana Govinda Govinda
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algoge...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups­.com>
> >> .
> >> 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 algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups­.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> yezhu malai vaasa venkataramana Govinda Govinda- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to