10844 - Bloques

All about problems in Volume 108. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

darkseed
New poster
Posts: 2
Joined: Tue Oct 19, 2010 1:14 am

Re: 10844 - Bloques

Post by darkseed » Tue Oct 19, 2010 1:22 am

I'm calculating Bell's numbers using Bell's triangle (as calculating Stirling numbers of the 2nd kind is too slow) and my custom BigInteger class to solve this problem and I get the correct answer, however I'm getting TLE. I keep only prev and current lines of the triangle to lower memory usage. I also only calculate until the line I need to get the requested Bell number. The algorithm is:

Code: Select all

generateFirstLine();
while (!reachedTargetLine())
{  
  generateCurrLine();
  prevLine = currLine;
}
number = currLine[0];
Are there optimizations to make in the algorithm or only in the add/copy methods of my BigInteger class?

Thanks

Post Reply

Return to “Volume 108 (10800-10899)”