Processing math: 12%
Google
 
Web unafbapune.blogspot.com

Saturday, December 21, 2013

 

Ex 1.14 - AofA

Solve the recurrence:
  AN=1+2NNj=1Aj1 for N>0NAN=N+2Nj=1Aj1(N1)AN1=(N1)+2N1j=1Aj1for N1 instead of NNAN(N1)AN1=1+2AN1subtract the last two equationsNAN=(N+1)AN1+1note it's now linear time, not quadratic!ANN+1=AN1N+1N(N+1)divide both sides by N(N+1)ANN+1=A12+123++1N(N+1)telescope=112+123++1N(N+1)note A1=1, assuming A0=0AN=(N+1)Nk=11k(k+1)=(N+1)Nk=1(1k1k+1)partial fraction=(N+1)(11N+1)telescoping seriesAN=N
Alternatively, instead of using telescoping series,
  AN=(N+1)Nk=1(1k1k+1)ANNNk=1(1k1k+1)f(x)g(x) meanslim
By the definition of Euler's constant,
  \begin{aligned} \gamma &= \lim_{N \rightarrow \infty} \big( \sum_{k=1}^N \frac{1}{k} - \ln N \big) \\ \therefore \lim_{N \rightarrow \infty} \big( \sum_{k=1}^N \frac{1}{k} &= \ln N + \gamma \big) \\ \gamma &= 1 + \lim_{N \rightarrow \infty} \big( \sum_{k=2}^N \frac{1}{k} - \ln N \big) & \text{pull out the 1st term} \\ &= 1 + \lim_{N \rightarrow \infty} \big( \sum_{k=1}^{N-1} \frac{1}{k+1} - \ln N \big) & \text{re-index} \\ \lim_{N \rightarrow \infty} \big( \sum_{k=1}^{N-1} \frac{1}{k+1} &= \ln N + \gamma - 1 \big) \\ \therefore \lim_{N \rightarrow \infty} \big( \sum_{k=1}^{N} \frac{1}{k+1} &= \ln (N+1) + \gamma - 1 \big) & \text{for } N+1 \text{ instead of } N \\ \end{aligned}
Hence
  \begin{aligned} A_N &\thicksim N \big(\sum_{k=1}^N \frac{1}{k} - \sum_{k=1}^N \frac{1}{k+1}\big) \\ A_N &\thicksim N \big[ \big(\ln N + \gamma\big) - \big(\ln (N+1) + \gamma - 1\big) \big] \\ A_N &\thicksim N \big(\ln N - \ln (N+1) + 1\big) \\ A_N &\thicksim N &\Box \\ \end{aligned}
Source: Analysis of Algorithm


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?