Finding maximal and average number of time slots in an Adaptive tree walk protocol
It is clear that you cannot know the maximum if $p \neq 1$, because there is always some chance, no matter how small, that neither station will transmit after any $n$ attempts.

However, if $p=1$ then the answer is always 3 (both average and maximum): first all stations under 1 transmit (both A and C), then under 2 (same), then under 4 (just A – success).

Regarding the average (excepted value), it's a combination of two things: the average tries you need until any station transmits, and the expected value of a successful transmission assuming at least one station transmitted. The first is a standard geometric distribution, where the expected value is $E=1/p$.