0

Suppose you are a kindergarten teacher and you need to get your children dressed to go play outside. Each kid needs a hat, mittens, and a coat. Each child has preferences on which clothes they want to wear.

We have n children, a hats, b pairs of mittens, and c coats. For each child we have a list of acceptable hats, mittens, and coats. Design an algorithm to determine if it's possible to get every child dressed with a hat, mittens, and a coat.

So this problem is very clearly a bipartite matching problem. I know that bipartite graphs can be solved by attaching a source and a sink, creating edges of weight 1 and solving a typical maximum flow problem.

I'm having a hard time grasping how to solve this problem knowing these things. I'm thinking that each pair (children, hats), (children, mittens), (children, coats) are their own separate bipartite graph. That's about as far as I've gotten so far, any hints or pushes in the right direction are much appreciated.

  • 2
    I'm voting to close this question as off-topic because this question belongs on another site in the Stack Exchange network: https://cstheory.stackexchange.com/ – joce Dec 12 '15 at 01:29

1 Answers1

0

As there is no relation between hats, mittens and coats, you can safely run three separate bipartite matchings for (children,hats), (children.mittens), (children,coats). Then your solution will be the minimum of these three. So if the minimum of these is equal to the total number of children then you can dress all of the children.

Saeid
  • 4,147
  • 7
  • 27
  • 43