Implementation of Basic Algorithms