PDA

View Full Version : Project Euler - What you've learned


Edgardo
Sep16-09, 02:03 PM
So I registered on Project Euler (http://projecteuler.net/) and I must say: it's quite addictive!
I didn't expect it to be that much fun.

I'd like to share what things I've learned from solving the problems:


- When solving a problem you get access to a thread. I was impressed
how different the approaches are. People use "crazy languages" like K where
the code looks like this: */_*a@&1000=+/'a:b,'(_sqrt+/)'b*b:,/n,/:'1+!:'n:!1000

- Memoization (http://en.wikipedia.org/wiki/Memoization): Use results that you've calculated before

- Using psyco (http://psyco.sourceforge.net/) (a Python compiler) improved the Python performance of one my programs by a factor of 4.

- C++ is much faster than Python. But Python can handle really big numbers.
I will probably have to learn using GMP (http://gmplib.org/).

- Java is fast. But the BigInteger datatype is slow (maybe I used it in the wrong way?) and hard to use :frown:


What did you learn (for example what kind of techniques boosted the speed
of your programs)?
What programming languages do you use and prefer?

chandubaba
Nov22-09, 06:21 AM
Hi, I registered in spoj.pl , www.topcoder.com , www.codechef.com, and many acm judges ... i am chandubaba everywhere. Read the book "introduction to algorithms" by cormen, awesome! Very good for all these sites. But i am not there in project euler ... i am not familiar with gcj stuff. Also we need to do a lot of math (learn it fun way, ie not preparing for exam but for fun)... dynamic programming and graph theory seems to be everywhere at the elementary level.

Amanheis
Nov22-09, 09:03 AM
I learned:
C can handle bigger numbers than C++
Many algorithms are already better implemented than I ever could, especially in Mathematica
Thinking about a problem first can reduce the time needed to get the answer significantly

Edgardo
Dec11-09, 04:47 AM
Hi, I registered in spoj.pl , www.topcoder.com , www.codechef.com, and many acm judges ... i am chandubaba everywhere. Read the book "introduction to algorithms" by cormen, awesome! Very good for all these sites. But i am not there in project euler ... i am not familiar with gcj stuff. Also we need to do a lot of math (learn it fun way, ie not preparing for exam but for fun)... dynamic programming and graph theory seems to be everywhere at the elementary level.

Interesting. I'm currently reading Cormen's book and I like it. But I wouldn't have thought that it is actually useful for the problems on the aforementioned websites.

Santa1
Dec18-09, 04:38 PM
There are larger int objects in C++ as well, however for project euler I can recommend vectorized python (numpy).

CRGreathouse
Dec18-09, 05:05 PM
I did it in Pari. It makes most of the problems trivial -- though I'll admit it's pretty bad at string manipulation.

Ben1220
Dec22-09, 06:19 PM
Project euler taught me the hard way about algorithm efficiency...

sprince09
Jan15-10, 08:12 PM
I learned that pretty much everything I ever need to implement has been implemented by an open source project somewhere along the line...

chandubaba
Aug21-10, 10:52 AM
Edgardo whats your handle in topcoder?