Will the stack ever underflow?
A program issues push operations and pop operations on a stack, in a uniformly random interleaving. A pop on an empty stack is an error.
What is the probability the whole sequence runs without ever popping from an empty stack?
Show a hint
Code each push as and each pop as . The stack size is the running total. The error condition is the same "never go below zero" constraint as the ballot problem, but now the start and end are both zero.