SpiffyEh
- 191
- 0
Homework Statement
Consider the following code fragment.
for i=1 to n/2 do
for j=i to n-i do
for k=1 to j do
output ‘‘foobar’’
Assume n is even. Let T(n) denote the number of times ‘foobar’ is printed as a
function of n.
(a) Express T(n) as three nested summations.
(b) Simplify the summation. Show your work.
Homework Equations
The Attempt at a Solution
I thin I understand a)
I got:
\sum (\sum (\sum output "foobar" ))
the sum bounds starting from the outside inward:
i = 1 to n/2
j = 1 to n-i
k = 1 to j
I'm not sure how to simplify this. Could someone please explain it to me?