Blog

Merge file sort and swap iterator

During my struggles with Project Euler Problem #302 I made an attempt to semi-brute force it. Unfortunately it required huge amounts of RAM (about 2e9 * 16 bytes) so I figured I could use some help from permanent storage. I implemented two helper classes, namely MergeSort and SwapIterator which look […]

Project Euler #300

In a very simplified form, we can consider proteins as strings consisting of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH. For this problem, the orientation of a protein is important; e.g. HPP is considered distinct from PPH. Thus, there are 2n distinct proteins consisting of n elements. When one […]

Paralell DP, BGL and other fun stuff ;)

I haven’t been posting for the past few days because I’ve been in WrocΕ‚aw (Breslau) for the weekend and then I was kinda busy playing with new coding quests, this time from topcoder.com, my second big love after Project Euler (jeez, why nobody told me about these two before? πŸ˜‰ […]

Open MPI convenience functions

I could start by lecturing you on the basics of usage and principles of operation of MPI and Open MPI in particular, but I think it might not be a good idea, because you (or even more probably me πŸ˜‰ ) could get bored really quickly. To cut long story […]

Becoming a Project Euler addict

Jeez, now I’ve solved Project Euler problems #297 and #299. I think I’m becoming an addict πŸ˜€ #299 required quite a lot of help from my friend (thank you πŸ™‚ ) while #297 was particularly easy. I managed to code it correctly in about 15 minutes πŸ™‚ Can you? ;D […]

Project Euler #298 – Solution

Omg, I finally solved this problem and gained access to Project Euler’s thread dedicated to its solutions. Apparently everybody came up with basically the same idea. The number of game states can be reduced to 438 (439 including the empty state). This way all 50 rounds can be simulated using […]

Project Euler #298

I’ve recently discovered Project Euler site – www.projecteuler.net and found one of its most recent puzzles quite a fun to solve πŸ™‚ I mean project #298 – Selective Amnesia. It’s a cache hit/miss problem although formulated using different terms. Larry and Robin play a memory game involving a sequence of […]

New macros system for C/C++

Now probably is a good time to start mentioning my own macros system for C/C++. I’ve already written a bit about it in my first post of the cycle. The codename for the project is RMPP, which stands for Real Macro Preprocessor (for C/C++). Why did I call it that? […]

Macros in Nemerle

Except obvious general differences, Nemerle is quite similar to MetaLua in its approach to macros. It allows equivalents of -{ … } and +{ … } blocks just like MetaLua does. Said equivalents are and $(…), although they don’t work exactly the same. is the quotation block, i.e. it generates […]