Against the grain: Linear-time breadth-first tree algorithms (1998)

by Jeremy Gibbons, Geraint Jones