Note that there are some explanatory texts on larger screens.

plurals
  1. POMaximization algorithm for ball preferences
    text
    copied!<p>I'm trying to devise the most efficient algorithm for a problem, but I'm having some difficulty. If someone could lend a hand, either by proposing an algorithm or classifying the problem so I can do some further research, I would be very appreciative.</p> <p>The problem is as follows:</p> <p>There are n (an integer) number of distinct red balls, each of which has its own number, and m number of distinct green balls, each of which has its own corresponding number as well. For example, if n = 3, then there are three red balls named Red Ball 1, Red Ball 2 and Red Ball 3. There are also two boxes in which the balls can be placed. </p> <p>Before the balls are placed in the boxes however, x number of people make predictions as to which balls will be placed in which box (either box 1 or box 2). Each person gets one prediction and for each prediction they can guess one ball to be in each box. The only condition is that the ball they guess in box 1 cannot be the same color as the ball they guess to be in box 2. An example prediction would be: "I think that Red Ball 2 will be in box 1 and Green Ball 3 will be in box 2"</p> <p>After everyone has made their predictions, the balls will be placed in the boxes the maximize the number of predictions that are correct. </p> <p>The code I must write will be prompted with n, m, and x as well as the predictions and then be asked to return the maximum number of predictions that are correct. </p> <p>Once again, I am looking for either algorithmic help or help to identify the type of problem this is. I currently have a recursive algorithm running on (n^2), but I need something a little more efficient. </p> <p>Thanks for your help! Cheers, Mates! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload