Ethereum : Recursive Length Prefix Encoding

The RLP protocol is a procedure used to serialize (convert to a stream of bytes) a nested data structure. It is used in Ethereum and it was first proposed in the yellow paper. In this text, I would like to go over the inner workings of the protocol and the reasons behind some choices that may appear odd at first glance.

Read More

Intrusive Linked Lists

I have just recently made an interesting discovery on an alternative way of representing linked lists and thought I would share how clever it is. I feel a bit ashamed that I did not hear about this sooner but better late than never! They are called intrusive linked lists.

Read More

Quicksort : Median Selection Strategies

quicksort is one of the most popular sorting algorithms out there due to its practical speed (ordered accesses and inplace). Any seasoned software engineer or computer scientist will know its average runtime of $\Theta(n \log n)$, like any efficient sorting algorithm, and most will also remember its worst case of $\Theta(n^2)$. Depending on the choice of the median during the partitioning phase of the array, performance can be drastically impacted by common cases such as an already sorted input. Ex: Suppose we pick the first or last element of an array of distinct elements as our pivot. For a sorted (or even and almost-sorted) input, the partitioning will split elements in a rather uneven manner. Most elements will be either greater or lesser than the pivot which will result in an undesirable performance.

Read More

Better Algorithm or Better Hardware?

In algorithmics, asymptotic analysis is used to describe the growth of functions that represent ressource usage (time and space). We say that algorithm $A$’s time complexity, \(T: \ \mathbb{N} \to \mathbb{R}_+\) with relation to a function \(f: \ \mathbb{N} \to \mathbb{R}_+\) is either

Read More

Master Theorem: An Intuitive Approach

In this post, I would like to go through an intuitive reasoning that will leading to the Master Theorem. It is a theorem used in computer science and mathematics to get the asymptotical runtime of a divide and conquer algorithm. More precisely, it is used to solve a reccurence.

Read More