TADM2E 2.33

From Algorithm Wiki
Revision as of 12:07, 2 August 2020 by Matt (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

On careful observation , one can see that the sum of any row is just $ 3^{n-1} $ this is the sum for the series . This can even be computed using a series as shown below

1 1 1 
a1 a0 a2

now a(mid) of the next line becomes the a(0) +a(1) +a(2) that it this mid element is always the sum of the middle three elements

Alternate explanation :

Every element in the current row will be used 3 times in next row; once directly below it, and also in left and right element below it.

So sum of elements in $ (n+1) $th row will be 3*(sum of elements in $ n $th row).

Hence, S(n) = $ 3^{n-1} $ (Base case : For 1st row, sum is 1)