Digital Search Trees and the Generation of an Exponentially Distributed Variate

We use several statistics on digital search trees (tries) to analyze in detail an almost optimal algorithm for generating an exponentially distributed variate. The algorithm, based on ideas of J. von Neumann, is due to Knuth and Yao. We establish that it can generate k bits of an exponentially distributed variate in about k+5.67974692 coin flippings. This result is presented together with companion estimates on the distribution of costs; it answers an open problem of Knuth and Yao.