下列程序实现求菲波那契数列第4项的值:
def f(n):
if n==1 or n==2:
return 1
elif n>2:
return f(n-1)+f(n-2)
else:
return -1
print(f(4))
请问:这种解决方法属于哪种算法?( )
归纳
列举
递推
递归