algorithm - Recurrence relation: iteration solving -


there recurrence relation following:

t(n) = 2 t(n-1) + o(1) n > 1  otherwise, t(n) = o(1) 

by iteration , far got like,

t(n) = 2(2t(n-2) + 1) + 1 --- 1 t(n) = 2(2(2t(n-3) + 1) + 1) + 1 ---- 2 t(n) = 2(2(2(2t(n-4) + 1) + 1) + 1) + 1 ------3 t(n) = 2(2(2(2(2t(n-5) + 1) + 1) + 1) + 1) +1 ----- 4 

i not sure next find upper bound time complexity. please me this.

look @ step 4

t(n) = 2(2(2(2(2t(n-5) + 1) + 1) + 1) + 1) +1 ----- 4 t(n) = 2(2(2(2(2t(n-5))))) + 16 + 8 + 4 + 2 +1 =  t(n) = 2^4* 2t(n-5) + 2^4 + 2^3 + 2^2 + 2^1 + 2^0 = t(n) = 2^4* 2t(n-5) + 2^5 -1 = 

similarly, if same , develop 1 more time get:

t(n) = 2^5 *2t(n-6) + 2^5 + 2^5-1 t(n) = 2^5 * 2t(n-6) + 2^6-1 

by can understand if develop until base of t(1), get:

t(n) = .... = 2^(n) -1  

note method giving intuition solving problem , not proof.


to formally prove claim can use induction, , claim hypothesis t(n) = 2^n -1:

base: t(1) = 1 = 2^1 -1

induction hypothesis: k<n, t(k) = 2^k-1

proof:

t(n) = 2t(n-1) +1 =(i.h.) 2* (2^(n-1) -1) + 1 = 2^n -2 + 1 = 2^n - 1 

remark: t(1) base clause c, , t(n) = 2t(n-1)+c constant , not 1, use 1 simplicity. logic not chagne @ when changing c.


Comments