Re: Delphi: algorithm that can generate all the perm. of 30 in just 1 second?


[ Delphi Forum -- by DelphiLand ]

Posted by webmaster Guido on December 05, 2003 at 17:53:20:

In Reply to: Is there any algorithm that can generate all the perm. of 30 in just 1 second? posted by vvv on December 03, 2003 at 22:24:41:

: Hi, Can you anyone help me? Is there an algorithm si fast he can generate all the combinations of 30 (nr. of solutions = 30! ) in just one second on a computer faster than 1 GHz? If yes, please tell it to me.

----------

The answer to the question is YES, if you use a 265252859812191058636308 GHz CPU. Would need a lot of electricity though.

If you don't have that much power, you could try the experiment with a 1 GHz box. At one solution per clock cycle, that would give you 1000000000 results per second.
And 30! solutions equals 30*29*28*27*26*...*2... that's... ehhh... give or take a bit:
265252859812191058636308480000000

Roughly, the job would take, not counting the programming time:
265252859812191058636308 seconds, or
73681349947830849621 hours, or
3070056247826285400 days, or
8411113007743247 years, or
84111130077432 centuries
;-)



[ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]