Question
please derive a closed formula of f(n) and please dont answer this question if you are not sure. because this is the second time I’m posting this question
Censiden MATRIX-eHAIN m p.kngth a ore 11 n 0 1 ton-t 1 and
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The innermost loop with variable k, for a particular value of l , evaluates from i to  j-1 where i range from 1 to  n-l+1 and j=i+l-1 .

Thus for a particular value of i say i = m, j=m+l-1 , innermost loop will run for j-1-i+1 = j-i = i+l-1 - i = l-1 iterations.

And since i range from 1 to  n-l+1 and for each value of i , the value of j is such that, innermost loop with variable k run for l-1 iterations.

Since there are n-l+1 possible values of i in the range   1 to  n-l+1 and hence number of times innermost loop will execute for a particular value of l will be (n-l+1)(l-1) .

Since the value of l range from 2 to n,

Hence number of times, innermost loop with variable k will execute will be

\sum_{l=2}^{n}(n-l+1)(l-1) = \sum_{x=1}^{n-1}(n-x)x \text{. where }x=l-1

\sum_{x=1}^{n-1}nx- \sum_{x=1}^{n-1}x^2 = n(n(n-1)/2)-n(n-1)(2n-1)/6 \\=n(n-1)(n+1)/6 = n(n^2-1)/6

Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
please derive a closed formula of f(n) and please dont answer this question if you are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT