Posts

Showing posts with the label combinatorics

What algorithm is appropriate for finding possible matches to form a group of L players?

What algorithm is appropriate for finding possible matches to form a group of L players? Given a group of M1, M2, ... , Mn teams (each team has length <= L/2) I am trying to find (as efficiently as possible, iteratively) combinations which match the criteria: Note: Any pointers, links, hints appreciated. "all possible combinations" - that sounds expensive. – Dai Jul 1 at 19:15 @Dai Agreed. I have edited to indicate I can work with a stream of results as well. – kidoman Jul 1 at 20:16 I've deleted my answer as it is not a good fit given the additional note above. – chucksmash Jul 1 at 21:03 ...

make all values zero of an integer array with minimum no. of binary operations

make all values zero of an integer array with minimum no. of binary operations I am working on a research project, where I need to convert an integer array's all value to zero using minimum no. of binary(addition/ subtraction only) operations. For e.g. Input Array: [ -9 , -3, -2, 8, 5, 1 ] Output: 4 operations: op1) -9 + 8 = -1 op2) -1 + 1 = 0 op3) -3 + 5 = 2 op4) -2 + 2 = 0 Input array: [ -6, -5, -4, 6, 9] output: 3 operations: 1) -6+6 = 0 2) -5 + 9 = 4 3) -4 + 4 =0 I cannot think of even the brute force solution. constraints: Minimum number of Binary operations(addition/subtraction only). Why do you need to do this? – Tim Biegeleisen Jul 1 at 14:30 its a variation of Hungarian algorithm with additional constraints for the project work. – pankaj kashyap Jul 1 at 14:35 ...