Voici quelques question sur l'évaluation des fonctions récursives.

1. Evaluez la fonction récursive suivante pour x = 3
// x is non-negative
int f1(int x){
if (x == 0)
return (x + 1);
return 1 + f1(x-1);
}
// x is non-negative int f1(int x){ if (x == 0) return (x + 1); return 1 + f1(x-1); }
// x is non-negative
int f1(int x){
  if (x == 0)
    return (x + 1);
  return 1 + f1(x-1);
}

2. Evaluez la fonction récursive suivante pour x = 6 et y = 5
int f2(int x, int y){
if (x <= 0)
return 0;
if (y >= x)
return 1 + f2(y,x);
return 2 + f2(x-3,y-1);
}
int f2(int x, int y){ if (x <= 0) return 0; if (y >= x) return 1 + f2(y,x); return 2 + f2(x-3,y-1); }
int f2(int x, int y){
  if (x <= 0)
    return 0;
  if (y >= x)
    return 1 + f2(y,x);
  return 2 + f2(x-3,y-1);
}