# Summation Problem

Page 1 of 1

## 4 Replies - 2036 Views - Last Post: 05 February 2013 - 08:40 AM

Reputation: 0
• Posts: 2
• Joined: 04-February 13

# Summation Problem

Posted 04 February 2013 - 01:44 PM

Hey I'm having trouble doing this problem for my Computer Algorithms class. We're using Introduction to Algorithms by Thomas H Cormen et al. (http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844)- if that helps.

In any case my issue is this:

From the following program fragment given below:

```sum <- 0
for i <- 0 to n-1 do
for j <- 0 to (i^2)-1 do
for k <- 0 to j-1 do
sum <- sum + 1
end-for
end-for
write sum
```

derive function sum(n) in a closed form such that:

1. Values of sum(n) for any given n are exactly the same as the values of variable sum in the program above
2. the result obtained for functiion sum(n) must be factored in terms of factors each in the form of (n-a), where a is a real constant

____________________________________________________

So yeah, any help with this would be very appreciated.

Is This A Good Question/Topic? 0

## Replies To: Summation Problem

### #2 tlhIn`toq

• Left site for a while

Reputation: 5927
• Posts: 12,923
• Joined: 02-June 10

## Re: Summation Problem

Posted 04 February 2013 - 01:56 PM

"I'm having trouble" is about as vague as you can get.
We won't write code for you. What is your specific question beyond... 'Errr... I don't get it, man'

Reputation: 0
• Posts: 2
• Joined: 04-February 13

## Re: Summation Problem

Posted 04 February 2013 - 06:36 PM

I'm not looking to get a code written. I'm actually looking to find the polynomial of the psuedo-code is using. I'mnot sure how I would go about trying to find it.

### #4 tlhIn`toq

• Left site for a while

Reputation: 5927
• Posts: 12,923
• Joined: 02-June 10

## Re: Summation Problem

Posted 04 February 2013 - 06:45 PM

"I don't know where to start" - This usually means you should go back to your instructor and admit you are this lost. Don't bluff your way through this course thinking that by chapter 10 it will all suddenly snap into place and become clear. It won't. Unlike history class where chapter 1 might be 17th century England and chapter 2 might be World War II, giving you a fresh start - Coding builds upon the lessons of the previous chapter. You have to use lesson 1 material to succeed in lesson 2. Chapter 10 builds upon and uses material from chapter 9. If you let your pride get in the way you will be too lost to recover and have wasted thousands of dollars in tuition.

### #5 mojo666

Reputation: 376
• Posts: 815
• Joined: 27-June 09

## Re: Summation Problem

Posted 05 February 2013 - 08:40 AM

```sum <- sum + a
sum <- sum + b

//is the same as

sum <- sum + (a+B)/>

//so, what is the closed form of the following

for k <- 0 to j-1
sum <- sum + 1
end for

```

This post has been edited by mojo666: 05 February 2013 - 08:40 AM