Implementations of different algorithms.