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:
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.
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.