|
|
nemesis wrote:
> "Tim Attwood" <tim### [at] comcastnet> wrote:
>> According to the statistics page on Project Euler there's about
>> three times as many people using C/C++ as Haskell, and about
>> twice as many using Python as Haskell.
>
> OTOH, most C++ solutions I've seen in the forum are the trivial, straightforward
> loopy and slow performant solutions, using pretty much the same obvious
> algorithm. Many Haskell solutions came up with amazingly concise and creative
> algorithms.
I admit that for the C++ solutions I've been resorting to brute force,
but for these problems I'm not aware of any solution that avoids the
brute force approach. For instance, in the problem for summing the
prime numbers less than one million, I'm not aware of any theorem which
calculates such a sum for any range without testing each odd number for
primality and then adding the primes.
It could be that the C++ coders either aren't aware of the
computationally less-expensive solutions, or they simply assume that the
relative efficiency of C++ (save counter-arguments for another thread,
please) enables them to not worry about computational efficiency.
Regards,
John
Post a reply to this message
|
|