Self-written implementation of simple algorithms.