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

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -