Re: [algogeeks] Can you solve this?

2010-05-31 Thread Nikhil Agarwal
This problem is like 2 processor job scheduling problem ,We may get an optimal solution for different instances using different algorithm apart from brute force.Whereas Brute force covers all possible subsets but may take years to complete if N is large. above algo fails in the following example.

Re: [algogeeks] Can you solve this?

2010-05-31 Thread Anurag Sharma
@Abhishek, I think your logic will not work. Although it can be done by greedy approach, but your method needs some tweak. Consider the case : 1,2,3,4,5,12 with your logic, we will get this answer team 1: 1,3,5 (total=9) team 2: 2,4,12(total=18) difference is 9 and its huge. what can be done is af

Re: [algogeeks] Can you solve this?

2010-05-30 Thread sharad kumar
@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 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..acc

Re: [algogeeks] Can you solve this?

2010-05-30 Thread Abhishek Sharma
Correction: Team2:7, 10, 11, 12, 15 On Sun, May 30, 2010 at 11:45 PM, Abhishek Sharma 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..

Re: [algogeeks] Can you solve this?

2010-05-30 Thread Abhishek Sharma
@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

Re: [algogeeks] Can you solve this?

2010-05-30 Thread sharad kumar
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 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 s

[algogeeks] Can you solve this?

2010-05-30 Thread Veer Sharma
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 comp