There are $m$ balls in box A and $n$ balls in box B. For every time, you draw a ball from either box with equal probability. (i.e. 1/2) You stop drawing when there is an empty box (i.e. you stop as soon as one box becomes empty).
a) what is the expectation of the number of balls in the nonempty box when you stop drawing?
b) if $m=n=c$ what is the trend the expectation goes when the $c$ goes to infinity?
If a) is too complex, then simply answering b) also helps
NOTE THAT THIS IS A MATH PROBLEM BUT NOT A PROGRAMMING PROBLEM.
These are simulation results using dynamic programming as follows.
c=1 result=1.0
c=4 result=2.1875
c=16 result=4.478397890925407
c=36 result=6.7468086213781735
c=81 result=10.139752756675115
c=100 result=11.26969580185129
c=225 result=16.916286965946945
c=400 result=22.560532075769885
c=625 result=28.203837846306
c=961 result=34.975204560067226
So it really looks like it goes to $\sqrt{N}$ as $c$ goes to infinity. Does anyone have an idea why it grows like this?
As you have found: if $X_{m,n}$ is the expected value of the number left in the box, then:
$$\begin{align} X_{m,n}&=X_{n,m}\\X_{m,0}&=X_{0,m}=m\\X_{m,n}&=\tfrac{1}2\left(X_{m-1,n}+X_{m,n-1}\right)\quad m,n>0 \end{align} $$
I think this gives for $m,n>0$
$$X_{m,n} = \frac1{2^{m+n}}\left(\sum\limits_{i=1}^m i2^i{m+n-1-i \choose n-1}+\sum\limits_{j=1}^n j2^j{m+n-1-j \choose m-1} \right)$$
That looks as if it should simplify, but seems to be related to OEIS A188553 which does not have an explicit formula given in general. If the OEIS table is $T(a,b)$ then it seems $X_{m,n} = \frac{1}{2^{m+n-1}}(T(m+n-1,m-1)+T(m+n-1,n-1))$
This does lead to an explicit form when $m=n=c$ giving $X_{m,n} = \frac1{2^{2c-1}}\sum\limits_{i=1}^c i2^i{2c-1-i \choose c-1} = \frac{2c}{4^c}{2c \choose c}$ and for large $c$ this is about $\sqrt{4 c /\pi}$