add code segment for recursion-iteration