I have to basically write a fuction that does the inmemoized recursion and count the number of times is called..which i did..
the second part is that i dont understand which is to create a global array of 100 and calculate the function using memoization...
can some one help..this is the first part
import java.util.Scanner;
public class Fib{
static int calls;
public static void main(String[] args){
int fib;
int n;
Scanner scan = new Scanner(System.in);
System.out.println("Input a number");
n = scan.nextInt();
System.out.println(" " + RecurFib(n) + " " + calls);
}
int count = 0;
public static int RecurFib (int n){
calls ++;
if (n<2){
int answer = n;
return answer;
}else{
int answer = RecurFib(n-1) + RecurFib(n-2);
return answer;
}
}