I am preparing for my exams in algorithms & probabilty. For the exam preparation, we have been given this exercise. I couldn't solve this, even with the master solution given to us.
In a casino in Monte Carlo, you play at a very peculiar machine. The machine has $n$ wheels, each with $k$ possible values (not necessarily distinct). The wheels may be different from each other, that is it does not necessarily hold that every wheel has the same $k$ values on it.
When you activate the machine, each wheels lands in one of its $k$ possible values chosen uniformly at random and independently of all other wheels. You win a jackpot if the $n$ chosen values form an increasing sequence $x_1 \leq x_2 \leq \dots \leq x_n$ (the sequence does not need to be strictly increasing). You want to compute your chances of winning a jackpot.
My idea would have been to define the events: $A_i = ``x_{i-1} \leq x_i"$. So I have to calculate $P[A_2 \& \dots \&A_N]$. I'm not sure but $P[A_i]$ must be: $P[A_i] = (k-z)/k * (1/k)$ ($z$ is the number that has been taken in $x_{i-1}$). But how do I calculate this probability? Does any one also have an idea how to implement it in Java? The master solution uses recursion, but I didn't get that part.
We have been given numbers to solve this problem: For example: we have two wheels and the number of different values each wheel has is 3.
Wheel 1 has the values: 1, 2, 3 Wheel 2 has the values: 1, 2, 3
The probability of an increasing sequence is 2/3
Another Example would be: we have two wheels, $k = 2$ wheel 1 = 1, 2 wheel 2 = 2, 2
probability is 1 :)
Thank you!!