add recursive and iterative. but I do not complete understand this