recursive version and iterative version