I have the following snipet :
public class A
public A(int n)
{
for (int i=0; i<n; i++)
{
new A(i)
}
console.writeln("?")
}
for a given n - how many "?" will be printed ?
- some testing shows the answer is 2^n. What is the way to reach the formula?
- I got to the formula F(n) = 1 + F(n-1) +... +F(1) + 1
how do I simplify it to 2^n ?