Monday, 30 September 2013

Given x_0 and x_n+1 and that x_i is integer, how to calculate sum(x_0

Given x_0 and x_n+1 and that x_i is integer, how to calculate sum(x_0

If there are certain numbers x_0 and x_(n+1) and if x_i is an integer for
0<=i<=n+1, how to calculate the above sum with JAVA? The sum indicates
that it takes the sum of f(x_1,x_2,...x_n) for every possible combination
of (x_1,x_2,...x_n) such that the above inequality holds. I have an idea
for the solution, but it is a terribly ineffective algorithm using binary,
and it's O(2^n). Of course, I cannot use "for" because it must be used for
n (non-specific) times. Is there anyone who knows more effective algorithm
for this?

No comments:

Post a Comment