The parking problem as told to me by Prof. Dan Garcia (UC-Berkeley).

A city creates space for parking in front of the police station. There is enough room for N cars to fit side-by-side. That doesn't mean that they will, especially if the drivers want to get out of their cars. Here three possible examples for N=10:

park_cars

In each case, there is no longer space for another car to park.

Problem: Assume that cars park randomly with space N, where N need not be an integer. Write a program that inserts cars like this and returns the number of cars that are parked when room runs out. (The return values for the three placements shown, above, would be 10, 6, and 5, respectively.)

Problem #2: Write a program that determines an average for the number of cars that get parked.

For those who are mathematically inclined, Prof. Garcia suggests this: http://mathworld.wolfram.com/RenyisParkingConstants.html