Processing math: 100%

Tuesday, April 17, 2012

Color Balls

Non-Coding Problem:
Given a bag of n balls each with a different color. Each time you pick up a pair of balls and paint both to one of their colors. What's the expected number of steps before all balls become the same color?

Analysis:
This is a problem from the "Green Cover Book". It's easy to see that we have the following transition probability.
Thus if we let μi be the expected number of steps getting to one color when the bag has i distinct colors, then we have μi=1+i(i1)n(n1)μi1+(1i(i1)n(n1))μi.
From this we can use induction to prove that μi=i1in(n1).
Therefore we have μn=(n1)2.

No comments:

Visitors