provide both iterative and recursive versions