added recursive method for 12.5 and made the iterative method fruitful