Implementation of algorithms in python