Archive | Programming

RSS feed for this category

Programming is a huge part of solving Project Euler problems and once in a while a subject pops up that I want to treat individually.

Disjoint-set data structure

Disjoint-set data structure

25 July 2012

9 Comments

I'm going to introduce you to a simple, but very effective, data structure called the Disjoint-set data structure (or the Union-Find data structure, but Union and Find are its main operations). We are going to use it in the upcoming Project Euler 107, and it might come in handy in future Project Euler or UVa Online Judge problems.

Continue reading...
GCD faceoff

GCD faceoff

11 April 2012

19 Comments

Recently I received an email from a guy named Alexandr who reads the blog. He send me a small piece of C# code with the statement that my Greatest Common Denominator (GCD) algorithm was not as efficient as it could be. As a side note this algorithm is  also known as greatest common factor GCF and highest common factor HCF. To my defense I would like to state that I do believe that even my implementation of the algorithm is sufficiently good to solve most problems and it is a really good enough.Being the geek that we all are it peeked my interest and I wanted to look a bit into it and test which one was faster as well as open the question for you to give your favorite GCD algorithm.

Continue reading...

Stopwatch – a timing function in C#

1 December 2010

4 Comments

Recently while seeking inspiration, I found a small function in the .net api called StopWatch. It was exactly what I have been looking for. It is placed under System.Diagnostics.Stopwatch Until now I have made my timed my solution algorithms using multiple timestamp variables, but I have come to realise that the StopWatch is exactly what […]

Continue reading...