07 August, 2012

Running for 2012

I started my own company in January, which means I'll be very busy (at least for a while). I'm only doing the Venice marathon this year and it's more of a way to get a nice break with my wife.
Of course I'm still very serious about running and do at least 50-60 km per week, but preparing and planning for an event seems like way too much work at this stage.

12 June, 2011

2011 marathons

My plan is to run 4 full marathons in 2011. I already did Connemara in April (4:01h) and have finally decided on the other 3:
1. The Galway City Marathon on 28th August (Update: cancelled)
2. The Dublin Marathon on 31st October (Update: finished in 3:52h)
3. The Clonakilty Waterfront Marathon on 10th December (Update: finished in 4:10h, it was really cold and hilly!)

08 June, 2011

The Last Lecture

What better topic for my first "daily note" than "The Last Lecture" of Prof. Randy Pausch? I happened to watch it for 3rd or 4th time this Saturday and it's still one of the most inspiring talks you could find online.

It's not so much about what he says. Most of it has been said before.
But the fact that he is a dying man with nothing to gain, makes it all sound so real and honest that it hurts.

And it's totally amazing how you finish watching a little sad, but also smiling and full of energy and love for life. And even if you cried (I guess most people do) you've also laughed a lot. A cocktail of feelings that will stick in your brain for days.

08 April, 2011

Connemarathon

I'm running in the 2011 Connemara marathon this Sunday (10th April).
It's supposed to be the most scenic but also the hardest in Ireland. And I'm also running in Vibram FiveFingers so should be fun :)

Vibram FiveFingers

01 August, 2010

Treaps in Erlang

After a few months break I'm back to working on a project written mainly in Erlang and I'll be posting the most interesting pieces online to a small open-source project at Google Code, ErlAZ - Erlang A to Z.
The first module I'm uploading is an implementation of the Treap data structure.

What is a Treap?
It's a binary search tree where each node, in addition to its key and value, contains a number, called priority, assigned to it at insertion time.
All nodes are sorted horizontally by their key (so that a greater key is always to the right of a smaller one) and vertically by their priority (so that all parents of any given node up to the root have a higher priority than the node).
By choosing the priorities uniformly distributed across all keys (for example randomly), in the long run the treap will have the characteristic of a well-balanced tree, without having to re-balance it periodically.

I implemented my version as a drop-in replacement for the dict module, with all the dict functions having exactly the same signiture and behaviour, but working on treaps and performing according to the underlying tree structure vs. the hashtable used in dict.
There are also a few additional functions that use the ordered nature of the tree to allow querying and iterating over the keys in a sorted manner (which is pretty much the point of using a treap anyway), as well as functions for splitting the treap in two by a key (the first sub-treap contains all nodes with keys less or equal to the given key and the second - all nodes with greater keys) and for merging back a splitted treap.

The treap module comes with well documented functions and an extensive EUnit test suit (in a separate module treap_test), which contains tests and examples for the usage of each function.
As always all the code I release is covered by the New BSD License unless stated otherwise.
This means you are free to use it in any way you like, so help yourself:

  • ErlAZ trunk - The ErlAZ project's root with the Makefile for building the code and its documentation.

  • treap.erl - The treap module.

  • treap_test.erl - The treap_test module with all the EUnit tests.