1/5
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
If every recursive call results in two or more recursive call, then the recursive method (algorithm) is said to have a/an [blank] recursion
excessive
[blank] is a technique for returning to a given position after trying other avenues that are unsuccessful in solving a particular problem
backtracking
[blank] is a type of recursion in which there is only one recursive call at the very end of a method implementation
tail recursion
what are the five information that are usually contained in the activation record of a function?
values for all parameters
local variables
return address
dynamic link
returned value
fibonacci code
int fib (int n ) {
if (n == 0) {
return 0;
} else if (n == 1) {
return 1;
} else {
return fib(n-1) + fib(n-2);
}
}
exponent
int exponent (int x, int n) {
if (n == 0) {
return 1;
} else {
return x * exponent(x, n-1);
}
}