0% found this document useful (0 votes)
84 views2 pages

Tadm2e 2.3 - Algorithm Wiki Functionprestiferous

This document analyzes the time complexity of a nested summation algorithm. It breaks the problem down into a series of nested summations and simplifies the expressions. The final expression is (((n^2)(n+1)^2)/8) + n(n+1)(2n+1)/12. The time complexity is determined to be O(n^4).

Uploaded by

Jessica Gomez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views2 pages

Tadm2e 2.3 - Algorithm Wiki Functionprestiferous

This document analyzes the time complexity of a nested summation algorithm. It breaks the problem down into a series of nested summations and simplifies the expressions. The final expression is (((n^2)(n+1)^2)/8) + n(n+1)(2n+1)/12. The time complexity is determined to be O(n^4).

Uploaded by

Jessica Gomez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like