Getting the maximum number of groups when grouping students with specific conditions

35 Views Asked by At

I currently have the task to code a programm that split a class of n people into groups of exactly 5 for a practice game. If there are less then 5 people in a team those people are not allowed to play so i should keep this number as low as possible. As an input i get a table containing the first and last name and a favourite color of the student for each individual student. Example:

  • Sven Busch red
  • Silvia W blue

... (For some reason) students with a certain favourite color can only be on the same team as students with other specified favourite colors. Those relations are delivered in a seperate table. Example:

  • red, blue => Meaning those color can co-exist in a team
  • red, yellow
  • yellow, green => But everyone in a team has to like everyone else so I cant do a team with e.g. red yellow green.

I already took a look at some topics that sounds similar, but I cant really draw a connection to any of them. Topics/Problems i looked at: Knapsack Problem, Bin packing problem, Dynamic programming. I think im going in the right direction with dynamic programming. Could anyone of you give me some clues or keywords i can look into that can help me solve my problem?

Thanks in advance!!

0

There are 0 best solutions below