Re: [algogeeks] Re: Can you solve this?

2010-06-03 Thread divya jain
same question as wat i asked in partioning of array such that the diff is min. On 31 May 2010 22:07, Senthilnathan Maadasamy senthilnathan.maadas...@gmail.com wrote: Same question with interesting answers in stackoverflow :

Re: [algogeeks] Re: Can you solve this?

2010-06-03 Thread saurabh gupta
@Divya: nope, your Q requires equal count too whereas this doesn't. On Thu, Jun 3, 2010 at 1:06 PM, divya jain sweetdivya@gmail.com wrote: same question as wat i asked in partioning of array such that the diff is min. On 31 May 2010 22:07, Senthilnathan Maadasamy

Re: [algogeeks] Re: Can you solve this?

2010-06-03 Thread Rohit Saraf
Still the solution will be similar and actually a bit simpler. -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you

Re: [algogeeks] Re: Can you solve this?

2010-06-03 Thread saurabh gupta
yep, constraints are fewer here but in terms of problem statement 'same' and 'similar' can create diversions. On Thu, Jun 3, 2010 at 6:01 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: Still the solution will be similar and actually a bit simpler. --

Re: [algogeeks] Re: Can you solve this?

2010-06-03 Thread saurabh gupta
This should be solvable by dp as in knapsack problem where value = weights and W = S/2. where S = sum of all elements in the array. The claim here is diff in sum of two subsets will be minimum when one maximizes a sub-set sum (say s) where sum (s) is closest to S/2. Divya's problem is looking

[algogeeks] Re: Can you solve this?

2010-05-31 Thread Veer Sharma
@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]

[algogeeks] Re: Can you solve this?

2010-05-31 Thread Nik_nitdgp
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] Re: Can you solve this?

2010-05-31 Thread Anurag Sharma
ya I guess its the same problem.. Anurag Sharma http://anuragsharma-sun.blogspot.com/ On Mon, May 31, 2010 at 10:00 AM, W Karas wka...@yahoo.com wrote: Is this the same problem as: http://groups.google.com/group/algogeeks/browse_frm/thread/26c31cc2530a88e1# ? Or can the teams have

Re: [algogeeks] Re: Can you solve this?

2010-05-31 Thread Anurag Sharma
Well, in that case, then just forget the balancing the number of elements in the 2 teams portion of my solution above :) Anurag Sharma http://anuragsharma-sun.blogspot.com/ On Mon, May 31, 2010 at 10:38 AM, Nik_nitdgp nikhil.bhoja...@gmail.comwrote: This problem is like 2 processor job

Re: [algogeeks] Re: Can you solve this?

2010-05-31 Thread Senthilnathan Maadasamy
Same question with interesting answers in stackoverflow : http://stackoverflow.com/questions/890171/algorithm-to-divide-a-list-of-numbers-into-2-equal-sum-lists On Mon, May 31, 2010 at 5:54 PM, Anurag Sharma anuragvic...@gmail.comwrote: Well, in that case, then just forget the balancing the

[algogeeks] Re: Can you solve this?

2010-05-30 Thread W Karas
Is this the same problem as: http://groups.google.com/group/algogeeks/browse_frm/thread/26c31cc2530a88e1# ? Or can the teams have different numbers of players? On May 30, 2:28 pm, Veer Sharma thisisv...@rediffmail.com wrote: Hi Friends, This is my first post to this forum. A Hi to all of

[algogeeks] Re: can you solve these questions!!!

2008-02-04 Thread Ridvan Gyundogan
Yes this seems to be working. On Feb 3, 6:50 pm, Aravind Narayanan [EMAIL PROTECTED] wrote: On Feb 3, 2008 10:12 PM, Ridvan Gyundogan [EMAIL PROTECTED] wrote: Hi Aravind, I think it will not work in this array: {1,2,3,4,5,6,7,7,7,7} It would give currentelem=7 and c=3 but 7 is not

[algogeeks] Re: can you solve these questions!!!

2008-01-30 Thread Aravind Narayanan
Hi HC On Jan 30, 2008 12:53 AM, hc busy [EMAIL PROTECTED] wrote: I think there was a typo. I wanted to say its a constant space, linear time algorithm instead of constant time linear space algorithm Maybe that helps to make sense of it. Well, one must find a number that repeats at least

[algogeeks] Re: can you solve these questions!!!

2008-01-29 Thread Mahesh Gunda
Hi HC, Here, In this sentence So there needs to be a number that is repeated once after seeing n/2+2 numbers for this to be possible(and the rest must all be the same) How did u find this number ? k bye On Jan 26, 2008 3:32 AM, hc busy [EMAIL PROTECTED] wrote: #2 is weird, start by

[algogeeks] Re: can you solve these questions!!!

2008-01-29 Thread hc busy
I think there was a typo. I wanted to say its a constant space, linear time algorithm instead of constant time linear space algorithm Maybe that helps to make sense of it. Well, one must find a number that repeats at least twice after seeing n/2+2 numbers, (then require the rest to be that same

[algogeeks] Re: can you solve these questions!!!

2008-01-29 Thread hc busy
I think there was a typo. I wanted to say its a constant space, linear time algorithm instead of constant time linear space algorithm Maybe that helps to make sense of it. Well, one must find a number that repeats at least twice after seeing n/2+2 numbers, (then require the rest to be that same

[algogeeks] Re: can you solve these questions!!!

2008-01-29 Thread vivek garg
for question no. 2 median wil be the answer because repeated element is one more than the half of the no. of element for finding medain we can use modified quick sort which uses the fact that we have to go only one side depending on the no. of element we found on that side. in general algo

[algogeeks] Re: can you solve these questions!!!

2008-01-26 Thread Aravind Narayanan
On Jan 25, 2008 11:47 PM, Sumedh Sakdeo [EMAIL PROTECTED] wrote: *1) find the second biggest number in a given array of size n. you have to use n+logn number of searches or less By this you want to have a complexity less than or equal to n + log n rite? Consider an array { 17 , 4, 3, 18

[algogeeks] Re: can you solve these questions!!!

2008-01-25 Thread hc busy
#2 is weird, start by observing that if you've seen n/2+2 items then you're done. You want n/2+1 equal numbers. So there needs to be a number that is repeated once after seeing n/2+2 numbers for this to be possible(and the rest must all be the same), now divide and conquer. For all possible

[algogeeks] Re: can you solve these questions!!!

2008-01-25 Thread Malay Bag
2. keep a counter n take the first element of the array say e and initialize the counter n=1 for each remaining number in the array if n==0, e=current element, n=1 if current element is equal to e, n++ else n-- if n==0 there is no number otherwise check the number of occurrences of e in the array

[algogeeks] Re: can you solve these questions!!!

2008-01-25 Thread Sumedh Sakdeo
*1) find the second biggest number in a given array of size n. you have to use n+logn number of searches or less By this you want to have a complexity less than or equal to n + log n rite? Consider an array { 17 , 4, 3, 18 , 9 , 15, 6 } max1 max2 are index in array. Iteration 1:-i=1 ( as

[algogeeks] Re: can you solve these questions!!!

2008-01-25 Thread hc busy
#2 is weird, start by observing that if you've seen n/2+2 items then you're done. You want n/2+1 equal numbers. So there needs to be a number that is repeated once after seeing n/2+2 numbers for this to be possible(and the rest must all be the same), now divide and conquer. For all possible