Algorithms optimization and tracing

Feb 6 2011 3:06 AM
I want to ask where I could find the advanced exercises or the book with exercises of algorithms optimizing and tracing for my students.

Sample:

Optimize algorithm:

t[0] = 0
for (n = 1; n <= N; n++)
    sum = 0
    for (i = 1; i <= n; i++)
        sum += n-1 + t[i-1] + t[n-i]
    t[n] = sum/n


 Another sample:

Result of:

for(int i = 0; i < 10; i++)
{
  Console.WriteLine((i + 1 + i) / i )
}


Answers (1)