You are viewing a single comment's thread. Return to all comments →
RECURSION
int utopianTree(int n) { if(n==0) return 1; if(n%2==0) return 1 + utopianTree(n-1); return 2 * utopianTree(n-1); }
Seems like cookies are disabled on this browser, please enable them to open this website
Utopian Tree
You are viewing a single comment's thread. Return to all comments →
RECURSION
int utopianTree(int n) { if(n==0) return 1; if(n%2==0) return 1 + utopianTree(n-1); return 2 * utopianTree(n-1); }