Runtime of random recursive program

67 Views Asked by At

I just wrote a simple recursive program together with my kids using Snap! It works like this:

Draw a V shape. At each of the ends draw either a small shape or another V-shape.

The chance of drawing another V-shape is p.

Question: What can be said about

  • the average number of Vs drawn in one run
  • the probability that the number of Vs is infinite (the program never ends).