Implementation of Various Algorithms.