Implementations of some algorithms in python