C++ and Python

Just some early thoughts as I got through the first 10 problems on Project Euler for the third time, using C++ this time:

  • It is fast.  I knew that having a bit of code that would return a list of prime numbers was useful, and my first naive version of it can generate a list of 100,000 in just over 5 seconds, as opposed to ~11 with a more polished snippet in Python.
  • I hate that everything happens at once.  When I fix programs in Python, I have been printing out information at various places to see if the code is doing what I expect.  Does not work in C++.
  • The first few Project Euler questions have nice pencil and paper solutions, and it is sometimes hard to ignore those in order to practice programming.
So far, as long as everything compiles, I have not had to worry about time constraints at all, and don’t think I should.  I’ll optimize code later- now I’m just working out syntax.

Now I’m off to the Joint Meetings!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s