math - Recurrence relation for basic operation -
i need little creating recurrence relation basic operation following recursive algorithm:
int d(int n) { if (n==0) { return 0; } return d(n - 1) + d(n - 1); }
i think basic operation addition having trouble setting recurrence relation
are sure correct code? recurrence relation is
d(n) = 2 * d(n-1) base case d(n) = 0
do see how works? function's recursion step shows recurrence step; function's termination clause shows base case.
i'm worried because in closed form, is
d(n) = 0 n
Comments
Post a Comment