Sei sulla pagina 1di 2

2/2/2019 TADM2E 2.

3 - Algorithm Wiki

TADM2E 2.3
From Algorithm Wiki
2 2
f (n) = (((n )(n + 1) )/8) + n(n + 1)(2n + 1)/12

This problem does appear to break down into a series of nested summations:

n i i+j j+i−k

∑ ∑ ∑ ∑ 1

i=1 j=1 k=j l=1

In the last summation, the formula is independent of the iterator, which translates into adding the value 1,
j + i − k times:

n i i+j

∑ ∑ ∑(j + i − k)

i=1 j=1 k=j

Now the third summation goes from j to i + j the formula on closer examination reveals that

i+j i

∑(j + i − k) is ∑(k) which is equal to i ∗ (i + 1)/2


k=j k=1

end end−start

Since ∑ (end − k) = ∑ (k)

k=start k=1

So the summation boils down to

n i

∑ ∑(i ∗ (i + 1)/2)

i=1 j=1

The formula in the second summation is independent of the iterator, which translates to adding i ∗ (i + 1)/2 , i
times.
n

2
∑(i ∗ (i + 1)/2)

i=1

which is
n

3 2
∑((i + i )/2)

i=1

http://www.algorist.com/algowiki/index.php/TADM2E_2.3 1/2
2/2/2019 TADM2E 2.3 - Algorithm Wiki

2 2
2 2
1 1 n (n+1) n(n+1)(2n+1) n (n+1) n(n+1)(2n+1)
3 2
(Σr + Σr ) = ( + ) = +
2 2 4 6 8 12

Time Complexity = O(n4 )

Return to Algo-analysis-TADM2E ...

Retrieved from "http://algorist.com/algowiki/index.php?title=TADM2E_2.3&oldid=521"

This page was last modified on 19 June 2017, at 19:46.


This page has been accessed 9,416 times.

http://www.algorist.com/algowiki/index.php/TADM2E_2.3 2/2

Potrebbero piacerti anche