Re: Need a Challenge?

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.

------=_NextPart_000_4043_7664_3b21

Irv Mullins wrote:


>Wow. The following pgm runs in about 24 seconds; of course, this is a 
>compiled language.

OK, I made a couple of changes to the code.

First, I re-ordered the declaration of constants so they match those in the 
example program. This ensures the comparisons are fair.

Next, I added pruning back into the code. It's rather oblique, but it only 
costs 6 lines of code. That brought the runtime down to about 12 seconds.

Finally, I commented out the redundant tests (those that the pruning already 
took care of). That brought the runtime down to less than 6 seconds. Of 
course, my speed is dependant on the processor I used - you'll want to run 
it on your machine for comparison.

And this is the interpreted version. I'd tried to compile it, but it 
complains that the Library and Translator both have to be the Complete 
Edition... (mild grumbling, since I should have both installed)

-- David Cuny


------=_NextPart_000_4043_7664_3b21
Content-Type: text/plain; name="puzzle.ex"; format=flowed
Content-Transfer-Encoding: 8bit

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu