# Need an algorithm to compute number of elements in sample space

An urn contains $X$ red balls, $Y$ green balls, and $Z$ white balls. $N$ balls are drawn without replacement from the urn, and the colors are noted in sequence.

$N \leq X+Y+Z$

Trying to come up with algorithm to compute the number of elements in sample space.

-

Hint First treat the case when $N < \min\{X,Y,Z\}$. Then what about $X < N < Y+Z$. Keep increasing the limitations until you get the general procedure.
@YevgeniyRozhkov for this case, i would condition on $z$ - it's either there or not, and if yes, choose a place for it. Now you reduced it to 2 elements and 2 or 3 places. 2 places are easy and for 3 you condition again. – gt6989b May 7 '13 at 19:15